bitwarden-android/app/src/main/java/com/x8bit/bitwarden/MainActivity.kt

42 lines
1.3 KiB
Kotlin

package com.x8bit.bitwarden
import android.content.Intent
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.viewModels
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import com.x8bit.bitwarden.ui.platform.feature.rootnav.RootNavScreen
import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme
import dagger.hilt.android.AndroidEntryPoint
/**
* Primary entry point for the application.
*/
@AndroidEntryPoint
class MainActivity : ComponentActivity() {
private val mainViewModel: MainViewModel by viewModels()
override fun onCreate(savedInstanceState: Bundle?) {
var shouldShowSplashScreen = true
installSplashScreen().setKeepOnScreenCondition { shouldShowSplashScreen }
super.onCreate(savedInstanceState)
setContent {
BitwardenTheme {
RootNavScreen(
onSplashScreenRemoved = { shouldShowSplashScreen = false },
)
}
}
}
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
mainViewModel.sendAction(
action = MainAction.ReceiveNewIntent(
intent = intent,
),
)
}
}