Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Farcaster Improvements #2462

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

pvicensSpacedev
Copy link
Collaborator

Summary of Changes

  • Added activity indicator when signing up with farcaster (mobile). Also added function to check wether the user canceled warpcast login (the onError from the library does not work so this is just a workaround)
  • Prefilled username input when farcaster signup (mobile & web)
  • Aded necessary types

https://linear.app/galleryso/issue/GAL-5603/various-auth-polish

Demo or Before/After Pics

  • Username from farcaster
Screen.Recording.2024-05-07.at.14.48.15.mov
  • Simple activity indicator
image
  • Hide modal when email signup
    Screenshot 2024-05-07 at 12 23 43

Edge Cases

List any common edge cases that you have considered and tested.

Testing Steps

Provide steps on how the reviewer can test the changes.

Checklist

Please make sure to review and check all of the following:

  • I've tested the changes and all tests pass.
  • (if web) I've tested the changes on various desktop screen sizes to ensure responsiveness.
  • (if mobile) I've tested the changes on both light and dark modes.

Copy link

vercel bot commented May 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
gallery ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 16, 2024 9:41pm

Copy link

github-actions bot commented May 7, 2024

Bundle Sizes

Compared against 8a7866b

Route: No significant changes found

Dynamic import: No significant changes found

Comment on lines 90 to 122
const [isFarcasterLoading, setIsFarcasterLoading] = useState(false);
const [attemptReconnect, setAttemptReconnect] = useState(false);

const {
open: handleConnectFarcaster,
isSuccess,
isConnected,
isPolling,
} = useLoginWithFarcaster({
setIsFarcasterLoading,
});

const [appState, setAppState] = useState(AppState.currentState);

useEffect(() => {
const subscription = AppState.addEventListener('change', (nextAppState) => {
if (appState.match(/inactive|background/) && nextAppState === 'active') {
if (isPolling || (!isConnected && !isSuccess)) {
setAttemptReconnect(true);
}
setIsFarcasterLoading(false);
}
setAppState(nextAppState);
});

return () => {
subscription.remove();
};
}, [appState, isPolling, isConnected, isSuccess]);

const handleConnectFarcasterPress = useCallback(() => {
handleConnectFarcaster(attemptReconnect);
}, [attemptReconnect, handleConnectFarcaster]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so the only thing i'm concerned about with this PR is farcaster-related-logic being split in this component (FarcasterBottomSheetRow) as well as the main hook useLoginWithFarcaster

from what i can tell, the appState / useState and useEffect can both live inside useLoginWithFarcaster. the only variable used by this component is isFarcasterLoading, but even that i think can be a state that's defined inside useLoginWithFarcaster and exported out for this component to use

Comment on lines 107 to 109
if (isPolling || (!isConnected && !isSuccess)) {
setAttemptReconnect(true);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this logic makes sense in that if the connection did not go through, we attempt to reconnect from scratch.

is there any chance the connection is actually successful, but our app doesn't pick up on it yet by the time the user arrives back on our app? just wondering if we need to wait at all before immediately going into reconnection mode

Comment on lines 201 to 204
const { nonce } = await createNonce();
setNonce(nonce);
signIn();
Linking.openURL(url);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we're attempting to reconnect i don't think we need to create a new nonce! so we can probably remove L201-202

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants