Page MenuHomePhabricator

D13100.id44308.diff
No OneTemporary

D13100.id44308.diff

diff --git a/native/account/registration/avatar-selection.react.js b/native/account/registration/avatar-selection.react.js
--- a/native/account/registration/avatar-selection.react.js
+++ b/native/account/registration/avatar-selection.react.js
@@ -39,6 +39,7 @@
+keyserverURL?: ?string,
+accountSelection: AccountSelection,
+farcasterID: ?string,
+ +farcasterAvatarURL: ?string,
},
};
diff --git a/native/account/registration/connect-ethereum.react.js b/native/account/registration/connect-ethereum.react.js
--- a/native/account/registration/connect-ethereum.react.js
+++ b/native/account/registration/connect-ethereum.react.js
@@ -52,6 +52,7 @@
+coolOrNerdMode?: ?CoolOrNerdMode,
+keyserverURL?: ?string,
+farcasterID: ?string,
+ +farcasterAvatarURL: ?string,
},
};
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
@@ -3,6 +3,7 @@
import invariant from 'invariant';
import * as React from 'react';
+import { NeynarClientContext } from 'lib/components/neynar-client-provider.react.js';
import { IdentityClientContext } from 'lib/shared/identity-client-context.js';
import { useIsAppForegrounded } from 'lib/shared/lifecycle-utils.js';
@@ -60,7 +61,7 @@
const { ethereumAccount } = cachedSelections;
const goToNextStep = React.useCallback(
- (fid?: ?string) => {
+ (fid?: ?string, farcasterAvatarURL: ?string) => {
setWebViewState('closed');
invariant(
!ethereumAccount || ethereumAccount.nonceTimestamp,
@@ -84,6 +85,7 @@
userSelections: {
...userSelections,
farcasterID: fid,
+ farcasterAvatarURL: farcasterAvatarURL,
},
},
});
@@ -94,6 +96,7 @@
...userSelections,
farcasterID: fid,
accountSelection: ethereumAccount,
+ farcasterAvatarURL: farcasterAvatarURL,
};
setSkipEthereumLoginOnce(false);
navigate<'AvatarSelection'>({
@@ -118,12 +121,19 @@
identityServiceClient?.identityClient.getFarcasterUsers;
invariant(getFarcasterUsers, 'Could not get getFarcasterUsers');
+ const neynarClient = React.useContext(NeynarClientContext);
+ const getFCAvatarURLs = neynarClient?.getFCAvatarURLs;
+ invariant(getFCAvatarURLs, 'Could not get getFCAvatarURLs');
+
const [queuedAlert, setQueuedAlert] = React.useState<?AlertDetails>();
const onSuccess = React.useCallback(
async (fid: string) => {
try {
- const commFCUsers = await getFarcasterUsers([fid]);
+ const [commFCUsers, farcasterAvatarURLs] = await Promise.all([
+ getFarcasterUsers([fid]),
+ getFCAvatarURLs([{ fid, pfpURL: null }]),
+ ]);
if (commFCUsers.length > 0 && commFCUsers[0].farcasterID === fid) {
const commUsername = commFCUsers[0].username;
@@ -133,10 +143,15 @@
setQueuedAlert(alert);
setWebViewState('closed');
} else {
- goToNextStep(fid);
+ const farcasterAvatarURL =
+ farcasterAvatarURLs.length > 0 && farcasterAvatarURLs[0].pfpURL
+ ? farcasterAvatarURLs[0].pfpURL
+ : null;
+ goToNextStep(fid, farcasterAvatarURL);
setCachedSelections(oldUserSelections => ({
...oldUserSelections,
farcasterID: fid,
+ farcasterAvatarURL: farcasterAvatarURL ?? null,
}));
}
} catch (e) {
@@ -149,7 +164,7 @@
setWebViewState('closed');
}
},
- [goToNextStep, setCachedSelections, getFarcasterUsers],
+ [getFarcasterUsers, getFCAvatarURLs, goToNextStep, setCachedSelections],
);
const isAppForegrounded = useIsAppForegrounded();
@@ -161,7 +176,7 @@
setQueuedAlert(null);
}, [queuedAlert, isAppForegrounded]);
- const { farcasterID } = cachedSelections;
+ const { farcasterID, farcasterAvatarURL } = cachedSelections;
const alreadyHasConnected = !!farcasterID;
const onPressConnectFarcaster = React.useCallback(() => {
@@ -184,8 +199,8 @@
farcasterID,
'farcasterID should be set in onUseAlreadyConnectedAccount',
);
- goToNextStep(farcasterID);
- }, [farcasterID, goToNextStep]);
+ goToNextStep(farcasterID, farcasterAvatarURL);
+ }, [farcasterAvatarURL, farcasterID, goToNextStep]);
const alreadyConnectedButton = React.useMemo(() => {
if (!alreadyHasConnected) {
diff --git a/native/account/registration/password-selection.react.js b/native/account/registration/password-selection.react.js
--- a/native/account/registration/password-selection.react.js
+++ b/native/account/registration/password-selection.react.js
@@ -27,6 +27,7 @@
+keyserverURL?: ?string,
+farcasterID: ?string,
+username: string,
+ farcasterAvatarURL: ?string,
},
};
diff --git a/native/account/registration/registration-terms.react.js b/native/account/registration/registration-terms.react.js
--- a/native/account/registration/registration-terms.react.js
+++ b/native/account/registration/registration-terms.react.js
@@ -31,6 +31,7 @@
+accountSelection: AccountSelection,
+avatarData: ?AvatarData,
+siweBackupSecrets?: ?SIWEBackupSecrets,
+ +farcasterAvatarURL: ?string,
},
};
@@ -62,16 +63,24 @@
const { navigation } = props;
const { reconnectEthereum } = navigation;
- const { coolOrNerdMode, keyserverURL, farcasterID } = userSelections;
+ const { coolOrNerdMode, keyserverURL, farcasterID, farcasterAvatarURL } =
+ userSelections;
const navigateToConnectEthereum = React.useCallback(() => {
reconnectEthereum({
userSelections: {
coolOrNerdMode,
keyserverURL,
farcasterID,
+ farcasterAvatarURL,
},
});
- }, [reconnectEthereum, coolOrNerdMode, keyserverURL, farcasterID]);
+ }, [
+ reconnectEthereum,
+ coolOrNerdMode,
+ keyserverURL,
+ farcasterID,
+ farcasterAvatarURL,
+ ]);
const onNonceExpired = React.useCallback(() => {
setCachedSelections(oldUserSelections => ({
...oldUserSelections,
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
@@ -44,6 +44,7 @@
+accountSelection: AccountSelection,
+avatarData: ?AvatarData,
+siweBackupSecrets?: ?SIWEBackupSecrets,
+ +farcasterAvatarURL: ?string,
+clearCachedSelections: () => void,
+onNonceExpired: () => mixed,
+onAlertAcknowledged?: () => mixed,
@@ -58,6 +59,7 @@
+ethereumAccount?: ?EthereumAccountSelection,
+farcasterID?: string,
+siweBackupSecrets?: ?SIWEBackupSecrets,
+ +farcasterAvatarURL?: ?string,
};
export const ensAvatarSelection: AvatarData = {
diff --git a/native/account/registration/siwe-backup-message-creation.react.js b/native/account/registration/siwe-backup-message-creation.react.js
--- a/native/account/registration/siwe-backup-message-creation.react.js
+++ b/native/account/registration/siwe-backup-message-creation.react.js
@@ -139,6 +139,7 @@
+farcasterID: ?string,
+accountSelection: AccountSelection,
+avatarData: ?AvatarData,
+ +farcasterAvatarURL: ?string,
},
};
diff --git a/native/account/registration/username-selection.react.js b/native/account/registration/username-selection.react.js
--- a/native/account/registration/username-selection.react.js
+++ b/native/account/registration/username-selection.react.js
@@ -34,6 +34,7 @@
+coolOrNerdMode?: ?CoolOrNerdMode,
+keyserverURL?: ?string,
+farcasterID: ?string,
+ +farcasterAvatarURL: ?string,
},
};

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 27, 6:42 AM (21 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2589233
Default Alt Text
D13100.id44308.diff (7 KB)

Event Timeline