Fix rare App crash on Shortcut run

This commit is contained in:
grakovne
2025-04-24 00:42:20 +02:00
parent 2560644717
commit 0cb80ec864
2 changed files with 5 additions and 16 deletions

View File

@@ -32,14 +32,10 @@ class AppActivity : ComponentActivity() {
private lateinit var appNavigationService: AppNavigationService
private var launchAction: AppLaunchAction = AppLaunchAction.DEFAULT
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
handleIntent(intent)
setContent {
val colorScheme by preferences
.colorSchemeFlow
@@ -55,21 +51,14 @@ class AppActivity : ComponentActivity() {
preferences = preferences,
imageLoader = imageLoader,
networkQualityService = networkQualityService,
appLaunchAction = launchAction,
appLaunchAction = getLaunchAction(intent),
)
}
}
}
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
handleIntent(intent)
}
private fun handleIntent(intent: Intent?) {
launchAction = when (intent?.action) {
"continue_playback" -> AppLaunchAction.CONTINUE_PLAYBACK
else -> AppLaunchAction.DEFAULT
}
private fun getLaunchAction(intent: Intent?) = when (intent?.action) {
"continue_playback" -> AppLaunchAction.CONTINUE_PLAYBACK
else -> AppLaunchAction.DEFAULT
}
}

View File

@@ -2,4 +2,4 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
android.useAndroidX=true
kotlin.code.style=official
android.nonTransitiveRClass=true
VERSION_NAME=1.4.1
VERSION_NAME=1.4.2