stream-chat-react-native-core 9.2.0-beta.1 → 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/a11y/hooks/useA11yLabel.js +4 -3
- package/lib/commonjs/a11y/hooks/useA11yLabel.js.map +1 -1
- package/lib/commonjs/a11y/hooks/useAccessibilityActivateAction.js +25 -0
- package/lib/commonjs/a11y/hooks/useAccessibilityActivateAction.js.map +1 -0
- package/lib/commonjs/a11y/index.js +11 -0
- package/lib/commonjs/a11y/index.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js +20 -0
- package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentMediaPicker.js +1 -0
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentMediaPicker.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.js +19 -2
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerContent.js +4 -3
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerContent.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentTypePickerButton.js +9 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentTypePickerButton.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/ImageGallery/components/ImageGalleryFooter.js +2 -2
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryHeader.js +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryHeader.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.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/AttachmentRemoveControl.js +16 -4
- package/lib/commonjs/components/MessageInput/components/AttachmentPreview/AttachmentRemoveControl.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 +30 -6
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecorder.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js +34 -9
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/InputButtons/AttachButton.js +12 -3
- package/lib/commonjs/components/MessageInput/components/InputButtons/AttachButton.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/OutputButtons/EditButton.js +1 -0
- package/lib/commonjs/components/MessageInput/components/OutputButtons/EditButton.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/OutputButtons/SendButton.js +1 -0
- package/lib/commonjs/components/MessageInput/components/OutputButtons/SendButton.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/OutputButtons/index.js +1 -1
- package/lib/commonjs/components/MessageList/MessageFlashList.js +24 -4
- package/lib/commonjs/components/MessageList/MessageFlashList.js.map +1 -1
- package/lib/commonjs/components/MessageList/MessageList.js +24 -4
- package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
- package/lib/commonjs/components/MessageList/ScrollToBottomButton.js +12 -6
- package/lib/commonjs/components/MessageList/ScrollToBottomButton.js.map +1 -1
- package/lib/commonjs/components/MessageList/UnreadMessagesNotification.js +1 -0
- package/lib/commonjs/components/MessageList/UnreadMessagesNotification.js.map +1 -1
- package/lib/commonjs/components/MessageList/hooks/useScrollToBottomAccessibilityAction.js +47 -0
- package/lib/commonjs/components/MessageList/hooks/useScrollToBottomAccessibilityAction.js.map +1 -0
- package/lib/commonjs/components/MessageMenu/MessageActionListItem.js +12 -4
- package/lib/commonjs/components/MessageMenu/MessageActionListItem.js.map +1 -1
- package/lib/commonjs/components/MessageMenu/MessageReactionPicker.js +1 -0
- package/lib/commonjs/components/MessageMenu/MessageReactionPicker.js.map +1 -1
- package/lib/commonjs/components/MessageMenu/ReactionButton.js +9 -6
- package/lib/commonjs/components/MessageMenu/ReactionButton.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/CreatePollHeader.js +2 -0
- package/lib/commonjs/components/Poll/components/CreatePollHeader.js.map +1 -1
- package/lib/commonjs/components/Poll/components/MultipleVotesSettings.js +2 -0
- package/lib/commonjs/components/Poll/components/MultipleVotesSettings.js.map +1 -1
- package/lib/commonjs/components/Poll/components/PollModalHeader.js +1 -0
- package/lib/commonjs/components/Poll/components/PollModalHeader.js.map +1 -1
- 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/Reply/Reply.js +1 -0
- package/lib/commonjs/components/Reply/Reply.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/components/ui/Avatar/Avatar.js +6 -3
- package/lib/commonjs/components/ui/Avatar/Avatar.js.map +1 -1
- package/lib/commonjs/components/ui/Button/Button.js +16 -3
- package/lib/commonjs/components/ui/Button/Button.js.map +1 -1
- package/lib/commonjs/contexts/accessibilityContext/AccessibilityContext.js +21 -1
- package/lib/commonjs/contexts/accessibilityContext/AccessibilityContext.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 +94 -1
- package/lib/commonjs/i18n/es.json +96 -3
- package/lib/commonjs/i18n/fr.json +94 -1
- package/lib/commonjs/i18n/he.json +94 -1
- package/lib/commonjs/i18n/hi.json +94 -1
- package/lib/commonjs/i18n/it.json +94 -1
- package/lib/commonjs/i18n/ja.json +94 -1
- package/lib/commonjs/i18n/ko.json +94 -1
- package/lib/commonjs/i18n/nl.json +94 -1
- package/lib/commonjs/i18n/pt-br.json +94 -1
- package/lib/commonjs/i18n/ru.json +94 -1
- package/lib/commonjs/i18n/tr.json +94 -1
- package/lib/commonjs/mock-builders/DB/mock.js +3 -1
- package/lib/commonjs/mock-builders/DB/mock.js.map +1 -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/test-utils/BetterSqlite.js +3 -2
- package/lib/commonjs/test-utils/BetterSqlite.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/a11y/hooks/useA11yLabel.js +4 -3
- package/lib/module/a11y/hooks/useA11yLabel.js.map +1 -1
- package/lib/module/a11y/hooks/useAccessibilityActivateAction.js +25 -0
- package/lib/module/a11y/hooks/useAccessibilityActivateAction.js.map +1 -0
- package/lib/module/a11y/index.js +11 -0
- package/lib/module/a11y/index.js.map +1 -1
- package/lib/module/components/AttachmentPicker/AttachmentPicker.js +20 -0
- package/lib/module/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentMediaPicker.js +1 -0
- package/lib/module/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentMediaPicker.js.map +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.js +19 -2
- package/lib/module/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.js.map +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerContent.js +4 -3
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerContent.js.map +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentTypePickerButton.js +9 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentTypePickerButton.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/ImageGallery/components/ImageGalleryFooter.js +2 -2
- package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryHeader.js +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryHeader.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.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/AttachmentRemoveControl.js +16 -4
- package/lib/module/components/MessageInput/components/AttachmentPreview/AttachmentRemoveControl.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 +30 -6
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecorder.js.map +1 -1
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js +34 -9
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js.map +1 -1
- package/lib/module/components/MessageInput/components/InputButtons/AttachButton.js +12 -3
- package/lib/module/components/MessageInput/components/InputButtons/AttachButton.js.map +1 -1
- package/lib/module/components/MessageInput/components/OutputButtons/EditButton.js +1 -0
- package/lib/module/components/MessageInput/components/OutputButtons/EditButton.js.map +1 -1
- package/lib/module/components/MessageInput/components/OutputButtons/SendButton.js +1 -0
- package/lib/module/components/MessageInput/components/OutputButtons/SendButton.js.map +1 -1
- package/lib/module/components/MessageInput/components/OutputButtons/index.js +1 -1
- package/lib/module/components/MessageList/MessageFlashList.js +24 -4
- package/lib/module/components/MessageList/MessageFlashList.js.map +1 -1
- package/lib/module/components/MessageList/MessageList.js +24 -4
- package/lib/module/components/MessageList/MessageList.js.map +1 -1
- package/lib/module/components/MessageList/ScrollToBottomButton.js +12 -6
- package/lib/module/components/MessageList/ScrollToBottomButton.js.map +1 -1
- package/lib/module/components/MessageList/UnreadMessagesNotification.js +1 -0
- package/lib/module/components/MessageList/UnreadMessagesNotification.js.map +1 -1
- package/lib/module/components/MessageList/hooks/useScrollToBottomAccessibilityAction.js +47 -0
- package/lib/module/components/MessageList/hooks/useScrollToBottomAccessibilityAction.js.map +1 -0
- package/lib/module/components/MessageMenu/MessageActionListItem.js +12 -4
- package/lib/module/components/MessageMenu/MessageActionListItem.js.map +1 -1
- package/lib/module/components/MessageMenu/MessageReactionPicker.js +1 -0
- package/lib/module/components/MessageMenu/MessageReactionPicker.js.map +1 -1
- package/lib/module/components/MessageMenu/ReactionButton.js +9 -6
- package/lib/module/components/MessageMenu/ReactionButton.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/CreatePollHeader.js +2 -0
- package/lib/module/components/Poll/components/CreatePollHeader.js.map +1 -1
- package/lib/module/components/Poll/components/MultipleVotesSettings.js +2 -0
- package/lib/module/components/Poll/components/MultipleVotesSettings.js.map +1 -1
- package/lib/module/components/Poll/components/PollModalHeader.js +1 -0
- package/lib/module/components/Poll/components/PollModalHeader.js.map +1 -1
- 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/Reply/Reply.js +1 -0
- package/lib/module/components/Reply/Reply.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/components/ui/Avatar/Avatar.js +6 -3
- package/lib/module/components/ui/Avatar/Avatar.js.map +1 -1
- package/lib/module/components/ui/Button/Button.js +16 -3
- package/lib/module/components/ui/Button/Button.js.map +1 -1
- package/lib/module/contexts/accessibilityContext/AccessibilityContext.js +21 -1
- package/lib/module/contexts/accessibilityContext/AccessibilityContext.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 +94 -1
- package/lib/module/i18n/es.json +96 -3
- package/lib/module/i18n/fr.json +94 -1
- package/lib/module/i18n/he.json +94 -1
- package/lib/module/i18n/hi.json +94 -1
- package/lib/module/i18n/it.json +94 -1
- package/lib/module/i18n/ja.json +94 -1
- package/lib/module/i18n/ko.json +94 -1
- package/lib/module/i18n/nl.json +94 -1
- package/lib/module/i18n/pt-br.json +94 -1
- package/lib/module/i18n/ru.json +94 -1
- package/lib/module/i18n/tr.json +94 -1
- package/lib/module/mock-builders/DB/mock.js +3 -1
- package/lib/module/mock-builders/DB/mock.js.map +1 -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/test-utils/BetterSqlite.js +3 -2
- package/lib/module/test-utils/BetterSqlite.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/a11y/a11yUtils.d.ts +3 -3
- package/lib/typescript/a11y/a11yUtils.d.ts.map +1 -1
- package/lib/typescript/a11y/hooks/useA11yLabel.d.ts +2 -1
- package/lib/typescript/a11y/hooks/useA11yLabel.d.ts.map +1 -1
- package/lib/typescript/a11y/hooks/useAccessibilityActivateAction.d.ts +17 -0
- package/lib/typescript/a11y/hooks/useAccessibilityActivateAction.d.ts.map +1 -0
- package/lib/typescript/a11y/index.d.ts +1 -0
- package/lib/typescript/a11y/index.d.ts.map +1 -1
- package/lib/typescript/components/AttachmentPicker/AttachmentPicker.d.ts.map +1 -1
- package/lib/typescript/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentMediaPicker.d.ts.map +1 -1
- package/lib/typescript/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.d.ts.map +1 -1
- package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerContent.d.ts.map +1 -1
- package/lib/typescript/components/AttachmentPicker/components/AttachmentTypePickerButton.d.ts +2 -1
- package/lib/typescript/components/AttachmentPicker/components/AttachmentTypePickerButton.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/AttachmentRemoveControl.d.ts +5 -2
- package/lib/typescript/components/MessageInput/components/AttachmentPreview/AttachmentRemoveControl.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/MessageInput/components/InputButtons/AttachButton.d.ts +1 -0
- package/lib/typescript/components/MessageInput/components/InputButtons/AttachButton.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/components/OutputButtons/EditButton.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/components/OutputButtons/SendButton.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/MessageList/ScrollToBottomButton.d.ts +2 -0
- package/lib/typescript/components/MessageList/ScrollToBottomButton.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/UnreadMessagesNotification.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/hooks/useScrollToBottomAccessibilityAction.d.ts +20 -0
- package/lib/typescript/components/MessageList/hooks/useScrollToBottomAccessibilityAction.d.ts.map +1 -0
- package/lib/typescript/components/MessageMenu/MessageActionListItem.d.ts.map +1 -1
- package/lib/typescript/components/MessageMenu/MessageReactionPicker.d.ts.map +1 -1
- package/lib/typescript/components/MessageMenu/ReactionButton.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/CreatePollHeader.d.ts.map +1 -1
- package/lib/typescript/components/Poll/components/MultipleVotesSettings.d.ts.map +1 -1
- package/lib/typescript/components/Poll/components/PollModalHeader.d.ts.map +1 -1
- 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/Reply/Reply.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/components/ui/Avatar/Avatar.d.ts.map +1 -1
- package/lib/typescript/components/ui/Button/Button.d.ts +10 -1
- package/lib/typescript/components/ui/Button/Button.d.ts.map +1 -1
- package/lib/typescript/contexts/accessibilityContext/AccessibilityContext.d.ts +1 -1
- package/lib/typescript/contexts/accessibilityContext/AccessibilityContext.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 +94 -1
- package/lib/typescript/i18n/es.json +96 -3
- package/lib/typescript/i18n/fr.json +94 -1
- package/lib/typescript/i18n/he.json +94 -1
- package/lib/typescript/i18n/hi.json +94 -1
- package/lib/typescript/i18n/it.json +94 -1
- package/lib/typescript/i18n/ja.json +94 -1
- package/lib/typescript/i18n/ko.json +94 -1
- package/lib/typescript/i18n/nl.json +94 -1
- package/lib/typescript/i18n/pt-br.json +94 -1
- package/lib/typescript/i18n/ru.json +94 -1
- package/lib/typescript/i18n/tr.json +94 -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/test-utils/BetterSqlite.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 +93 -0
- package/lib/typescript/utils/i18n/Streami18n.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/offline-support/offline-feature.tsx +40 -34
- package/src/a11y/a11yUtils.ts +2 -2
- package/src/a11y/hooks/useA11yLabel.ts +7 -4
- package/src/a11y/hooks/useAccessibilityActivateAction.ts +44 -0
- package/src/a11y/index.ts +1 -0
- package/src/components/AttachmentPicker/AttachmentPicker.tsx +23 -1
- package/src/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentMediaPicker.tsx +1 -0
- package/src/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.tsx +15 -2
- package/src/components/AttachmentPicker/components/AttachmentPickerContent.tsx +4 -3
- package/src/components/AttachmentPicker/components/AttachmentTypePickerButton.tsx +9 -0
- 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/__tests__/ChannelListView.test.tsx +16 -5
- package/src/components/ChannelList/hooks/__tests__/useChannelActions.test.tsx +123 -0
- package/src/components/ChannelList/hooks/useChannelActions.ts +181 -12
- package/src/components/ImageGallery/__tests__/ImageGalleryFooter.test.tsx +9 -3
- package/src/components/ImageGallery/__tests__/ImageGalleryHeader.test.tsx +4 -1
- package/src/components/ImageGallery/components/ImageGalleryFooter.tsx +2 -2
- package/src/components/ImageGallery/components/ImageGalleryHeader.tsx +1 -1
- package/src/components/ImageGallery/components/ImageGalleryVideoControl.tsx +1 -1
- 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/AttachmentRemoveControl.tsx +18 -2
- package/src/components/MessageInput/components/AttachmentPreview/AttachmentUploadPreviewList.tsx +1 -10
- package/src/components/MessageInput/components/AudioRecorder/AudioRecorder.tsx +13 -2
- package/src/components/MessageInput/components/AudioRecorder/AudioRecordingButton.tsx +35 -14
- package/src/components/MessageInput/components/InputButtons/AttachButton.tsx +13 -3
- package/src/components/MessageInput/components/OutputButtons/EditButton.tsx +1 -0
- package/src/components/MessageInput/components/OutputButtons/SendButton.tsx +1 -0
- package/src/components/MessageInput/components/OutputButtons/index.tsx +1 -1
- package/src/components/MessageList/MessageFlashList.tsx +26 -3
- package/src/components/MessageList/MessageList.tsx +26 -3
- package/src/components/MessageList/ScrollToBottomButton.tsx +18 -6
- package/src/components/MessageList/UnreadMessagesNotification.tsx +1 -0
- package/src/components/MessageList/__tests__/MessageList.test.tsx +221 -0
- package/src/components/MessageList/__tests__/ScrollToBottomButton.test.tsx +2 -2
- package/src/components/MessageList/__tests__/__snapshots__/ScrollToBottomButton.test.tsx.snap +3 -1
- package/src/components/MessageList/hooks/useScrollToBottomAccessibilityAction.ts +74 -0
- package/src/components/MessageMenu/MessageActionListItem.tsx +10 -4
- package/src/components/MessageMenu/MessageReactionPicker.tsx +1 -0
- package/src/components/MessageMenu/ReactionButton.tsx +7 -9
- package/src/components/MessageMenu/__tests__/MessageReactionPicker.test.tsx +13 -15
- package/src/components/MessageMenu/__tests__/MessageUserReactions.test.tsx +20 -18
- package/src/components/MessageMenu/__tests__/ReactionButton.test.tsx +18 -5
- 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/CreatePollHeader.tsx +2 -0
- package/src/components/Poll/components/MultipleVotesSettings.tsx +2 -0
- package/src/components/Poll/components/PollModalHeader.tsx +1 -0
- package/src/components/Poll/components/PollOption.tsx +10 -6
- package/src/components/Poll/hooks/usePollState.ts +26 -2
- package/src/components/Reply/Reply.tsx +4 -1
- package/src/components/Thread/Thread.tsx +24 -16
- package/src/components/Thread/__tests__/__snapshots__/Thread.test.tsx.snap +3 -0
- package/src/components/ThreadList/ThreadList.tsx +33 -9
- package/src/components/index.ts +2 -0
- package/src/components/ui/Avatar/Avatar.tsx +2 -1
- package/src/components/ui/Button/Button.tsx +26 -0
- package/src/components/ui/Button/__tests__/Button.test.tsx +44 -0
- package/src/contexts/accessibilityContext/AccessibilityContext.tsx +35 -1
- 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 +94 -1
- package/src/i18n/es.json +96 -3
- package/src/i18n/fr.json +94 -1
- package/src/i18n/he.json +94 -1
- package/src/i18n/hi.json +94 -1
- package/src/i18n/it.json +94 -1
- package/src/i18n/ja.json +94 -1
- package/src/i18n/ko.json +94 -1
- package/src/i18n/nl.json +94 -1
- package/src/i18n/pt-br.json +94 -1
- package/src/i18n/ru.json +94 -1
- package/src/i18n/tr.json +94 -1
- package/src/mock-builders/DB/mock.ts +2 -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/test-utils/BetterSqlite.ts +3 -1
- 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
|
@@ -28,12 +28,14 @@ import { Button, ButtonProps } from '../../ui';
|
|
|
28
28
|
import { BottomSheetModal } from '../../UIComponents';
|
|
29
29
|
|
|
30
30
|
export type AttachmentTypePickerButtonProps = Pick<ButtonProps, 'selected' | 'onPress'> & {
|
|
31
|
+
accessibilityLabelKey?: string;
|
|
31
32
|
Icon: ButtonProps['LeadingIcon'];
|
|
32
33
|
} & Pick<PressableProps, 'testID'>;
|
|
33
34
|
|
|
34
35
|
const hitSlop = { bottom: 15, top: 15 };
|
|
35
36
|
|
|
36
37
|
export const AttachmentTypePickerButton = ({
|
|
38
|
+
accessibilityLabelKey,
|
|
37
39
|
testID,
|
|
38
40
|
selected,
|
|
39
41
|
onPress: onPressProp,
|
|
@@ -52,6 +54,7 @@ export const AttachmentTypePickerButton = ({
|
|
|
52
54
|
|
|
53
55
|
return (
|
|
54
56
|
<Button
|
|
57
|
+
accessibilityLabelKey={accessibilityLabelKey}
|
|
55
58
|
testID={testID}
|
|
56
59
|
hitSlop={hitSlop}
|
|
57
60
|
onPress={onPress}
|
|
@@ -80,6 +83,7 @@ export const MediaPickerButton = () => {
|
|
|
80
83
|
|
|
81
84
|
return hasImagePicker ? (
|
|
82
85
|
<AttachmentTypePickerButton
|
|
86
|
+
accessibilityLabelKey='a11y/Open photo picker'
|
|
83
87
|
testID='upload-photo-touchable'
|
|
84
88
|
Icon={Picture}
|
|
85
89
|
selected={selectedPicker === 'images'}
|
|
@@ -113,6 +117,7 @@ export const CameraPickerButton = () => {
|
|
|
113
117
|
return hasCameraPicker ? (
|
|
114
118
|
<>
|
|
115
119
|
<AttachmentTypePickerButton
|
|
120
|
+
accessibilityLabelKey='a11y/Open camera'
|
|
116
121
|
testID='take-photo-touchable'
|
|
117
122
|
Icon={Camera}
|
|
118
123
|
selected={selectedPicker === 'camera-photo'}
|
|
@@ -120,6 +125,7 @@ export const CameraPickerButton = () => {
|
|
|
120
125
|
/>
|
|
121
126
|
{Platform.OS === 'android' ? (
|
|
122
127
|
<AttachmentTypePickerButton
|
|
128
|
+
accessibilityLabelKey='a11y/Open video recorder'
|
|
123
129
|
Icon={VideoIcon}
|
|
124
130
|
selected={selectedPicker === 'camera-video'}
|
|
125
131
|
onPress={onVideoRecorderPickerPress}
|
|
@@ -144,6 +150,7 @@ export const FilePickerButton = () => {
|
|
|
144
150
|
|
|
145
151
|
return hasFilePicker ? (
|
|
146
152
|
<AttachmentTypePickerButton
|
|
153
|
+
accessibilityLabelKey='a11y/Open file picker'
|
|
147
154
|
testID='upload-file-touchable'
|
|
148
155
|
Icon={FilePickerIcon}
|
|
149
156
|
selected={selectedPicker === 'files'}
|
|
@@ -171,6 +178,7 @@ export const PollPickerButton = () => {
|
|
|
171
178
|
|
|
172
179
|
return !threadList && hasCreatePoll && ownCapabilities.sendPoll ? ( // do not allow poll creation in threads
|
|
173
180
|
<AttachmentTypePickerButton
|
|
181
|
+
accessibilityLabelKey='a11y/Open poll creation'
|
|
174
182
|
testID='create-poll-touchable'
|
|
175
183
|
Icon={PollThumbnail}
|
|
176
184
|
selected={selectedPicker === 'polls'}
|
|
@@ -198,6 +206,7 @@ export const CommandsPickerButton = () => {
|
|
|
198
206
|
return hasCommands ? (
|
|
199
207
|
<>
|
|
200
208
|
<AttachmentTypePickerButton
|
|
209
|
+
accessibilityLabelKey='a11y/Open commands'
|
|
201
210
|
testID='commands-touchable'
|
|
202
211
|
Icon={CommandsIcon}
|
|
203
212
|
selected={selectedPicker === 'commands'}
|
package/src/components/AttachmentPicker/components/__tests__/AttachmentPickerContent.test.tsx
CHANGED
|
@@ -1,27 +1,31 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import { fireEvent, render, screen } from '@testing-library/react-native';
|
|
4
|
-
import type
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
AttachmentCommandNativePickerItem,
|
|
8
|
-
AttachmentCommandPickerItem,
|
|
9
|
-
} from '../AttachmentPickerContent';
|
|
4
|
+
import { type CommandSuggestion, notifyCommandDisabled } from 'stream-chat';
|
|
10
5
|
|
|
11
6
|
jest.mock('stream-chat', () => ({
|
|
12
7
|
CommandSearchSource: jest.fn(() => ({
|
|
13
8
|
query: jest.fn(() => ({ items: [] })),
|
|
14
9
|
})),
|
|
10
|
+
notifyCommandDisabled: jest.fn(),
|
|
15
11
|
}));
|
|
16
12
|
|
|
13
|
+
import {
|
|
14
|
+
AttachmentCommandNativePickerItem,
|
|
15
|
+
AttachmentCommandPickerItem,
|
|
16
|
+
} from '../AttachmentPickerContent';
|
|
17
|
+
|
|
17
18
|
jest.mock('../AttachmentMediaPicker/AttachmentMediaPicker', () => ({
|
|
18
19
|
AttachmentMediaPicker: () => null,
|
|
19
20
|
}));
|
|
20
21
|
|
|
22
|
+
const mockNotifyCommandDisabled = jest.mocked(notifyCommandDisabled);
|
|
21
23
|
const mockClose = jest.fn((callback?: () => void) => callback?.());
|
|
22
24
|
const mockFocus = jest.fn();
|
|
23
|
-
const mockIsCommandDisabled = jest.fn();
|
|
24
25
|
const mockSetCommand = jest.fn();
|
|
26
|
+
const mockMessageComposer = {
|
|
27
|
+
textComposer: { setCommand: mockSetCommand },
|
|
28
|
+
};
|
|
25
29
|
|
|
26
30
|
jest.mock('../../../../contexts', () => ({
|
|
27
31
|
useAttachmentPickerContext: jest.fn(() => ({
|
|
@@ -30,10 +34,7 @@ jest.mock('../../../../contexts', () => ({
|
|
|
30
34
|
useBottomSheetContext: jest.fn(() => ({
|
|
31
35
|
close: mockClose,
|
|
32
36
|
})),
|
|
33
|
-
useMessageComposer: jest.fn(() =>
|
|
34
|
-
isCommandDisabled: mockIsCommandDisabled,
|
|
35
|
-
textComposer: { setCommand: mockSetCommand },
|
|
36
|
-
})),
|
|
37
|
+
useMessageComposer: jest.fn(() => mockMessageComposer),
|
|
37
38
|
useMessageInputContext: jest.fn(() => ({
|
|
38
39
|
inputBoxRef: { current: { focus: mockFocus } },
|
|
39
40
|
})),
|
|
@@ -73,30 +74,30 @@ describe('AttachmentPickerContent commands', () => {
|
|
|
73
74
|
beforeEach(() => {
|
|
74
75
|
mockClose.mockClear();
|
|
75
76
|
mockFocus.mockClear();
|
|
76
|
-
|
|
77
|
+
mockNotifyCommandDisabled.mockReset();
|
|
77
78
|
mockSetCommand.mockClear();
|
|
78
79
|
});
|
|
79
80
|
|
|
80
|
-
it('does not focus the input when a disabled command is
|
|
81
|
-
|
|
81
|
+
it('does not focus the input when a disabled command notification is emitted', () => {
|
|
82
|
+
mockNotifyCommandDisabled.mockReturnValue(true);
|
|
82
83
|
|
|
83
84
|
render(<AttachmentCommandPickerItem item={command} />);
|
|
84
85
|
|
|
85
86
|
fireEvent.press(screen.getByText('ban'));
|
|
86
87
|
|
|
87
|
-
expect(
|
|
88
|
+
expect(mockNotifyCommandDisabled).toHaveBeenCalledWith(mockMessageComposer, command);
|
|
88
89
|
expect(mockSetCommand).not.toHaveBeenCalled();
|
|
89
90
|
expect(mockFocus).not.toHaveBeenCalled();
|
|
90
91
|
});
|
|
91
92
|
|
|
92
|
-
it('does not close the picker or focus the input when a disabled command is
|
|
93
|
-
|
|
93
|
+
it('does not close the picker or focus the input when a disabled command notification is emitted in native picker mode', () => {
|
|
94
|
+
mockNotifyCommandDisabled.mockReturnValue(true);
|
|
94
95
|
|
|
95
96
|
render(<AttachmentCommandNativePickerItem item={command} />);
|
|
96
97
|
|
|
97
98
|
fireEvent.press(screen.getByText('ban'));
|
|
98
99
|
|
|
99
|
-
expect(
|
|
100
|
+
expect(mockNotifyCommandDisabled).toHaveBeenCalledWith(mockMessageComposer, command);
|
|
100
101
|
expect(mockSetCommand).not.toHaveBeenCalled();
|
|
101
102
|
expect(mockClose).not.toHaveBeenCalled();
|
|
102
103
|
expect(mockFocus).not.toHaveBeenCalled();
|
|
@@ -118,6 +118,8 @@ import type { KeyboardCompatibleViewProps } from '../KeyboardCompatibleView/Keyb
|
|
|
118
118
|
import { Emoji } from '../MessageMenu/EmojiPickerList';
|
|
119
119
|
import { emojis } from '../MessageMenu/emojis';
|
|
120
120
|
import { toUnicodeScalarString } from '../MessageMenu/utils/toUnicodeScalarString';
|
|
121
|
+
import { getChannelNotificationHostId } from '../Notifications/notificationTarget';
|
|
122
|
+
import { NotificationTargetProvider } from '../Notifications/NotificationTargetContext';
|
|
121
123
|
|
|
122
124
|
export type MarkReadFunctionOptions = {
|
|
123
125
|
/**
|
|
@@ -352,6 +354,7 @@ export type ChannelPropsWithContext = Pick<ChannelContextValue, 'channel'> &
|
|
|
352
354
|
* Load the channel at a specified message instead of the most recent message.
|
|
353
355
|
*/
|
|
354
356
|
messageId?: string;
|
|
357
|
+
notificationHostId?: string;
|
|
355
358
|
/**
|
|
356
359
|
* @deprecated
|
|
357
360
|
* The time interval for throttling while updating the message state
|
|
@@ -1789,6 +1792,9 @@ export type ChannelProps = Partial<Omit<ChannelPropsWithContext, 'channel' | 'th
|
|
|
1789
1792
|
export const Channel = (props: PropsWithChildren<ChannelProps>) => {
|
|
1790
1793
|
const { client, enableOfflineSupport, isOnline, isMessageAIGenerated } = useChatContext();
|
|
1791
1794
|
const { t } = useTranslationContext();
|
|
1795
|
+
const notificationHostId =
|
|
1796
|
+
props.notificationHostId ??
|
|
1797
|
+
(props.channel?.cid ? getChannelNotificationHostId(props.channel.cid) : undefined);
|
|
1792
1798
|
|
|
1793
1799
|
const threadFromProps = props?.thread;
|
|
1794
1800
|
const threadInstance = (threadFromProps as ThreadType)?.threadInstance as Thread;
|
|
@@ -1808,7 +1814,7 @@ export const Channel = (props: PropsWithChildren<ChannelProps>) => {
|
|
|
1808
1814
|
props.threadList ? threadMessage?.id : undefined,
|
|
1809
1815
|
);
|
|
1810
1816
|
|
|
1811
|
-
|
|
1817
|
+
const channelWithContext = (
|
|
1812
1818
|
<ChannelWithContext
|
|
1813
1819
|
{...{
|
|
1814
1820
|
client,
|
|
@@ -1826,6 +1832,14 @@ export const Channel = (props: PropsWithChildren<ChannelProps>) => {
|
|
|
1826
1832
|
}}
|
|
1827
1833
|
/>
|
|
1828
1834
|
);
|
|
1835
|
+
|
|
1836
|
+
return notificationHostId ? (
|
|
1837
|
+
<NotificationTargetProvider hostId={notificationHostId} panel='channel'>
|
|
1838
|
+
{channelWithContext}
|
|
1839
|
+
</NotificationTargetProvider>
|
|
1840
|
+
) : (
|
|
1841
|
+
channelWithContext
|
|
1842
|
+
);
|
|
1829
1843
|
};
|
|
1830
1844
|
|
|
1831
1845
|
const useStyles = () => {
|
|
@@ -1,16 +1,30 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
|
|
1
3
|
import { act, cleanup, renderHook, waitFor } from '@testing-library/react-native';
|
|
2
4
|
import type { Channel as ChannelType, LocalMessage, StreamChat } from 'stream-chat';
|
|
3
5
|
|
|
6
|
+
import { ChatProvider } from '../../../contexts/chatContext/ChatContext';
|
|
4
7
|
import { getOrCreateChannelApi } from '../../../mock-builders/api/getOrCreateChannel';
|
|
5
8
|
import { useMockedApis } from '../../../mock-builders/api/useMockedApis';
|
|
6
9
|
import { generateChannelResponse } from '../../../mock-builders/generator/channel';
|
|
7
10
|
import { generateMessage } from '../../../mock-builders/generator/message';
|
|
8
11
|
import { generateUser } from '../../../mock-builders/generator/user';
|
|
9
12
|
import { getTestClientWithUser } from '../../../mock-builders/mock';
|
|
13
|
+
import { NotificationTargetProvider } from '../../Notifications/NotificationTargetContext';
|
|
10
14
|
import { channelInitialState } from '../hooks/useChannelDataState';
|
|
11
15
|
import * as ChannelStateHooks from '../hooks/useChannelDataState';
|
|
12
16
|
import { useMessageListPagination } from '../hooks/useMessageListPagination';
|
|
13
17
|
|
|
18
|
+
const createChatWrapper =
|
|
19
|
+
(client: StreamChat) =>
|
|
20
|
+
({ children }: PropsWithChildren) => (
|
|
21
|
+
<ChatProvider value={{ client } as never}>
|
|
22
|
+
<NotificationTargetProvider hostId='channel:messaging:general' panel='channel'>
|
|
23
|
+
{children}
|
|
24
|
+
</NotificationTargetProvider>
|
|
25
|
+
</ChatProvider>
|
|
26
|
+
);
|
|
27
|
+
|
|
14
28
|
describe('useMessageListPagination', () => {
|
|
15
29
|
let chatClient: StreamChat;
|
|
16
30
|
let channel: ChannelType;
|
|
@@ -618,7 +632,7 @@ describe('useMessageListPagination', () => {
|
|
|
618
632
|
};
|
|
619
633
|
|
|
620
634
|
// Mock query if needed
|
|
621
|
-
const queryMock = jest.fn();
|
|
635
|
+
const queryMock = jest.fn().mockResolvedValue({ messages: [] });
|
|
622
636
|
channel.query = queryMock as unknown as typeof channel.query;
|
|
623
637
|
|
|
624
638
|
// Set up mocks
|
|
@@ -626,9 +640,12 @@ describe('useMessageListPagination', () => {
|
|
|
626
640
|
mockedHook(channelInitialState, { jumpToMessageFinished: jumpToMessageFinishedMock });
|
|
627
641
|
const setChannelUnreadStateMock = jest.fn();
|
|
628
642
|
const setTargetedMessageIdMock = jest.fn((message) => message);
|
|
643
|
+
const addNotificationSpy = jest.spyOn(chatClient.notifications, 'add');
|
|
629
644
|
|
|
630
645
|
// Render hook
|
|
631
|
-
const { result } = renderHook(() => useMessageListPagination({ channel })
|
|
646
|
+
const { result } = renderHook(() => useMessageListPagination({ channel }), {
|
|
647
|
+
wrapper: createChatWrapper(chatClient),
|
|
648
|
+
});
|
|
632
649
|
|
|
633
650
|
// Act
|
|
634
651
|
await act(async () => {
|
|
@@ -642,6 +659,21 @@ describe('useMessageListPagination', () => {
|
|
|
642
659
|
// Assert
|
|
643
660
|
await waitFor(() => {
|
|
644
661
|
expect(queryMock).toHaveBeenCalledTimes(expectedQueryCalls);
|
|
662
|
+
if (expectedQueryCalls) {
|
|
663
|
+
expect(addNotificationSpy).toHaveBeenCalledWith({
|
|
664
|
+
message: 'Failed to jump to the first unread message',
|
|
665
|
+
options: {
|
|
666
|
+
originalError: expect.any(Error),
|
|
667
|
+
severity: 'error',
|
|
668
|
+
tags: ['target:channel:channel:messaging:general'],
|
|
669
|
+
type: 'channel:jumpToFirstUnread:failed',
|
|
670
|
+
},
|
|
671
|
+
origin: {
|
|
672
|
+
context: { feature: 'jumpToFirstUnread' },
|
|
673
|
+
emitter: 'Channel',
|
|
674
|
+
},
|
|
675
|
+
});
|
|
676
|
+
}
|
|
645
677
|
expect(jumpToMessageFinishedMock).toHaveBeenCalledTimes(
|
|
646
678
|
expectedJumpToMessageFinishedCalls,
|
|
647
679
|
);
|
|
@@ -6,8 +6,10 @@ import { Channel, ChannelState, MessageResponse } from 'stream-chat';
|
|
|
6
6
|
import { useChannelMessageDataState } from './useChannelDataState';
|
|
7
7
|
|
|
8
8
|
import { ChannelContextValue } from '../../../contexts/channelContext/ChannelContext';
|
|
9
|
+
import { useTranslationContext } from '../../../contexts/translationContext/TranslationContext';
|
|
9
10
|
import { useStableCallback } from '../../../hooks';
|
|
10
11
|
import { findInMessagesByDate, findInMessagesById } from '../../../utils/utils';
|
|
12
|
+
import { useNotificationApi } from '../../Notifications';
|
|
11
13
|
|
|
12
14
|
const defaultDebounceInterval = 500;
|
|
13
15
|
const debounceOptions = {
|
|
@@ -22,6 +24,8 @@ const debounceOptions = {
|
|
|
22
24
|
* @param channel The channel object for which the message list pagination is being handled.
|
|
23
25
|
*/
|
|
24
26
|
export const useMessageListPagination = ({ channel }: { channel: Channel }) => {
|
|
27
|
+
const { addNotification } = useNotificationApi();
|
|
28
|
+
const { t } = useTranslationContext();
|
|
25
29
|
const {
|
|
26
30
|
copyMessagesStateFromChannel,
|
|
27
31
|
jumpToLatestMessage,
|
|
@@ -180,6 +184,18 @@ export const useMessageListPagination = ({ channel }: { channel: Channel }) => {
|
|
|
180
184
|
},
|
|
181
185
|
);
|
|
182
186
|
|
|
187
|
+
const notifyJumpToFirstUnreadError = useStableCallback((error: unknown) => {
|
|
188
|
+
addNotification({
|
|
189
|
+
message: t('Failed to jump to the first unread message'),
|
|
190
|
+
options: {
|
|
191
|
+
...(error instanceof Error ? { originalError: error } : {}),
|
|
192
|
+
severity: 'error',
|
|
193
|
+
type: 'channel:jumpToFirstUnread:failed',
|
|
194
|
+
},
|
|
195
|
+
origin: { context: { feature: 'jumpToFirstUnread' }, emitter: 'Channel' },
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
|
|
183
199
|
/**
|
|
184
200
|
* Loads channel at first unread message.
|
|
185
201
|
*/
|
|
@@ -225,7 +241,7 @@ export const useMessageListPagination = ({ channel }: { channel: Channel }) => {
|
|
|
225
241
|
} catch (error) {
|
|
226
242
|
setLoading(false);
|
|
227
243
|
loadMoreFinished(channel.state.messagePagination.hasPrev, messagesState);
|
|
228
|
-
|
|
244
|
+
notifyJumpToFirstUnreadError(error);
|
|
229
245
|
return;
|
|
230
246
|
}
|
|
231
247
|
|
|
@@ -275,7 +291,7 @@ export const useMessageListPagination = ({ channel }: { channel: Channel }) => {
|
|
|
275
291
|
} catch (error) {
|
|
276
292
|
setLoading(false);
|
|
277
293
|
loadMoreFinished(channel.state.messagePagination.hasPrev, channel.state.messages);
|
|
278
|
-
|
|
294
|
+
notifyJumpToFirstUnreadError(error);
|
|
279
295
|
return;
|
|
280
296
|
}
|
|
281
297
|
}
|
|
@@ -296,7 +312,7 @@ export const useMessageListPagination = ({ channel }: { channel: Channel }) => {
|
|
|
296
312
|
setTargetedMessage(firstUnreadMessageId);
|
|
297
313
|
}
|
|
298
314
|
} catch (error) {
|
|
299
|
-
|
|
315
|
+
notifyJumpToFirstUnreadError(error);
|
|
300
316
|
}
|
|
301
317
|
},
|
|
302
318
|
);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
2
2
|
|
|
3
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
4
|
import type { FlatList } from 'react-native-gesture-handler';
|
|
4
5
|
|
|
5
6
|
import {
|
|
@@ -21,8 +22,12 @@ import {
|
|
|
21
22
|
ChannelsProvider,
|
|
22
23
|
} from '../../contexts/channelsContext/ChannelsContext';
|
|
23
24
|
import { useChatContext } from '../../contexts/chatContext/ChatContext';
|
|
25
|
+
import { useComponentsContext } from '../../contexts/componentsContext/ComponentsContext';
|
|
24
26
|
import { SwipeRegistryProvider } from '../../contexts/swipeableContext/SwipeRegistryContext';
|
|
27
|
+
import { useLazyRef } from '../../hooks/useLazyRef';
|
|
25
28
|
import type { ChannelListEventListenerOptions } from '../../types/types';
|
|
29
|
+
import { generateRandomId } from '../../utils/utils';
|
|
30
|
+
import { NotificationTargetProvider } from '../Notifications/NotificationTargetContext';
|
|
26
31
|
|
|
27
32
|
export type ChannelListProps = Partial<
|
|
28
33
|
Pick<
|
|
@@ -206,6 +211,7 @@ export type ChannelListProps = Partial<
|
|
|
206
211
|
* - The return type has to be Channel[] (which is the return type of StreamChat.queryChannels)
|
|
207
212
|
*/
|
|
208
213
|
queryChannelsOverride?: QueryChannelsRequestType;
|
|
214
|
+
notificationHostId?: string;
|
|
209
215
|
};
|
|
210
216
|
|
|
211
217
|
const DEFAULT_FILTERS = {};
|
|
@@ -244,12 +250,16 @@ export const ChannelList = (props: ChannelListProps) => {
|
|
|
244
250
|
setFlatListRef,
|
|
245
251
|
sort = DEFAULT_SORT,
|
|
246
252
|
queryChannelsOverride,
|
|
253
|
+
notificationHostId: notificationHostIdProp,
|
|
247
254
|
mutedStatusPosition = 'inlineTitle',
|
|
248
255
|
swipeActionsEnabled = true,
|
|
249
256
|
} = props;
|
|
250
257
|
|
|
251
258
|
const [forceUpdate, setForceUpdate] = useState(0);
|
|
259
|
+
const fallbackNotificationHostIdRef = useLazyRef(() => `channel-list:${generateRandomId()}`);
|
|
260
|
+
const notificationHostId = notificationHostIdProp ?? fallbackNotificationHostIdRef.current;
|
|
252
261
|
const { client, enableOfflineSupport } = useChatContext();
|
|
262
|
+
const { NotificationList } = useComponentsContext();
|
|
253
263
|
const channelManager = useMemo(() => client.createChannelManager({}), [client]);
|
|
254
264
|
|
|
255
265
|
/**
|
|
@@ -368,10 +378,22 @@ export const ChannelList = (props: ChannelListProps) => {
|
|
|
368
378
|
});
|
|
369
379
|
|
|
370
380
|
return (
|
|
371
|
-
<
|
|
372
|
-
<
|
|
373
|
-
<
|
|
374
|
-
|
|
375
|
-
|
|
381
|
+
<NotificationTargetProvider hostId={notificationHostId} panel='channel-list'>
|
|
382
|
+
<ChannelsProvider value={channelsContext}>
|
|
383
|
+
<SwipeRegistryProvider>
|
|
384
|
+
<View style={styles.container}>
|
|
385
|
+
<ChannelListView />
|
|
386
|
+
<NotificationList />
|
|
387
|
+
</View>
|
|
388
|
+
</SwipeRegistryProvider>
|
|
389
|
+
</ChannelsProvider>
|
|
390
|
+
</NotificationTargetProvider>
|
|
376
391
|
);
|
|
377
392
|
};
|
|
393
|
+
|
|
394
|
+
const styles = StyleSheet.create({
|
|
395
|
+
container: {
|
|
396
|
+
backgroundColor: 'transparent',
|
|
397
|
+
flex: 1,
|
|
398
|
+
},
|
|
399
|
+
});
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import { cleanup, render, waitFor } from '@testing-library/react-native';
|
|
4
|
-
import type { StreamChat } from 'stream-chat';
|
|
4
|
+
import type { Channel, QueryChannelsRequestType, StreamChat } from 'stream-chat';
|
|
5
5
|
|
|
6
6
|
import type { ChannelsContextValue } from '../../../contexts/channelsContext/ChannelsContext';
|
|
7
7
|
import { ChannelsProvider } from '../../../contexts/channelsContext/ChannelsContext';
|
|
8
8
|
import { ChatContext, ChatProvider } from '../../../contexts/chatContext/ChatContext';
|
|
9
9
|
import { getOrCreateChannelApi } from '../../../mock-builders/api/getOrCreateChannel';
|
|
10
|
-
import { queryChannelsApi } from '../../../mock-builders/api/queryChannels';
|
|
11
10
|
import { useMockedApis } from '../../../mock-builders/api/useMockedApis';
|
|
12
11
|
import { generateChannelResponse } from '../../../mock-builders/generator/channel';
|
|
13
12
|
import { getTestClientWithUser } from '../../../mock-builders/mock';
|
|
@@ -16,6 +15,11 @@ import { ChannelList } from '../ChannelList';
|
|
|
16
15
|
import { ChannelListView } from '../ChannelListView';
|
|
17
16
|
|
|
18
17
|
let chatClient: StreamChat;
|
|
18
|
+
let defaultChannels: Channel[];
|
|
19
|
+
let queryChannelsResponse: Channel[];
|
|
20
|
+
|
|
21
|
+
const queryChannelsOverride: QueryChannelsRequestType = () =>
|
|
22
|
+
Promise.resolve(queryChannelsResponse);
|
|
19
23
|
|
|
20
24
|
/**
|
|
21
25
|
* Renders the full ChannelList (which now always uses ChannelListView internally).
|
|
@@ -31,6 +35,7 @@ const Component = () => (
|
|
|
31
35
|
$in: ['vishal', 'neil'],
|
|
32
36
|
},
|
|
33
37
|
}}
|
|
38
|
+
queryChannelsOverride={queryChannelsOverride}
|
|
34
39
|
/>
|
|
35
40
|
</ChatProvider>
|
|
36
41
|
)}
|
|
@@ -90,13 +95,19 @@ describe('ChannelListView', () => {
|
|
|
90
95
|
chatClient = await getTestClientWithUser({ id: 'vishal' });
|
|
91
96
|
const c1 = generateChannelResponse();
|
|
92
97
|
const c2 = generateChannelResponse();
|
|
93
|
-
useMockedApis(chatClient, [getOrCreateChannelApi(c1)
|
|
98
|
+
useMockedApis(chatClient, [getOrCreateChannelApi(c1)]);
|
|
94
99
|
const channel1 = chatClient.channel(c1.channel.type, c1.channel.id);
|
|
95
100
|
await channel1.watch();
|
|
101
|
+
useMockedApis(chatClient, [getOrCreateChannelApi(c2)]);
|
|
96
102
|
const channel2 = chatClient.channel(c2.channel.type, c2.channel.id);
|
|
97
103
|
await channel2.watch();
|
|
98
|
-
|
|
104
|
+
defaultChannels = [channel1, channel2];
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
beforeEach(() => {
|
|
108
|
+
queryChannelsResponse = defaultChannels;
|
|
99
109
|
});
|
|
110
|
+
|
|
100
111
|
afterEach(cleanup);
|
|
101
112
|
|
|
102
113
|
it('renders without crashing', async () => {
|
|
@@ -107,7 +118,7 @@ describe('ChannelListView', () => {
|
|
|
107
118
|
});
|
|
108
119
|
|
|
109
120
|
it('renders the `EmptyStateIndicator` when no channels are present', async () => {
|
|
110
|
-
|
|
121
|
+
queryChannelsResponse = [];
|
|
111
122
|
const { getByTestId } = render(<Component />);
|
|
112
123
|
await waitFor(() => {
|
|
113
124
|
expect(getByTestId('empty-channel-state-title')).toBeTruthy();
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
|
|
3
|
+
import { act, renderHook } from '@testing-library/react-native';
|
|
4
|
+
import type { Channel } from 'stream-chat';
|
|
5
|
+
|
|
6
|
+
import { ChatProvider } from '../../../../contexts/chatContext/ChatContext';
|
|
7
|
+
import { useChannelActions } from '../useChannelActions';
|
|
8
|
+
|
|
9
|
+
const createWrapper =
|
|
10
|
+
(client: unknown) =>
|
|
11
|
+
({ children }: PropsWithChildren) => (
|
|
12
|
+
<ChatProvider value={{ client } as never}>{children}</ChatProvider>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
const createClient = () => ({
|
|
16
|
+
blockUser: jest.fn(),
|
|
17
|
+
notifications: {
|
|
18
|
+
add: jest.fn(),
|
|
19
|
+
remove: jest.fn(),
|
|
20
|
+
startTimeout: jest.fn(),
|
|
21
|
+
},
|
|
22
|
+
muteUser: jest.fn(),
|
|
23
|
+
unBlockUser: jest.fn(),
|
|
24
|
+
unmuteUser: jest.fn(),
|
|
25
|
+
userID: 'current-user-id',
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const createChannel = (client: ReturnType<typeof createClient>) =>
|
|
29
|
+
({
|
|
30
|
+
archive: jest.fn(),
|
|
31
|
+
getClient: () => client,
|
|
32
|
+
mute: jest.fn(),
|
|
33
|
+
pin: jest.fn(),
|
|
34
|
+
removeMembers: jest.fn(),
|
|
35
|
+
state: {
|
|
36
|
+
members: {
|
|
37
|
+
current: { user: { id: 'current-user-id' } },
|
|
38
|
+
other: { user: { id: 'other-user-id', name: 'Other User' } },
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
unarchive: jest.fn(),
|
|
42
|
+
unmute: jest.fn(),
|
|
43
|
+
unpin: jest.fn(),
|
|
44
|
+
}) as unknown as Channel;
|
|
45
|
+
|
|
46
|
+
describe('useChannelActions', () => {
|
|
47
|
+
it('notifies when channel mute succeeds', async () => {
|
|
48
|
+
const client = createClient();
|
|
49
|
+
const channel = createChannel(client);
|
|
50
|
+
const { result } = renderHook(() => useChannelActions(channel), {
|
|
51
|
+
wrapper: createWrapper(client),
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
await act(async () => {
|
|
55
|
+
await result.current.muteChannel();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
expect(channel.mute).toHaveBeenCalledTimes(1);
|
|
59
|
+
expect(client.notifications.add).toHaveBeenCalledWith({
|
|
60
|
+
message: 'Channel muted',
|
|
61
|
+
options: {
|
|
62
|
+
severity: 'success',
|
|
63
|
+
type: 'api:channel:mute:success',
|
|
64
|
+
},
|
|
65
|
+
origin: {
|
|
66
|
+
context: { channel },
|
|
67
|
+
emitter: 'ChannelActions',
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('notifies when channel mute fails', async () => {
|
|
73
|
+
const error = new Error('mute failed');
|
|
74
|
+
const client = createClient();
|
|
75
|
+
const channel = createChannel(client);
|
|
76
|
+
jest.mocked(channel.mute).mockRejectedValue(error);
|
|
77
|
+
const { result } = renderHook(() => useChannelActions(channel), {
|
|
78
|
+
wrapper: createWrapper(client),
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
await act(async () => {
|
|
82
|
+
await result.current.muteChannel();
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
expect(client.notifications.add).toHaveBeenCalledWith({
|
|
86
|
+
message: 'Failed to update channel mute status',
|
|
87
|
+
options: {
|
|
88
|
+
originalError: error,
|
|
89
|
+
severity: 'error',
|
|
90
|
+
type: 'api:channel:mute:failed',
|
|
91
|
+
},
|
|
92
|
+
origin: {
|
|
93
|
+
context: { channel },
|
|
94
|
+
emitter: 'ChannelActions',
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('notifies when a direct channel user is blocked', async () => {
|
|
100
|
+
const client = createClient();
|
|
101
|
+
const channel = createChannel(client);
|
|
102
|
+
const { result } = renderHook(() => useChannelActions(channel), {
|
|
103
|
+
wrapper: createWrapper(client),
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
await act(async () => {
|
|
107
|
+
await result.current.blockUser();
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
expect(client.blockUser).toHaveBeenCalledWith('other-user-id');
|
|
111
|
+
expect(client.notifications.add).toHaveBeenCalledWith({
|
|
112
|
+
message: 'User blocked',
|
|
113
|
+
options: {
|
|
114
|
+
severity: 'success',
|
|
115
|
+
type: 'api:user:block:success',
|
|
116
|
+
},
|
|
117
|
+
origin: {
|
|
118
|
+
context: { channel },
|
|
119
|
+
emitter: 'ChannelActions',
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
});
|