Page MenuHomePhabricator

D14090.diff
No OneTemporary

D14090.diff

diff --git a/native/account/restore-prompt-screen.react.js b/native/account/restore-prompt-screen.react.js
--- a/native/account/restore-prompt-screen.react.js
+++ b/native/account/restore-prompt-screen.react.js
@@ -3,6 +3,8 @@
import * as React from 'react';
import { Text, View } from 'react-native';
+import { getMessageForException } from 'lib/utils/errors.js';
+
import PromptButton from './prompt-button.react.js';
import RegistrationButtonContainer from './registration/registration-button-container.react.js';
import RegistrationContainer from './registration/registration-container.react.js';
@@ -10,8 +12,12 @@
import type { SignInNavigationProp } from './sign-in-navigator.react';
import { useSIWEPanelState } from './siwe-hooks.js';
import SIWEPanel from './siwe-panel.react.js';
+import { useClientBackup } from '../backup/use-client-backup.js';
import type { NavigationRoute } from '../navigation/route-names';
-import { RestorePasswordAccountScreenRouteName } from '../navigation/route-names.js';
+import {
+ RestoreSIWEBackupRouteName,
+ RestorePasswordAccountScreenRouteName,
+} from '../navigation/route-names.js';
import { useColors, useStyles } from '../themes/colors.js';
import RestoreIcon from '../vectors/restore-icon.react.js';
@@ -31,6 +37,36 @@
props.navigation.navigate(RestorePasswordAccountScreenRouteName);
}, [props.navigation]);
+ const { retrieveLatestBackupInfo } = useClientBackup();
+ const onSIWESuccess = React.useCallback(async () => {
+ try {
+ const backupInfo = await retrieveLatestBackupInfo();
+ const { siweBackupData, backupID } = backupInfo;
+
+ if (!siweBackupData) {
+ throw new Error('Missing SIWE message for Wallet user backup');
+ }
+
+ const {
+ siweBackupMsgNonce,
+ siweBackupMsgIssuedAt,
+ siweBackupMsgStatement,
+ } = siweBackupData;
+
+ props.navigation.navigate<'RestoreSIWEBackup'>({
+ name: RestoreSIWEBackupRouteName,
+ params: {
+ backupID,
+ siweNonce: siweBackupMsgNonce,
+ siweStatement: siweBackupMsgStatement,
+ siweIssuedAt: siweBackupMsgIssuedAt,
+ },
+ });
+ } catch (e) {
+ console.log(`Backup restore error: ${String(getMessageForException(e))}`);
+ }
+ }, [props.navigation, retrieveLatestBackupInfo]);
+
const {
panelState,
openPanel,
@@ -45,7 +81,7 @@
onClosing={onPanelClosing}
onClosed={onPanelClosed}
closing={panelState === 'closing'}
- onSuccessfulWalletSignature={() => {}}
+ onSuccessfulWalletSignature={onSIWESuccess}
siweSignatureRequestData={siweSignatureRequestData}
setLoading={siwePanelSetLoading}
/>

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 11, 8:41 PM (2 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2646255
Default Alt Text
D14090.diff (2 KB)

Event Timeline