mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-27 22:43:52 +00:00
Show dialog for successfully resetting your username link.
This commit is contained in:
committed by
Cody Henthorne
parent
8e8ba23da7
commit
555ddb5b20
@@ -28,7 +28,6 @@ import org.thoughtcrime.securesms.components.settings.PreferenceViewHolder
|
||||
import org.thoughtcrime.securesms.components.settings.app.subscription.completed.TerminalDonationDelegate
|
||||
import org.thoughtcrime.securesms.components.settings.configure
|
||||
import org.thoughtcrime.securesms.events.ReminderUpdateEvent
|
||||
import org.thoughtcrime.securesms.keyvalue.AccountValues
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.phonenumbers.PhoneNumberFormatter
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
|
||||
@@ -44,6 +44,8 @@ import org.thoughtcrime.securesms.components.settings.app.usernamelinks.Username
|
||||
import org.thoughtcrime.securesms.components.settings.app.usernamelinks.main.UsernameLinkSettingsState.ActiveTab
|
||||
import org.thoughtcrime.securesms.util.Util
|
||||
import org.thoughtcrime.securesms.util.navigation.safeNavigate
|
||||
import org.whispersystems.signalservice.api.push.UsernameLinkComponents
|
||||
import java.util.UUID
|
||||
|
||||
/**
|
||||
* A screen that shows all the data around your username link and how to share it, including a QR code.
|
||||
@@ -68,6 +70,12 @@ fun UsernameLinkShareScreen(
|
||||
UsernameLinkResetResult.NetworkError -> {
|
||||
ResetLinkResultDialog(stringResource(R.string.UsernameLinkSettings_reset_link_result_network_error), onDismiss = onLinkResultHandled)
|
||||
}
|
||||
UsernameLinkResetResult.UnexpectedError -> {
|
||||
ResetLinkResultDialog(stringResource(R.string.UsernameLinkSettings_reset_link_result_unknown_error), onDismiss = onLinkResultHandled)
|
||||
}
|
||||
is UsernameLinkResetResult.Success -> {
|
||||
ResetLinkResultDialog(stringResource(R.string.UsernameLinkSettings_reset_link_result_success), onDismiss = onLinkResultHandled)
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
|
||||
@@ -223,6 +231,82 @@ private fun ScreenPreview() {
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(name = "Light Theme", group = "screen", uiMode = Configuration.UI_MODE_NIGHT_NO)
|
||||
@Preview(name = "Dark Theme", group = "screen", uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun ScreenPreviewResetSuccess() {
|
||||
SignalTheme {
|
||||
Surface {
|
||||
UsernameLinkShareScreen(
|
||||
state = previewState().copy(usernameLinkResetResult = UsernameLinkResetResult.Success(UsernameLinkComponents(Util.getSecretBytes(32), UUID.randomUUID()))),
|
||||
snackbarHostState = SnackbarHostState(),
|
||||
scope = rememberCoroutineScope(),
|
||||
navController = NavController(LocalContext.current),
|
||||
onShareBadge = {},
|
||||
onResetClicked = {},
|
||||
onLinkResultHandled = {}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(name = "Light Theme", group = "screen", uiMode = Configuration.UI_MODE_NIGHT_NO)
|
||||
@Preview(name = "Dark Theme", group = "screen", uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun ScreenPreviewResetNetworkError() {
|
||||
SignalTheme {
|
||||
Surface {
|
||||
UsernameLinkShareScreen(
|
||||
state = previewState().copy(usernameLinkResetResult = UsernameLinkResetResult.NetworkError),
|
||||
snackbarHostState = SnackbarHostState(),
|
||||
scope = rememberCoroutineScope(),
|
||||
navController = NavController(LocalContext.current),
|
||||
onShareBadge = {},
|
||||
onResetClicked = {},
|
||||
onLinkResultHandled = {}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(name = "Light Theme", group = "screen", uiMode = Configuration.UI_MODE_NIGHT_NO)
|
||||
@Preview(name = "Dark Theme", group = "screen", uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun ScreenPreviewResetNetworkUnavailable() {
|
||||
SignalTheme {
|
||||
Surface {
|
||||
UsernameLinkShareScreen(
|
||||
state = previewState().copy(usernameLinkResetResult = UsernameLinkResetResult.NetworkUnavailable),
|
||||
snackbarHostState = SnackbarHostState(),
|
||||
scope = rememberCoroutineScope(),
|
||||
navController = NavController(LocalContext.current),
|
||||
onShareBadge = {},
|
||||
onResetClicked = {},
|
||||
onLinkResultHandled = {}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(name = "Light Theme", group = "screen", uiMode = Configuration.UI_MODE_NIGHT_NO)
|
||||
@Preview(name = "Dark Theme", group = "screen", uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
private fun ScreenPreviewResetUnexpectedError() {
|
||||
SignalTheme {
|
||||
Surface {
|
||||
UsernameLinkShareScreen(
|
||||
state = previewState().copy(usernameLinkResetResult = UsernameLinkResetResult.UnexpectedError),
|
||||
snackbarHostState = SnackbarHostState(),
|
||||
scope = rememberCoroutineScope(),
|
||||
navController = NavController(LocalContext.current),
|
||||
onShareBadge = {},
|
||||
onResetClicked = {},
|
||||
onLinkResultHandled = {}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(name = "Light Theme", group = "LinkRow", uiMode = Configuration.UI_MODE_NIGHT_NO)
|
||||
@Preview(name = "Dark Theme", group = "LinkRow", uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
|
||||
@@ -6484,6 +6484,10 @@
|
||||
<string name="UsernameLinkSettings_reset_link_result_network_unavailable">You do not have network access. Your link was not reset. Try again later.</string>
|
||||
<!-- Body of a dialog that is displayed when we failed to reset your username link because of a transient network issue. -->
|
||||
<string name="UsernameLinkSettings_reset_link_result_network_error">A network error occurred while trying to reset your link. Try again later.</string>
|
||||
<!-- Body of a dialog that is displayed when we failed to reset your username link because of an unknown error. -->
|
||||
<string name="UsernameLinkSettings_reset_link_result_unknown_error">An unexpected error occurred while trying to reset your link. Try again later.</string>
|
||||
<!-- Body of a dialog that is displayed when we successfully reset you username link. -->
|
||||
<string name="UsernameLinkSettings_reset_link_result_success">Your QR code and link have been reset and a new QR code and link has been created.</string>
|
||||
<!-- Shown on the generated username qr code image to explain how to use it. -->
|
||||
<string name="UsernameLinkSettings_scan_this_qr_code">Scan this QR code with your phone to chat with me on Signal.</string>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user