Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33336688
D15389.1768905802.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D15389.1768905802.diff
View Options
diff --git a/lib/components/farcaster-data-handler.react.js b/lib/components/farcaster-data-handler.react.js
--- a/lib/components/farcaster-data-handler.react.js
+++ b/lib/components/farcaster-data-handler.react.js
@@ -13,7 +13,6 @@
import { relationshipActions } from '../types/relationship-types.js';
import {
useCurrentUserFID,
- useUnlinkFID,
useSetLocalFID,
useSetLocalCurrentUserSupportsDCs,
} from '../utils/farcaster-utils.js';
@@ -56,8 +55,6 @@
const fid = useCurrentUserFID();
- const unlinkFID = useUnlinkFID();
-
const prevCanQueryRef = React.useRef<?boolean>();
// It's possible for the user to log out while handleFarcasterMutuals below
@@ -170,7 +167,7 @@
}
prevCanQueryHandleCurrentUserFIDRef.current = canQueryHandleCurrentUserFID;
- if (!canQueryHandleCurrentUserFID || !currentUserID || !neynarClient) {
+ if (!canQueryHandleCurrentUserFID || !currentUserID) {
return;
}
@@ -178,27 +175,14 @@
currentUserID,
]);
const identityFID = userIdentities[currentUserID]?.farcasterID;
- const identityFIDRequestTimedOut = identityFID
- ? false
- : getCachedUserIdentity(currentUserID) === undefined;
+ const identityFIDRequestTimedOut =
+ !identityFID && getCachedUserIdentity(currentUserID) === undefined;
if (userIdentities[currentUserID]) {
setLocalDCsSupport(userIdentities[currentUserID].hasFarcasterDCsToken);
}
- if (fid && !identityFIDRequestTimedOut && fid !== identityFID) {
- setLocalFID(identityFID);
- return;
- } else if (fid) {
- const isCurrentUserFIDValid =
- await neynarClient.checkIfCurrentUserFIDIsValid(fid);
- if (!isCurrentUserFIDValid) {
- await unlinkFID();
- return;
- }
- }
-
- if (identityFID) {
+ if (fid !== identityFID && !identityFIDRequestTimedOut) {
setLocalFID(identityFID);
}
@@ -207,9 +191,7 @@
canQueryHandleCurrentUserFID,
findUserIdentities,
currentUserID,
- neynarClient,
fid,
- unlinkFID,
setLocalFID,
getCachedUserIdentity,
setLocalDCsSupport,
diff --git a/lib/utils/neynar-client.js b/lib/utils/neynar-client.js
--- a/lib/utils/neynar-client.js
+++ b/lib/utils/neynar-client.js
@@ -313,28 +313,6 @@
return farcasterChannels;
}
- async checkIfCurrentUserFIDIsValid(fid: string): Promise<boolean> {
- const url = getNeynarURL('2', 'user/bulk', { fids: fid });
-
- try {
- const response = await fetch(url, {
- method: 'GET',
- headers: {
- Accept: 'application/json',
- api_key: this.apiKey,
- },
- });
-
- return response.ok;
- } catch (error) {
- console.log(
- 'Failed to check if current user FID is valid:',
- getMessageForException(error) ?? 'unknown',
- );
- throw error;
- }
- }
-
async fetchFarcasterCastByHash(hash: string): Promise<NeynarCast> {
const url = getNeynarURL('2', 'cast', { identifier: hash, type: 'hash' });
diff --git a/native/components/connect-farcaster-bottom-sheet.react.js b/native/components/connect-farcaster-bottom-sheet.react.js
--- a/native/components/connect-farcaster-bottom-sheet.react.js
+++ b/native/components/connect-farcaster-bottom-sheet.react.js
@@ -81,19 +81,19 @@
const isAppForegrounded = useIsAppForegrounded();
React.useEffect(() => {
- if (fid && isAppForegrounded) {
- if (currentUserSupportsDCs || !supportsFarcasterDCs) {
- goBack();
- } else if (supportsFarcasterDCs && !showConnectDCs) {
- setShowConnectDCs(true);
- }
+ if (!fid || !isAppForegrounded) {
+ return;
+ }
+ if (currentUserSupportsDCs || !supportsFarcasterDCs) {
+ goBack();
+ return;
}
+ setShowConnectDCs(true);
}, [
fid,
goBack,
isAppForegrounded,
currentUserSupportsDCs,
- showConnectDCs,
supportsFarcasterDCs,
]);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jan 20, 10:43 AM (17 m, 55 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5960508
Default Alt Text
D15389.1768905802.diff (3 KB)
Attached To
Mode
D15389: [lib][native] Don't unlink FID in FarcasterDataHandler and simplify logic
Attached
Detach File
Event Timeline
Log In to Comment