diff --git a/native/account/fullscreen-siwe-panel.react.js b/native/account/fullscreen-siwe-panel.react.js --- a/native/account/fullscreen-siwe-panel.react.js +++ b/native/account/fullscreen-siwe-panel.react.js @@ -19,6 +19,7 @@ AccountDoesNotExistRouteName, RegistrationRouteName, } from '../navigation/route-names.js'; +import { UnknownErrorAlertDetails } from '../utils/alert-messages.js'; import Alert from '../utils/alert.js'; type Props = { @@ -82,8 +83,8 @@ return; } Alert.alert( - 'Unknown error', - 'Uhh... try again?', + UnknownErrorAlertDetails.title, + UnknownErrorAlertDetails.message, [{ text: 'OK', onPress: goBackToPrompt }], { cancelable: false }, ); diff --git a/native/account/log-in-panel.react.js b/native/account/log-in-panel.react.js --- a/native/account/log-in-panel.react.js +++ b/native/account/log-in-panel.react.js @@ -44,7 +44,11 @@ import { useSelector } from '../redux/redux-utils.js'; import { nativeLogInExtraInfoSelector } from '../selectors/account-selectors.js'; import type { KeyPressEvent } from '../types/react-native.js'; -import { AppOutOfDateAlertDetails } from '../utils/alert-messages.js'; +import { + AppOutOfDateAlertDetails, + UnknownErrorAlertDetails, + UserNotFoundAlertDetails, +} from '../utils/alert-messages.js'; import Alert from '../utils/alert.js'; import { nativeNotificationsSessionCreator } from '../utils/crypto-utils.js'; import type { StateContainer } from '../utils/state-container.js'; @@ -270,8 +274,8 @@ } catch (e) { if (e.message === 'invalid_credentials') { Alert.alert( - 'Incorrect username or password', - "Either that user doesn't exist, or the password is incorrect", + UserNotFoundAlertDetails.title, + UserNotFoundAlertDetails.message, [{ text: 'OK', onPress: this.onUnsuccessfulLoginAlertAckowledged }], { cancelable: false }, ); @@ -284,8 +288,8 @@ ); } else { Alert.alert( - 'Unknown error', - 'Uhh... try again?', + UnknownErrorAlertDetails.title, + UnknownErrorAlertDetails.message, [{ text: 'OK', onPress: this.onUnknownErrorAlertAcknowledged }], { cancelable: false }, ); diff --git a/native/account/register-panel.react.js b/native/account/register-panel.react.js --- a/native/account/register-panel.react.js +++ b/native/account/register-panel.react.js @@ -51,6 +51,7 @@ AppOutOfDateAlertDetails, UsernameReservedAlertDetails, UsernameTakenAlertDetails, + UnknownErrorAlertDetails, } from '../utils/alert-messages.js'; import Alert from '../utils/alert.js'; import { nativeNotificationsSessionCreator } from '../utils/crypto-utils.js'; @@ -395,8 +396,8 @@ ); } else { Alert.alert( - 'Unknown error', - 'Uhh... try again?', + UnknownErrorAlertDetails.title, + UnknownErrorAlertDetails.message, [{ text: 'OK', onPress: this.onUnknownErrorAlertAcknowledged }], { cancelable: false }, ); diff --git a/native/account/registration/existing-ethereum-account.react.js b/native/account/registration/existing-ethereum-account.react.js --- a/native/account/registration/existing-ethereum-account.react.js +++ b/native/account/registration/existing-ethereum-account.react.js @@ -18,6 +18,7 @@ import type { NavigationRoute } from '../../navigation/route-names.js'; import { useSelector } from '../../redux/redux-utils.js'; import { useStyles } from '../../themes/colors.js'; +import { UnknownErrorAlertDetails } from '../../utils/alert-messages.js'; import Alert from '../../utils/alert.js'; import { useSIWEServerCall } from '../siwe-hooks.js'; @@ -39,9 +40,14 @@ try { await siweServerCall({ ...params, doNotRegister: true }); } catch (e) { - Alert.alert('Unknown error', 'Uhh... try again?', [{ text: 'OK' }], { - cancelable: false, - }); + Alert.alert( + UnknownErrorAlertDetails.title, + UnknownErrorAlertDetails.message, + [{ text: 'OK' }], + { + cancelable: false, + }, + ); throw e; } dispatch({ diff --git a/native/account/registration/registration-server-call.js b/native/account/registration/registration-server-call.js --- a/native/account/registration/registration-server-call.js +++ b/native/account/registration/registration-server-call.js @@ -31,6 +31,7 @@ AppOutOfDateAlertDetails, UsernameReservedAlertDetails, UsernameTakenAlertDetails, + UnknownErrorAlertDetails, } from '../../utils/alert-messages.js'; import Alert from '../../utils/alert.js'; import { setNativeCredentials } from '../native-credentials.js'; @@ -99,7 +100,10 @@ AppOutOfDateAlertDetails.message, ); } else { - Alert.alert('Unknown error', 'Uhh... try again?'); + Alert.alert( + UnknownErrorAlertDetails.title, + UnknownErrorAlertDetails.message, + ); } throw e; } @@ -153,7 +157,10 @@ AppOutOfDateAlertDetails.message, ); } else { - Alert.alert('Unknown error', 'Uhh... try again?'); + Alert.alert( + UnknownErrorAlertDetails.title, + UnknownErrorAlertDetails.message, + ); } throw e; } @@ -197,7 +204,10 @@ urlPrefixOverride: keyserverURL, }); } catch (e) { - Alert.alert('Unknown error', 'Uhh... try again?'); + Alert.alert( + UnknownErrorAlertDetails.title, + UnknownErrorAlertDetails.message, + ); throw e; } } diff --git a/native/account/siwe-panel.react.js b/native/account/siwe-panel.react.js --- a/native/account/siwe-panel.react.js +++ b/native/account/siwe-panel.react.js @@ -19,6 +19,7 @@ import { useKeyboardHeight } from '../keyboard/keyboard-hooks.js'; import { useSelector } from '../redux/redux-utils.js'; import type { BottomSheetRef } from '../types/bottom-sheet.js'; +import { UnknownErrorAlertDetails } from '../utils/alert-messages.js'; import Alert from '../utils/alert.js'; import { getContentSigningKey } from '../utils/crypto-utils.js'; import { defaultLandingURLPrefix } from '../utils/url-utils.js'; @@ -78,8 +79,8 @@ setNonce(response); } catch (e) { Alert.alert( - 'Unknown error', - 'Uhh... try again?', + UnknownErrorAlertDetails.title, + UnknownErrorAlertDetails.message, [{ text: 'OK', onPress: onClosing }], { cancelable: false }, ); diff --git a/native/chat/compose-subchannel.react.js b/native/chat/compose-subchannel.react.js --- a/native/chat/compose-subchannel.react.js +++ b/native/chat/compose-subchannel.react.js @@ -35,6 +35,7 @@ import type { NavigationRoute } from '../navigation/route-names.js'; import { useSelector } from '../redux/redux-utils.js'; import { useStyles } from '../themes/colors.js'; +import { UnknownErrorAlertDetails } from '../utils/alert-messages.js'; import Alert from '../utils/alert.js'; const TagInput = createTagInput(); @@ -100,8 +101,8 @@ } catch (e) { setCreateButtonEnabled(true); Alert.alert( - 'Unknown error', - 'Uhh... try again?', + UnknownErrorAlertDetails.title, + UnknownErrorAlertDetails.message, [{ text: 'OK', onPress: onUnknownErrorAlertAcknowledged }], { cancelable: false }, ); diff --git a/native/chat/relationship-prompt.react.js b/native/chat/relationship-prompt.react.js --- a/native/chat/relationship-prompt.react.js +++ b/native/chat/relationship-prompt.react.js @@ -11,6 +11,7 @@ import Button from '../components/button.react.js'; import { useStyles } from '../themes/colors.js'; +import { UnknownErrorAlertDetails } from '../utils/alert-messages.js'; import Alert from '../utils/alert.js'; type Props = { @@ -24,7 +25,11 @@ threadInfo, }: Props) { const onErrorCallback = React.useCallback(() => { - Alert.alert('Unknown error', 'Uhh... try again?', [{ text: 'OK' }]); + Alert.alert( + UnknownErrorAlertDetails.title, + UnknownErrorAlertDetails.message, + [{ text: 'OK' }], + ); }, []); const { otherUserInfo, diff --git a/native/chat/settings/add-users-modal.react.js b/native/chat/settings/add-users-modal.react.js --- a/native/chat/settings/add-users-modal.react.js +++ b/native/chat/settings/add-users-modal.react.js @@ -28,6 +28,7 @@ import type { NavigationRoute } from '../../navigation/route-names.js'; import { useSelector } from '../../redux/redux-utils.js'; import { useStyles } from '../../themes/colors.js'; +import { UnknownErrorAlertDetails } from '../../utils/alert-messages.js'; import Alert from '../../utils/alert.js'; const TagInput = createTagInput(); @@ -83,8 +84,8 @@ return result; } catch (e) { Alert.alert( - 'Unknown error', - 'Uhh... try again?', + UnknownErrorAlertDetails.title, + UnknownErrorAlertDetails.message, [{ text: 'OK', onPress: onUnknownErrorAlertAcknowledged }], { cancelable: false }, ); diff --git a/native/chat/settings/color-selector-modal.react.js b/native/chat/settings/color-selector-modal.react.js --- a/native/chat/settings/color-selector-modal.react.js +++ b/native/chat/settings/color-selector-modal.react.js @@ -24,6 +24,7 @@ import type { NavigationRoute } from '../../navigation/route-names.js'; import { useSelector } from '../../redux/redux-utils.js'; import { type Colors, useColors, useStyles } from '../../themes/colors.js'; +import { UnknownErrorAlertDetails } from '../../utils/alert-messages.js'; import Alert from '../../utils/alert.js'; export type ColorSelectorModalParams = { @@ -104,8 +105,8 @@ }); } catch (e) { Alert.alert( - 'Unknown error', - 'Uhh... try again?', + UnknownErrorAlertDetails.title, + UnknownErrorAlertDetails.message, [{ text: 'OK', onPress: onErrorAcknowledged }], { cancelable: false }, ); diff --git a/native/chat/settings/delete-thread.react.js b/native/chat/settings/delete-thread.react.js --- a/native/chat/settings/delete-thread.react.js +++ b/native/chat/settings/delete-thread.react.js @@ -45,6 +45,7 @@ import type { NavigationRoute } from '../../navigation/route-names.js'; import { useSelector } from '../../redux/redux-utils.js'; import { type Colors, useColors, useStyles } from '../../themes/colors.js'; +import { UnknownErrorAlertDetails } from '../../utils/alert-messages.js'; import Alert from '../../utils/alert.js'; import type { ChatNavigationProp } from '../chat.react.js'; @@ -228,9 +229,14 @@ { cancelable: false }, ); } else { - Alert.alert('Unknown error', 'Uhh... try again?', [{ text: 'OK' }], { - cancelable: false, - }); + Alert.alert( + UnknownErrorAlertDetails.title, + UnknownErrorAlertDetails.message, + [{ text: 'OK' }], + { + cancelable: false, + }, + ); } throw e; } diff --git a/native/chat/settings/thread-settings-description.react.js b/native/chat/settings/thread-settings-description.react.js --- a/native/chat/settings/thread-settings-description.react.js +++ b/native/chat/settings/thread-settings-description.react.js @@ -42,6 +42,7 @@ ContentSizeChangeEvent, LayoutEvent, } from '../../types/react-native.js'; +import { UnknownErrorAlertDetails } from '../../utils/alert-messages.js'; import Alert from '../../utils/alert.js'; const unboundStyles = { @@ -273,8 +274,8 @@ }); } catch (e) { Alert.alert( - 'Unknown error', - 'Uhh... try again?', + UnknownErrorAlertDetails.title, + UnknownErrorAlertDetails.message, [{ text: 'OK', onPress: this.onErrorAcknowledged }], { cancelable: false }, ); diff --git a/native/chat/settings/thread-settings-edit-relationship.react.js b/native/chat/settings/thread-settings-edit-relationship.react.js --- a/native/chat/settings/thread-settings-edit-relationship.react.js +++ b/native/chat/settings/thread-settings-edit-relationship.react.js @@ -26,6 +26,7 @@ import { useSelector } from '../../redux/redux-utils.js'; import { useColors, useStyles } from '../../themes/colors.js'; import type { ViewStyle } from '../../types/styles.js'; +import { UnknownErrorAlertDetails } from '../../utils/alert-messages.js'; import Alert from '../../utils/alert.js'; type Props = { @@ -59,9 +60,14 @@ userIDs: [otherUserInfo.id], }); } catch (e) { - Alert.alert('Unknown error', 'Uhh... try again?', [{ text: 'OK' }], { - cancelable: true, - }); + Alert.alert( + UnknownErrorAlertDetails.title, + UnknownErrorAlertDetails.message, + [{ text: 'OK' }], + { + cancelable: true, + }, + ); throw e; } }, diff --git a/native/chat/settings/thread-settings-leave-thread.react.js b/native/chat/settings/thread-settings-leave-thread.react.js --- a/native/chat/settings/thread-settings-leave-thread.react.js +++ b/native/chat/settings/thread-settings-leave-thread.react.js @@ -29,6 +29,7 @@ import { useSelector } from '../../redux/redux-utils.js'; import { type Colors, useColors, useStyles } from '../../themes/colors.js'; import type { ViewStyle } from '../../types/styles.js'; +import { UnknownErrorAlertDetails } from '../../utils/alert-messages.js'; import Alert from '../../utils/alert.js'; const unboundStyles = { @@ -141,9 +142,14 @@ }); return result; } catch (e) { - Alert.alert('Unknown error', 'Uhh... try again?', undefined, { - cancelable: true, - }); + Alert.alert( + UnknownErrorAlertDetails.title, + UnknownErrorAlertDetails.message, + undefined, + { + cancelable: true, + }, + ); throw e; } } diff --git a/native/chat/settings/thread-settings-name.react.js b/native/chat/settings/thread-settings-name.react.js --- a/native/chat/settings/thread-settings-name.react.js +++ b/native/chat/settings/thread-settings-name.react.js @@ -33,6 +33,7 @@ import TextInput from '../../components/text-input.react.js'; import { useSelector } from '../../redux/redux-utils.js'; import { type Colors, useStyles, useColors } from '../../themes/colors.js'; +import { UnknownErrorAlertDetails } from '../../utils/alert-messages.js'; import Alert from '../../utils/alert.js'; const unboundStyles = { @@ -198,8 +199,8 @@ }); } catch (e) { Alert.alert( - 'Unknown error', - 'Uhh... try again?', + UnknownErrorAlertDetails.title, + UnknownErrorAlertDetails.message, [{ text: 'OK', onPress: this.onErrorAcknowledged }], { cancelable: false }, ); diff --git a/native/chat/settings/thread-settings-promote-sidebar.react.js b/native/chat/settings/thread-settings-promote-sidebar.react.js --- a/native/chat/settings/thread-settings-promote-sidebar.react.js +++ b/native/chat/settings/thread-settings-promote-sidebar.react.js @@ -10,6 +10,7 @@ import Button from '../../components/button.react.js'; import { type Colors, useColors, useStyles } from '../../themes/colors.js'; import type { ViewStyle } from '../../types/styles.js'; +import { UnknownErrorAlertDetails } from '../../utils/alert-messages.js'; import Alert from '../../utils/alert.js'; const unboundStyles = { @@ -83,9 +84,14 @@ } const onError = () => { - Alert.alert('Unknown error', 'Uhh... try again?', undefined, { - cancelable: true, - }); + Alert.alert( + UnknownErrorAlertDetails.title, + UnknownErrorAlertDetails.message, + undefined, + { + cancelable: true, + }, + ); }; const ConnectedThreadSettingsPromoteSidebar: React.ComponentType = diff --git a/native/profile/default-notifications-preferences.react.js b/native/profile/default-notifications-preferences.react.js --- a/native/profile/default-notifications-preferences.react.js +++ b/native/profile/default-notifications-preferences.react.js @@ -27,6 +27,7 @@ import type { NavigationRoute } from '../navigation/route-names.js'; import { useSelector } from '../redux/redux-utils.js'; import { useStyles } from '../themes/colors.js'; +import { UnknownErrorAlertDetails } from '../utils/alert-messages.js'; import Alert from '../utils/alert.js'; const CheckIcon = () => ( @@ -110,8 +111,8 @@ }); } catch (e) { Alert.alert( - 'Unknown error', - 'Uhh... try again?', + UnknownErrorAlertDetails.title, + UnknownErrorAlertDetails.message, [{ text: 'OK', onPress: () => {} }], { cancelable: false }, ); diff --git a/native/profile/edit-password.react.js b/native/profile/edit-password.react.js --- a/native/profile/edit-password.react.js +++ b/native/profile/edit-password.react.js @@ -31,6 +31,7 @@ import type { NavigationRoute } from '../navigation/route-names.js'; import { useSelector } from '../redux/redux-utils.js'; import { type Colors, useColors, useStyles } from '../themes/colors.js'; +import { UnknownErrorAlertDetails } from '../utils/alert-messages.js'; import Alert from '../utils/alert.js'; const unboundStyles = { @@ -310,8 +311,8 @@ ); } else { Alert.alert( - 'Unknown error', - 'Uhh... try again?', + UnknownErrorAlertDetails.title, + UnknownErrorAlertDetails.message, [{ text: 'OK', onPress: this.onUnknownErrorAlertAcknowledged }], { cancelable: false }, ); diff --git a/native/profile/relationship-list-item.react.js b/native/profile/relationship-list-item.react.js --- a/native/profile/relationship-list-item.react.js +++ b/native/profile/relationship-list-item.react.js @@ -50,6 +50,7 @@ import { type Colors, useColors, useStyles } from '../themes/colors.js'; import type { VerticalBounds } from '../types/layout-types.js'; import { useNavigateToUserProfileBottomSheet } from '../user-profile/user-profile-utils.js'; +import { UnknownErrorAlertDetails } from '../utils/alert-messages.js'; import Alert from '../utils/alert.js'; const unboundStyles = { @@ -310,9 +311,14 @@ userIDs: [this.props.userInfo.id], }); } catch (e) { - Alert.alert('Unknown error', 'Uhh... try again?', [{ text: 'OK' }], { - cancelable: true, - }); + Alert.alert( + UnknownErrorAlertDetails.title, + UnknownErrorAlertDetails.message, + [{ text: 'OK' }], + { + cancelable: true, + }, + ); throw e; } } diff --git a/native/profile/relationship-list.react.js b/native/profile/relationship-list.react.js --- a/native/profile/relationship-list.react.js +++ b/native/profile/relationship-list.react.js @@ -40,6 +40,7 @@ import { useSelector } from '../redux/redux-utils.js'; import { useStyles, useIndicatorStyle } from '../themes/colors.js'; import type { VerticalBounds } from '../types/layout-types.js'; +import { UnknownErrorAlertDetails } from '../utils/alert-messages.js'; import Alert from '../utils/alert.js'; const TagInput = createTagInput(); @@ -217,8 +218,8 @@ return result; } catch (e) { Alert.alert( - 'Unknown error', - 'Uhh... try again?', + UnknownErrorAlertDetails.title, + UnknownErrorAlertDetails.message, [{ text: 'OK', onPress: onUnknownErrorAlertAcknowledged }], { cancelable: true, onDismiss: onUnknownErrorAlertAcknowledged }, ); diff --git a/native/profile/user-relationship-tooltip-modal.react.js b/native/profile/user-relationship-tooltip-modal.react.js --- a/native/profile/user-relationship-tooltip-modal.react.js +++ b/native/profile/user-relationship-tooltip-modal.react.js @@ -23,6 +23,7 @@ type TooltipRoute, } from '../tooltip/tooltip.react.js'; import type { UserProfileBottomSheetNavigationProp } from '../user-profile/user-profile-bottom-sheet-navigator.react.js'; +import { UnknownErrorAlertDetails } from '../utils/alert-messages.js'; import Alert from '../utils/alert.js'; type Action = 'unfriend' | 'block' | 'unblock'; @@ -51,9 +52,14 @@ userIDs: [input.relativeUserInfo.id], }); } catch (e) { - Alert.alert('Unknown error', 'Uhh... try again?', [{ text: 'OK' }], { - cancelable: true, - }); + Alert.alert( + UnknownErrorAlertDetails.title, + UnknownErrorAlertDetails.message, + [{ text: 'OK' }], + { + cancelable: true, + }, + ); throw e; } }; diff --git a/native/user-profile/user-profile-relationship-button.react.js b/native/user-profile/user-profile-relationship-button.react.js --- a/native/user-profile/user-profile-relationship-button.react.js +++ b/native/user-profile/user-profile-relationship-button.react.js @@ -12,10 +12,15 @@ import { userProfileActionButtonHeight } from './user-profile-constants.js'; import RelationshipButton from '../components/relationship-button.react.js'; import { useStyles } from '../themes/colors.js'; +import { UnknownErrorAlertDetails } from '../utils/alert-messages.js'; import Alert from '../utils/alert.js'; const onErrorCallback = () => { - Alert.alert('Unknown error', 'Uhh... try again?', [{ text: 'OK' }]); + Alert.alert( + UnknownErrorAlertDetails.title, + UnknownErrorAlertDetails.message, + [{ text: 'OK' }], + ); }; type Props = { diff --git a/native/utils/alert-messages.js b/native/utils/alert-messages.js --- a/native/utils/alert-messages.js +++ b/native/utils/alert-messages.js @@ -30,3 +30,13 @@ title: 'Username taken', message: 'An account with that username already exists', }; + +export const UserNotFoundAlertDetails: AlertDetails = { + title: 'Incorrect username or password', + message: "Either that user doesn't exist, or the password is incorrect", +}; + +export const UnknownErrorAlertDetails: AlertDetails = { + title: 'Unknown error', + message: 'Uhh... try again?', +};