Changeset View
Changeset View
Standalone View
Standalone View
native/profile/profile-screen.react.js
// @flow | // @flow | ||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import { View, Text, Alert, Platform, ScrollView } from 'react-native'; | import { View, Text, Alert, Platform, ScrollView } from 'react-native'; | ||||
import { logOutActionTypes, logOut } from 'lib/actions/user-actions.js'; | import { logOutActionTypes, logOut } from 'lib/actions/user-actions.js'; | ||||
import { useStringForUser } from 'lib/hooks/ens-cache.js'; | import { useStringForUser } from 'lib/hooks/ens-cache.js'; | ||||
import { preRequestUserStateSelector } from 'lib/selectors/account-selectors.js'; | import { preRequestUserStateSelector } from 'lib/selectors/account-selectors.js'; | ||||
import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js'; | import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js'; | ||||
import { accountHasPassword } from 'lib/shared/account-utils.js'; | import { accountHasPassword } from 'lib/shared/account-utils.js'; | ||||
import { getAvatarForUser } from 'lib/shared/avatar-utils.js'; | |||||
import type { LogOutResult } from 'lib/types/account-types.js'; | import type { LogOutResult } from 'lib/types/account-types.js'; | ||||
import { type PreRequestUserState } from 'lib/types/session-types.js'; | import { type PreRequestUserState } from 'lib/types/session-types.js'; | ||||
import { type CurrentUserInfo } from 'lib/types/user-types.js'; | import { type CurrentUserInfo } from 'lib/types/user-types.js'; | ||||
import { | import { | ||||
type DispatchActionPromise, | type DispatchActionPromise, | ||||
useDispatchActionPromise, | useDispatchActionPromise, | ||||
useServerCall, | useServerCall, | ||||
} from 'lib/utils/action-utils.js'; | } from 'lib/utils/action-utils.js'; | ||||
import type { ProfileNavigationProp } from './profile.react.js'; | import type { ProfileNavigationProp } from './profile.react.js'; | ||||
import { deleteNativeCredentialsFor } from '../account/native-credentials.js'; | import { deleteNativeCredentialsFor } from '../account/native-credentials.js'; | ||||
import Action from '../components/action-row.react.js'; | import Action from '../components/action-row.react.js'; | ||||
import Avatar from '../components/avatar.react.js'; | |||||
import Button from '../components/button.react.js'; | import Button from '../components/button.react.js'; | ||||
import EditSettingButton from '../components/edit-setting-button.react.js'; | import EditSettingButton from '../components/edit-setting-button.react.js'; | ||||
import { SingleLine } from '../components/single-line.react.js'; | import { SingleLine } from '../components/single-line.react.js'; | ||||
import UserAvatar from '../components/user-avatar.react.js'; | |||||
import type { NavigationRoute } from '../navigation/route-names.js'; | import type { NavigationRoute } from '../navigation/route-names.js'; | ||||
import { | import { | ||||
EditPasswordRouteName, | EditPasswordRouteName, | ||||
DeleteAccountRouteName, | DeleteAccountRouteName, | ||||
BuildInfoRouteName, | BuildInfoRouteName, | ||||
DevToolsRouteName, | DevToolsRouteName, | ||||
AppearancePreferencesRouteName, | AppearancePreferencesRouteName, | ||||
FriendListRouteName, | FriendListRouteName, | ||||
▲ Show 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | if (accountHasPassword(this.props.currentUserInfo)) { | ||||
onPress={this.onPressEditPassword} | onPress={this.onPressEditPassword} | ||||
canChangeSettings={true} | canChangeSettings={true} | ||||
style={this.props.styles.editPasswordButton} | style={this.props.styles.editPasswordButton} | ||||
/> | /> | ||||
</Action.Row> | </Action.Row> | ||||
); | ); | ||||
} | } | ||||
const avatarInfo = getAvatarForUser(this.props.currentUserInfo); | |||||
const avatar = ( | const avatar = ( | ||||
<View style={this.props.styles.avatarSection}> | <View style={this.props.styles.avatarSection}> | ||||
<Avatar size="profile" avatarInfo={avatarInfo} /> | <UserAvatar size="profile" userID={this.props.currentUserInfo?.id} /> | ||||
</View> | </View> | ||||
); | ); | ||||
let avatarSection; | let avatarSection; | ||||
if (this.props.shouldRenderAvatars) { | if (this.props.shouldRenderAvatars) { | ||||
avatarSection = ( | avatarSection = ( | ||||
<> | <> | ||||
<Text style={this.props.styles.header}>USER AVATAR</Text> | <Text style={this.props.styles.header}>USER AVATAR</Text> | ||||
▲ Show 20 Lines • Show All 292 Lines • Show Last 20 Lines |