Fix settings screen crashing when saving state
This commit is contained in:
parent
cc56fde9fe
commit
0d09039e5f
@ -24,19 +24,21 @@ import eu.kanade.presentation.util.isTabletUi
|
|||||||
import tachiyomi.presentation.core.components.TwoPanelBox
|
import tachiyomi.presentation.core.components.TwoPanelBox
|
||||||
|
|
||||||
class SettingsScreen(
|
class SettingsScreen(
|
||||||
private val destination: Destination = Destination.Main,
|
private val destination: Int? = null,
|
||||||
) : Screen() {
|
) : Screen() {
|
||||||
|
|
||||||
|
constructor(destination: Destination) : this(destination.id)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun Content() {
|
override fun Content() {
|
||||||
val parentNavigator = LocalNavigator.currentOrThrow
|
val parentNavigator = LocalNavigator.currentOrThrow
|
||||||
if (!isTabletUi()) {
|
if (!isTabletUi()) {
|
||||||
Navigator(
|
Navigator(
|
||||||
screen = when (destination) {
|
screen = when (destination) {
|
||||||
Destination.Main -> SettingsMainScreen
|
Destination.About.id -> AboutScreen
|
||||||
Destination.About -> AboutScreen
|
Destination.DataAndStorage.id -> SettingsDataScreen
|
||||||
Destination.DataAndStorage -> SettingsDataScreen
|
Destination.Tracking.id -> SettingsTrackingScreen
|
||||||
Destination.Tracking -> SettingsTrackingScreen
|
else -> SettingsMainScreen
|
||||||
},
|
},
|
||||||
content = {
|
content = {
|
||||||
val pop: () -> Unit = {
|
val pop: () -> Unit = {
|
||||||
@ -54,10 +56,10 @@ class SettingsScreen(
|
|||||||
} else {
|
} else {
|
||||||
Navigator(
|
Navigator(
|
||||||
screen = when (destination) {
|
screen = when (destination) {
|
||||||
Destination.Main -> SettingsAppearanceScreen
|
Destination.About.id -> AboutScreen
|
||||||
Destination.About -> AboutScreen
|
Destination.DataAndStorage.id -> SettingsDataScreen
|
||||||
Destination.DataAndStorage -> SettingsDataScreen
|
Destination.Tracking.id -> SettingsTrackingScreen
|
||||||
Destination.Tracking -> SettingsTrackingScreen
|
else -> SettingsAppearanceScreen
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
val insets = WindowInsets.systemBars.only(WindowInsetsSides.Horizontal)
|
val insets = WindowInsets.systemBars.only(WindowInsetsSides.Horizontal)
|
||||||
@ -76,10 +78,9 @@ class SettingsScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed interface Destination {
|
sealed class Destination(val id: Int) {
|
||||||
data object Main : Destination
|
data object About : Destination(0)
|
||||||
data object About : Destination
|
data object DataAndStorage : Destination(1)
|
||||||
data object DataAndStorage : Destination
|
data object Tracking : Destination(2)
|
||||||
data object Tracking : Destination
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user