Skip to content

Commit b0334c4

Browse files
committed
fix: only pop screen when enable/disable pin
1 parent 408ec89 commit b0334c4

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

app/src/main/java/to/bitkit/ui/settings/pin/PinManagementScreen.kt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,10 @@ fun PinManagementScreen(
4545
val app = appViewModel ?: return
4646
val settings = settingsViewModel ?: return
4747
val isPinEnabled by settings.isPinEnabled.collectAsStateWithLifecycle()
48-
val currentSheet by app.currentSheet.collectAsStateWithLifecycle()
49-
var pinSheetWasShown by remember { mutableStateOf(false) }
48+
val initialPinState = remember { isPinEnabled }
5049

51-
LaunchedEffect(currentSheet) {
52-
if (currentSheet is Sheet.Pin || currentSheet is Sheet.ChangePin || currentSheet is Sheet.DisablePin) {
53-
pinSheetWasShown = true
54-
} else if (pinSheetWasShown && currentSheet == null) {
50+
LaunchedEffect(isPinEnabled) {
51+
if (isPinEnabled != initialPinState) {
5552
navController.popBackStack()
5653
}
5754
}

0 commit comments

Comments
 (0)