From 0cb80ec8649ec4e096db15171daff3fc540c646d Mon Sep 17 00:00:00 2001 From: grakovne Date: Thu, 24 Apr 2025 00:42:20 +0200 Subject: [PATCH] Fix rare App crash on Shortcut run --- .../lissen/ui/activity/AppActivity.kt | 19 ++++--------------- gradle.properties | 2 +- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/org/grakovne/lissen/ui/activity/AppActivity.kt b/app/src/main/java/org/grakovne/lissen/ui/activity/AppActivity.kt index d06ae0d4..b7520b5d 100644 --- a/app/src/main/java/org/grakovne/lissen/ui/activity/AppActivity.kt +++ b/app/src/main/java/org/grakovne/lissen/ui/activity/AppActivity.kt @@ -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 } } diff --git a/gradle.properties b/gradle.properties index 7e06ebcf..b7f84c62 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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