Page MenuHomePhorge

D11973.1767378879.diff
No OneTemporary

Size
9 KB
Referenced Files
None
Subscribers
None

D11973.1767378879.diff

diff --git a/native/account/registration/account-does-not-exist.react.js b/native/account/registration/account-does-not-exist.react.js
--- a/native/account/registration/account-does-not-exist.react.js
+++ b/native/account/registration/account-does-not-exist.react.js
@@ -11,7 +11,7 @@
import commSwooshSource from '../../img/comm-swoosh.png';
import {
type NavigationRoute,
- ConnectEthereumRouteName,
+ ConnectFarcasterRouteName,
} from '../../navigation/route-names.js';
import { useStyles } from '../../themes/colors.js';
@@ -22,7 +22,7 @@
function AccountDoesNotExist(props: Props): React.Node {
const { navigate } = props.navigation;
const onSubmit = React.useCallback(() => {
- navigate(ConnectEthereumRouteName);
+ navigate(ConnectFarcasterRouteName);
}, [navigate]);
const styles = useStyles(unboundStyles);
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
@@ -26,7 +26,8 @@
import {
type NavigationRoute,
ExistingEthereumAccountRouteName,
- ConnectFarcasterRouteName,
+ UsernameSelectionRouteName,
+ AvatarSelectionRouteName,
} from '../../navigation/route-names.js';
import { useSelector } from '../../redux/redux-utils.js';
import { useStyles } from '../../themes/colors.js';
@@ -38,10 +39,11 @@
exactSearchUserActionTypes,
);
-export type ConnectEthereumParams = ?{
- +userSelections?: {
- +coolOrNerdMode: CoolOrNerdMode,
- +keyserverURL: string,
+export type ConnectEthereumParams = {
+ +userSelections: {
+ +coolOrNerdMode?: CoolOrNerdMode,
+ +keyserverURL?: string,
+ +farcasterID: ?string,
},
};
@@ -126,12 +128,10 @@
const { navigate } = props.navigation;
const onSkip = React.useCallback(() => {
- navigate<'ConnectFarcaster'>({
- name: ConnectFarcasterRouteName,
+ navigate<'UsernameSelection'>({
+ name: UsernameSelectionRouteName,
params: {
- userSelections: {
- ...userSelections,
- },
+ userSelections,
},
});
}, [navigate, userSelections]);
@@ -181,11 +181,13 @@
const newUserSelections = {
...userSelections,
- ethereumAccount,
+ accountSelection: ethereumAccount,
};
- navigate<'ConnectFarcaster'>({
- name: ConnectFarcasterRouteName,
- params: { userSelections: newUserSelections },
+ navigate<'AvatarSelection'>({
+ name: AvatarSelectionRouteName,
+ params: {
+ userSelections: newUserSelections,
+ },
});
},
[
@@ -236,11 +238,13 @@
);
const newUserSelections = {
...userSelections,
- ethereumAccount,
+ accountSelection: ethereumAccount,
};
- navigate<'ConnectFarcaster'>({
- name: ConnectFarcasterRouteName,
- params: { userSelections: newUserSelections },
+ navigate<'AvatarSelection'>({
+ name: AvatarSelectionRouteName,
+ params: {
+ userSelections: newUserSelections,
+ },
});
}, [ethereumAccount, userSelections, navigate]);
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
@@ -13,24 +13,20 @@
import RegistrationContentContainer from './registration-content-container.react.js';
import { RegistrationContext } from './registration-context.js';
import type { RegistrationNavigationProp } from './registration-navigator.react.js';
-import type {
- CoolOrNerdMode,
- EthereumAccountSelection,
-} from './registration-types.js';
+import type { CoolOrNerdMode } from './registration-types.js';
import FarcasterPrompt from '../../components/farcaster-prompt.react.js';
import FarcasterWebView from '../../components/farcaster-web-view.react.js';
import type { FarcasterWebViewState } from '../../components/farcaster-web-view.react.js';
import {
type NavigationRoute,
- UsernameSelectionRouteName,
+ ConnectEthereumRouteName,
AvatarSelectionRouteName,
} from '../../navigation/route-names.js';
-export type ConnectFarcasterParams = {
- +userSelections: {
+export type ConnectFarcasterParams = ?{
+ +userSelections?: {
+coolOrNerdMode?: CoolOrNerdMode,
+keyserverURL?: string,
- +ethereumAccount?: EthereumAccountSelection,
},
};
@@ -43,47 +39,56 @@
const { navigation, route } = prop;
const { navigate } = navigation;
- const { params } = route;
+ const userSelections = route.params?.userSelections;
const registrationContext = React.useContext(RegistrationContext);
invariant(registrationContext, 'registrationContext should be set');
- const { cachedSelections, setCachedSelections } = registrationContext;
+ const {
+ cachedSelections,
+ setCachedSelections,
+ skipEthereumLoginOnce,
+ setSkipEthereumLoginOnce,
+ } = registrationContext;
const [webViewState, setWebViewState] =
React.useState<FarcasterWebViewState>('closed');
+ const { ethereumAccount } = cachedSelections;
const goToNextStep = React.useCallback(
(fid?: ?string) => {
setWebViewState('closed');
- const { ethereumAccount, ...restUserSelections } = params.userSelections;
-
- if (ethereumAccount) {
- navigate<'AvatarSelection'>({
- name: AvatarSelectionRouteName,
- params: {
- ...params,
- userSelections: {
- ...restUserSelections,
- accountSelection: ethereumAccount,
- farcasterID: fid,
- },
- },
- });
- } else {
- navigate<'UsernameSelection'>({
- name: UsernameSelectionRouteName,
+ if (!skipEthereumLoginOnce || !ethereumAccount) {
+ navigate<'ConnectEthereum'>({
+ name: ConnectEthereumRouteName,
params: {
- ...params,
userSelections: {
- ...restUserSelections,
+ ...userSelections,
farcasterID: fid,
},
},
});
+ return;
}
+
+ const newUserSelections = {
+ ...userSelections,
+ farcasterID: fid,
+ accountSelection: ethereumAccount,
+ };
+ setSkipEthereumLoginOnce(false);
+ navigate<'AvatarSelection'>({
+ name: AvatarSelectionRouteName,
+ params: { userSelections: newUserSelections },
+ });
},
- [navigate, params],
+ [
+ navigate,
+ skipEthereumLoginOnce,
+ setSkipEthereumLoginOnce,
+ ethereumAccount,
+ userSelections,
+ ],
);
const onSkip = React.useCallback(() => goToNextStep(), [goToNextStep]);
diff --git a/native/account/registration/keyserver-selection.react.js b/native/account/registration/keyserver-selection.react.js
--- a/native/account/registration/keyserver-selection.react.js
+++ b/native/account/registration/keyserver-selection.react.js
@@ -23,7 +23,6 @@
import CommIcon from '../../components/comm-icon.react.js';
import {
type NavigationRoute,
- ConnectEthereumRouteName,
ConnectFarcasterRouteName,
} from '../../navigation/route-names.js';
import { useSelector } from '../../redux/redux-utils.js';
@@ -51,12 +50,7 @@
function KeyserverSelection(props: Props): React.Node {
const registrationContext = React.useContext(RegistrationContext);
invariant(registrationContext, 'registrationContext should be set');
- const {
- cachedSelections,
- setCachedSelections,
- skipEthereumLoginOnce,
- setSkipEthereumLoginOnce,
- } = registrationContext;
+ const { cachedSelections, setCachedSelections } = registrationContext;
const initialKeyserverURL = cachedSelections.keyserverURL;
const [customKeyserver, setCustomKeyserver] = React.useState(
@@ -117,7 +111,6 @@
const { navigate } = props.navigation;
const { coolOrNerdMode } = props.route.params.userSelections;
- const { ethereumAccount } = cachedSelections;
const onSubmit = React.useCallback(async () => {
setError(undefined);
@@ -134,22 +127,9 @@
}));
const userSelections = { coolOrNerdMode, keyserverURL };
- if (!skipEthereumLoginOnce || !ethereumAccount) {
- navigate<'ConnectEthereum'>({
- name: ConnectEthereumRouteName,
- params: { userSelections },
- });
- return;
- }
-
- const userSelectionsWithAccount = {
- ...userSelections,
- ethereumAccount,
- };
- setSkipEthereumLoginOnce(false);
navigate<'ConnectFarcaster'>({
name: ConnectFarcasterRouteName,
- params: { userSelections: userSelectionsWithAccount },
+ params: { userSelections },
});
}, [
keyserverURL,
@@ -157,9 +137,6 @@
setCachedSelections,
navigate,
coolOrNerdMode,
- skipEthereumLoginOnce,
- ethereumAccount,
- setSkipEthereumLoginOnce,
]);
const styles = useStyles(unboundStyles);
diff --git a/native/account/registration/registration-navigator.react.js b/native/account/registration/registration-navigator.react.js
--- a/native/account/registration/registration-navigator.react.js
+++ b/native/account/registration/registration-navigator.react.js
@@ -72,7 +72,7 @@
return (
<Registration.Navigator
screenOptions={screenOptions}
- initialRouteName={ConnectEthereumRouteName}
+ initialRouteName={ConnectFarcasterRouteName}
>
<Registration.Screen
name={CoolOrNerdModeSelectionRouteName}

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 2, 6:34 PM (20 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5878557
Default Alt Text
D11973.1767378879.diff (9 KB)

Event Timeline