mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-09 08:01:20 +02:00
Fix crash when starting app from next up (#730)
## Description Fixes a possible crash starting the app from the next up row ### Related issues Fixes #729
This commit is contained in:
parent
7a20fedef4
commit
81d7aad0c6
2 changed files with 10 additions and 2 deletions
|
|
@ -150,7 +150,6 @@ class MainActivity : AppCompatActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
viewModel.appStart()
|
viewModel.appStart()
|
||||||
val requestedDestination = this.intent?.let(::extractDestination)
|
|
||||||
setContent {
|
setContent {
|
||||||
val appPreferences by userPreferencesDataStore.data.collectAsState(null)
|
val appPreferences by userPreferencesDataStore.data.collectAsState(null)
|
||||||
appPreferences?.let { appPreferences ->
|
appPreferences?.let { appPreferences ->
|
||||||
|
|
@ -257,6 +256,10 @@ class MainActivity : AppCompatActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showContent) {
|
if (showContent) {
|
||||||
|
val requestedDestination =
|
||||||
|
remember(intent) {
|
||||||
|
intent?.let(::extractDestination)
|
||||||
|
}
|
||||||
ApplicationContent(
|
ApplicationContent(
|
||||||
user = current.user,
|
user = current.user,
|
||||||
server = current.server,
|
server = current.server,
|
||||||
|
|
@ -344,6 +347,7 @@ class MainActivity : AppCompatActivity() {
|
||||||
override fun onNewIntent(intent: Intent) {
|
override fun onNewIntent(intent: Intent) {
|
||||||
super.onNewIntent(intent)
|
super.onNewIntent(intent)
|
||||||
Timber.v("onNewIntent")
|
Timber.v("onNewIntent")
|
||||||
|
setIntent(intent)
|
||||||
extractDestination(intent)?.let {
|
extractDestination(intent)?.let {
|
||||||
navigationManager.replace(it)
|
navigationManager.replace(it)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,11 @@ class NavigationManager
|
||||||
while (backStack.size > 1) {
|
while (backStack.size > 1) {
|
||||||
backStack.removeLastOrNull()
|
backStack.removeLastOrNull()
|
||||||
}
|
}
|
||||||
|
if (backStack.isEmpty()) {
|
||||||
|
backStack.add(0, destination)
|
||||||
|
} else {
|
||||||
backStack[0] = destination
|
backStack[0] = destination
|
||||||
|
}
|
||||||
log()
|
log()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue