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 @@ -4,19 +4,16 @@ import * as React from 'react'; import { Text, View } from 'react-native'; -import type { - UpdateUserAvatarRequest, - ClientAvatar, -} from 'lib/types/avatar-types.js'; -import type { NativeMediaSelection } from 'lib/types/media-types.js'; -import type { SIWEResult } from 'lib/types/siwe-types.js'; - import RegistrationButtonContainer from './registration-button-container.react.js'; import RegistrationButton from './registration-button.react.js'; import RegistrationContainer from './registration-container.react.js'; import RegistrationContentContainer from './registration-content-container.react.js'; import type { RegistrationNavigationProp } from './registration-navigator.react.js'; -import type { CoolOrNerdMode } from './registration-types.js'; +import type { + CoolOrNerdMode, + AccountSelection, + AvatarData, +} from './registration-types.js'; import { EditUserAvatarContext, type UserAvatarSelection, @@ -25,38 +22,14 @@ import type { NavigationRoute } from '../../navigation/route-names.js'; import { useStyles } from '../../themes/colors.js'; -type EthereumAccountSelections = { - +accountType: 'ethereum', - ...SIWEResult, - +avatarURI: ?string, -}; - -type UsernameAccountSelections = { - +accountType: 'username', - +username: string, - +password: string, -}; - export type AvatarSelectionParams = { +userSelections: { +coolOrNerdMode: CoolOrNerdMode, +keyserverUsername: string, - +accountSelections: EthereumAccountSelections | UsernameAccountSelections, + +accountSelections: AccountSelection, }, }; -type AvatarData = - | { - +needsUpload: true, - +mediaSelection: NativeMediaSelection, - +clientAvatar: ClientAvatar, - } - | { - +needsUpload: false, - +updateUserAvatarRequest: UpdateUserAvatarRequest, - +clientAvatar: ClientAvatar, - }; - const ensDefaultSelection = { needsUpload: false, updateUserAvatarRequest: { type: 'ens' }, 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 @@ -1,3 +1,38 @@ // @flow +import type { + UpdateUserAvatarRequest, + ClientAvatar, +} from 'lib/types/avatar-types.js'; +import type { NativeMediaSelection } from 'lib/types/media-types.js'; +import type { SIWEResult } from 'lib/types/siwe-types.js'; + export type CoolOrNerdMode = 'cool' | 'nerd'; + +export type EthereumAccountSelection = { + +accountType: 'ethereum', + ...SIWEResult, + +avatarURI: ?string, +}; + +export type UsernameAccountSelection = { + +accountType: 'username', + +username: string, + +password: string, +}; + +export type AccountSelection = + | EthereumAccountSelection + | UsernameAccountSelection; + +export type AvatarData = + | { + +needsUpload: true, + +mediaSelection: NativeMediaSelection, + +clientAvatar: ClientAvatar, + } + | { + +needsUpload: false, + +updateUserAvatarRequest: UpdateUserAvatarRequest, + +clientAvatar: ClientAvatar, + };