stream-chat-react-native-core 9.2.0-beta.2 → 9.2.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerContent.js +2 -2
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerContent.js.map +1 -1
- package/lib/commonjs/components/Channel/Channel.js +10 -1
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useMessageListPagination.js +26 -3
- package/lib/commonjs/components/Channel/hooks/useMessageListPagination.js.map +1 -1
- package/lib/commonjs/components/ChannelList/ChannelList.js +29 -4
- package/lib/commonjs/components/ChannelList/ChannelList.js.map +1 -1
- package/lib/commonjs/components/ChannelList/hooks/useChannelActions.js +314 -11
- package/lib/commonjs/components/ChannelList/hooks/useChannelActions.js.map +1 -1
- package/lib/commonjs/components/Message/hooks/useMessageActionHandlers.js +202 -15
- package/lib/commonjs/components/Message/hooks/useMessageActionHandlers.js.map +1 -1
- package/lib/commonjs/components/MessageInput/MessageComposer.js +1 -1
- package/lib/commonjs/components/MessageInput/MessageComposerLeadingView.js +1 -1
- package/lib/commonjs/components/MessageInput/MessageComposerLeadingView.js.map +1 -1
- package/lib/commonjs/components/MessageInput/MessageInputHeaderView.js +1 -1
- package/lib/commonjs/components/MessageInput/MessageInputHeaderView.js.map +1 -1
- package/lib/commonjs/components/MessageInput/MessageInputTrailingView.js +1 -1
- package/lib/commonjs/components/MessageInput/MessageInputTrailingView.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/AttachmentPreview/AttachmentUploadPreviewList.js +7 -13
- package/lib/commonjs/components/MessageInput/components/AttachmentPreview/AttachmentUploadPreviewList.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecorder.js +27 -6
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecorder.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js +29 -9
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/OutputButtons/index.js +1 -1
- package/lib/commonjs/components/MessageList/MessageFlashList.js +5 -2
- package/lib/commonjs/components/MessageList/MessageFlashList.js.map +1 -1
- package/lib/commonjs/components/MessageList/MessageList.js +5 -2
- package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
- package/lib/commonjs/components/MessageMenu/hooks/useFetchReactions.js +23 -2
- package/lib/commonjs/components/MessageMenu/hooks/useFetchReactions.js.map +1 -1
- package/lib/commonjs/components/Notifications/Notification.js +232 -0
- package/lib/commonjs/components/Notifications/Notification.js.map +1 -0
- package/lib/commonjs/components/Notifications/NotificationList.js +120 -0
- package/lib/commonjs/components/Notifications/NotificationList.js.map +1 -0
- package/lib/commonjs/components/Notifications/NotificationTargetContext.js +45 -0
- package/lib/commonjs/components/Notifications/NotificationTargetContext.js.map +1 -0
- package/lib/commonjs/components/Notifications/hooks/index.js +59 -0
- package/lib/commonjs/components/Notifications/hooks/index.js.map +1 -0
- package/lib/commonjs/components/Notifications/hooks/useNotificationApi.js +133 -0
- package/lib/commonjs/components/Notifications/hooks/useNotificationApi.js.map +1 -0
- package/lib/commonjs/components/Notifications/hooks/useNotificationListController.js +133 -0
- package/lib/commonjs/components/Notifications/hooks/useNotificationListController.js.map +1 -0
- package/lib/commonjs/components/Notifications/hooks/useNotificationTarget.js +26 -0
- package/lib/commonjs/components/Notifications/hooks/useNotificationTarget.js.map +1 -0
- package/lib/commonjs/components/Notifications/hooks/useNotifications.js +26 -0
- package/lib/commonjs/components/Notifications/hooks/useNotifications.js.map +1 -0
- package/lib/commonjs/components/Notifications/hooks/useSystemNotifications.js +22 -0
- package/lib/commonjs/components/Notifications/hooks/useSystemNotifications.js.map +1 -0
- package/lib/commonjs/components/Notifications/index.js +59 -0
- package/lib/commonjs/components/Notifications/index.js.map +1 -0
- package/lib/commonjs/components/Notifications/notificationTarget.js +220 -0
- package/lib/commonjs/components/Notifications/notificationTarget.js.map +1 -0
- package/lib/commonjs/components/Notifications/notificationTranslations.js +137 -0
- package/lib/commonjs/components/Notifications/notificationTranslations.js.map +1 -0
- package/lib/commonjs/components/Poll/components/PollOption.js +14 -9
- package/lib/commonjs/components/Poll/components/PollOption.js.map +1 -1
- package/lib/commonjs/components/Poll/hooks/usePollState.js +35 -3
- package/lib/commonjs/components/Poll/hooks/usePollState.js.map +1 -1
- package/lib/commonjs/components/Thread/Thread.js +19 -11
- package/lib/commonjs/components/Thread/Thread.js.map +1 -1
- package/lib/commonjs/components/ThreadList/ThreadList.js +30 -9
- package/lib/commonjs/components/ThreadList/ThreadList.js.map +1 -1
- package/lib/commonjs/components/index.js +11 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/contexts/componentsContext/defaultComponents.js +4 -0
- package/lib/commonjs/contexts/componentsContext/defaultComponents.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +37 -0
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js +13 -0
- package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/commonjs/hooks/index.js +11 -0
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/useAudioPlayer.js +34 -1
- package/lib/commonjs/hooks/useAudioPlayer.js.map +1 -1
- package/lib/commonjs/hooks/useInAppNotificationsState.js.map +1 -1
- package/lib/commonjs/hooks/useLazyRef.js +13 -0
- package/lib/commonjs/hooks/useLazyRef.js.map +1 -0
- package/lib/commonjs/i18n/en.json +60 -1
- package/lib/commonjs/i18n/es.json +62 -3
- package/lib/commonjs/i18n/fr.json +60 -1
- package/lib/commonjs/i18n/he.json +60 -1
- package/lib/commonjs/i18n/hi.json +60 -1
- package/lib/commonjs/i18n/it.json +60 -1
- package/lib/commonjs/i18n/ja.json +60 -1
- package/lib/commonjs/i18n/ko.json +60 -1
- package/lib/commonjs/i18n/nl.json +60 -1
- package/lib/commonjs/i18n/pt-br.json +60 -1
- package/lib/commonjs/i18n/ru.json +60 -1
- package/lib/commonjs/i18n/tr.json +60 -1
- package/lib/commonjs/state-store/audio-player-pool.js +1 -0
- package/lib/commonjs/state-store/audio-player-pool.js.map +1 -1
- package/lib/commonjs/state-store/audio-player.js +92 -13
- package/lib/commonjs/state-store/audio-player.js.map +1 -1
- package/lib/commonjs/theme/generated/dark/StreamTokens.android.js +16 -16
- package/lib/commonjs/theme/generated/dark/StreamTokens.android.js.map +1 -1
- package/lib/commonjs/theme/generated/dark/StreamTokens.ios.js +8 -8
- package/lib/commonjs/theme/generated/dark/StreamTokens.ios.js.map +1 -1
- package/lib/commonjs/theme/generated/dark/StreamTokens.web.js +8 -8
- package/lib/commonjs/theme/generated/dark/StreamTokens.web.js.map +1 -1
- package/lib/commonjs/theme/generated/light/StreamTokens.android.js +16 -16
- package/lib/commonjs/theme/generated/light/StreamTokens.android.js.map +1 -1
- package/lib/commonjs/theme/generated/light/StreamTokens.ios.js +8 -8
- package/lib/commonjs/theme/generated/light/StreamTokens.ios.js.map +1 -1
- package/lib/commonjs/theme/generated/light/StreamTokens.web.js +8 -8
- package/lib/commonjs/theme/generated/light/StreamTokens.web.js.map +1 -1
- package/lib/commonjs/utils/animations/createBoundedZoomTransition.js +151 -0
- package/lib/commonjs/utils/animations/createBoundedZoomTransition.js.map +1 -0
- package/lib/commonjs/utils/{transitions.js → animations/transitions.js} +6 -0
- package/lib/commonjs/utils/animations/transitions.js.map +1 -0
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerContent.js +2 -2
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerContent.js.map +1 -1
- package/lib/module/components/Channel/Channel.js +10 -1
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/hooks/useMessageListPagination.js +26 -3
- package/lib/module/components/Channel/hooks/useMessageListPagination.js.map +1 -1
- package/lib/module/components/ChannelList/ChannelList.js +29 -4
- package/lib/module/components/ChannelList/ChannelList.js.map +1 -1
- package/lib/module/components/ChannelList/hooks/useChannelActions.js +314 -11
- package/lib/module/components/ChannelList/hooks/useChannelActions.js.map +1 -1
- package/lib/module/components/Message/hooks/useMessageActionHandlers.js +202 -15
- package/lib/module/components/Message/hooks/useMessageActionHandlers.js.map +1 -1
- package/lib/module/components/MessageInput/MessageComposer.js +1 -1
- package/lib/module/components/MessageInput/MessageComposerLeadingView.js +1 -1
- package/lib/module/components/MessageInput/MessageComposerLeadingView.js.map +1 -1
- package/lib/module/components/MessageInput/MessageInputHeaderView.js +1 -1
- package/lib/module/components/MessageInput/MessageInputHeaderView.js.map +1 -1
- package/lib/module/components/MessageInput/MessageInputTrailingView.js +1 -1
- package/lib/module/components/MessageInput/MessageInputTrailingView.js.map +1 -1
- package/lib/module/components/MessageInput/components/AttachmentPreview/AttachmentUploadPreviewList.js +7 -13
- package/lib/module/components/MessageInput/components/AttachmentPreview/AttachmentUploadPreviewList.js.map +1 -1
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecorder.js +27 -6
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecorder.js.map +1 -1
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js +29 -9
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js.map +1 -1
- package/lib/module/components/MessageInput/components/OutputButtons/index.js +1 -1
- package/lib/module/components/MessageList/MessageFlashList.js +5 -2
- package/lib/module/components/MessageList/MessageFlashList.js.map +1 -1
- package/lib/module/components/MessageList/MessageList.js +5 -2
- package/lib/module/components/MessageList/MessageList.js.map +1 -1
- package/lib/module/components/MessageMenu/hooks/useFetchReactions.js +23 -2
- package/lib/module/components/MessageMenu/hooks/useFetchReactions.js.map +1 -1
- package/lib/module/components/Notifications/Notification.js +232 -0
- package/lib/module/components/Notifications/Notification.js.map +1 -0
- package/lib/module/components/Notifications/NotificationList.js +120 -0
- package/lib/module/components/Notifications/NotificationList.js.map +1 -0
- package/lib/module/components/Notifications/NotificationTargetContext.js +45 -0
- package/lib/module/components/Notifications/NotificationTargetContext.js.map +1 -0
- package/lib/module/components/Notifications/hooks/index.js +59 -0
- package/lib/module/components/Notifications/hooks/index.js.map +1 -0
- package/lib/module/components/Notifications/hooks/useNotificationApi.js +133 -0
- package/lib/module/components/Notifications/hooks/useNotificationApi.js.map +1 -0
- package/lib/module/components/Notifications/hooks/useNotificationListController.js +133 -0
- package/lib/module/components/Notifications/hooks/useNotificationListController.js.map +1 -0
- package/lib/module/components/Notifications/hooks/useNotificationTarget.js +26 -0
- package/lib/module/components/Notifications/hooks/useNotificationTarget.js.map +1 -0
- package/lib/module/components/Notifications/hooks/useNotifications.js +26 -0
- package/lib/module/components/Notifications/hooks/useNotifications.js.map +1 -0
- package/lib/module/components/Notifications/hooks/useSystemNotifications.js +22 -0
- package/lib/module/components/Notifications/hooks/useSystemNotifications.js.map +1 -0
- package/lib/module/components/Notifications/index.js +59 -0
- package/lib/module/components/Notifications/index.js.map +1 -0
- package/lib/module/components/Notifications/notificationTarget.js +220 -0
- package/lib/module/components/Notifications/notificationTarget.js.map +1 -0
- package/lib/module/components/Notifications/notificationTranslations.js +137 -0
- package/lib/module/components/Notifications/notificationTranslations.js.map +1 -0
- package/lib/module/components/Poll/components/PollOption.js +14 -9
- package/lib/module/components/Poll/components/PollOption.js.map +1 -1
- package/lib/module/components/Poll/hooks/usePollState.js +35 -3
- package/lib/module/components/Poll/hooks/usePollState.js.map +1 -1
- package/lib/module/components/Thread/Thread.js +19 -11
- package/lib/module/components/Thread/Thread.js.map +1 -1
- package/lib/module/components/ThreadList/ThreadList.js +30 -9
- package/lib/module/components/ThreadList/ThreadList.js.map +1 -1
- package/lib/module/components/index.js +11 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/contexts/componentsContext/defaultComponents.js +4 -0
- package/lib/module/contexts/componentsContext/defaultComponents.js.map +1 -1
- package/lib/module/contexts/messageInputContext/MessageInputContext.js +37 -0
- package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/module/contexts/themeContext/utils/theme.js +13 -0
- package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/module/hooks/index.js +11 -0
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useAudioPlayer.js +34 -1
- package/lib/module/hooks/useAudioPlayer.js.map +1 -1
- package/lib/module/hooks/useInAppNotificationsState.js.map +1 -1
- package/lib/module/hooks/useLazyRef.js +13 -0
- package/lib/module/hooks/useLazyRef.js.map +1 -0
- package/lib/module/i18n/en.json +60 -1
- package/lib/module/i18n/es.json +62 -3
- package/lib/module/i18n/fr.json +60 -1
- package/lib/module/i18n/he.json +60 -1
- package/lib/module/i18n/hi.json +60 -1
- package/lib/module/i18n/it.json +60 -1
- package/lib/module/i18n/ja.json +60 -1
- package/lib/module/i18n/ko.json +60 -1
- package/lib/module/i18n/nl.json +60 -1
- package/lib/module/i18n/pt-br.json +60 -1
- package/lib/module/i18n/ru.json +60 -1
- package/lib/module/i18n/tr.json +60 -1
- package/lib/module/state-store/audio-player-pool.js +1 -0
- package/lib/module/state-store/audio-player-pool.js.map +1 -1
- package/lib/module/state-store/audio-player.js +92 -13
- package/lib/module/state-store/audio-player.js.map +1 -1
- package/lib/module/theme/generated/dark/StreamTokens.android.js +16 -16
- package/lib/module/theme/generated/dark/StreamTokens.android.js.map +1 -1
- package/lib/module/theme/generated/dark/StreamTokens.ios.js +8 -8
- package/lib/module/theme/generated/dark/StreamTokens.ios.js.map +1 -1
- package/lib/module/theme/generated/dark/StreamTokens.web.js +8 -8
- package/lib/module/theme/generated/dark/StreamTokens.web.js.map +1 -1
- package/lib/module/theme/generated/light/StreamTokens.android.js +16 -16
- package/lib/module/theme/generated/light/StreamTokens.android.js.map +1 -1
- package/lib/module/theme/generated/light/StreamTokens.ios.js +8 -8
- package/lib/module/theme/generated/light/StreamTokens.ios.js.map +1 -1
- package/lib/module/theme/generated/light/StreamTokens.web.js +8 -8
- package/lib/module/theme/generated/light/StreamTokens.web.js.map +1 -1
- package/lib/module/utils/animations/createBoundedZoomTransition.js +151 -0
- package/lib/module/utils/animations/createBoundedZoomTransition.js.map +1 -0
- package/lib/module/utils/{transitions.js → animations/transitions.js} +6 -0
- package/lib/module/utils/animations/transitions.js.map +1 -0
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerContent.d.ts.map +1 -1
- package/lib/typescript/components/Channel/Channel.d.ts +1 -0
- package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
- package/lib/typescript/components/Channel/hooks/useMessageListPagination.d.ts.map +1 -1
- package/lib/typescript/components/ChannelList/ChannelList.d.ts +1 -0
- package/lib/typescript/components/ChannelList/ChannelList.d.ts.map +1 -1
- package/lib/typescript/components/ChannelList/hooks/useChannelActions.d.ts.map +1 -1
- package/lib/typescript/components/Message/hooks/useMessageActionHandlers.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/components/AttachmentPreview/AttachmentUploadPreviewList.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecorder.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingButton.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/MessageFlashList.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/MessageList.d.ts.map +1 -1
- package/lib/typescript/components/MessageMenu/hooks/useFetchReactions.d.ts.map +1 -1
- package/lib/typescript/components/Notifications/Notification.d.ts +31 -0
- package/lib/typescript/components/Notifications/Notification.d.ts.map +1 -0
- package/lib/typescript/components/Notifications/NotificationList.d.ts +28 -0
- package/lib/typescript/components/Notifications/NotificationList.d.ts.map +1 -0
- package/lib/typescript/components/Notifications/NotificationTargetContext.d.ts +14 -0
- package/lib/typescript/components/Notifications/NotificationTargetContext.d.ts.map +1 -0
- package/lib/typescript/components/Notifications/hooks/index.d.ts +6 -0
- package/lib/typescript/components/Notifications/hooks/index.d.ts.map +1 -0
- package/lib/typescript/components/Notifications/hooks/useNotificationApi.d.ts +48 -0
- package/lib/typescript/components/Notifications/hooks/useNotificationApi.d.ts.map +1 -0
- package/lib/typescript/components/Notifications/hooks/useNotificationListController.d.ts +14 -0
- package/lib/typescript/components/Notifications/hooks/useNotificationListController.d.ts.map +1 -0
- package/lib/typescript/components/Notifications/hooks/useNotificationTarget.d.ts +3 -0
- package/lib/typescript/components/Notifications/hooks/useNotificationTarget.d.ts.map +1 -0
- package/lib/typescript/components/Notifications/hooks/useNotifications.d.ts +14 -0
- package/lib/typescript/components/Notifications/hooks/useNotifications.d.ts.map +1 -0
- package/lib/typescript/components/Notifications/hooks/useSystemNotifications.d.ts +9 -0
- package/lib/typescript/components/Notifications/hooks/useSystemNotifications.d.ts.map +1 -0
- package/lib/typescript/components/Notifications/index.d.ts +6 -0
- package/lib/typescript/components/Notifications/index.d.ts.map +1 -0
- package/lib/typescript/components/Notifications/notificationTarget.d.ts +55 -0
- package/lib/typescript/components/Notifications/notificationTarget.d.ts.map +1 -0
- package/lib/typescript/components/Notifications/notificationTranslations.d.ts +7 -0
- package/lib/typescript/components/Notifications/notificationTranslations.d.ts.map +1 -0
- package/lib/typescript/components/Poll/components/PollOption.d.ts.map +1 -1
- package/lib/typescript/components/Poll/hooks/usePollState.d.ts.map +1 -1
- package/lib/typescript/components/Thread/Thread.d.ts +1 -0
- package/lib/typescript/components/Thread/Thread.d.ts.map +1 -1
- package/lib/typescript/components/ThreadList/ThreadList.d.ts +3 -1
- package/lib/typescript/components/ThreadList/ThreadList.d.ts.map +1 -1
- package/lib/typescript/components/index.d.ts +1 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/contexts/componentsContext/defaultComponents.d.ts +3 -0
- package/lib/typescript/contexts/componentsContext/defaultComponents.d.ts.map +1 -1
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts.map +1 -1
- package/lib/typescript/contexts/themeContext/ThemeContext.d.ts +13 -0
- package/lib/typescript/contexts/themeContext/ThemeContext.d.ts.map +1 -1
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts +13 -0
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts.map +1 -1
- package/lib/typescript/hooks/index.d.ts +1 -0
- package/lib/typescript/hooks/index.d.ts.map +1 -1
- package/lib/typescript/hooks/useAudioPlayer.d.ts.map +1 -1
- package/lib/typescript/hooks/useInAppNotificationsState.d.ts +6 -0
- package/lib/typescript/hooks/useInAppNotificationsState.d.ts.map +1 -1
- package/lib/typescript/hooks/useLazyRef.d.ts +7 -0
- package/lib/typescript/hooks/useLazyRef.d.ts.map +1 -0
- package/lib/typescript/i18n/en.json +60 -1
- package/lib/typescript/i18n/es.json +62 -3
- package/lib/typescript/i18n/fr.json +60 -1
- package/lib/typescript/i18n/he.json +60 -1
- package/lib/typescript/i18n/hi.json +60 -1
- package/lib/typescript/i18n/it.json +60 -1
- package/lib/typescript/i18n/ja.json +60 -1
- package/lib/typescript/i18n/ko.json +60 -1
- package/lib/typescript/i18n/nl.json +60 -1
- package/lib/typescript/i18n/pt-br.json +60 -1
- package/lib/typescript/i18n/ru.json +60 -1
- package/lib/typescript/i18n/tr.json +60 -1
- package/lib/typescript/state-store/audio-player-pool.d.ts.map +1 -1
- package/lib/typescript/state-store/audio-player.d.ts +13 -0
- package/lib/typescript/state-store/audio-player.d.ts.map +1 -1
- package/lib/typescript/utils/animations/createBoundedZoomTransition.d.ts +21 -0
- package/lib/typescript/utils/animations/createBoundedZoomTransition.d.ts.map +1 -0
- package/lib/typescript/utils/animations/transitions.d.ts +21 -0
- package/lib/typescript/utils/animations/transitions.d.ts.map +1 -0
- package/lib/typescript/utils/i18n/Streami18n.d.ts +59 -0
- package/lib/typescript/utils/i18n/Streami18n.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/AttachmentPicker/components/AttachmentPickerContent.tsx +3 -3
- package/src/components/AttachmentPicker/components/__tests__/AttachmentPickerContent.test.tsx +19 -18
- package/src/components/Channel/Channel.tsx +15 -1
- package/src/components/Channel/__tests__/useMessageListPagination.test.tsx +34 -2
- package/src/components/Channel/hooks/useMessageListPagination.tsx +19 -3
- package/src/components/ChannelList/ChannelList.tsx +27 -5
- package/src/components/ChannelList/hooks/__tests__/useChannelActions.test.tsx +123 -0
- package/src/components/ChannelList/hooks/useChannelActions.ts +181 -12
- package/src/components/Message/hooks/__tests__/useMessageActionHandlers.test.tsx +131 -0
- package/src/components/Message/hooks/useMessageActionHandlers.ts +133 -23
- package/src/components/MessageInput/MessageComposer.tsx +1 -1
- package/src/components/MessageInput/MessageComposerLeadingView.tsx +1 -1
- package/src/components/MessageInput/MessageInputHeaderView.tsx +1 -1
- package/src/components/MessageInput/MessageInputTrailingView.tsx +1 -1
- package/src/components/MessageInput/components/AttachmentPreview/AttachmentUploadPreviewList.tsx +1 -10
- package/src/components/MessageInput/components/AudioRecorder/AudioRecorder.tsx +10 -2
- package/src/components/MessageInput/components/AudioRecorder/AudioRecordingButton.tsx +27 -13
- package/src/components/MessageInput/components/OutputButtons/index.tsx +1 -1
- package/src/components/MessageList/MessageFlashList.tsx +3 -1
- package/src/components/MessageList/MessageList.tsx +3 -1
- package/src/components/MessageList/__tests__/MessageList.test.tsx +35 -0
- package/src/components/MessageList/__tests__/__snapshots__/ScrollToBottomButton.test.tsx.snap +1 -1
- package/src/components/MessageMenu/hooks/useFetchReactions.ts +17 -2
- package/src/components/Notifications/Notification.tsx +254 -0
- package/src/components/Notifications/NotificationList.tsx +160 -0
- package/src/components/Notifications/NotificationTargetContext.tsx +45 -0
- package/src/components/Notifications/__tests__/NotificationList.test.tsx +480 -0
- package/src/components/Notifications/__tests__/notificationTarget.test.ts +157 -0
- package/src/components/Notifications/hooks/__tests__/useNotificationApi.test.tsx +172 -0
- package/src/components/Notifications/hooks/__tests__/useNotificationTarget.test.tsx +85 -0
- package/src/components/Notifications/hooks/index.ts +5 -0
- package/src/components/Notifications/hooks/useNotificationApi.ts +248 -0
- package/src/components/Notifications/hooks/useNotificationListController.ts +160 -0
- package/src/components/Notifications/hooks/useNotificationTarget.ts +37 -0
- package/src/components/Notifications/hooks/useNotifications.ts +43 -0
- package/src/components/Notifications/hooks/useSystemNotifications.ts +33 -0
- package/src/components/Notifications/index.ts +5 -0
- package/src/components/Notifications/notificationTarget.ts +305 -0
- package/src/components/Notifications/notificationTranslations.ts +142 -0
- package/src/components/Poll/components/PollOption.tsx +10 -6
- package/src/components/Poll/hooks/usePollState.ts +26 -2
- package/src/components/Thread/Thread.tsx +24 -16
- package/src/components/ThreadList/ThreadList.tsx +33 -9
- package/src/components/index.ts +2 -0
- package/src/contexts/componentsContext/defaultComponents.ts +4 -0
- package/src/contexts/messageInputContext/MessageInputContext.tsx +36 -0
- package/src/contexts/themeContext/utils/theme.ts +26 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useAudioPlayer.ts +44 -3
- package/src/hooks/useInAppNotificationsState.ts +6 -0
- package/src/hooks/useLazyRef.ts +15 -0
- package/src/i18n/en.json +60 -1
- package/src/i18n/es.json +62 -3
- package/src/i18n/fr.json +60 -1
- package/src/i18n/he.json +60 -1
- package/src/i18n/hi.json +60 -1
- package/src/i18n/it.json +60 -1
- package/src/i18n/ja.json +60 -1
- package/src/i18n/ko.json +60 -1
- package/src/i18n/nl.json +60 -1
- package/src/i18n/pt-br.json +60 -1
- package/src/i18n/ru.json +60 -1
- package/src/i18n/tr.json +60 -1
- package/src/state-store/__tests__/audio-player.test.ts +45 -0
- package/src/state-store/audio-player-pool.ts +1 -0
- package/src/state-store/audio-player.ts +108 -16
- package/src/theme/generated/dark/StreamTokens.android.ts +16 -16
- package/src/theme/generated/dark/StreamTokens.ios.ts +8 -8
- package/src/theme/generated/dark/StreamTokens.web.ts +8 -8
- package/src/theme/generated/light/StreamTokens.android.ts +16 -16
- package/src/theme/generated/light/StreamTokens.ios.ts +8 -8
- package/src/theme/generated/light/StreamTokens.web.ts +8 -8
- package/src/utils/animations/createBoundedZoomTransition.ts +117 -0
- package/src/utils/{transitions.ts → animations/transitions.ts} +6 -0
- package/src/version.json +1 -1
- package/lib/commonjs/utils/transitions.js.map +0 -1
- package/lib/module/utils/transitions.js.map +0 -1
- package/lib/typescript/utils/transitions.d.ts +0 -9
- package/lib/typescript/utils/transitions.d.ts.map +0 -1
|
@@ -2,8 +2,9 @@ import { useMemo } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { Channel } from 'stream-chat';
|
|
4
4
|
|
|
5
|
-
import { useChatContext } from '../../../contexts';
|
|
5
|
+
import { useChatContext, useTranslationContext } from '../../../contexts';
|
|
6
6
|
import { useStableCallback } from '../../../hooks';
|
|
7
|
+
import { useNotificationApi } from '../../Notifications';
|
|
7
8
|
|
|
8
9
|
export type ChannelActions = {
|
|
9
10
|
archive: () => Promise<void>;
|
|
@@ -27,8 +28,25 @@ export const getOtherUserInDirectChannel = (channel: Channel) => {
|
|
|
27
28
|
: undefined;
|
|
28
29
|
};
|
|
29
30
|
|
|
31
|
+
const getNotificationError = (error: unknown): Error | undefined => {
|
|
32
|
+
if (error instanceof Error) return error;
|
|
33
|
+
if (typeof error === 'string') return new Error(error);
|
|
34
|
+
if (error && typeof error === 'object' && 'message' in error) {
|
|
35
|
+
const message = error.message;
|
|
36
|
+
if (typeof message === 'string') return new Error(message);
|
|
37
|
+
}
|
|
38
|
+
return undefined;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const getNotificationErrorOptions = (error: unknown) => {
|
|
42
|
+
const originalError = getNotificationError(error);
|
|
43
|
+
return originalError ? { originalError } : {};
|
|
44
|
+
};
|
|
45
|
+
|
|
30
46
|
export const useChannelActions = (channel: Channel) => {
|
|
31
47
|
const { client } = useChatContext();
|
|
48
|
+
const { addNotification } = useNotificationApi();
|
|
49
|
+
const { t } = useTranslationContext();
|
|
32
50
|
const ownUserId = client.userID;
|
|
33
51
|
|
|
34
52
|
const pin = useStableCallback(async () => {
|
|
@@ -37,8 +55,21 @@ export const useChannelActions = (channel: Channel) => {
|
|
|
37
55
|
return;
|
|
38
56
|
}
|
|
39
57
|
await channel.pin();
|
|
58
|
+
addNotification({
|
|
59
|
+
message: t('Channel pinned'),
|
|
60
|
+
options: { severity: 'success', type: 'api:channel:pin:success' },
|
|
61
|
+
origin: { context: { channel }, emitter: 'ChannelActions' },
|
|
62
|
+
});
|
|
40
63
|
} catch (error) {
|
|
41
|
-
|
|
64
|
+
addNotification({
|
|
65
|
+
message: t('Failed to update channel pinned status'),
|
|
66
|
+
options: {
|
|
67
|
+
...getNotificationErrorOptions(error),
|
|
68
|
+
severity: 'error',
|
|
69
|
+
type: 'api:channel:pin:failed',
|
|
70
|
+
},
|
|
71
|
+
origin: { context: { channel }, emitter: 'ChannelActions' },
|
|
72
|
+
});
|
|
42
73
|
}
|
|
43
74
|
});
|
|
44
75
|
|
|
@@ -48,8 +79,21 @@ export const useChannelActions = (channel: Channel) => {
|
|
|
48
79
|
return;
|
|
49
80
|
}
|
|
50
81
|
await channel.unpin();
|
|
82
|
+
addNotification({
|
|
83
|
+
message: t('Channel unpinned'),
|
|
84
|
+
options: { severity: 'success', type: 'api:channel:unpin:success' },
|
|
85
|
+
origin: { context: { channel }, emitter: 'ChannelActions' },
|
|
86
|
+
});
|
|
51
87
|
} catch (error) {
|
|
52
|
-
|
|
88
|
+
addNotification({
|
|
89
|
+
message: t('Failed to update channel pinned status'),
|
|
90
|
+
options: {
|
|
91
|
+
...getNotificationErrorOptions(error),
|
|
92
|
+
severity: 'error',
|
|
93
|
+
type: 'api:channel:pin:failed',
|
|
94
|
+
},
|
|
95
|
+
origin: { context: { channel }, emitter: 'ChannelActions' },
|
|
96
|
+
});
|
|
53
97
|
}
|
|
54
98
|
});
|
|
55
99
|
|
|
@@ -59,8 +103,21 @@ export const useChannelActions = (channel: Channel) => {
|
|
|
59
103
|
return;
|
|
60
104
|
}
|
|
61
105
|
await channel.archive();
|
|
106
|
+
addNotification({
|
|
107
|
+
message: t('Channel archived'),
|
|
108
|
+
options: { severity: 'success', type: 'api:channel:archive:success' },
|
|
109
|
+
origin: { context: { channel }, emitter: 'ChannelActions' },
|
|
110
|
+
});
|
|
62
111
|
} catch (error) {
|
|
63
|
-
|
|
112
|
+
addNotification({
|
|
113
|
+
message: t('Failed to update channel archive status'),
|
|
114
|
+
options: {
|
|
115
|
+
...getNotificationErrorOptions(error),
|
|
116
|
+
severity: 'error',
|
|
117
|
+
type: 'api:channel:archive:failed',
|
|
118
|
+
},
|
|
119
|
+
origin: { context: { channel }, emitter: 'ChannelActions' },
|
|
120
|
+
});
|
|
64
121
|
}
|
|
65
122
|
});
|
|
66
123
|
|
|
@@ -70,8 +127,21 @@ export const useChannelActions = (channel: Channel) => {
|
|
|
70
127
|
return;
|
|
71
128
|
}
|
|
72
129
|
await channel.unarchive();
|
|
130
|
+
addNotification({
|
|
131
|
+
message: t('Channel unarchived'),
|
|
132
|
+
options: { severity: 'success', type: 'api:channel:unarchive:success' },
|
|
133
|
+
origin: { context: { channel }, emitter: 'ChannelActions' },
|
|
134
|
+
});
|
|
73
135
|
} catch (error) {
|
|
74
|
-
|
|
136
|
+
addNotification({
|
|
137
|
+
message: t('Failed to update channel archive status'),
|
|
138
|
+
options: {
|
|
139
|
+
...getNotificationErrorOptions(error),
|
|
140
|
+
severity: 'error',
|
|
141
|
+
type: 'api:channel:archive:failed',
|
|
142
|
+
},
|
|
143
|
+
origin: { context: { channel }, emitter: 'ChannelActions' },
|
|
144
|
+
});
|
|
75
145
|
}
|
|
76
146
|
});
|
|
77
147
|
|
|
@@ -80,7 +150,24 @@ export const useChannelActions = (channel: Channel) => {
|
|
|
80
150
|
return;
|
|
81
151
|
}
|
|
82
152
|
if (ownUserId) {
|
|
83
|
-
|
|
153
|
+
try {
|
|
154
|
+
await channel.removeMembers([ownUserId]);
|
|
155
|
+
addNotification({
|
|
156
|
+
message: t('Left channel'),
|
|
157
|
+
options: { severity: 'success', type: 'api:channel:leave:success' },
|
|
158
|
+
origin: { context: { channel }, emitter: 'ChannelActions' },
|
|
159
|
+
});
|
|
160
|
+
} catch (error) {
|
|
161
|
+
addNotification({
|
|
162
|
+
message: t('Failed to leave channel'),
|
|
163
|
+
options: {
|
|
164
|
+
...getNotificationErrorOptions(error),
|
|
165
|
+
severity: 'error',
|
|
166
|
+
type: 'api:channel:leave:failed',
|
|
167
|
+
},
|
|
168
|
+
origin: { context: { channel }, emitter: 'ChannelActions' },
|
|
169
|
+
});
|
|
170
|
+
}
|
|
84
171
|
}
|
|
85
172
|
});
|
|
86
173
|
|
|
@@ -106,9 +193,24 @@ export const useChannelActions = (channel: Channel) => {
|
|
|
106
193
|
try {
|
|
107
194
|
if (otherUser?.user?.id) {
|
|
108
195
|
await client.muteUser(otherUser.user.id);
|
|
196
|
+
addNotification({
|
|
197
|
+
message: t('{{ user }} has been muted', {
|
|
198
|
+
user: otherUser.user.name || otherUser.user.id,
|
|
199
|
+
}),
|
|
200
|
+
options: { severity: 'success', type: 'api:user:mute:success' },
|
|
201
|
+
origin: { context: { channel }, emitter: 'ChannelActions' },
|
|
202
|
+
});
|
|
109
203
|
}
|
|
110
204
|
} catch (error) {
|
|
111
|
-
|
|
205
|
+
addNotification({
|
|
206
|
+
message: t('Error muting a user ...'),
|
|
207
|
+
options: {
|
|
208
|
+
...getNotificationErrorOptions(error),
|
|
209
|
+
severity: 'error',
|
|
210
|
+
type: 'api:user:mute:failed',
|
|
211
|
+
},
|
|
212
|
+
origin: { context: { channel }, emitter: 'ChannelActions' },
|
|
213
|
+
});
|
|
112
214
|
}
|
|
113
215
|
});
|
|
114
216
|
|
|
@@ -122,9 +224,24 @@ export const useChannelActions = (channel: Channel) => {
|
|
|
122
224
|
try {
|
|
123
225
|
if (otherUser?.user?.id) {
|
|
124
226
|
await client.unmuteUser(otherUser.user.id);
|
|
227
|
+
addNotification({
|
|
228
|
+
message: t('{{ user }} has been unmuted', {
|
|
229
|
+
user: otherUser.user.name || otherUser.user.id,
|
|
230
|
+
}),
|
|
231
|
+
options: { severity: 'success', type: 'api:user:unmute:success' },
|
|
232
|
+
origin: { context: { channel }, emitter: 'ChannelActions' },
|
|
233
|
+
});
|
|
125
234
|
}
|
|
126
235
|
} catch (error) {
|
|
127
|
-
|
|
236
|
+
addNotification({
|
|
237
|
+
message: t('Error unmuting a user ...'),
|
|
238
|
+
options: {
|
|
239
|
+
...getNotificationErrorOptions(error),
|
|
240
|
+
severity: 'error',
|
|
241
|
+
type: 'api:user:unmute:failed',
|
|
242
|
+
},
|
|
243
|
+
origin: { context: { channel }, emitter: 'ChannelActions' },
|
|
244
|
+
});
|
|
128
245
|
}
|
|
129
246
|
});
|
|
130
247
|
|
|
@@ -135,8 +252,21 @@ export const useChannelActions = (channel: Channel) => {
|
|
|
135
252
|
|
|
136
253
|
try {
|
|
137
254
|
await channel.mute();
|
|
255
|
+
addNotification({
|
|
256
|
+
message: t('Channel muted'),
|
|
257
|
+
options: { severity: 'success', type: 'api:channel:mute:success' },
|
|
258
|
+
origin: { context: { channel }, emitter: 'ChannelActions' },
|
|
259
|
+
});
|
|
138
260
|
} catch (error) {
|
|
139
|
-
|
|
261
|
+
addNotification({
|
|
262
|
+
message: t('Failed to update channel mute status'),
|
|
263
|
+
options: {
|
|
264
|
+
...getNotificationErrorOptions(error),
|
|
265
|
+
severity: 'error',
|
|
266
|
+
type: 'api:channel:mute:failed',
|
|
267
|
+
},
|
|
268
|
+
origin: { context: { channel }, emitter: 'ChannelActions' },
|
|
269
|
+
});
|
|
140
270
|
}
|
|
141
271
|
});
|
|
142
272
|
|
|
@@ -147,8 +277,21 @@ export const useChannelActions = (channel: Channel) => {
|
|
|
147
277
|
|
|
148
278
|
try {
|
|
149
279
|
await channel.unmute();
|
|
280
|
+
addNotification({
|
|
281
|
+
message: t('Channel unmuted'),
|
|
282
|
+
options: { severity: 'success', type: 'api:channel:unmute:success' },
|
|
283
|
+
origin: { context: { channel }, emitter: 'ChannelActions' },
|
|
284
|
+
});
|
|
150
285
|
} catch (error) {
|
|
151
|
-
|
|
286
|
+
addNotification({
|
|
287
|
+
message: t('Failed to update channel mute status'),
|
|
288
|
+
options: {
|
|
289
|
+
...getNotificationErrorOptions(error),
|
|
290
|
+
severity: 'error',
|
|
291
|
+
type: 'api:channel:mute:failed',
|
|
292
|
+
},
|
|
293
|
+
origin: { context: { channel }, emitter: 'ChannelActions' },
|
|
294
|
+
});
|
|
152
295
|
}
|
|
153
296
|
});
|
|
154
297
|
|
|
@@ -162,9 +305,22 @@ export const useChannelActions = (channel: Channel) => {
|
|
|
162
305
|
try {
|
|
163
306
|
if (otherUser?.user?.id) {
|
|
164
307
|
await client.blockUser(otherUser.user.id);
|
|
308
|
+
addNotification({
|
|
309
|
+
message: t('User blocked'),
|
|
310
|
+
options: { severity: 'success', type: 'api:user:block:success' },
|
|
311
|
+
origin: { context: { channel }, emitter: 'ChannelActions' },
|
|
312
|
+
});
|
|
165
313
|
}
|
|
166
314
|
} catch (error) {
|
|
167
|
-
|
|
315
|
+
addNotification({
|
|
316
|
+
message: t('Failed to block user'),
|
|
317
|
+
options: {
|
|
318
|
+
...getNotificationErrorOptions(error),
|
|
319
|
+
severity: 'error',
|
|
320
|
+
type: 'api:user:block:failed',
|
|
321
|
+
},
|
|
322
|
+
origin: { context: { channel }, emitter: 'ChannelActions' },
|
|
323
|
+
});
|
|
168
324
|
}
|
|
169
325
|
});
|
|
170
326
|
|
|
@@ -178,9 +334,22 @@ export const useChannelActions = (channel: Channel) => {
|
|
|
178
334
|
try {
|
|
179
335
|
if (otherUser?.user?.id) {
|
|
180
336
|
await client.unBlockUser(otherUser.user.id);
|
|
337
|
+
addNotification({
|
|
338
|
+
message: t('User unblocked'),
|
|
339
|
+
options: { severity: 'success', type: 'api:user:unblock:success' },
|
|
340
|
+
origin: { context: { channel }, emitter: 'ChannelActions' },
|
|
341
|
+
});
|
|
181
342
|
}
|
|
182
343
|
} catch (error) {
|
|
183
|
-
|
|
344
|
+
addNotification({
|
|
345
|
+
message: t('Failed to block user'),
|
|
346
|
+
options: {
|
|
347
|
+
...getNotificationErrorOptions(error),
|
|
348
|
+
severity: 'error',
|
|
349
|
+
type: 'api:user:block:failed',
|
|
350
|
+
},
|
|
351
|
+
origin: { context: { channel }, emitter: 'ChannelActions' },
|
|
352
|
+
});
|
|
184
353
|
}
|
|
185
354
|
});
|
|
186
355
|
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
|
|
3
|
+
import { act, renderHook } from '@testing-library/react-native';
|
|
4
|
+
import type { Channel, LocalMessage, StreamChat } from 'stream-chat';
|
|
5
|
+
|
|
6
|
+
import { ChannelProvider } from '../../../../contexts/channelContext/ChannelContext';
|
|
7
|
+
import { ChatProvider } from '../../../../contexts/chatContext/ChatContext';
|
|
8
|
+
import { NotificationTargetProvider } from '../../../Notifications/NotificationTargetContext';
|
|
9
|
+
import { useMessageActionHandlers } from '../useMessageActionHandlers';
|
|
10
|
+
|
|
11
|
+
const createClient = () =>
|
|
12
|
+
({
|
|
13
|
+
mutedUsers: [],
|
|
14
|
+
notifications: {
|
|
15
|
+
add: jest.fn(() => 'notification-id'),
|
|
16
|
+
remove: jest.fn(),
|
|
17
|
+
startTimeout: jest.fn(),
|
|
18
|
+
},
|
|
19
|
+
on: jest.fn(() => ({ unsubscribe: jest.fn() })),
|
|
20
|
+
pinMessage: jest.fn(),
|
|
21
|
+
unpinMessage: jest.fn(),
|
|
22
|
+
userID: 'current-user-id',
|
|
23
|
+
}) as unknown as StreamChat & {
|
|
24
|
+
notifications: { add: jest.Mock; remove: jest.Mock; startTimeout: jest.Mock };
|
|
25
|
+
pinMessage: jest.Mock;
|
|
26
|
+
unpinMessage: jest.Mock;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const createChannel = () =>
|
|
30
|
+
({
|
|
31
|
+
markUnread: jest.fn(),
|
|
32
|
+
}) as unknown as Channel & { markUnread: jest.Mock };
|
|
33
|
+
|
|
34
|
+
const createWrapper =
|
|
35
|
+
(client: StreamChat, channel: Channel) =>
|
|
36
|
+
({ children }: PropsWithChildren) => (
|
|
37
|
+
<ChatProvider value={{ client } as never}>
|
|
38
|
+
<NotificationTargetProvider hostId='channel:messaging:general' panel='channel'>
|
|
39
|
+
<ChannelProvider value={{ channel } as never}>{children}</ChannelProvider>
|
|
40
|
+
</NotificationTargetProvider>
|
|
41
|
+
</ChatProvider>
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const createMessage = (overrides?: Partial<LocalMessage>) =>
|
|
45
|
+
({
|
|
46
|
+
id: 'message-id',
|
|
47
|
+
pinned: false,
|
|
48
|
+
text: 'Message text',
|
|
49
|
+
user: { id: 'message-user-id', name: 'Message User' },
|
|
50
|
+
...overrides,
|
|
51
|
+
}) as LocalMessage;
|
|
52
|
+
|
|
53
|
+
const renderUseMessageActionHandlers = ({
|
|
54
|
+
channel = createChannel(),
|
|
55
|
+
client = createClient(),
|
|
56
|
+
message = createMessage(),
|
|
57
|
+
}: {
|
|
58
|
+
channel?: Channel & { markUnread: jest.Mock };
|
|
59
|
+
client?: ReturnType<typeof createClient>;
|
|
60
|
+
message?: LocalMessage;
|
|
61
|
+
} = {}) =>
|
|
62
|
+
renderHook(
|
|
63
|
+
() =>
|
|
64
|
+
useMessageActionHandlers({
|
|
65
|
+
channel,
|
|
66
|
+
client,
|
|
67
|
+
deleteMessage: jest.fn(),
|
|
68
|
+
deleteReaction: jest.fn(),
|
|
69
|
+
enforceUniqueReaction: false,
|
|
70
|
+
message,
|
|
71
|
+
retrySendMessage: jest.fn(),
|
|
72
|
+
sendReaction: jest.fn(),
|
|
73
|
+
setEditingState: jest.fn(),
|
|
74
|
+
setQuotedMessage: jest.fn(),
|
|
75
|
+
supportedReactions: [],
|
|
76
|
+
}),
|
|
77
|
+
{ wrapper: createWrapper(client, channel) },
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
describe('useMessageActionHandlers notifications', () => {
|
|
81
|
+
it('notifies when pinning a message succeeds', async () => {
|
|
82
|
+
const client = createClient();
|
|
83
|
+
const message = createMessage();
|
|
84
|
+
const { result } = renderUseMessageActionHandlers({ client, message });
|
|
85
|
+
|
|
86
|
+
await act(async () => {
|
|
87
|
+
await result.current.handleTogglePinMessage();
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
expect(client.pinMessage).toHaveBeenCalledWith(message, null);
|
|
91
|
+
expect(client.notifications.add).toHaveBeenCalledWith({
|
|
92
|
+
message: 'Message pinned',
|
|
93
|
+
options: {
|
|
94
|
+
severity: 'success',
|
|
95
|
+
tags: ['target:channel:channel:messaging:general'],
|
|
96
|
+
type: 'api:message:pin:success',
|
|
97
|
+
},
|
|
98
|
+
origin: {
|
|
99
|
+
context: { message },
|
|
100
|
+
emitter: 'MessageActions',
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('notifies when marking a message unread fails', async () => {
|
|
106
|
+
const error = new Error('Cannot mark unread');
|
|
107
|
+
const client = createClient();
|
|
108
|
+
const channel = createChannel();
|
|
109
|
+
const message = createMessage();
|
|
110
|
+
channel.markUnread.mockRejectedValue(error);
|
|
111
|
+
const { result } = renderUseMessageActionHandlers({ channel, client, message });
|
|
112
|
+
|
|
113
|
+
await act(async () => {
|
|
114
|
+
await result.current.handleMarkUnreadMessage();
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
expect(client.notifications.add).toHaveBeenCalledWith({
|
|
118
|
+
message: 'Cannot mark unread',
|
|
119
|
+
options: {
|
|
120
|
+
originalError: error,
|
|
121
|
+
severity: 'error',
|
|
122
|
+
tags: ['target:channel:channel:messaging:general'],
|
|
123
|
+
type: 'api:message:markUnread:failed',
|
|
124
|
+
},
|
|
125
|
+
origin: {
|
|
126
|
+
context: { message },
|
|
127
|
+
emitter: 'MessageActions',
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
});
|
|
@@ -19,6 +19,25 @@ import {
|
|
|
19
19
|
} from '../../../hooks';
|
|
20
20
|
import { useTranslatedMessage } from '../../../hooks/useTranslatedMessage';
|
|
21
21
|
import { NativeHandlers } from '../../../native';
|
|
22
|
+
import { useNotificationApi } from '../../Notifications';
|
|
23
|
+
|
|
24
|
+
const getErrorMessage = (error: unknown, fallback: string) =>
|
|
25
|
+
error instanceof Error && error.message ? error.message : fallback;
|
|
26
|
+
|
|
27
|
+
const getNotificationError = (error: unknown): Error | undefined => {
|
|
28
|
+
if (error instanceof Error) return error;
|
|
29
|
+
if (typeof error === 'string') return new Error(error);
|
|
30
|
+
if (error && typeof error === 'object' && 'message' in error) {
|
|
31
|
+
const message = error.message;
|
|
32
|
+
if (typeof message === 'string') return new Error(message);
|
|
33
|
+
}
|
|
34
|
+
return undefined;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const getNotificationErrorOptions = (error: unknown) => {
|
|
38
|
+
const originalError = getNotificationError(error);
|
|
39
|
+
return originalError ? { originalError } : {};
|
|
40
|
+
};
|
|
22
41
|
|
|
23
42
|
export const useWithPortalKeyboardSafety = <T extends unknown[]>(
|
|
24
43
|
callback: (...args: T) => void,
|
|
@@ -47,6 +66,7 @@ export const useMessageActionHandlers = ({
|
|
|
47
66
|
Pick<MessageContextValue, 'message'> &
|
|
48
67
|
Pick<MessageComposerAPIContextValue, 'setEditingState' | 'setQuotedMessage'>) => {
|
|
49
68
|
const { t } = useTranslationContext();
|
|
69
|
+
const { addNotification } = useNotificationApi();
|
|
50
70
|
const handleResendMessage = useStableCallback(() => retrySendMessage(message));
|
|
51
71
|
const translatedMessage = useTranslatedMessage(message);
|
|
52
72
|
|
|
@@ -74,7 +94,24 @@ export const useMessageActionHandlers = ({
|
|
|
74
94
|
{ style: 'cancel', text: t('Cancel') },
|
|
75
95
|
{
|
|
76
96
|
onPress: async () => {
|
|
77
|
-
|
|
97
|
+
try {
|
|
98
|
+
await deleteMessage(message);
|
|
99
|
+
addNotification({
|
|
100
|
+
message: t('Message deleted'),
|
|
101
|
+
options: { severity: 'success', type: 'api:message:delete:success' },
|
|
102
|
+
origin: { context: { message }, emitter: 'MessageActions' },
|
|
103
|
+
});
|
|
104
|
+
} catch (error) {
|
|
105
|
+
addNotification({
|
|
106
|
+
message: getErrorMessage(error, t('Error deleting message')),
|
|
107
|
+
options: {
|
|
108
|
+
...getNotificationErrorOptions(error),
|
|
109
|
+
severity: 'error',
|
|
110
|
+
type: 'api:message:delete:failed',
|
|
111
|
+
},
|
|
112
|
+
origin: { context: { message }, emitter: 'MessageActions' },
|
|
113
|
+
});
|
|
114
|
+
}
|
|
78
115
|
},
|
|
79
116
|
style: 'destructive',
|
|
80
117
|
text: t('Delete'),
|
|
@@ -97,10 +134,39 @@ export const useMessageActionHandlers = ({
|
|
|
97
134
|
return;
|
|
98
135
|
}
|
|
99
136
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
137
|
+
try {
|
|
138
|
+
if (isMuted) {
|
|
139
|
+
await client.unmuteUser(message.user.id);
|
|
140
|
+
addNotification({
|
|
141
|
+
message: t('{{ user }} has been unmuted', {
|
|
142
|
+
user: message.user?.name || message.user?.id,
|
|
143
|
+
}),
|
|
144
|
+
options: { severity: 'success', type: 'api:user:unmute:success' },
|
|
145
|
+
origin: { context: { message }, emitter: 'MessageActions' },
|
|
146
|
+
});
|
|
147
|
+
} else {
|
|
148
|
+
await client.muteUser(message.user.id);
|
|
149
|
+
addNotification({
|
|
150
|
+
message: t('{{ user }} has been muted', {
|
|
151
|
+
user: message.user?.name || message.user?.id,
|
|
152
|
+
}),
|
|
153
|
+
options: { severity: 'success', type: 'api:user:mute:success' },
|
|
154
|
+
origin: { context: { message }, emitter: 'MessageActions' },
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
} catch (error) {
|
|
158
|
+
addNotification({
|
|
159
|
+
message: getErrorMessage(
|
|
160
|
+
error,
|
|
161
|
+
isMuted ? t('Error unmuting a user ...') : t('Error muting a user ...'),
|
|
162
|
+
),
|
|
163
|
+
options: {
|
|
164
|
+
...getNotificationErrorOptions(error),
|
|
165
|
+
severity: 'error',
|
|
166
|
+
type: isMuted ? 'api:user:unmute:failed' : 'api:user:mute:failed',
|
|
167
|
+
},
|
|
168
|
+
origin: { context: { message }, emitter: 'MessageActions' },
|
|
169
|
+
});
|
|
104
170
|
}
|
|
105
171
|
});
|
|
106
172
|
|
|
@@ -118,11 +184,36 @@ export const useMessageActionHandlers = ({
|
|
|
118
184
|
});
|
|
119
185
|
|
|
120
186
|
const handleTogglePinMessage = useStableCallback(async () => {
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
187
|
+
const isPinned = !!message.pinned;
|
|
188
|
+
try {
|
|
189
|
+
if (!isPinned) {
|
|
190
|
+
await client.pinMessage(message, null);
|
|
191
|
+
addNotification({
|
|
192
|
+
message: t('Message pinned'),
|
|
193
|
+
options: { severity: 'success', type: 'api:message:pin:success' },
|
|
194
|
+
origin: { context: { message }, emitter: 'MessageActions' },
|
|
195
|
+
});
|
|
196
|
+
} else {
|
|
197
|
+
await client.unpinMessage(message);
|
|
198
|
+
addNotification({
|
|
199
|
+
message: t('Message unpinned'),
|
|
200
|
+
options: { severity: 'success', type: 'api:message:unpin:success' },
|
|
201
|
+
origin: { context: { message }, emitter: 'MessageActions' },
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
} catch (error) {
|
|
205
|
+
addNotification({
|
|
206
|
+
message: getErrorMessage(
|
|
207
|
+
error,
|
|
208
|
+
isPinned ? t('Error removing message pin') : t('Error pinning message'),
|
|
209
|
+
),
|
|
210
|
+
options: {
|
|
211
|
+
...getNotificationErrorOptions(error),
|
|
212
|
+
severity: 'error',
|
|
213
|
+
type: isPinned ? 'api:message:unpin:failed' : 'api:message:pin:failed',
|
|
214
|
+
},
|
|
215
|
+
origin: { context: { message }, emitter: 'MessageActions' },
|
|
216
|
+
});
|
|
126
217
|
}
|
|
127
218
|
});
|
|
128
219
|
|
|
@@ -143,15 +234,21 @@ export const useMessageActionHandlers = ({
|
|
|
143
234
|
onPress: async () => {
|
|
144
235
|
try {
|
|
145
236
|
await client.flagMessage(message.id);
|
|
146
|
-
|
|
237
|
+
addNotification({
|
|
238
|
+
message: t('Message has been successfully flagged'),
|
|
239
|
+
options: { severity: 'success', type: 'api:message:flag:success' },
|
|
240
|
+
origin: { context: { message }, emitter: 'MessageActions' },
|
|
241
|
+
});
|
|
147
242
|
} catch (error) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
243
|
+
addNotification({
|
|
244
|
+
message: getErrorMessage(error, t('Error adding flag')),
|
|
245
|
+
options: {
|
|
246
|
+
...getNotificationErrorOptions(error),
|
|
247
|
+
severity: 'error',
|
|
248
|
+
type: 'api:message:flag:failed',
|
|
249
|
+
},
|
|
250
|
+
origin: { context: { message }, emitter: 'MessageActions' },
|
|
251
|
+
});
|
|
155
252
|
}
|
|
156
253
|
},
|
|
157
254
|
text: t('Flag'),
|
|
@@ -167,13 +264,26 @@ export const useMessageActionHandlers = ({
|
|
|
167
264
|
}
|
|
168
265
|
try {
|
|
169
266
|
await channel.markUnread({ message_id: message.id });
|
|
267
|
+
addNotification({
|
|
268
|
+
message: t('Message marked as unread'),
|
|
269
|
+
options: { severity: 'success', type: 'api:message:markUnread:success' },
|
|
270
|
+
origin: { context: { message }, emitter: 'MessageActions' },
|
|
271
|
+
});
|
|
170
272
|
} catch (error) {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
273
|
+
addNotification({
|
|
274
|
+
message: getErrorMessage(
|
|
275
|
+
error,
|
|
276
|
+
t(
|
|
277
|
+
'Error marking message unread. Cannot mark unread messages older than the newest 100 channel messages.',
|
|
278
|
+
),
|
|
175
279
|
),
|
|
176
|
-
|
|
280
|
+
options: {
|
|
281
|
+
...getNotificationErrorOptions(error),
|
|
282
|
+
severity: 'error',
|
|
283
|
+
type: 'api:message:markUnread:failed',
|
|
284
|
+
},
|
|
285
|
+
origin: { context: { message }, emitter: 'MessageActions' },
|
|
286
|
+
});
|
|
177
287
|
}
|
|
178
288
|
});
|
|
179
289
|
|
|
@@ -50,7 +50,7 @@ import { useStateStore } from '../../hooks/useStateStore';
|
|
|
50
50
|
import { AudioRecorderManagerState } from '../../state-store/audio-recorder-manager';
|
|
51
51
|
import { MessageInputHeightState } from '../../state-store/message-input-height-store';
|
|
52
52
|
import { primitives } from '../../theme';
|
|
53
|
-
import { transitions } from '../../utils/transitions';
|
|
53
|
+
import { transitions } from '../../utils/animations/transitions';
|
|
54
54
|
import { type TextInputOverrideComponent } from '../AutoCompleteInput/AutoCompleteInput';
|
|
55
55
|
import { CreatePoll } from '../Poll/CreatePollContent';
|
|
56
56
|
import { PortalWhileClosingView } from '../UIComponents/PortalWhileClosingView';
|
|
@@ -9,7 +9,7 @@ import { idleRecordingStateSelector } from './utils/audioRecorderSelectors';
|
|
|
9
9
|
import { useMessageInputContext } from '../../contexts/messageInputContext/MessageInputContext';
|
|
10
10
|
import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
11
11
|
import { useStateStore } from '../../hooks/useStateStore';
|
|
12
|
-
import { transitions } from '../../utils/transitions';
|
|
12
|
+
import { transitions } from '../../utils/animations/transitions';
|
|
13
13
|
|
|
14
14
|
export const MessageComposerLeadingView = () => {
|
|
15
15
|
const {
|
|
@@ -17,7 +17,7 @@ import { useMessageInputContext } from '../../contexts/messageInputContext/Messa
|
|
|
17
17
|
import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
18
18
|
import { useStateStore } from '../../hooks/useStateStore';
|
|
19
19
|
import { primitives } from '../../theme';
|
|
20
|
-
import { transitions } from '../../utils/transitions';
|
|
20
|
+
import { transitions } from '../../utils/animations/transitions';
|
|
21
21
|
|
|
22
22
|
export const MessageInputHeaderView = () => {
|
|
23
23
|
const {
|
|
@@ -11,7 +11,7 @@ import { useMessageInputContext } from '../../contexts/messageInputContext/Messa
|
|
|
11
11
|
import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
12
12
|
import { useStateStore } from '../../hooks/useStateStore';
|
|
13
13
|
import { primitives } from '../../theme';
|
|
14
|
-
import { transitions } from '../../utils/transitions';
|
|
14
|
+
import { transitions } from '../../utils/animations/transitions';
|
|
15
15
|
|
|
16
16
|
export const MessageInputTrailingView = () => {
|
|
17
17
|
const {
|