diff --git a/native/navigation/route-names.js b/native/navigation/route-names.js index 3ded41f2d..f5d3d8e9e 100644 --- a/native/navigation/route-names.js +++ b/native/navigation/route-names.js @@ -1,194 +1,191 @@ // @flow import type { RouteProp } from '@react-navigation/native'; import type { ActionResultModalParams } from './action-result-modal.react.js'; import type { TermsAndPrivacyModalParams } from '../account/terms-and-privacy-modal.react.js'; import type { ThreadPickerModalParams } from '../calendar/thread-picker-modal.react.js'; import type { ComposeSubchannelParams } from '../chat/compose-subchannel.react.js'; import type { FullScreenThreadMediaGalleryParams } from '../chat/fullscreen-thread-media-gallery.react.js'; import type { ImagePasteModalParams } from '../chat/image-paste-modal.react.js'; import type { MessageListParams } from '../chat/message-list-types.js'; import type { MessageReactionsModalParams } from '../chat/message-reactions-modal.react.js'; import type { MultimediaMessageTooltipModalParams } from '../chat/multimedia-message-tooltip-modal.react.js'; import type { RobotextMessageTooltipModalParams } from '../chat/robotext-message-tooltip-modal.react.js'; import type { AddUsersModalParams } from '../chat/settings/add-users-modal.react.js'; import type { ColorSelectorModalParams } from '../chat/settings/color-selector-modal.react.js'; import type { ComposeSubchannelModalParams } from '../chat/settings/compose-subchannel-modal.react.js'; import type { DeleteThreadParams } from '../chat/settings/delete-thread.react.js'; import type { ThreadSettingsMemberTooltipModalParams } from '../chat/settings/thread-settings-member-tooltip-modal.react.js'; import type { ThreadSettingsParams } from '../chat/settings/thread-settings.react.js'; import type { SidebarListModalParams } from '../chat/sidebar-list-modal.react.js'; import type { SubchannelListModalParams } from '../chat/subchannels-list-modal.react.js'; import type { TextMessageTooltipModalParams } from '../chat/text-message-tooltip-modal.react.js'; import type { CameraModalParams } from '../media/camera-modal.react.js'; import type { ImageModalParams } from '../media/image-modal.react.js'; import type { VideoPlaybackModalParams } from '../media/video-playback-modal.react.js'; import type { CustomServerModalParams } from '../profile/custom-server-modal.react.js'; -import type { EmojiAvatarCreationParams } from '../profile/emoji-avatar-creation.react.js'; import type { RelationshipListItemTooltipModalParams } from '../profile/relationship-list-item-tooltip-modal.react.js'; export const ActionResultModalRouteName = 'ActionResultModal'; export const AddUsersModalRouteName = 'AddUsersModal'; export const AppearancePreferencesRouteName = 'AppearancePreferences'; export const AppRouteName = 'App'; export const AppsRouteName = 'Apps'; export const BackgroundChatThreadListRouteName = 'BackgroundChatThreadList'; export const BlockListRouteName = 'BlockList'; export const BuildInfoRouteName = 'BuildInfo'; export const CalendarRouteName = 'Calendar'; export const CameraModalRouteName = 'CameraModal'; export const ChatRouteName = 'Chat'; export const ChatThreadListRouteName = 'ChatThreadList'; export const ColorSelectorModalRouteName = 'ColorSelectorModal'; export const ComposeSubchannelModalRouteName = 'ComposeSubchannelModal'; export const ComposeSubchannelRouteName = 'ComposeSubchannel'; export const CommunityDrawerNavigatorRouteName = 'CommunityDrawerNavigator'; export const CustomServerModalRouteName = 'CustomServerModal'; export const DefaultNotificationsPreferencesRouteName = 'DefaultNotifications'; export const DeleteAccountRouteName = 'DeleteAccount'; export const DeleteThreadRouteName = 'DeleteThread'; export const DevToolsRouteName = 'DevTools'; export const EditPasswordRouteName = 'EditPassword'; -export const EmojiAvatarCreationRouteName = 'EmojiAvatarCreation'; export const FriendListRouteName = 'FriendList'; export const FullScreenThreadMediaGalleryRouteName = 'FullScreenThreadMediaGallery'; export const HomeChatThreadListRouteName = 'HomeChatThreadList'; export const ImageModalRouteName = 'ImageModal'; export const ImagePasteModalRouteName = 'ImagePasteModal'; export const LoggedOutModalRouteName = 'LoggedOutModal'; export const MessageListRouteName = 'MessageList'; export const MessageReactionsModalRouteName = 'MessageReactionsModal'; export const MultimediaMessageTooltipModalRouteName = 'MultimediaMessageTooltipModal'; export const PrivacyPreferencesRouteName = 'PrivacyPreferences'; export const ProfileRouteName = 'Profile'; export const ProfileScreenRouteName = 'ProfileScreen'; export const RelationshipListItemTooltipModalRouteName = 'RelationshipListItemTooltipModal'; export const RobotextMessageTooltipModalRouteName = 'RobotextMessageTooltipModal'; export const SidebarListModalRouteName = 'SidebarListModal'; export const SubchannelsListModalRouteName = 'SubchannelsListModal'; export const TabNavigatorRouteName = 'TabNavigator'; export const TextMessageTooltipModalRouteName = 'TextMessageTooltipModal'; export const ThreadPickerModalRouteName = 'ThreadPickerModal'; export const ThreadSettingsMemberTooltipModalRouteName = 'ThreadSettingsMemberTooltipModal'; export const ThreadSettingsRouteName = 'ThreadSettings'; export const VideoPlaybackModalRouteName = 'VideoPlaybackModal'; export const TermsAndPrivacyRouteName = 'TermsAndPrivacyModal'; export type RootParamList = { +LoggedOutModal: void, +App: void, +ThreadPickerModal: ThreadPickerModalParams, +AddUsersModal: AddUsersModalParams, +CustomServerModal: CustomServerModalParams, +ColorSelectorModal: ColorSelectorModalParams, +ComposeSubchannelModal: ComposeSubchannelModalParams, +SidebarListModal: SidebarListModalParams, +ImagePasteModal: ImagePasteModalParams, +TermsAndPrivacyModal: TermsAndPrivacyModalParams, +SubchannelsListModal: SubchannelListModalParams, +MessageReactionsModal: MessageReactionsModalParams, }; export type MessageTooltipRouteNames = | typeof RobotextMessageTooltipModalRouteName | typeof MultimediaMessageTooltipModalRouteName | typeof TextMessageTooltipModalRouteName; export type TooltipModalParamList = { +MultimediaMessageTooltipModal: MultimediaMessageTooltipModalParams, +TextMessageTooltipModal: TextMessageTooltipModalParams, +ThreadSettingsMemberTooltipModal: ThreadSettingsMemberTooltipModalParams, +RelationshipListItemTooltipModal: RelationshipListItemTooltipModalParams, +RobotextMessageTooltipModal: RobotextMessageTooltipModalParams, }; export type OverlayParamList = { +CommunityDrawerNavigator: void, +ImageModal: ImageModalParams, +ActionResultModal: ActionResultModalParams, +CameraModal: CameraModalParams, +VideoPlaybackModal: VideoPlaybackModalParams, ...TooltipModalParamList, }; export type TabParamList = { +Calendar: void, +Chat: void, +Profile: void, +Apps: void, }; export type ChatParamList = { +ChatThreadList: void, +MessageList: MessageListParams, +ComposeSubchannel: ComposeSubchannelParams, +ThreadSettings: ThreadSettingsParams, +DeleteThread: DeleteThreadParams, +FullScreenThreadMediaGallery: FullScreenThreadMediaGalleryParams, }; export type ChatTopTabsParamList = { +HomeChatThreadList: void, +BackgroundChatThreadList: void, }; export type ProfileParamList = { +ProfileScreen: void, - +EmojiAvatarCreation: EmojiAvatarCreationParams, +EditPassword: void, +DeleteAccount: void, +BuildInfo: void, +DevTools: void, +AppearancePreferences: void, +PrivacyPreferences: void, +DefaultNotifications: void, +FriendList: void, +BlockList: void, }; export type CommunityDrawerParamList = { +TabNavigator: void }; export type ScreenParamList = { ...RootParamList, ...OverlayParamList, ...TabParamList, ...ChatParamList, ...ChatTopTabsParamList, ...ProfileParamList, ...CommunityDrawerParamList, }; export type NavigationRoute> = RouteProp; export const accountModals = [LoggedOutModalRouteName]; export const scrollBlockingModals = [ ImageModalRouteName, MultimediaMessageTooltipModalRouteName, TextMessageTooltipModalRouteName, ThreadSettingsMemberTooltipModalRouteName, RelationshipListItemTooltipModalRouteName, RobotextMessageTooltipModalRouteName, VideoPlaybackModalRouteName, ]; export const chatRootModals = [ AddUsersModalRouteName, ColorSelectorModalRouteName, ComposeSubchannelModalRouteName, ]; export const threadRoutes = [ MessageListRouteName, ThreadSettingsRouteName, DeleteThreadRouteName, ComposeSubchannelRouteName, FullScreenThreadMediaGalleryRouteName, ]; diff --git a/native/profile/emoji-avatar-creation.react.js b/native/profile/emoji-avatar-creation.react.js deleted file mode 100644 index 712539063..000000000 --- a/native/profile/emoji-avatar-creation.react.js +++ /dev/null @@ -1,188 +0,0 @@ -// @flow - -import * as React from 'react'; -import { View, Text, TouchableWithoutFeedback } from 'react-native'; -import EmojiPicker from 'rn-emoji-keyboard'; - -import { - updateUserAvatar, - updateUserAvatarActionTypes, -} from 'lib/actions/user-actions.js'; -import type { ClientEmojiAvatar } from 'lib/types/avatar-types.js'; -import { - useDispatchActionPromise, - useServerCall, -} from 'lib/utils/action-utils.js'; - -import type { ProfileNavigationProp } from './profile.react.js'; -import Avatar from '../components/avatar.react.js'; -import Button from '../components/button.react.js'; -import ColorRows from '../components/color-rows.react.js'; -import type { NavigationRoute } from '../navigation/route-names.js'; -import { useStyles } from '../themes/colors.js'; - -export type EmojiAvatarCreationParams = { - +emojiAvatarInfo: ClientEmojiAvatar, -}; - -type Props = { - +navigation: ProfileNavigationProp<'EmojiAvatarCreation'>, - +route: NavigationRoute<'EmojiAvatarCreation'>, -}; - -function EmojiAvatarCreation(props: Props): React.Node { - const { emoji: initalEmoji, color: initialColor } = - props.route.params.emojiAvatarInfo; - - const [pendingEmoji, setPendingEmoji] = React.useState(initalEmoji); - const [pendingColor, setPendingColor] = React.useState(initialColor); - const [emojiKeyboardOpen, setEmojiKeyboardOpen] = - React.useState(false); - - const styles = useStyles(unboundStyles); - - const dispatchActionPromise = useDispatchActionPromise(); - const callUpdateUserAvatar = useServerCall(updateUserAvatar); - - const onPressEditEmoji = React.useCallback(() => { - setEmojiKeyboardOpen(true); - }, []); - - const onPressSetAvatar = React.useCallback(() => { - const newEmojiAvatarRequest = { - type: 'emoji', - emoji: pendingEmoji, - color: pendingColor, - }; - - dispatchActionPromise( - updateUserAvatarActionTypes, - callUpdateUserAvatar(newEmojiAvatarRequest), - ); - props.navigation.goBack(); - }, [ - callUpdateUserAvatar, - dispatchActionPromise, - pendingColor, - pendingEmoji, - props.navigation, - ]); - - const onPressReset = React.useCallback(() => { - setPendingEmoji(initalEmoji); - setPendingColor(initialColor); - }, [initalEmoji, initialColor]); - - const onEmojiSelected = React.useCallback(emoji => { - setPendingEmoji(emoji.emoji); - }, []); - - const onEmojiKeyboardClose = React.useCallback( - () => setEmojiKeyboardOpen(false), - [], - ); - - const stagedAvatarInfo: ClientEmojiAvatar = React.useMemo( - () => ({ - type: 'emoji', - emoji: pendingEmoji, - color: pendingColor, - }), - [pendingColor, pendingEmoji], - ); - - return ( - - - - - - - Edit Emoji - - - - - - - - - - - - - - ); -} - -const unboundStyles = { - container: { - flex: 1, - justifyContent: 'space-between', - }, - emojiAvatarCreationContainer: { - paddingTop: 16, - }, - stagedAvatarSection: { - backgroundColor: 'panelForeground', - paddingVertical: 24, - alignItems: 'center', - }, - editEmojiText: { - color: '#7E57C2', - marginTop: 16, - fontWeight: '500', - fontSize: 16, - lineHeight: 24, - textAlign: 'center', - }, - colorRowsSection: { - paddingVertical: 24, - marginTop: 24, - backgroundColor: 'panelForeground', - alignItems: 'center', - }, - buttonsContainer: { - paddingHorizontal: 16, - paddingBottom: 8, - }, - saveButton: { - backgroundColor: '#7E57C2', - paddingVertical: 12, - borderRadius: 8, - }, - saveButtonText: { - color: '#FFFFFF', - textAlign: 'center', - fontWeight: '500', - fontSize: 16, - lineHeight: 24, - }, - resetButton: { - padding: 12, - borderRadius: 8, - marginTop: 8, - alignSelf: 'center', - }, - resetButtonText: { - color: '#B62602', - textAlign: 'center', - fontWeight: '500', - fontSize: 16, - lineHeight: 24, - }, -}; - -export default EmojiAvatarCreation;