diff --git a/_locales/en/messages.json b/_locales/en/messages.json index cc6fccdfbf..ab6e15d2d6 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -8554,14 +8554,6 @@ "messageformat": "This action could not be completed because system authentication failed. Please try again or open the Signal app on your mobile device and go to Backup Settings to view your recovery key.", "description": "Error shown in local backups settings when system authentication fails while trying to view the recovery key." }, - "icu:Preferences__local-backups-auth-error--unauthorized-no-windows-ucv": { - "messageformat": "This action could not be completed because Windows Hello is not enabled on your computer. Please set up Windows Hello and try again, or open the Signal app on your mobile device and go to Backup Settings to view your recovery key.", - "description": "Error shown in local backups settings on Windows when Windows Hello is not available while trying to view the recovery key." - }, - "icu:Preferences__local-backups-auth-error--unavailable": { - "messageformat": "The action could not be completed because authentication is not available on this computer. Please open the Signal app on your mobile device and go to Backup Settings to view your recovery key.", - "description": "Error shown in local backups settings when system authentication is unavailable while trying to view the recovery key." - }, "icu:Preferences__view-key": { "messageformat": "View key", "description": "Button to view the backup key which is used to restore a message history backup" diff --git a/ts/components/PreferencesBackups.dom.tsx b/ts/components/PreferencesBackups.dom.tsx index d92cd32005..6f1a463d32 100644 --- a/ts/components/PreferencesBackups.dom.tsx +++ b/ts/components/PreferencesBackups.dom.tsx @@ -290,18 +290,19 @@ export function PreferencesBackups({ size="lg" disabled={isAuthPending} onClick={async () => { - if (!isLocalBackupsSetup) { + if (isLocalBackupsSetup) { + setSettingsLocation({ page: SettingsPage.LocalBackups }); + } else { try { setIsAuthPending(true); const result = await promptOSAuth('enable-backups'); - if (result !== 'success' && result !== 'unsupported') { - return; + if (result === 'success' || result === 'unsupported') { + setSettingsLocation({ page: SettingsPage.LocalBackups }); } } finally { setIsAuthPending(false); } } - setSettingsLocation({ page: SettingsPage.LocalBackups }); }} > {isLocalBackupsSetup diff --git a/ts/components/PreferencesLocalBackups.dom.tsx b/ts/components/PreferencesLocalBackups.dom.tsx index ff028227a9..c57ef71666 100644 --- a/ts/components/PreferencesLocalBackups.dom.tsx +++ b/ts/components/PreferencesLocalBackups.dom.tsx @@ -85,7 +85,9 @@ export function PreferencesLocalBackups({ startLocalBackupExport: () => void; }): React.JSX.Element | null { const [authError, setAuthError] = - React.useState>(); + React.useState< + Exclude + >(); const [isAuthPending, setIsAuthPending] = useState(false); const [isDisablePending, setIsDisablePending] = useState(false); const [isShowingBackupKeyChangedModal, setIsShowingBackupKeyChangedModal] = @@ -336,7 +338,9 @@ export function PreferencesLocalBackups({ - {getOSAuthErrorString(i18n, authError) ?? i18n('icu:error')} + {i18n( + 'icu:Preferences__local-backups-auth-error--unauthorized' + )} @@ -772,28 +776,6 @@ function LocalBackupsBackupKeyTextarea({ ); } -function getOSAuthErrorString( - i18n: LocalizerType, - authError: Omit | undefined -): string | undefined { - if (!authError) { - return undefined; - } - - // TODO: DESKTOP-8895 - if (authError === 'unauthorized') { - return i18n('icu:Preferences__local-backups-auth-error--unauthorized'); - } - - if (authError === 'unauthorized-no-windows-ucv') { - return i18n( - 'icu:Preferences__local-backups-auth-error--unauthorized-no-windows-ucv' - ); - } - - return i18n('icu:Preferences__local-backups-auth-error--unavailable'); -} - function LocalBackupSetupIcon(props: { symbol: 'key' | 'lock' }): JSX.Element { return (
{ // For Windows a verification device is required for the UserConsentVerifier API. - // If unavailable, then the UI must fail and require the user to setup verification. const availability = await checkAvailabilityWindowsUcv(); log.info(`Windows UCV availability=${availability}`); if (availability !== 'available') { - return 'unauthorized-no-windows-ucv'; + return 'unsupported'; } const result = await requestVerificationWindowsUcv(text);