Page MenuHomePhabricator

D11873.id39779.diff
No OneTemporary

D11873.id39779.diff

diff --git a/native/account/registration/connect-farcaster.react.js b/native/account/registration/connect-farcaster.react.js
--- a/native/account/registration/connect-farcaster.react.js
+++ b/native/account/registration/connect-farcaster.react.js
@@ -25,6 +25,7 @@
UsernameSelectionRouteName,
AvatarSelectionRouteName,
} from '../../navigation/route-names.js';
+import { getFarcasterAccountAlreadyLinkedAlertDetails } from '../../utils/alert-messages.js';
export type ConnectFarcasterParams = {
+userSelections: {
@@ -95,7 +96,7 @@
const [queuedAlert, setQueuedAlert] = React.useState<?{
+title: string,
- +body: string,
+ +message: string,
}>();
const onSuccess = React.useCallback(
@@ -104,9 +105,13 @@
const commFCUsers = await getFarcasterUsers([fid]);
if (commFCUsers.length > 0 && commFCUsers[0].farcasterID === fid) {
const commUsername = commFCUsers[0].username;
+
+ const { title, message } =
+ getFarcasterAccountAlreadyLinkedAlertDetails(commUsername);
+
setQueuedAlert({
- title: 'Farcaster account already linked',
- body: `That Farcaster account is already linked to ${commUsername}`,
+ title,
+ message,
});
setWebViewState('closed');
} else {
@@ -119,7 +124,7 @@
} catch (e) {
setQueuedAlert({
title: 'Failed to query Comm',
- body:
+ message:
'We failed to query Comm to see if that Farcaster account is ' +
'already linked',
});
@@ -134,7 +139,7 @@
if (!queuedAlert || !isAppForegrounded) {
return;
}
- Alert.alert(queuedAlert.title, queuedAlert.body);
+ Alert.alert(queuedAlert.title, queuedAlert.message);
setQueuedAlert(null);
}, [queuedAlert, isAppForegrounded]);
diff --git a/native/utils/alert-messages.js b/native/utils/alert-messages.js
--- a/native/utils/alert-messages.js
+++ b/native/utils/alert-messages.js
@@ -12,31 +12,49 @@
android: 'Play Store',
});
-export const AppOutOfDateAlertDetails: AlertDetails = {
+const AppOutOfDateAlertDetails: AlertDetails = {
title: 'App out of date',
message:
'Your app version is pretty old, and the server doesn’t know how ' +
`to speak to it anymore. Please use the ${platformStore} to update!`,
};
-export const UsernameReservedAlertDetails: AlertDetails = {
+const UsernameReservedAlertDetails: AlertDetails = {
title: 'Username reserved',
message:
'This username is currently reserved. Please contact support@' +
'comm.app if you would like to claim this account.',
};
-export const UsernameTakenAlertDetails: AlertDetails = {
+const UsernameTakenAlertDetails: AlertDetails = {
title: 'Username taken',
message: 'An account with that username already exists',
};
-export const UserNotFoundAlertDetails: AlertDetails = {
+const UserNotFoundAlertDetails: AlertDetails = {
title: 'Incorrect username or password',
message: "Either that user doesn't exist, or the password is incorrect",
};
-export const UnknownErrorAlertDetails: AlertDetails = {
+const UnknownErrorAlertDetails: AlertDetails = {
title: 'Unknown error',
message: 'Uhh... try again?',
};
+
+const getFarcasterAccountAlreadyLinkedAlertDetails = (
+ commUsername: ?string,
+): AlertDetails => ({
+ title: 'Farcaster account already linked',
+ message: `That Farcaster account is already linked to ${
+ commUsername ? commUsername : 'another account'
+ }`,
+});
+
+export {
+ AppOutOfDateAlertDetails,
+ UsernameReservedAlertDetails,
+ UsernameTakenAlertDetails,
+ UserNotFoundAlertDetails,
+ UnknownErrorAlertDetails,
+ getFarcasterAccountAlreadyLinkedAlertDetails,
+};

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 30, 4:42 PM (21 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2601657
Default Alt Text
D11873.id39779.diff (3 KB)

Event Timeline