[SES-2694] Incorrect back press warning message (#1657)

This commit is contained in:
Fanchao Liu 2024-09-09 11:06:50 +10:00 committed by GitHub
parent cef47df0e4
commit a6886f1375
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 17 additions and 7 deletions

View File

@ -38,7 +38,8 @@ local ci_dep_mirror(want_mirror) = (if want_mirror then ' -DLOCAL_MIRROR=https:/
pull: 'always',
environment: { ANDROID_HOME: '/usr/lib/android-sdk' },
commands: [
'apt-get install -y ninja-build',
'apt-get install -y ninja-build openjdk-17-jdk',
'update-java-alternatives -s java-1.17.0-openjdk-amd64',
'./gradlew testPlayDebugUnitTestCoverageReport'
],
}
@ -78,7 +79,8 @@ local ci_dep_mirror(want_mirror) = (if want_mirror then ' -DLOCAL_MIRROR=https:/
pull: 'always',
environment: { SSH_KEY: { from_secret: 'SSH_KEY' }, ANDROID_HOME: '/usr/lib/android-sdk' },
commands: [
'apt-get install -y ninja-build',
'apt-get install -y ninja-build openjdk-17-jdk',
'update-java-alternatives -s java-1.17.0-openjdk-amd64',
'./gradlew assemblePlayDebug',
'./scripts/drone-static-upload.sh'
],

View File

@ -17,7 +17,7 @@ import org.thoughtcrime.securesms.ui.theme.LocalColors
@Composable
fun OnboardingBackPressAlertDialog(
dismissDialog: () -> Unit,
@StringRes textId: Int = R.string.onboardingBackAccountCreation,
@StringRes textId: Int,
quit: () -> Unit
) {
val c = LocalContext.current

View File

@ -53,7 +53,12 @@ internal fun MessageNotificationsScreen(
return
}
if (state.showDialog) OnboardingBackPressAlertDialog(dismissDialog, quit = quit)
if (state.showingBackWarningDialogText != null) {
OnboardingBackPressAlertDialog(dismissDialog,
textId = state.showingBackWarningDialogText,
quit = quit
)
}
Column {
Spacer(Modifier.weight(1f))

View File

@ -14,6 +14,7 @@ import kotlinx.coroutines.flow.asSharedFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import network.loki.messenger.R
import org.session.libsession.utilities.TextSecurePreferences
import org.thoughtcrime.securesms.ApplicationContext
import org.thoughtcrime.securesms.notifications.PushRegistry
@ -58,14 +59,16 @@ internal class MessageNotificationsViewModel(
fun onBackPressed(): Boolean = when (state) {
is State.CreateAccount -> false
is State.LoadAccount -> {
_uiStates.update { it.copy(showDialog = true) }
_uiStates.update { it.copy(showingBackWarningDialogText = R.string.onboardingBackLoadAccount) }
true
}
}
fun dismissDialog() {
_uiStates.update { it.copy(showDialog = false) }
_uiStates.update {
it.copy(showingBackWarningDialogText = null)
}
}
fun quit() {
@ -78,7 +81,7 @@ internal class MessageNotificationsViewModel(
data class UiState(
val pushEnabled: Boolean = true,
val showDialog: Boolean = false,
val showingBackWarningDialogText: Int? = null,
val clearData: Boolean = false
) {
val pushDisabled get() = !pushEnabled