Skip to content

Commit e482790

Browse files
authored
Persisted navigation state (#547). (#550)
1 parent c634126 commit e482790

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

app/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ plugins {
1212
alias(libs.plugins.ktlint)
1313
alias(libs.plugins.detekt)
1414
alias(libs.plugins.compose.compiler)
15+
id("kotlin-parcelize")
1516
}
1617

1718
kotlin {

app/src/main/java/com/mitteloupe/whoami/ui/main/AppNavHost.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import androidx.compose.runtime.Composable
99
import androidx.compose.runtime.getValue
1010
import androidx.compose.runtime.mutableIntStateOf
1111
import androidx.compose.runtime.mutableStateListOf
12-
import androidx.compose.runtime.remember
1312
import androidx.compose.runtime.saveable.rememberSaveable
1413
import androidx.compose.ui.Modifier
1514
import androidx.fragment.app.FragmentManager
@@ -28,7 +27,7 @@ fun AppNavHostDependencies.AppNavHost(
2827
) {
2928
val containerId by rememberSaveable { mutableIntStateOf(View.generateViewId()) }
3029

31-
val backStack = remember { mutableStateListOf(startDestination) }
30+
val backStack = rememberSaveable { mutableStateListOf(startDestination) }
3231

3332
NavDisplay(
3433
backStack = backStack,
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package com.mitteloupe.whoami.ui.main.route
22

3-
import kotlinx.serialization.Serializable
3+
import android.os.Parcelable
4+
import kotlinx.parcelize.Parcelize
45

5-
@Serializable
6-
object Home
6+
@Parcelize
7+
object Home : Parcelable
78

8-
@Serializable
9-
data class History(val highlightedIpAddress: String?)
9+
@Parcelize
10+
data class History(val highlightedIpAddress: String?) : Parcelable

0 commit comments

Comments
 (0)