Page MenuHomePhabricator

D12083.id40307.diff
No OneTemporary

D12083.id40307.diff

diff --git a/native/account/fullscreen-siwe-panel.react.js b/native/account/fullscreen-siwe-panel.react.js
--- a/native/account/fullscreen-siwe-panel.react.js
+++ b/native/account/fullscreen-siwe-panel.react.js
@@ -135,6 +135,7 @@
avatarData: null,
clearCachedSelections: () => {},
onNonceExpired: () => onNonceExpired('registration'),
+ onAlertAcknowledged: goBackToPrompt,
});
} catch {
// We swallow exceptions here because registrationServerCall
diff --git a/native/account/registration/registration-server-call.js b/native/account/registration/registration-server-call.js
--- a/native/account/registration/registration-server-call.js
+++ b/native/account/registration/registration-server-call.js
@@ -69,6 +69,7 @@
| {
+step: 'identity_registration_dispatched',
+clearCachedSelections: () => void,
+ +onAlertAcknowledged: ?() => mixed,
+avatarData: ?AvatarData,
+credentialsToSave: ?{ +username: string, +password: string },
+resolve: () => void,
@@ -103,6 +104,7 @@
async (
accountSelection: UsernameAccountSelection,
farcasterID: ?string,
+ onAlertAcknowledged: ?() => mixed,
) => {
const identityRegisterPromise = (async () => {
try {
@@ -116,21 +118,29 @@
Alert.alert(
UsernameReservedAlertDetails.title,
UsernameReservedAlertDetails.message,
+ [{ text: 'OK', onPress: onAlertAcknowledged }],
+ { cancelable: !onAlertAcknowledged },
);
} else if (e.message === 'username already exists') {
Alert.alert(
UsernameTakenAlertDetails.title,
UsernameTakenAlertDetails.message,
+ [{ text: 'OK', onPress: onAlertAcknowledged }],
+ { cancelable: !onAlertAcknowledged },
);
} else if (e.message === 'Unsupported version') {
Alert.alert(
AppOutOfDateAlertDetails.title,
AppOutOfDateAlertDetails.message,
+ [{ text: 'OK', onPress: onAlertAcknowledged }],
+ { cancelable: !onAlertAcknowledged },
);
} else {
Alert.alert(
UnknownErrorAlertDetails.title,
UnknownErrorAlertDetails.message,
+ [{ text: 'OK', onPress: onAlertAcknowledged }],
+ { cancelable: !onAlertAcknowledged },
);
}
throw e;
@@ -149,6 +159,7 @@
async (
accountSelection: UsernameAccountSelection,
keyserverURL: string,
+ onAlertAcknowledged: ?() => mixed,
) => {
const extraInfo = await legacyLogInExtraInfo();
const legacyKeyserverRegisterPromise = (async () => {
@@ -168,21 +179,29 @@
Alert.alert(
UsernameReservedAlertDetails.title,
UsernameReservedAlertDetails.message,
+ [{ text: 'OK', onPress: onAlertAcknowledged }],
+ { cancelable: !onAlertAcknowledged },
);
} else if (e.message === 'username_taken') {
Alert.alert(
UsernameTakenAlertDetails.title,
UsernameTakenAlertDetails.message,
+ [{ text: 'OK', onPress: onAlertAcknowledged }],
+ { cancelable: !onAlertAcknowledged },
);
} else if (e.message === 'client_version_unsupported') {
Alert.alert(
AppOutOfDateAlertDetails.title,
AppOutOfDateAlertDetails.message,
+ [{ text: 'OK', onPress: onAlertAcknowledged }],
+ { cancelable: !onAlertAcknowledged },
);
} else {
Alert.alert(
UnknownErrorAlertDetails.title,
UnknownErrorAlertDetails.message,
+ [{ text: 'OK', onPress: onAlertAcknowledged }],
+ { cancelable: !onAlertAcknowledged },
);
}
throw e;
@@ -221,6 +240,7 @@
siweBackupSecrets,
clearCachedSelections,
onNonceExpired,
+ onAlertAcknowledged,
} = input;
const keyserverURL = passedKeyserverURL ?? defaultURLPrefix;
if (
@@ -230,11 +250,13 @@
await legacyKeyserverRegisterUsernameAccount(
accountSelection,
keyserverURL,
+ onAlertAcknowledged,
);
} else if (accountSelection.accountType === 'username') {
await identityRegisterUsernameAccount(
accountSelection,
farcasterID,
+ onAlertAcknowledged,
);
} else if (!usingCommServicesAccessToken) {
try {
@@ -245,6 +267,8 @@
Alert.alert(
UnknownErrorAlertDetails.title,
UnknownErrorAlertDetails.message,
+ [{ text: 'OK', onPress: onAlertAcknowledged }],
+ { cancelable: !onAlertAcknowledged },
);
throw e;
}
@@ -264,6 +288,8 @@
Alert.alert(
UnknownErrorAlertDetails.title,
UnknownErrorAlertDetails.message,
+ [{ text: 'OK', onPress: onAlertAcknowledged }],
+ { cancelable: !onAlertAcknowledged },
);
}
throw e;
@@ -299,6 +325,7 @@
step: 'identity_registration_dispatched',
avatarData,
clearCachedSelections,
+ onAlertAcknowledged,
credentialsToSave,
resolve,
reject,
@@ -356,6 +383,7 @@
const {
avatarData,
clearCachedSelections,
+ onAlertAcknowledged,
credentialsToSave,
resolve,
reject,
@@ -385,6 +413,8 @@
Alert.alert(
UnknownErrorAlertDetails.title,
UnknownErrorAlertDetails.message,
+ [{ text: 'OK', onPress: onAlertAcknowledged }],
+ { cancelable: !onAlertAcknowledged },
);
return deletionResult;
} catch (deleteException) {
@@ -393,6 +423,8 @@
'We were able to create your account, but were unable to log ' +
'you in. Try going back to the login screen and logging in ' +
'with your new credentials.',
+ [{ text: 'OK', onPress: onAlertAcknowledged }],
+ { cancelable: !onAlertAcknowledged },
);
throw deleteException;
}
diff --git a/native/account/registration/registration-types.js b/native/account/registration/registration-types.js
--- a/native/account/registration/registration-types.js
+++ b/native/account/registration/registration-types.js
@@ -46,6 +46,7 @@
+siweBackupSecrets?: ?SIWEBackupSecrets,
+clearCachedSelections: () => void,
+onNonceExpired: () => mixed,
+ +onAlertAcknowledged?: () => mixed,
};
export type CachedUserSelections = {

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 29, 9:52 AM (21 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2596605
Default Alt Text
D12083.id40307.diff (7 KB)

Event Timeline