fix: keep login/signup page choice across uiMode recreation (#1097)

Toggling the system dark/light theme recreates MainActivity (uiMode is
not in configChanges), and the login/signup page choice was held in a
plain remember, so the UI reset from Sign-Up back to Login. Switch it to
rememberSaveable so the choice survives recreation. Same fix for the
password-visibility toggle in LoginScreen.

https://github.com/vitorpamplona/amethyst/issues/1097

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J74bRJ9H1KFx4vTo9wpez3
This commit is contained in:
Claude
2026-07-10 20:11:47 +00:00
parent 16711caec0
commit a509d41358
2 changed files with 4 additions and 3 deletions
@@ -24,7 +24,7 @@ import androidx.compose.animation.Crossfade
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import com.vitorpamplona.amethyst.ui.screen.AccountSessionManager
import com.vitorpamplona.amethyst.ui.screen.loggedOff.login.LoginPage
@@ -36,7 +36,7 @@ fun LoginOrSignupScreen(
accountSessionManager: AccountSessionManager,
isFirstLogin: Boolean,
) {
var wantsNewUser by remember {
var wantsNewUser by rememberSaveable {
mutableStateOf(false)
}
@@ -47,6 +47,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@@ -278,7 +279,7 @@ fun PasswordField(
passwordFocusRequester: FocusRequester,
onGo: () -> Unit,
) {
var showCharsPassword by remember { mutableStateOf(false) }
var showCharsPassword by rememberSaveable { mutableStateOf(false) }
OutlinedTextField(
modifier =
Modifier