package de.ypchat.android

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.viewModels
import de.ypchat.android.ui.ChatViewModel
import de.ypchat.android.ui.ChatViewModelFactory
import de.ypchat.android.ui.YpChatRoot

class MainActivity : ComponentActivity() {
    private val viewModel: ChatViewModel by viewModels {
        ChatViewModelFactory((application as YpChatApp).container.chatRepository)
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent { YpChatRoot(viewModel) }
    }
}
