mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-23 05:13:07 +03:00
fix(app): Fix settings screen crashing when saving state
This commit is contained in:
parent
d99755ab2a
commit
2ac867d9d0
1 changed files with 15 additions and 14 deletions
|
@ -24,19 +24,21 @@ import eu.kanade.presentation.util.isTabletUi
|
|||
import tachiyomi.presentation.core.components.TwoPanelBox
|
||||
|
||||
class SettingsScreen(
|
||||
private val destination: Destination = Destination.Main,
|
||||
private val destination: Int? = null,
|
||||
) : Screen() {
|
||||
|
||||
constructor(destination: Destination) : this(destination.id)
|
||||
|
||||
@Composable
|
||||
override fun Content() {
|
||||
val parentNavigator = LocalNavigator.currentOrThrow
|
||||
if (!isTabletUi()) {
|
||||
Navigator(
|
||||
screen = when (destination) {
|
||||
Destination.Main -> SettingsMainScreen
|
||||
Destination.About -> AboutScreen
|
||||
Destination.DataAndStorage -> SettingsDataScreen
|
||||
Destination.Tracking -> SettingsTrackingScreen
|
||||
Destination.About.id -> AboutScreen
|
||||
Destination.DataAndStorage.id -> SettingsDataScreen
|
||||
Destination.Tracking.id -> SettingsTrackingScreen
|
||||
else -> SettingsMainScreen
|
||||
},
|
||||
content = {
|
||||
val pop: () -> Unit = {
|
||||
|
@ -54,10 +56,10 @@ class SettingsScreen(
|
|||
} else {
|
||||
Navigator(
|
||||
screen = when (destination) {
|
||||
Destination.Main -> SettingsAppearanceScreen
|
||||
Destination.About -> AboutScreen
|
||||
Destination.DataAndStorage -> SettingsDataScreen
|
||||
Destination.Tracking -> SettingsTrackingScreen
|
||||
Destination.About.id -> AboutScreen
|
||||
Destination.DataAndStorage.id -> SettingsDataScreen
|
||||
Destination.Tracking.id -> SettingsTrackingScreen
|
||||
else -> SettingsAppearanceScreen
|
||||
},
|
||||
) {
|
||||
val insets = WindowInsets.systemBars.only(WindowInsetsSides.Horizontal)
|
||||
|
@ -76,10 +78,9 @@ class SettingsScreen(
|
|||
}
|
||||
}
|
||||
|
||||
sealed interface Destination {
|
||||
data object Main : Destination
|
||||
data object About : Destination
|
||||
data object DataAndStorage : Destination
|
||||
data object Tracking : Destination
|
||||
sealed class Destination(val id: Int) {
|
||||
data object About : Destination(0)
|
||||
data object DataAndStorage : Destination(1)
|
||||
data object Tracking : Destination(2)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue