mirror of
https://github.com/mattermost/mattermost-mobile.git
synced 2026-11-12 22:20:14 +00:00
* Expo-Router partial migration * Full migration to ExpoRouter * i18n * add tests * Merge branch 'main' into expo-router * align package-lock.json * i18n * feedback review * feedback review * android 16kb patch * Refactored emoji picker keyboard using a state machine * set android launch_screen in drawables instead of layout * no conditional hooks * remove duplicate call in test * address feedback * fix tests and address more feedback * small corrections * small corrections * small corrections * fix draft test * fix draft test 2 * remove navigateToScreen in draff test * fix nit in draft test * remove doc file * Feedback review * fix snapshots * improve test coverage * fix i18n * Upgrade t o RN 0.83, other dependencies and new architecture (#9737) * library hardware-keyboard android new arch support fix * library rnshare android new arch support fix * library rnutils android new arch support fix * library secure-pdf-viewer add new arch support * Enable new arch on iOS and Android * update emm and network client with new-arch * update intune to use new-arch * performance improvements * fix tests * fixes post input on new-arch * fix android emoji picker * remove doc * run tests in parallel * upgrade to React Native 0.83.9, Expo 55, React 19, and New Architecture Bumps core dependencies to their latest versions: - React Native 0.77.3 → 0.83.9 (New Architecture enabled) - React 18.3.1 → 19.2.5 - Expo SDK 52 → 55 - TypeScript 5.8.3 → 6.0.3 - Node.js 22.16.0 → 24.15.0 - react-native-reanimated 3.17.3 → 4.3.0 - Various other dependency upgrades Migrates iOS AppDelegate from Objective-C to Swift, updates Android build tooling and Gradle wrapper, refreshes all patches and font assets, and adapts app code, tests, and CI workflows throughout for API changes introduced by these upgrades. * remove unecessary dismissKeyboard in notifications * feedback review * update intune to use new-arch * update @mattermost deps * missing i18n string * additional fixes * update fastlane
293 lines
8.2 KiB
TypeScript
293 lines
8.2 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {defineMessages, type MessageDescriptor} from 'react-intl';
|
|
|
|
import keyMirror from '@utils/key_mirror';
|
|
|
|
import type {CompassIconName} from '@components/compass_icon';
|
|
|
|
export const SNACK_BAR_TYPE = keyMirror({
|
|
ADD_CHANNEL_MEMBERS: null,
|
|
AGENT_STOP_ERROR: null,
|
|
AGENT_REGENERATE_ERROR: null,
|
|
AGENT_TOOL_APPROVAL_ERROR: null,
|
|
AGENT_TOOL_RESULT_ERROR: null,
|
|
AGENT_FETCH_PRIVATE_ERROR: null,
|
|
CODE_COPIED: null,
|
|
FAVORITE_CHANNEL: null,
|
|
FILE_DOWNLOAD_REJECTED: null,
|
|
FOLLOW_THREAD: null,
|
|
INFO_COPIED: null,
|
|
LINK_COPIED: null,
|
|
LINK_COPY_FAILED: null,
|
|
MESSAGE_COPIED: null,
|
|
MUTE_CHANNEL: null,
|
|
PLUGIN_TOAST: null,
|
|
REMOVE_CHANNEL_USER: null,
|
|
TEXT_COPIED: null,
|
|
UNFAVORITE_CHANNEL: null,
|
|
UNMUTE_CHANNEL: null,
|
|
UNFOLLOW_THREAD: null,
|
|
CREATE_POST_ERROR: null,
|
|
CONNECTION_ERROR: null,
|
|
SCHEDULED_POST_CREATION_ERROR: null,
|
|
RESCHEDULED_POST: null,
|
|
DELETE_SCHEDULED_POST_ERROR: null,
|
|
PLAYBOOK_ERROR: null,
|
|
ENABLE_TRANSLATION: null,
|
|
BOR_POST_EXPIRED: null,
|
|
});
|
|
|
|
export const MESSAGE_TYPE = {
|
|
SUCCESS: 'success',
|
|
ERROR: 'error',
|
|
DEFAULT: 'default',
|
|
};
|
|
|
|
export type SnackBarConfig = {
|
|
message: MessageDescriptor;
|
|
iconName: CompassIconName;
|
|
hasAction: boolean;
|
|
type?: typeof MESSAGE_TYPE[keyof typeof MESSAGE_TYPE];
|
|
};
|
|
|
|
const messages = defineMessages({
|
|
ADD_CHANNEL_MEMBERS: {
|
|
id: 'snack.bar.channel.members.added',
|
|
defaultMessage: '{numMembers, number} {numMembers, plural, one {member} other {members}} added',
|
|
},
|
|
AGENT_STOP_ERROR: {
|
|
id: 'snack.bar.agent.stop.error',
|
|
defaultMessage: 'Failed to stop generation',
|
|
},
|
|
AGENT_REGENERATE_ERROR: {
|
|
id: 'snack.bar.agent.regenerate.error',
|
|
defaultMessage: 'Failed to regenerate response',
|
|
},
|
|
AGENT_TOOL_APPROVAL_ERROR: {
|
|
id: 'snack.bar.agent.tool.approval.error',
|
|
defaultMessage: 'Failed to submit tool approval',
|
|
},
|
|
AGENT_TOOL_RESULT_ERROR: {
|
|
id: 'snack.bar.agent.tool.result.error',
|
|
defaultMessage: 'Failed to submit tool result',
|
|
},
|
|
AGENT_FETCH_PRIVATE_ERROR: {
|
|
id: 'snack.bar.agent.fetch.private.error',
|
|
defaultMessage: 'Failed to fetch private data',
|
|
},
|
|
CODE_COPIED: {
|
|
id: 'snack.bar.code.copied',
|
|
defaultMessage: 'Code copied to clipboard',
|
|
},
|
|
FAVORITE_CHANNEL: {
|
|
id: 'snack.bar.favorited.channel',
|
|
defaultMessage: 'This channel was favorited',
|
|
},
|
|
FILE_DOWNLOAD_REJECTED: {
|
|
id: 'snack.bar.file.download.rejected',
|
|
defaultMessage: 'File access blocked by plugin',
|
|
},
|
|
FOLLOW_THREAD: {
|
|
id: 'snack.bar.following.thread',
|
|
defaultMessage: 'Thread followed',
|
|
},
|
|
INFO_COPIED: {
|
|
id: 'snack.bar.info.copied',
|
|
defaultMessage: 'Info copied to clipboard',
|
|
},
|
|
LINK_COPIED: {
|
|
id: 'snack.bar.link.copied',
|
|
defaultMessage: 'Link copied to clipboard',
|
|
},
|
|
LINK_COPY_FAILED: {
|
|
id: 'gallery.copy_link.failed',
|
|
defaultMessage: 'Failed to copy link to clipboard',
|
|
},
|
|
MESSAGE_COPIED: {
|
|
id: 'snack.bar.message.copied',
|
|
defaultMessage: 'Text copied to clipboard',
|
|
},
|
|
MUTE_CHANNEL: {
|
|
id: 'snack.bar.mute.channel',
|
|
defaultMessage: 'This channel was muted',
|
|
},
|
|
REMOVE_CHANNEL_USER: {
|
|
id: 'snack.bar.remove.user',
|
|
defaultMessage: '1 member was removed from the channel',
|
|
},
|
|
TEXT_COPIED: {
|
|
id: 'snack.bar.text.copied',
|
|
defaultMessage: 'Copied to clipboard',
|
|
},
|
|
UNFAVORITE_CHANNEL: {
|
|
id: 'snack.bar.unfavorite.channel',
|
|
defaultMessage: 'This channel was unfavorited',
|
|
},
|
|
UNMUTE_CHANNEL: {
|
|
id: 'snack.bar.unmute.channel',
|
|
defaultMessage: 'This channel was unmuted',
|
|
},
|
|
UNFOLLOW_THREAD: {
|
|
id: 'snack.bar.unfollow.thread',
|
|
defaultMessage: 'Thread unfollowed',
|
|
},
|
|
PLUGIN_TOAST: {
|
|
id: 'snack.bar.plugin.toast',
|
|
defaultMessage: 'Notification',
|
|
},
|
|
PLAYBOOK_ERROR: {
|
|
id: 'snack.bar.playbook.error',
|
|
defaultMessage: 'Unable to perform action. Please try again later.',
|
|
},
|
|
ENABLE_TRANSLATION: {
|
|
id: 'snack.bar.enable.translation',
|
|
defaultMessage: 'Enable auto-translation?',
|
|
},
|
|
BOR_POST_EXPIRED: {
|
|
id: 'snack.bar.bor_post_expired.error',
|
|
defaultMessage: 'This burn-on-read post has expired and can no longer be revealed.',
|
|
},
|
|
});
|
|
|
|
export const SNACK_BAR_CONFIG: Record<string, SnackBarConfig> = {
|
|
ADD_CHANNEL_MEMBERS: {
|
|
message: messages.ADD_CHANNEL_MEMBERS,
|
|
iconName: 'check',
|
|
hasAction: false,
|
|
},
|
|
AGENT_STOP_ERROR: {
|
|
message: messages.AGENT_STOP_ERROR,
|
|
iconName: 'alert-outline',
|
|
hasAction: false,
|
|
type: MESSAGE_TYPE.ERROR,
|
|
},
|
|
AGENT_REGENERATE_ERROR: {
|
|
message: messages.AGENT_REGENERATE_ERROR,
|
|
iconName: 'alert-outline',
|
|
hasAction: false,
|
|
type: MESSAGE_TYPE.ERROR,
|
|
},
|
|
AGENT_TOOL_APPROVAL_ERROR: {
|
|
message: messages.AGENT_TOOL_APPROVAL_ERROR,
|
|
iconName: 'alert-outline',
|
|
hasAction: false,
|
|
type: MESSAGE_TYPE.ERROR,
|
|
},
|
|
AGENT_TOOL_RESULT_ERROR: {
|
|
message: messages.AGENT_TOOL_RESULT_ERROR,
|
|
iconName: 'alert-outline',
|
|
hasAction: false,
|
|
type: MESSAGE_TYPE.ERROR,
|
|
},
|
|
AGENT_FETCH_PRIVATE_ERROR: {
|
|
message: messages.AGENT_FETCH_PRIVATE_ERROR,
|
|
iconName: 'alert-outline',
|
|
hasAction: false,
|
|
type: MESSAGE_TYPE.ERROR,
|
|
},
|
|
CODE_COPIED: {
|
|
message: messages.CODE_COPIED,
|
|
iconName: 'content-copy',
|
|
hasAction: false,
|
|
},
|
|
FAVORITE_CHANNEL: {
|
|
message: messages.FAVORITE_CHANNEL,
|
|
iconName: 'star',
|
|
hasAction: true,
|
|
},
|
|
FILE_DOWNLOAD_REJECTED: {
|
|
message: messages.FILE_DOWNLOAD_REJECTED,
|
|
iconName: 'alert-circle-outline',
|
|
hasAction: false,
|
|
type: MESSAGE_TYPE.ERROR,
|
|
},
|
|
FOLLOW_THREAD: {
|
|
message: messages.FOLLOW_THREAD,
|
|
iconName: 'check',
|
|
hasAction: true,
|
|
},
|
|
INFO_COPIED: {
|
|
message: messages.INFO_COPIED,
|
|
iconName: 'content-copy',
|
|
hasAction: false,
|
|
},
|
|
LINK_COPIED: {
|
|
message: messages.LINK_COPIED,
|
|
iconName: 'link-variant',
|
|
hasAction: false,
|
|
type: MESSAGE_TYPE.SUCCESS,
|
|
},
|
|
LINK_COPY_FAILED: {
|
|
message: messages.LINK_COPY_FAILED,
|
|
iconName: 'link-variant',
|
|
hasAction: false,
|
|
type: MESSAGE_TYPE.ERROR,
|
|
},
|
|
MESSAGE_COPIED: {
|
|
message: messages.MESSAGE_COPIED,
|
|
iconName: 'content-copy',
|
|
hasAction: false,
|
|
},
|
|
MUTE_CHANNEL: {
|
|
message: messages.MUTE_CHANNEL,
|
|
iconName: 'bell-off-outline',
|
|
hasAction: true,
|
|
},
|
|
REMOVE_CHANNEL_USER: {
|
|
message: messages.REMOVE_CHANNEL_USER,
|
|
iconName: 'check',
|
|
hasAction: true,
|
|
},
|
|
TEXT_COPIED: {
|
|
message: messages.TEXT_COPIED,
|
|
iconName: 'content-copy',
|
|
hasAction: false,
|
|
type: MESSAGE_TYPE.SUCCESS,
|
|
},
|
|
UNFAVORITE_CHANNEL: {
|
|
message: messages.UNFAVORITE_CHANNEL,
|
|
iconName: 'star-outline',
|
|
hasAction: true,
|
|
},
|
|
UNMUTE_CHANNEL: {
|
|
message: messages.UNMUTE_CHANNEL,
|
|
iconName: 'bell-outline',
|
|
hasAction: true,
|
|
},
|
|
UNFOLLOW_THREAD: {
|
|
message: messages.UNFOLLOW_THREAD,
|
|
iconName: 'check',
|
|
hasAction: true,
|
|
},
|
|
PLUGIN_TOAST: {
|
|
message: messages.PLUGIN_TOAST,
|
|
iconName: 'information-outline',
|
|
hasAction: false,
|
|
type: MESSAGE_TYPE.DEFAULT,
|
|
},
|
|
PLAYBOOK_ERROR: {
|
|
message: messages.PLAYBOOK_ERROR,
|
|
iconName: 'alert-outline',
|
|
hasAction: false,
|
|
type: MESSAGE_TYPE.ERROR,
|
|
},
|
|
ENABLE_TRANSLATION: {
|
|
message: messages.ENABLE_TRANSLATION,
|
|
iconName: 'globe',
|
|
hasAction: true,
|
|
},
|
|
BOR_POST_EXPIRED: {
|
|
message: messages.BOR_POST_EXPIRED,
|
|
iconName: 'alert-outline',
|
|
hasAction: false,
|
|
type: MESSAGE_TYPE.ERROR,
|
|
},
|
|
};
|
|
|
|
export default {
|
|
SNACK_BAR_TYPE,
|
|
SNACK_BAR_CONFIG,
|
|
};
|