Skip to content

Commit

Permalink
fix: misleading e2ei certificate error dialog (WPB-7129) (#2883)
Browse files Browse the repository at this point in the history
Signed-off-by: alexandreferris <[email protected]>
  • Loading branch information
alexandreferris authored and github-actions[bot] committed Apr 11, 2024
1 parent a2b700e commit 829d4fc
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import com.wire.android.ui.common.topappbar.WireCenterAlignedTopAppBar
import com.wire.android.ui.common.visbility.rememberVisibilityState
import com.wire.android.ui.destinations.E2eiCertificateDetailsScreenDestination
import com.wire.android.ui.destinations.InitialSyncScreenDestination
import com.wire.android.ui.home.E2EIErrorNoSnoozeDialog
import com.wire.android.ui.home.E2EIEnrollmentErrorWithDismissDialog
import com.wire.android.ui.home.E2EISuccessDialog
import com.wire.android.ui.markdown.MarkdownConstants
import com.wire.android.ui.theme.WireTheme
Expand Down Expand Up @@ -190,12 +190,10 @@ private fun E2EIEnrollmentScreenContent(
}

if (state.isCertificateEnrollError) {
E2EIErrorNoSnoozeDialog(
E2EIEnrollmentErrorWithDismissDialog(
isE2EILoading = state.isLoading,
updateCertificate = {
dismissErrorDialog()
enrollE2EICertificate()
}
onClick = enrollE2EICertificate,
onDismiss = dismissErrorDialog
)
}

Expand Down
38 changes: 35 additions & 3 deletions app/src/main/kotlin/com/wire/android/ui/home/E2EIDialogs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,46 @@ fun E2EISuccessDialog(
}

@Composable
fun E2EIErrorWithDismissDialog(
fun E2EIUpdateErrorWithDismissDialog(
isE2EILoading: Boolean,
updateCertificate: () -> Unit,
onDismiss: () -> Unit
) {
WireDialog(
E2EIErrorWithDismissDialog(
title = stringResource(id = R.string.end_to_end_identity_renew_error_dialog_title),
text = stringResource(id = R.string.end_to_end_identity_renew_error_dialog_text),
isE2EILoading = isE2EILoading,
updateCertificate = updateCertificate,
onDismiss = onDismiss
)
}

@Composable
fun E2EIEnrollmentErrorWithDismissDialog(
isE2EILoading: Boolean,
onClick: () -> Unit,
onDismiss: () -> Unit
) {
E2EIErrorWithDismissDialog(
title = stringResource(id = R.string.end_to_end_identity_enrollment_error_dialog_title),
text = stringResource(id = R.string.end_to_end_identity_enrollment_error_dialog_text),
isE2EILoading = isE2EILoading,
updateCertificate = onClick,
onDismiss = onDismiss
)
}

@Composable
private fun E2EIErrorWithDismissDialog(
title: String,
text: String,
isE2EILoading: Boolean,
updateCertificate: () -> Unit,
onDismiss: () -> Unit
) {
WireDialog(
title = title,
text = text,
onDismiss = onDismiss,
optionButton1Properties = WireDialogButtonProperties(
onClick = updateCertificate,
Expand Down Expand Up @@ -247,7 +279,7 @@ private fun E2EIErrorWithSnoozeDialog(
}

@Composable
fun E2EIErrorNoSnoozeDialog(
private fun E2EIErrorNoSnoozeDialog(
isE2EILoading: Boolean,
updateCertificate: () -> Unit
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ import com.wire.android.ui.common.topappbar.WireCenterAlignedTopAppBar
import com.wire.android.ui.common.topappbar.WireTopAppBarTitle
import com.wire.android.ui.destinations.E2eiCertificateDetailsScreenDestination
import com.wire.android.ui.e2eiEnrollment.GetE2EICertificateUI
import com.wire.android.ui.home.E2EIErrorWithDismissDialog
import com.wire.android.ui.home.E2EISuccessDialog
import com.wire.android.ui.home.E2EIUpdateErrorWithDismissDialog
import com.wire.android.ui.home.conversationslist.common.FolderHeader
import com.wire.android.ui.settings.devices.model.DeviceDetailsState
import com.wire.android.ui.theme.wireColorScheme
Expand Down Expand Up @@ -279,7 +279,7 @@ fun DeviceDetailsContent(
}

if (state.isE2EICertificateEnrollError) {
E2EIErrorWithDismissDialog(
E2EIUpdateErrorWithDismissDialog(
isE2EILoading = state.isLoadingCertificate,
updateCertificate = { enrollE2eiCertificate() },
onDismiss = onEnrollE2EIErrorDismiss
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1287,6 +1287,8 @@
<string name="end_to_end_identity_renew_success_dialog_title">Certificate updated</string>
<string name="end_to_end_identity_renew_success_dialog_text">The certificate is updated and your device is verified.</string>
<string name="end_to_end_identity_renew_success_dialog_second_button">Certificate Details</string>
<string name="end_to_end_identity_enrollment_error_dialog_title">Certificate couldn’t be issued.</string>
<string name="end_to_end_identity_enrollment_error_dialog_text">Please try again, or reach out to your team admin.</string>
<string name="end_to_end_identity_ceritifcate">Certificate Details</string>
<string name="end_to_end_identity_certificate_revoked_dialog_title">End-to-end certificate revoked</string>
<string name="end_to_end_identity_certificate_revoked_dialog_description">Log out to reduce security risks. Then log in again, get a new certificate, and reset your password.\n\nIf you keep using this device, your conversations are no longer verified.</string>
Expand Down

0 comments on commit 829d4fc

Please sign in to comment.