stream-chat-react-native-core 10.0.0-rc.2 → 10.0.0-rc.4
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/lib/commonjs/ai-components/README.md +50 -2
- package/lib/commonjs/ai-components/index.js +24 -0
- package/lib/commonjs/ai-components/index.js.map +1 -1
- package/lib/commonjs/ai-components/message-composer/ComposerView.js +4 -2
- package/lib/commonjs/ai-components/message-composer/ComposerView.js.map +1 -1
- package/lib/commonjs/ai-components/message-composer/SpeechToTextButton.js +4 -1
- package/lib/commonjs/ai-components/message-composer/SpeechToTextButton.js.map +1 -1
- package/lib/commonjs/ai-components/native/AIDictation.js +6 -0
- package/lib/commonjs/ai-components/native/AIDictation.js.map +1 -1
- package/lib/commonjs/ai-components/store/dictation/store.js +4 -2
- package/lib/commonjs/ai-components/store/dictation/store.js.map +1 -1
- package/lib/commonjs/ai-components/store/dictation/useDictationState.js +4 -2
- package/lib/commonjs/ai-components/store/dictation/useDictationState.js.map +1 -1
- package/lib/commonjs/ai-components/store/index.js +22 -0
- package/lib/commonjs/ai-components/store/index.js.map +1 -1
- package/lib/commonjs/ai-components/theme.js +3 -0
- package/lib/commonjs/ai-components/theme.js.map +1 -1
- package/lib/commonjs/ai-components/transcription/useDictation.js +7 -3
- package/lib/commonjs/ai-components/transcription/useDictation.js.map +1 -1
- package/lib/commonjs/ai-components/transcription/useDictationAudioLevel.js +32 -0
- package/lib/commonjs/ai-components/transcription/useDictationAudioLevel.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/VoiceGlow.js +79 -0
- package/lib/commonjs/ai-components/voice-visualization/VoiceGlow.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/VoiceVisualizationView.js +147 -0
- package/lib/commonjs/ai-components/voice-visualization/VoiceVisualizationView.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/VoiceWave.js +58 -0
- package/lib/commonjs/ai-components/voice-visualization/VoiceWave.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/bounce.js +60 -0
- package/lib/commonjs/ai-components/voice-visualization/bounce.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/driver.js +208 -0
- package/lib/commonjs/ai-components/voice-visualization/driver.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/glowShader.js +218 -0
- package/lib/commonjs/ai-components/voice-visualization/glowShader.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/index.js +18 -0
- package/lib/commonjs/ai-components/voice-visualization/index.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/math.js +70 -0
- package/lib/commonjs/ai-components/voice-visualization/math.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/palette.js +47 -0
- package/lib/commonjs/ai-components/voice-visualization/palette.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/simplex.js +77 -0
- package/lib/commonjs/ai-components/voice-visualization/simplex.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/styles.js +33 -0
- package/lib/commonjs/ai-components/voice-visualization/styles.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/types.js +4 -0
- package/lib/commonjs/ai-components/voice-visualization/types.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/useReduceMotion.js +28 -0
- package/lib/commonjs/ai-components/voice-visualization/useReduceMotion.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/useVoiceVisualization.js +129 -0
- package/lib/commonjs/ai-components/voice-visualization/useVoiceVisualization.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/waveGeometry.js +124 -0
- package/lib/commonjs/ai-components/voice-visualization/waveGeometry.js.map +1 -0
- package/lib/commonjs/components/Channel/Channel.js +1 -0
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/ChannelShell.js +8 -1
- package/lib/commonjs/components/Channel/ChannelShell.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useChannelLifecycle.js +2 -1
- package/lib/commonjs/components/Channel/hooks/useChannelLifecycle.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useJumpToLatestOnOpen.js +26 -0
- package/lib/commonjs/components/Channel/hooks/useJumpToLatestOnOpen.js.map +1 -0
- package/lib/commonjs/components/ChannelDetails/components/members/ChannelMemberItem.js +1 -1
- package/lib/commonjs/components/ChannelDetails/components/members/ChannelMemberItem.js.map +1 -1
- package/lib/commonjs/components/ChannelDetails/hooks/useChannelDetailsMemberStatusText.js +1 -1
- package/lib/commonjs/components/ChannelDetails/hooks/useChannelDetailsMemberStatusText.js.map +1 -1
- package/lib/commonjs/components/ChannelList/ChannelListView.js +0 -2
- package/lib/commonjs/components/ChannelList/ChannelListView.js.map +1 -1
- package/lib/commonjs/components/ChannelList/hooks/usePaginatedChannels.js +2 -2
- package/lib/commonjs/components/ChannelList/hooks/usePaginatedChannels.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelDetailsBottomSheet.js +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelDetailsBottomSheet.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelLastMessagePreview.js +1 -0
- package/lib/commonjs/components/ChannelPreview/ChannelLastMessagePreview.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelMessagePreviewDeliveryStatus.js +2 -0
- package/lib/commonjs/components/ChannelPreview/ChannelMessagePreviewDeliveryStatus.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewTitle.js +1 -0
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewTitle.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewView.js +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewView.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewData.js +5 -5
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewData.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js +1 -1
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayPresence.js +1 -1
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayPresence.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewPollLabel.js +4 -1
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewPollLabel.js.map +1 -1
- package/lib/commonjs/components/Chat/hooks/useConnectionLifecycle.js +6 -2
- package/lib/commonjs/components/Chat/hooks/useConnectionLifecycle.js.map +1 -1
- package/lib/commonjs/components/Indicators/LoadingErrorIndicator.js +5 -0
- package/lib/commonjs/components/Indicators/LoadingErrorIndicator.js.map +1 -1
- package/lib/commonjs/components/Message/Message.js +1 -1
- package/lib/commonjs/components/Message/Message.js.map +1 -1
- package/lib/commonjs/components/Message/MessageItemView/MessageStatus.js +4 -0
- package/lib/commonjs/components/Message/MessageItemView/MessageStatus.js.map +1 -1
- package/lib/commonjs/components/Message/MessageItemView/MessageWrapper.js +7 -4
- package/lib/commonjs/components/Message/MessageItemView/MessageWrapper.js.map +1 -1
- package/lib/commonjs/components/Message/hooks/useCreateMessageActionHandlers.js +3 -3
- package/lib/commonjs/components/Message/hooks/useCreateMessageActionHandlers.js.map +1 -1
- package/lib/commonjs/components/Message/hooks/useProcessReactions.js +2 -2
- package/lib/commonjs/components/Message/hooks/useProcessReactions.js.map +1 -1
- package/lib/commonjs/components/Message/hooks/useUserMuteActive.js +1 -1
- package/lib/commonjs/components/Message/hooks/useUserMuteActive.js.map +1 -1
- package/lib/commonjs/components/MessageInput/MessageComposer.js +2 -1
- package/lib/commonjs/components/MessageInput/MessageComposer.js.map +1 -1
- package/lib/commonjs/components/MessageList/MessageFlashList.js +2 -2
- package/lib/commonjs/components/MessageList/MessageFlashList.js.map +1 -1
- package/lib/commonjs/components/MessageList/MessageList.js +2 -2
- package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
- package/lib/commonjs/components/MessageList/hooks/useOwnUnreadCount.js +1 -1
- package/lib/commonjs/components/MessageList/hooks/useOwnUnreadCount.js.map +1 -1
- package/lib/commonjs/components/MessageMenu/MessageUserReactionsItem.js +1 -1
- package/lib/commonjs/components/MessageMenu/MessageUserReactionsItem.js.map +1 -1
- package/lib/commonjs/components/MessageMenu/hooks/useMessageOwnReactions.js +2 -2
- package/lib/commonjs/components/MessageMenu/hooks/useMessageOwnReactions.js.map +1 -1
- package/lib/commonjs/components/Poll/components/PollAnswersList.js +1 -1
- package/lib/commonjs/components/Poll/components/PollAnswersList.js.map +1 -1
- package/lib/commonjs/components/Poll/components/PollButtons.js +1 -1
- package/lib/commonjs/components/Poll/components/PollButtons.js.map +1 -1
- package/lib/commonjs/components/Poll/hook/useIsPollCreatedByCurrentUser.js +1 -1
- package/lib/commonjs/components/Poll/hook/useIsPollCreatedByCurrentUser.js.map +1 -1
- package/lib/commonjs/components/Thread/Thread.js +1 -1
- package/lib/commonjs/components/Thread/Thread.js.map +1 -1
- package/lib/commonjs/components/ThreadList/ThreadListItem.js +1 -1
- package/lib/commonjs/components/ThreadList/ThreadListItem.js.map +1 -1
- package/lib/commonjs/components/ThreadList/ThreadListUnreadBanner.js +9 -2
- package/lib/commonjs/components/ThreadList/ThreadListUnreadBanner.js.map +1 -1
- package/lib/commonjs/components/index.js +36 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/contexts/componentsContext/defaultComponents.js +0 -2
- package/lib/commonjs/contexts/componentsContext/defaultComponents.js.map +1 -1
- package/lib/commonjs/contexts/liveLocationManagerContext/LiveLocationManagerContext.js +1 -1
- package/lib/commonjs/contexts/liveLocationManagerContext/LiveLocationManagerContext.js.map +1 -1
- package/lib/commonjs/hooks/actions/useChannelActionItems.js +1 -1
- package/lib/commonjs/hooks/actions/useChannelActionItems.js.map +1 -1
- package/lib/commonjs/hooks/actions/useChannelActions.js +2 -2
- package/lib/commonjs/hooks/actions/useChannelActions.js.map +1 -1
- package/lib/commonjs/hooks/actions/useChannelMemberActionItems.js +1 -1
- package/lib/commonjs/hooks/actions/useChannelMemberActionItems.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/messagePreview/useMessageDeliveryStatus.js +6 -6
- package/lib/commonjs/hooks/messagePreview/useMessageDeliveryStatus.js.map +1 -1
- package/lib/commonjs/hooks/useIsDirectChat.js +1 -1
- package/lib/commonjs/hooks/useIsDirectChat.js.map +1 -1
- package/lib/commonjs/i18n/runtimeDefaults.js +1 -0
- package/lib/commonjs/i18n/runtimeDefaults.js.map +1 -1
- package/lib/commonjs/store/apis/getChannelMessages.js +5 -3
- package/lib/commonjs/store/apis/getChannelMessages.js.map +1 -1
- package/lib/commonjs/store/apis/getChannels.js +6 -3
- package/lib/commonjs/store/apis/getChannels.js.map +1 -1
- package/lib/commonjs/store/apis/getChannelsForFilterSort.js +2 -1
- package/lib/commonjs/store/apis/getChannelsForFilterSort.js.map +1 -1
- package/lib/commonjs/store/apis/queries/selectMessagesForChannels.js +7 -5
- package/lib/commonjs/store/apis/queries/selectMessagesForChannels.js.map +1 -1
- package/lib/commonjs/utils/installNativeMultipartAdapter.js.map +1 -1
- package/lib/commonjs/utils/setupCommandUIMiddlewares.js +6 -3
- package/lib/commonjs/utils/setupCommandUIMiddlewares.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/ai-components/README.md +50 -2
- package/lib/module/ai-components/index.js +24 -0
- package/lib/module/ai-components/index.js.map +1 -1
- package/lib/module/ai-components/message-composer/ComposerView.js +4 -2
- package/lib/module/ai-components/message-composer/ComposerView.js.map +1 -1
- package/lib/module/ai-components/message-composer/SpeechToTextButton.js +4 -1
- package/lib/module/ai-components/message-composer/SpeechToTextButton.js.map +1 -1
- package/lib/module/ai-components/native/AIDictation.js +6 -0
- package/lib/module/ai-components/native/AIDictation.js.map +1 -1
- package/lib/module/ai-components/store/dictation/store.js +4 -2
- package/lib/module/ai-components/store/dictation/store.js.map +1 -1
- package/lib/module/ai-components/store/dictation/useDictationState.js +4 -2
- package/lib/module/ai-components/store/dictation/useDictationState.js.map +1 -1
- package/lib/module/ai-components/store/index.js +22 -0
- package/lib/module/ai-components/store/index.js.map +1 -1
- package/lib/module/ai-components/theme.js +3 -0
- package/lib/module/ai-components/theme.js.map +1 -1
- package/lib/module/ai-components/transcription/useDictation.js +7 -3
- package/lib/module/ai-components/transcription/useDictation.js.map +1 -1
- package/lib/module/ai-components/transcription/useDictationAudioLevel.js +32 -0
- package/lib/module/ai-components/transcription/useDictationAudioLevel.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/VoiceGlow.js +79 -0
- package/lib/module/ai-components/voice-visualization/VoiceGlow.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/VoiceVisualizationView.js +147 -0
- package/lib/module/ai-components/voice-visualization/VoiceVisualizationView.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/VoiceWave.js +58 -0
- package/lib/module/ai-components/voice-visualization/VoiceWave.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/bounce.js +60 -0
- package/lib/module/ai-components/voice-visualization/bounce.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/driver.js +208 -0
- package/lib/module/ai-components/voice-visualization/driver.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/glowShader.js +218 -0
- package/lib/module/ai-components/voice-visualization/glowShader.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/index.js +18 -0
- package/lib/module/ai-components/voice-visualization/index.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/math.js +70 -0
- package/lib/module/ai-components/voice-visualization/math.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/palette.js +47 -0
- package/lib/module/ai-components/voice-visualization/palette.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/simplex.js +77 -0
- package/lib/module/ai-components/voice-visualization/simplex.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/styles.js +33 -0
- package/lib/module/ai-components/voice-visualization/styles.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/types.js +4 -0
- package/lib/module/ai-components/voice-visualization/types.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/useReduceMotion.js +28 -0
- package/lib/module/ai-components/voice-visualization/useReduceMotion.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/useVoiceVisualization.js +129 -0
- package/lib/module/ai-components/voice-visualization/useVoiceVisualization.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/waveGeometry.js +124 -0
- package/lib/module/ai-components/voice-visualization/waveGeometry.js.map +1 -0
- package/lib/module/components/Channel/Channel.js +1 -0
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/ChannelShell.js +8 -1
- package/lib/module/components/Channel/ChannelShell.js.map +1 -1
- package/lib/module/components/Channel/hooks/useChannelLifecycle.js +2 -1
- package/lib/module/components/Channel/hooks/useChannelLifecycle.js.map +1 -1
- package/lib/module/components/Channel/hooks/useJumpToLatestOnOpen.js +26 -0
- package/lib/module/components/Channel/hooks/useJumpToLatestOnOpen.js.map +1 -0
- package/lib/module/components/ChannelDetails/components/members/ChannelMemberItem.js +1 -1
- package/lib/module/components/ChannelDetails/components/members/ChannelMemberItem.js.map +1 -1
- package/lib/module/components/ChannelDetails/hooks/useChannelDetailsMemberStatusText.js +1 -1
- package/lib/module/components/ChannelDetails/hooks/useChannelDetailsMemberStatusText.js.map +1 -1
- package/lib/module/components/ChannelList/ChannelListView.js +0 -2
- package/lib/module/components/ChannelList/ChannelListView.js.map +1 -1
- package/lib/module/components/ChannelList/hooks/usePaginatedChannels.js +2 -2
- package/lib/module/components/ChannelList/hooks/usePaginatedChannels.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelDetailsBottomSheet.js +1 -1
- package/lib/module/components/ChannelPreview/ChannelDetailsBottomSheet.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelLastMessagePreview.js +1 -0
- package/lib/module/components/ChannelPreview/ChannelLastMessagePreview.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelMessagePreviewDeliveryStatus.js +2 -0
- package/lib/module/components/ChannelPreview/ChannelMessagePreviewDeliveryStatus.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreviewTitle.js +1 -0
- package/lib/module/components/ChannelPreview/ChannelPreviewTitle.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreviewView.js +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreviewView.js.map +1 -1
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewData.js +5 -5
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewData.js.map +1 -1
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js +1 -1
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js.map +1 -1
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayPresence.js +1 -1
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayPresence.js.map +1 -1
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewPollLabel.js +4 -1
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewPollLabel.js.map +1 -1
- package/lib/module/components/Chat/hooks/useConnectionLifecycle.js +6 -2
- package/lib/module/components/Chat/hooks/useConnectionLifecycle.js.map +1 -1
- package/lib/module/components/Indicators/LoadingErrorIndicator.js +5 -0
- package/lib/module/components/Indicators/LoadingErrorIndicator.js.map +1 -1
- package/lib/module/components/Message/Message.js +1 -1
- package/lib/module/components/Message/Message.js.map +1 -1
- package/lib/module/components/Message/MessageItemView/MessageStatus.js +4 -0
- package/lib/module/components/Message/MessageItemView/MessageStatus.js.map +1 -1
- package/lib/module/components/Message/MessageItemView/MessageWrapper.js +7 -4
- package/lib/module/components/Message/MessageItemView/MessageWrapper.js.map +1 -1
- package/lib/module/components/Message/hooks/useCreateMessageActionHandlers.js +3 -3
- package/lib/module/components/Message/hooks/useCreateMessageActionHandlers.js.map +1 -1
- package/lib/module/components/Message/hooks/useProcessReactions.js +2 -2
- package/lib/module/components/Message/hooks/useProcessReactions.js.map +1 -1
- package/lib/module/components/Message/hooks/useUserMuteActive.js +1 -1
- package/lib/module/components/Message/hooks/useUserMuteActive.js.map +1 -1
- package/lib/module/components/MessageInput/MessageComposer.js +2 -1
- package/lib/module/components/MessageInput/MessageComposer.js.map +1 -1
- package/lib/module/components/MessageList/MessageFlashList.js +2 -2
- package/lib/module/components/MessageList/MessageFlashList.js.map +1 -1
- package/lib/module/components/MessageList/MessageList.js +2 -2
- package/lib/module/components/MessageList/MessageList.js.map +1 -1
- package/lib/module/components/MessageList/hooks/useOwnUnreadCount.js +1 -1
- package/lib/module/components/MessageList/hooks/useOwnUnreadCount.js.map +1 -1
- package/lib/module/components/MessageMenu/MessageUserReactionsItem.js +1 -1
- package/lib/module/components/MessageMenu/MessageUserReactionsItem.js.map +1 -1
- package/lib/module/components/MessageMenu/hooks/useMessageOwnReactions.js +2 -2
- package/lib/module/components/MessageMenu/hooks/useMessageOwnReactions.js.map +1 -1
- package/lib/module/components/Poll/components/PollAnswersList.js +1 -1
- package/lib/module/components/Poll/components/PollAnswersList.js.map +1 -1
- package/lib/module/components/Poll/components/PollButtons.js +1 -1
- package/lib/module/components/Poll/components/PollButtons.js.map +1 -1
- package/lib/module/components/Poll/hook/useIsPollCreatedByCurrentUser.js +1 -1
- package/lib/module/components/Poll/hook/useIsPollCreatedByCurrentUser.js.map +1 -1
- package/lib/module/components/Thread/Thread.js +1 -1
- package/lib/module/components/Thread/Thread.js.map +1 -1
- package/lib/module/components/ThreadList/ThreadListItem.js +1 -1
- package/lib/module/components/ThreadList/ThreadListItem.js.map +1 -1
- package/lib/module/components/ThreadList/ThreadListUnreadBanner.js +9 -2
- package/lib/module/components/ThreadList/ThreadListUnreadBanner.js.map +1 -1
- package/lib/module/components/index.js +36 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/contexts/componentsContext/defaultComponents.js +0 -2
- package/lib/module/contexts/componentsContext/defaultComponents.js.map +1 -1
- package/lib/module/contexts/liveLocationManagerContext/LiveLocationManagerContext.js +1 -1
- package/lib/module/contexts/liveLocationManagerContext/LiveLocationManagerContext.js.map +1 -1
- package/lib/module/hooks/actions/useChannelActionItems.js +1 -1
- package/lib/module/hooks/actions/useChannelActionItems.js.map +1 -1
- package/lib/module/hooks/actions/useChannelActions.js +2 -2
- package/lib/module/hooks/actions/useChannelActions.js.map +1 -1
- package/lib/module/hooks/actions/useChannelMemberActionItems.js +1 -1
- package/lib/module/hooks/actions/useChannelMemberActionItems.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/messagePreview/useMessageDeliveryStatus.js +6 -6
- package/lib/module/hooks/messagePreview/useMessageDeliveryStatus.js.map +1 -1
- package/lib/module/hooks/useIsDirectChat.js +1 -1
- package/lib/module/hooks/useIsDirectChat.js.map +1 -1
- package/lib/module/i18n/runtimeDefaults.js +1 -0
- package/lib/module/i18n/runtimeDefaults.js.map +1 -1
- package/lib/module/store/apis/getChannelMessages.js +5 -3
- package/lib/module/store/apis/getChannelMessages.js.map +1 -1
- package/lib/module/store/apis/getChannels.js +6 -3
- package/lib/module/store/apis/getChannels.js.map +1 -1
- package/lib/module/store/apis/getChannelsForFilterSort.js +2 -1
- package/lib/module/store/apis/getChannelsForFilterSort.js.map +1 -1
- package/lib/module/store/apis/queries/selectMessagesForChannels.js +7 -5
- package/lib/module/store/apis/queries/selectMessagesForChannels.js.map +1 -1
- package/lib/module/utils/installNativeMultipartAdapter.js.map +1 -1
- package/lib/module/utils/setupCommandUIMiddlewares.js +6 -3
- package/lib/module/utils/setupCommandUIMiddlewares.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/ai-components/index.d.ts +3 -1
- package/lib/typescript/ai-components/index.d.ts.map +1 -1
- package/lib/typescript/ai-components/message-composer/ComposerView.d.ts.map +1 -1
- package/lib/typescript/ai-components/native/AIDictation.d.ts +6 -0
- package/lib/typescript/ai-components/native/AIDictation.d.ts.map +1 -1
- package/lib/typescript/ai-components/store/dictation/store.d.ts +7 -0
- package/lib/typescript/ai-components/store/dictation/store.d.ts.map +1 -1
- package/lib/typescript/ai-components/store/dictation/useDictationState.d.ts +1 -0
- package/lib/typescript/ai-components/store/dictation/useDictationState.d.ts.map +1 -1
- package/lib/typescript/ai-components/store/index.d.ts +2 -0
- package/lib/typescript/ai-components/store/index.d.ts.map +1 -1
- package/lib/typescript/ai-components/theme.d.ts +13 -0
- package/lib/typescript/ai-components/theme.d.ts.map +1 -1
- package/lib/typescript/ai-components/transcription/useDictation.d.ts +9 -1
- package/lib/typescript/ai-components/transcription/useDictation.d.ts.map +1 -1
- package/lib/typescript/ai-components/transcription/useDictationAudioLevel.d.ts +11 -0
- package/lib/typescript/ai-components/transcription/useDictationAudioLevel.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/VoiceGlow.d.ts +13 -0
- package/lib/typescript/ai-components/voice-visualization/VoiceGlow.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/VoiceVisualizationView.d.ts +26 -0
- package/lib/typescript/ai-components/voice-visualization/VoiceVisualizationView.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/VoiceWave.d.ts +13 -0
- package/lib/typescript/ai-components/voice-visualization/VoiceWave.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/bounce.d.ts +20 -0
- package/lib/typescript/ai-components/voice-visualization/bounce.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/driver.d.ts +96 -0
- package/lib/typescript/ai-components/voice-visualization/driver.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/glowShader.d.ts +7 -0
- package/lib/typescript/ai-components/voice-visualization/glowShader.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/index.d.ts +4 -0
- package/lib/typescript/ai-components/voice-visualization/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/math.d.ts +26 -0
- package/lib/typescript/ai-components/voice-visualization/math.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/palette.d.ts +18 -0
- package/lib/typescript/ai-components/voice-visualization/palette.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/simplex.d.ts +11 -0
- package/lib/typescript/ai-components/voice-visualization/simplex.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/styles.d.ts +24 -0
- package/lib/typescript/ai-components/voice-visualization/styles.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/types.d.ts +45 -0
- package/lib/typescript/ai-components/voice-visualization/types.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/useReduceMotion.d.ts +10 -0
- package/lib/typescript/ai-components/voice-visualization/useReduceMotion.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/useVoiceVisualization.d.ts +18 -0
- package/lib/typescript/ai-components/voice-visualization/useVoiceVisualization.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/waveGeometry.d.ts +25 -0
- package/lib/typescript/ai-components/voice-visualization/waveGeometry.d.ts.map +1 -0
- package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
- package/lib/typescript/components/Channel/ChannelShell.d.ts +2 -0
- package/lib/typescript/components/Channel/ChannelShell.d.ts.map +1 -1
- package/lib/typescript/components/Channel/hooks/useChannelLifecycle.d.ts.map +1 -1
- package/lib/typescript/components/Channel/hooks/useJumpToLatestOnOpen.d.ts +15 -0
- package/lib/typescript/components/Channel/hooks/useJumpToLatestOnOpen.d.ts.map +1 -0
- package/lib/typescript/components/ChannelList/ChannelListView.d.ts +1 -1
- package/lib/typescript/components/ChannelList/ChannelListView.d.ts.map +1 -1
- package/lib/typescript/components/ChannelPreview/ChannelMessagePreviewDeliveryStatus.d.ts.map +1 -1
- package/lib/typescript/components/ChannelPreview/hooks/useChannelPreviewData.d.ts.map +1 -1
- package/lib/typescript/components/Chat/hooks/useConnectionLifecycle.d.ts +5 -4
- package/lib/typescript/components/Chat/hooks/useConnectionLifecycle.d.ts.map +1 -1
- package/lib/typescript/components/Indicators/LoadingErrorIndicator.d.ts +1 -1
- package/lib/typescript/components/Indicators/LoadingErrorIndicator.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageItemView/MessageStatus.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageItemView/MessageWrapper.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/MessageComposer.d.ts.map +1 -1
- package/lib/typescript/components/ThreadList/ThreadListUnreadBanner.d.ts.map +1 -1
- package/lib/typescript/components/index.d.ts +3 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/contexts/componentsContext/defaultComponents.d.ts +0 -1
- package/lib/typescript/contexts/componentsContext/defaultComponents.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/messagePreview/useMessageDeliveryStatus.d.ts +3 -0
- package/lib/typescript/hooks/messagePreview/useMessageDeliveryStatus.d.ts.map +1 -1
- package/lib/typescript/i18n/keys.d.ts +3 -1
- package/lib/typescript/i18n/keys.d.ts.map +1 -1
- package/lib/typescript/i18n/runtimeDefaults.d.ts +1 -0
- package/lib/typescript/i18n/runtimeDefaults.d.ts.map +1 -1
- package/lib/typescript/store/apis/getChannelMessages.d.ts +2 -1
- package/lib/typescript/store/apis/getChannelMessages.d.ts.map +1 -1
- package/lib/typescript/store/apis/getChannels.d.ts +3 -1
- package/lib/typescript/store/apis/getChannels.d.ts.map +1 -1
- package/lib/typescript/store/apis/getChannelsForFilterSort.d.ts.map +1 -1
- package/lib/typescript/store/apis/queries/selectMessagesForChannels.d.ts +3 -1
- package/lib/typescript/store/apis/queries/selectMessagesForChannels.d.ts.map +1 -1
- package/lib/typescript/utils/installNativeMultipartAdapter.d.ts +5 -3
- package/lib/typescript/utils/installNativeMultipartAdapter.d.ts.map +1 -1
- package/lib/typescript/utils/setupCommandUIMiddlewares.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/__tests__/offline-support/offline-feature.tsx +7 -7
- package/src/__tests__/offline-support/optimistic-update.tsx +5 -5
- package/src/ai-components/README.md +50 -2
- package/src/ai-components/__tests__/VoiceVisualization.test.tsx +208 -0
- package/src/ai-components/__tests__/dictation.test.tsx +58 -1
- package/src/ai-components/__tests__/voiceDriver.test.ts +317 -0
- package/src/ai-components/__tests__/voicePalette.test.ts +124 -0
- package/src/ai-components/index.ts +3 -1
- package/src/ai-components/message-composer/ComposerView.tsx +6 -3
- package/src/ai-components/message-composer/SpeechToTextButton.tsx +5 -2
- package/src/ai-components/native/AIDictation.ts +11 -0
- package/src/ai-components/store/dictation/store.ts +9 -0
- package/src/ai-components/store/dictation/useDictationState.ts +2 -1
- package/src/ai-components/store/index.ts +2 -0
- package/src/ai-components/theme.ts +16 -0
- package/src/ai-components/transcription/useDictation.ts +16 -3
- package/src/ai-components/transcription/useDictationAudioLevel.ts +38 -0
- package/src/ai-components/voice-visualization/VoiceGlow.tsx +79 -0
- package/src/ai-components/voice-visualization/VoiceVisualizationView.tsx +179 -0
- package/src/ai-components/voice-visualization/VoiceWave.tsx +67 -0
- package/src/ai-components/voice-visualization/bounce.ts +61 -0
- package/src/ai-components/voice-visualization/driver.ts +240 -0
- package/src/ai-components/voice-visualization/glowShader.ts +227 -0
- package/src/ai-components/voice-visualization/index.ts +3 -0
- package/src/ai-components/voice-visualization/math.ts +73 -0
- package/src/ai-components/voice-visualization/palette.ts +59 -0
- package/src/ai-components/voice-visualization/simplex.ts +92 -0
- package/src/ai-components/voice-visualization/styles.ts +42 -0
- package/src/ai-components/voice-visualization/types.ts +44 -0
- package/src/ai-components/voice-visualization/useReduceMotion.ts +34 -0
- package/src/ai-components/voice-visualization/useVoiceVisualization.ts +153 -0
- package/src/ai-components/voice-visualization/waveGeometry.ts +137 -0
- package/src/components/Channel/Channel.tsx +1 -0
- package/src/components/Channel/ChannelShell.tsx +12 -0
- package/src/components/Channel/__tests__/Channel.test.tsx +146 -5
- package/src/components/Channel/hooks/useChannelLifecycle.ts +4 -1
- package/src/components/Channel/hooks/useJumpToLatestOnOpen.ts +42 -0
- package/src/components/ChannelDetails/__tests__/ChannelDetails.test.tsx +1 -1
- package/src/components/ChannelDetails/__tests__/ChannelDetailsActionsSection.test.tsx +1 -1
- package/src/components/ChannelDetails/__tests__/ChannelDetailsEditButton.test.tsx +1 -1
- package/src/components/ChannelDetails/__tests__/ChannelDetailsMemberSection.test.tsx +1 -1
- package/src/components/ChannelDetails/__tests__/ChannelDetailsNavHeader.test.tsx +1 -1
- package/src/components/ChannelDetails/__tests__/ChannelDetailsProfile.test.tsx +2 -2
- package/src/components/ChannelDetails/__tests__/ChannelEditDetailsForm.test.tsx +1 -1
- package/src/components/ChannelDetails/__tests__/ChannelEditDetailsFormContent.test.tsx +2 -2
- package/src/components/ChannelDetails/__tests__/ChannelEditName.test.tsx +1 -1
- package/src/components/ChannelDetails/__tests__/members/ChannelAddMembersForm.test.tsx +1 -1
- package/src/components/ChannelDetails/__tests__/members/ChannelMemberActionsSheet.test.tsx +2 -2
- package/src/components/ChannelDetails/__tests__/members/ChannelMemberItem.test.tsx +1 -1
- package/src/components/ChannelDetails/__tests__/useChannelDetailsMemberStatusText.test.tsx +1 -1
- package/src/components/ChannelDetails/components/members/ChannelMemberItem.tsx +1 -1
- package/src/components/ChannelDetails/hooks/useChannelDetailsMemberStatusText.ts +1 -1
- package/src/components/ChannelList/ChannelListView.tsx +1 -3
- package/src/components/ChannelList/__tests__/ChannelList.test.tsx +72 -0
- package/src/components/ChannelList/hooks/usePaginatedChannels.ts +2 -2
- package/src/components/ChannelPreview/ChannelDetailsBottomSheet.tsx +1 -1
- package/src/components/ChannelPreview/ChannelLastMessagePreview.tsx +1 -1
- package/src/components/ChannelPreview/ChannelMessagePreviewDeliveryStatus.tsx +8 -2
- package/src/components/ChannelPreview/ChannelPreviewTitle.tsx +1 -1
- package/src/components/ChannelPreview/ChannelPreviewView.tsx +1 -1
- package/src/components/ChannelPreview/__tests__/ChannelPreview.test.tsx +4 -4
- package/src/components/ChannelPreview/__tests__/ChannelPreviewView.test.tsx +40 -0
- package/src/components/ChannelPreview/hooks/__tests__/useChannelPreviewData.test.tsx +51 -0
- package/src/components/ChannelPreview/hooks/__tests__/useChannelPreviewDisplayName.test.tsx +1 -1
- package/src/components/ChannelPreview/hooks/__tests__/useChannelPreviewDisplayPresence.test.tsx +1 -1
- package/src/components/ChannelPreview/hooks/__tests__/useChannelPreviewPollLabel.test.tsx +87 -0
- package/src/components/ChannelPreview/hooks/useChannelPreviewData.ts +3 -4
- package/src/components/ChannelPreview/hooks/useChannelPreviewDisplayName.ts +1 -1
- package/src/components/ChannelPreview/hooks/useChannelPreviewDisplayPresence.ts +1 -1
- package/src/components/ChannelPreview/hooks/useChannelPreviewPollLabel.ts +1 -1
- package/src/components/Chat/__tests__/Chat.test.tsx +31 -1
- package/src/components/Chat/hooks/useConnectionLifecycle.ts +12 -6
- package/src/components/Indicators/LoadingErrorIndicator.tsx +8 -1
- package/src/components/Message/Message.tsx +1 -1
- package/src/components/Message/MessageItemView/MessageStatus.tsx +16 -2
- package/src/components/Message/MessageItemView/MessageWrapper.tsx +14 -4
- package/src/components/Message/MessageItemView/__tests__/MessageStatus.test.tsx +21 -0
- package/src/components/Message/hooks/__tests__/useCreateMessageActionHandlers.test.tsx +1 -1
- package/src/components/Message/hooks/__tests__/useUserMuteActive.test.tsx +1 -1
- package/src/components/Message/hooks/useCreateMessageActionHandlers.ts +3 -3
- package/src/components/Message/hooks/useProcessReactions.ts +2 -2
- package/src/components/Message/hooks/useUserMuteActive.ts +1 -1
- package/src/components/MessageInput/MessageComposer.tsx +4 -2
- package/src/components/MessageList/MessageFlashList.tsx +2 -2
- package/src/components/MessageList/MessageList.tsx +2 -2
- package/src/components/MessageList/__tests__/MessageList.test.tsx +115 -14
- package/src/components/MessageList/__tests__/ScrollToBottomButton.test.tsx +3 -3
- package/src/components/MessageList/hooks/useOwnUnreadCount.ts +1 -1
- package/src/components/MessageMenu/MessageUserReactionsItem.tsx +1 -1
- package/src/components/MessageMenu/hooks/useMessageOwnReactions.ts +2 -2
- package/src/components/Poll/components/PollAnswersList.tsx +1 -1
- package/src/components/Poll/components/PollButtons.tsx +1 -1
- package/src/components/Poll/hook/useIsPollCreatedByCurrentUser.ts +1 -1
- package/src/components/Thread/Thread.tsx +1 -1
- package/src/components/Thread/__tests__/Thread.test.tsx +89 -2
- package/src/components/ThreadList/ThreadListItem.tsx +1 -1
- package/src/components/ThreadList/ThreadListUnreadBanner.tsx +6 -2
- package/src/components/ThreadList/__tests__/ThreadList.test.tsx +21 -0
- package/src/components/index.ts +3 -0
- package/src/contexts/componentsContext/defaultComponents.ts +0 -2
- package/src/contexts/liveLocationManagerContext/LiveLocationManagerContext.tsx +1 -1
- package/src/hooks/__tests__/useChannelMuteActive.test.tsx +1 -1
- package/src/hooks/__tests__/useIsDirectChat.test.tsx +1 -1
- package/src/hooks/actions/__tests__/useChannelActionItems.test.tsx +1 -1
- package/src/hooks/actions/__tests__/useChannelActions.test.tsx +1 -1
- package/src/hooks/actions/__tests__/useChannelMemberActionItems.test.tsx +6 -6
- package/src/hooks/actions/useChannelActionItems.tsx +1 -1
- package/src/hooks/actions/useChannelActions.ts +2 -2
- package/src/hooks/actions/useChannelMemberActionItems.tsx +1 -1
- package/src/hooks/index.ts +1 -0
- package/src/hooks/messagePreview/__tests__/useMessageDeliveryStatus.test.tsx +57 -32
- package/src/hooks/messagePreview/useMessageDeliveryStatus.ts +13 -7
- package/src/hooks/useIsDirectChat.ts +1 -1
- package/src/i18n/__tests__/catalog.fixture.json +2 -0
- package/src/i18n/keys.ts +3 -0
- package/src/i18n/runtimeDefaults.ts +1 -0
- package/src/store/__tests__/selectMessagesForChannels.test.ts +34 -12
- package/src/store/apis/getChannelMessages.ts +4 -1
- package/src/store/apis/getChannels.ts +5 -1
- package/src/store/apis/getChannelsForFilterSort.ts +1 -0
- package/src/store/apis/queries/selectMessagesForChannels.ts +7 -2
- package/src/utils/__tests__/setupCommandUIMiddlewares.test.ts +49 -0
- package/src/utils/installNativeMultipartAdapter.ts +5 -3
- package/src/utils/setupCommandUIMiddlewares.ts +3 -0
- package/src/version.json +1 -1
|
@@ -4,7 +4,7 @@ import { View } from 'react-native';
|
|
|
4
4
|
import NetInfo from '@react-native-community/netinfo';
|
|
5
5
|
import { act, cleanup, render, screen, waitFor } from '@testing-library/react-native';
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import { StreamChat } from 'stream-chat';
|
|
8
8
|
|
|
9
9
|
import type { ChatContextValue } from '../../../contexts/chatContext/ChatContext';
|
|
10
10
|
import { useChatContext } from '../../../contexts/chatContext/ChatContext';
|
|
@@ -136,6 +136,36 @@ describe('Chat', () => {
|
|
|
136
136
|
expect(chatClient.networkConnection.isOnline).toBe(true);
|
|
137
137
|
});
|
|
138
138
|
|
|
139
|
+
it('keeps a reporter the app registered before mounting', async () => {
|
|
140
|
+
const statusReporter = jest.fn(() => () => undefined);
|
|
141
|
+
chatClient.config.set({ client: { networkConnection: { statusReporter } } });
|
|
142
|
+
|
|
143
|
+
const { getByTestId } = render(
|
|
144
|
+
<Chat client={chatClient}>
|
|
145
|
+
<View testID='children' />
|
|
146
|
+
</Chat>,
|
|
147
|
+
);
|
|
148
|
+
await waitFor(() => expect(getByTestId('children')).toBeTruthy());
|
|
149
|
+
|
|
150
|
+
expect(chatClient.networkConnection.config.statusReporter).toBe(statusReporter);
|
|
151
|
+
expect(NetInfo.addEventListener).not.toHaveBeenCalled();
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
it('keeps a reporter passed to the client constructor', async () => {
|
|
155
|
+
const statusReporter = jest.fn(() => () => undefined);
|
|
156
|
+
const client = new StreamChat('key', { client: { networkConnection: { statusReporter } } });
|
|
157
|
+
|
|
158
|
+
const { getByTestId } = render(
|
|
159
|
+
<Chat client={client}>
|
|
160
|
+
<View testID='children' />
|
|
161
|
+
</Chat>,
|
|
162
|
+
);
|
|
163
|
+
await waitFor(() => expect(getByTestId('children')).toBeTruthy());
|
|
164
|
+
|
|
165
|
+
expect(client.networkConnection.config.statusReporter).toBe(statusReporter);
|
|
166
|
+
expect(NetInfo.addEventListener).not.toHaveBeenCalled();
|
|
167
|
+
});
|
|
168
|
+
|
|
139
169
|
it('keeps the NetInfo listener alive after unmount, because the client outlives <Chat>', async () => {
|
|
140
170
|
// The reporter's lifetime is the CLIENT's, not this component's. Releasing it here would leave
|
|
141
171
|
// `isOnline` frozen at a stale value (`setStatusReporter(null)` keeps the last status by design),
|
|
@@ -9,9 +9,9 @@ import type { NetworkStatusReporter, StreamChat } from 'stream-chat';
|
|
|
9
9
|
import { useAppStateListener } from '../../../hooks/useAppStateListener';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Installs the NetInfo network status reporter on the client
|
|
13
|
-
* is in the background, reopening it in the foreground (push
|
|
14
|
-
* no socket is active).
|
|
12
|
+
* Installs the NetInfo network status reporter on the client, unless the app registered one, and
|
|
13
|
+
* closes the WebSocket while the app is in the background, reopening it in the foreground (push
|
|
14
|
+
* notifications are only delivered while no socket is active).
|
|
15
15
|
*
|
|
16
16
|
* Read the results with `useNetworkConnectionState()` and `useWSConnectionState()`.
|
|
17
17
|
*
|
|
@@ -32,7 +32,7 @@ export const useConnectionLifecycle = (client: StreamChat, closeConnectionOnBack
|
|
|
32
32
|
|
|
33
33
|
const onForeground = useCallback(() => {
|
|
34
34
|
// Without a user ID, opening the connection would raise an unneeded error.
|
|
35
|
-
if (!clientExists || !client.
|
|
35
|
+
if (!clientExists || !client.userId) {
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -44,7 +44,7 @@ export const useConnectionLifecycle = (client: StreamChat, closeConnectionOnBack
|
|
|
44
44
|
// A `<Chat>` mounted while the app is already active (Android recreating the activity) never sees
|
|
45
45
|
// the background-to-foreground change that reopens a socket its predecessor closed.
|
|
46
46
|
useEffect(() => {
|
|
47
|
-
if (!closeConnectionOnBackground || !clientExists || !client.
|
|
47
|
+
if (!closeConnectionOnBackground || !clientExists || !client.userId) return;
|
|
48
48
|
if (AppState.currentState === 'active' && client.wsConnection.connection?.isDisconnected) {
|
|
49
49
|
client.openConnection();
|
|
50
50
|
}
|
|
@@ -55,6 +55,11 @@ export const useConnectionLifecycle = (client: StreamChat, closeConnectionOnBack
|
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
// a reporter the app registered, through `client.config` or the client's constructor wins
|
|
59
|
+
if (client.config.getConfig('client')?.networkConnection?.statusReporter) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
58
63
|
// Set through the client config so `client.config.get('client')` shows the installed reporter.
|
|
59
64
|
// Required on React Native: the client's fallback mirrors its own WebSocket and cannot report
|
|
60
65
|
// the network returning before the socket notices.
|
|
@@ -74,7 +79,8 @@ export const useConnectionLifecycle = (client: StreamChat, closeConnectionOnBack
|
|
|
74
79
|
};
|
|
75
80
|
|
|
76
81
|
/**
|
|
77
|
-
* Subscribes to NetInfo and reports every change to the client. `<Chat>` installs it in an effect
|
|
82
|
+
* Subscribes to NetInfo and reports every change to the client. `<Chat>` installs it in an effect,
|
|
83
|
+
* unless a reporter is registered in `client.config`.
|
|
78
84
|
*
|
|
79
85
|
* When you build the client yourself, install it at construction instead:
|
|
80
86
|
*
|
|
@@ -33,7 +33,7 @@ const LoadingErrorWrapper = (props: React.PropsWithChildren<LoadingErrorWrapperP
|
|
|
33
33
|
|
|
34
34
|
export type LoadingErrorProps = {
|
|
35
35
|
error?: Error;
|
|
36
|
-
listType?: 'channel' | 'message' | 'default';
|
|
36
|
+
listType?: 'channel' | 'message' | 'thread' | 'default';
|
|
37
37
|
loadNextPage?: () => Promise<void>;
|
|
38
38
|
retry?: () => void;
|
|
39
39
|
};
|
|
@@ -64,6 +64,13 @@ export const LoadingErrorIndicator = (props: LoadingErrorProps) => {
|
|
|
64
64
|
)}
|
|
65
65
|
/>
|
|
66
66
|
);
|
|
67
|
+
case 'thread':
|
|
68
|
+
return (
|
|
69
|
+
<LoadingErrorWrapper
|
|
70
|
+
onPress={retry}
|
|
71
|
+
text={t('indicators.loading.replies.error', 'Error loading replies...')}
|
|
72
|
+
/>
|
|
73
|
+
);
|
|
67
74
|
default:
|
|
68
75
|
return <LoadingErrorWrapper text={t('indicators.loading.error', 'Error loading')} />;
|
|
69
76
|
}
|
|
@@ -343,7 +343,7 @@ const MessageWithContext = (props: MessagePropsWithContext) => {
|
|
|
343
343
|
const actionsEnabled =
|
|
344
344
|
message.type === 'regular' && message.status === MessageStatusTypes.RECEIVED;
|
|
345
345
|
|
|
346
|
-
const isMyMessage = client && message && client.
|
|
346
|
+
const isMyMessage = client && message && client.userId === message.user?.id;
|
|
347
347
|
|
|
348
348
|
const handleAction = async (name: string, value: string) => {
|
|
349
349
|
if (message.id) {
|
|
@@ -71,6 +71,7 @@ const MessageStatusWithContext = (props: MessageStatusPropsWithContext) => {
|
|
|
71
71
|
<icons.CheckAll
|
|
72
72
|
height={16}
|
|
73
73
|
stroke={styles.readCheck.color}
|
|
74
|
+
testID='message-status-read'
|
|
74
75
|
width={16}
|
|
75
76
|
{...checkAllIcon}
|
|
76
77
|
/>
|
|
@@ -78,13 +79,26 @@ const MessageStatusWithContext = (props: MessageStatusPropsWithContext) => {
|
|
|
78
79
|
<icons.CheckAll
|
|
79
80
|
stroke={styles.deliveredCheck.color}
|
|
80
81
|
height={16}
|
|
82
|
+
testID='message-status-delivered'
|
|
81
83
|
width={16}
|
|
82
84
|
{...checkAllIcon}
|
|
83
85
|
/>
|
|
84
86
|
) : sending ? (
|
|
85
|
-
<icons.Time
|
|
87
|
+
<icons.Time
|
|
88
|
+
stroke={styles.sendingCheck.color}
|
|
89
|
+
height={16}
|
|
90
|
+
testID='message-status-sending'
|
|
91
|
+
width={16}
|
|
92
|
+
{...timeIcon}
|
|
93
|
+
/>
|
|
86
94
|
) : sent ? (
|
|
87
|
-
<icons.Check
|
|
95
|
+
<icons.Check
|
|
96
|
+
stroke={styles.sentCheck.color}
|
|
97
|
+
height={16}
|
|
98
|
+
testID='message-status-sent'
|
|
99
|
+
width={16}
|
|
100
|
+
{...checkIcon}
|
|
101
|
+
/>
|
|
88
102
|
) : null}
|
|
89
103
|
</View>
|
|
90
104
|
</>
|
|
@@ -57,8 +57,9 @@ export const MessageWrapper = React.memo(function MessageWrapper(props: MessageW
|
|
|
57
57
|
const createdAtTimestamp = message.created_at;
|
|
58
58
|
const messageId = message.id;
|
|
59
59
|
const nextMessageId = nextMessage?.id;
|
|
60
|
-
const nextMessageIsOwn = nextMessage?.user?.id === client.
|
|
60
|
+
const nextMessageIsOwn = nextMessage?.user?.id === client.userId;
|
|
61
61
|
const nextMessageCreatedAt = nextMessage?.created_at ?? undefined;
|
|
62
|
+
const isThreadList = !!messagePaginator.parentMessageId;
|
|
62
63
|
|
|
63
64
|
// The unread separator goes on the row above the first unread message from another user. It is
|
|
64
65
|
// located per message inside the selector, so the flag stays `false` for every other row and a
|
|
@@ -66,7 +67,9 @@ export const MessageWrapper = React.memo(function MessageWrapper(props: MessageW
|
|
|
66
67
|
const showUnreadSeparatorSelector = useCallback(
|
|
67
68
|
(snapshot: UnreadSnapshotState) => {
|
|
68
69
|
let showUnreadSeparator: boolean;
|
|
69
|
-
if (
|
|
70
|
+
if (isThreadList) {
|
|
71
|
+
showUnreadSeparator = false;
|
|
72
|
+
} else if (snapshot.firstUnreadMessageId) {
|
|
70
73
|
// Frozen boundary (channel open or mark-unread): anchor to the known first unread ID.
|
|
71
74
|
showUnreadSeparator = nextMessageId === snapshot.firstUnreadMessageId;
|
|
72
75
|
} else if (snapshot.unreadCount) {
|
|
@@ -103,7 +106,14 @@ export const MessageWrapper = React.memo(function MessageWrapper(props: MessageW
|
|
|
103
106
|
unreadCount: showUnreadSeparator ? snapshot.unreadCount : undefined,
|
|
104
107
|
};
|
|
105
108
|
},
|
|
106
|
-
[
|
|
109
|
+
[
|
|
110
|
+
createdAtTimestamp,
|
|
111
|
+
isThreadList,
|
|
112
|
+
messageId,
|
|
113
|
+
nextMessageCreatedAt,
|
|
114
|
+
nextMessageId,
|
|
115
|
+
nextMessageIsOwn,
|
|
116
|
+
],
|
|
107
117
|
);
|
|
108
118
|
const { showUnreadSeparator, unreadCount } = useStateStore(
|
|
109
119
|
messagePaginator.unreadStateSnapshot,
|
|
@@ -119,7 +129,7 @@ export const MessageWrapper = React.memo(function MessageWrapper(props: MessageW
|
|
|
119
129
|
|
|
120
130
|
const showUnreadUnderlay = !!shouldShowUnreadUnderlay && showUnreadSeparator;
|
|
121
131
|
|
|
122
|
-
const wrapMessageInTheme = client.
|
|
132
|
+
const wrapMessageInTheme = client.userId === message.user?.id && !!myMessageTheme;
|
|
123
133
|
const renderDateSeperator = dateSeparatorDate ? (
|
|
124
134
|
<View style={styles.dateSeparatorContainer}>
|
|
125
135
|
<InlineDateSeparator date={dateSeparatorDate} />
|
|
@@ -184,4 +184,25 @@ describe('MessageStatus', () => {
|
|
|
184
184
|
});
|
|
185
185
|
});
|
|
186
186
|
});
|
|
187
|
+
|
|
188
|
+
it.each([
|
|
189
|
+
[false, false, 'sending', 'message-status-sending'],
|
|
190
|
+
[true, true, 'received', 'message-status-read'],
|
|
191
|
+
[false, false, 'received', 'message-status-sent'],
|
|
192
|
+
[true, false, 'received', 'message-status-delivered'],
|
|
193
|
+
] as [boolean, boolean, string, string][])(
|
|
194
|
+
'exposes a status testID when delivered is %s, read is %s and status is %s',
|
|
195
|
+
async (delivered, read, status, testID) => {
|
|
196
|
+
const message = generateMessage({ user: generateUser() });
|
|
197
|
+
const { getByTestId } = renderMessageStatus({
|
|
198
|
+
delivered,
|
|
199
|
+
message: { ...message, status },
|
|
200
|
+
read,
|
|
201
|
+
});
|
|
202
|
+
// The icon row is hidden from screen readers in favour of the hidden text label.
|
|
203
|
+
await waitFor(() => {
|
|
204
|
+
expect(getByTestId(testID, { includeHiddenElements: true })).toBeTruthy();
|
|
205
|
+
});
|
|
206
|
+
},
|
|
207
|
+
);
|
|
187
208
|
});
|
|
@@ -22,7 +22,7 @@ const createClient = (mutedUsers: UserMuteResponse[] = []) =>
|
|
|
22
22
|
on: jest.fn(() => ({ unsubscribe: jest.fn() })),
|
|
23
23
|
pinMessage: jest.fn(),
|
|
24
24
|
unpinMessage: jest.fn(),
|
|
25
|
-
|
|
25
|
+
userId: 'current-user-id',
|
|
26
26
|
}) as unknown as StreamChat & {
|
|
27
27
|
moderation: { mute: jest.Mock; unmute: jest.Mock };
|
|
28
28
|
notifications: { add: jest.Mock; remove: jest.Mock; startTimeout: jest.Mock };
|
|
@@ -13,7 +13,7 @@ const muteOf = (targetId: string) =>
|
|
|
13
13
|
const createClient = () =>
|
|
14
14
|
({
|
|
15
15
|
mutedUsersStore: new StateStore<{ mutedUsers: UserMuteResponse[] }>({ mutedUsers: [] }),
|
|
16
|
-
|
|
16
|
+
userId: 'current-user-id',
|
|
17
17
|
}) as unknown as StreamChat;
|
|
18
18
|
|
|
19
19
|
describe('useUserMuteActive', () => {
|
|
@@ -197,7 +197,7 @@ export const useCreateMessageActionHandlers = ({
|
|
|
197
197
|
|
|
198
198
|
const isMuted = isUserMuted(
|
|
199
199
|
client.mutedUsersStore.getLatestValue().mutedUsers,
|
|
200
|
-
client.
|
|
200
|
+
client.userId,
|
|
201
201
|
message.user.id,
|
|
202
202
|
);
|
|
203
203
|
|
|
@@ -371,9 +371,9 @@ export const useCreateMessageActionHandlers = ({
|
|
|
371
371
|
const userExistingReaction = own_reactions.find((reaction) => {
|
|
372
372
|
// `own_reactions` should only hold the current user's reactions; checked anyway so a bad
|
|
373
373
|
// message update cannot break toggling.
|
|
374
|
-
if (reaction.user && client.
|
|
374
|
+
if (reaction.user && client.userId === reaction.user.id && reaction.type === reactionType) {
|
|
375
375
|
return true;
|
|
376
|
-
} else if (reaction.user && client.
|
|
376
|
+
} else if (reaction.user && client.userId !== reaction.user.id) {
|
|
377
377
|
console.warn(
|
|
378
378
|
'message.own_reactions contained reactions from a different user, this indicates a bug',
|
|
379
379
|
);
|
|
@@ -113,7 +113,7 @@ export const useProcessReactions = (props: UseProcessReactionsParams) => {
|
|
|
113
113
|
Icon: getEmojiByReactionType(reactionType, supportedReactions),
|
|
114
114
|
lastReactionAt: convertTimestampToDate(last_reaction_at) ?? null,
|
|
115
115
|
latestReactedUserNames,
|
|
116
|
-
own: isOwnReaction(reactionType, own_reactions, latest_reactions, client.
|
|
116
|
+
own: isOwnReaction(reactionType, own_reactions, latest_reactions, client.userId),
|
|
117
117
|
type: reactionType,
|
|
118
118
|
unlistedReactedUserCount: count - latestReactedUserNames.length,
|
|
119
119
|
};
|
|
@@ -126,7 +126,7 @@ export const useProcessReactions = (props: UseProcessReactionsParams) => {
|
|
|
126
126
|
totalReactionCount: unsortedReactions.reduce((total, { count }) => total + count, 0),
|
|
127
127
|
};
|
|
128
128
|
}, [
|
|
129
|
-
client.
|
|
129
|
+
client.userId,
|
|
130
130
|
reaction_groups,
|
|
131
131
|
own_reactions,
|
|
132
132
|
latest_reactions,
|
|
@@ -32,7 +32,7 @@ export const isUserMuted = (
|
|
|
32
32
|
*/
|
|
33
33
|
export const useUserMuteActive = (user: UserResponse | null | undefined) => {
|
|
34
34
|
const { client } = useChatContext();
|
|
35
|
-
const currentUserId = client?.
|
|
35
|
+
const currentUserId = client?.userId;
|
|
36
36
|
const userId = user?.id;
|
|
37
37
|
|
|
38
38
|
const selector = useCallback(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useMemo } from 'react';
|
|
2
|
-
import { StyleSheet, View } from 'react-native';
|
|
2
|
+
import { Platform, StyleSheet, View } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import Animated, {
|
|
5
5
|
Extrapolation,
|
|
@@ -328,7 +328,9 @@ const MessageComposerWithContext = (props: MessageComposerPropsWithContext) => {
|
|
|
328
328
|
}));
|
|
329
329
|
const { bottom } = useSafeAreaInsets();
|
|
330
330
|
|
|
331
|
-
const
|
|
331
|
+
const safeAreaBottomOffset = Platform.OS === 'android' ? bottom + 16 : bottom;
|
|
332
|
+
const BOTTOM_OFFSET =
|
|
333
|
+
isKeyboardVisible || selectedPicker ? 16 : bottom ? safeAreaBottomOffset : 16;
|
|
332
334
|
|
|
333
335
|
const micPositionContextValue = useMemo(
|
|
334
336
|
() => ({ micPositionX, micPositionY }),
|
|
@@ -321,7 +321,7 @@ const MessageFlashListWithContext = (props: MessageFlashListPropsWithContext) =>
|
|
|
321
321
|
channel,
|
|
322
322
|
markRead,
|
|
323
323
|
readEvents,
|
|
324
|
-
userId: client.
|
|
324
|
+
userId: client.userId,
|
|
325
325
|
});
|
|
326
326
|
|
|
327
327
|
const renderItem = useCallback(
|
|
@@ -343,7 +343,7 @@ const MessageFlashListWithContext = (props: MessageFlashListPropsWithContext) =>
|
|
|
343
343
|
|
|
344
344
|
const shouldScrollToRecentOnNewOwnMessageRef = useShouldScrollToRecentOnNewOwnMessage(
|
|
345
345
|
rawMessageList,
|
|
346
|
-
client.
|
|
346
|
+
client.userId,
|
|
347
347
|
);
|
|
348
348
|
|
|
349
349
|
const [autoscrollToRecent, setAutoscrollToRecent] = useState(true);
|
|
@@ -321,7 +321,7 @@ const MessageListWithContext = (props: MessageListPropsWithContext) => {
|
|
|
321
321
|
channel,
|
|
322
322
|
markRead,
|
|
323
323
|
readEvents,
|
|
324
|
-
userId: client.
|
|
324
|
+
userId: client.userId,
|
|
325
325
|
});
|
|
326
326
|
|
|
327
327
|
const previousDerivedItemsRef = useRef<Map<string, MessageListItemWithNeighbours>>(undefined);
|
|
@@ -355,7 +355,7 @@ const MessageListWithContext = (props: MessageListPropsWithContext) => {
|
|
|
355
355
|
|
|
356
356
|
const shouldScrollToRecentOnNewOwnMessageRef = useShouldScrollToRecentOnNewOwnMessage(
|
|
357
357
|
rawMessageList,
|
|
358
|
-
client.
|
|
358
|
+
client.userId,
|
|
359
359
|
);
|
|
360
360
|
|
|
361
361
|
const [autoscrollToRecent, setAutoscrollToRecent] = useState(false);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
|
|
3
3
|
import { FlatList, StyleSheet } from 'react-native';
|
|
4
4
|
|
|
@@ -8,6 +8,9 @@ import type { LocalMessage, StreamChat as StreamChatClient, UserResponse } from
|
|
|
8
8
|
import { msToNs, Thread } from 'stream-chat';
|
|
9
9
|
|
|
10
10
|
import { WithComponents } from '../../../contexts/componentsContext/ComponentsContext';
|
|
11
|
+
import { useMessageComposerAPIContext } from '../../../contexts/messageComposerContext/MessageComposerAPIContext';
|
|
12
|
+
import { useMessageComposer } from '../../../contexts/messageInputContext/hooks/useMessageComposer';
|
|
13
|
+
import { useMessageInputContext } from '../../../contexts/messageInputContext/MessageInputContext';
|
|
11
14
|
import { OverlayProvider } from '../../../contexts/overlayContext/OverlayProvider';
|
|
12
15
|
import { getOrCreateChannelApi } from '../../../mock-builders/api/getOrCreateChannel';
|
|
13
16
|
|
|
@@ -22,6 +25,7 @@ import { getTestClientWithUser } from '../../../mock-builders/mock';
|
|
|
22
25
|
import { primitives } from '../../../theme';
|
|
23
26
|
import { Channel } from '../../Channel/Channel';
|
|
24
27
|
import { Chat } from '../../Chat/Chat';
|
|
28
|
+
import { MessageComposer } from '../../MessageInput/MessageComposer';
|
|
25
29
|
|
|
26
30
|
import { Thread as ThreadComponent } from '../../Thread/Thread';
|
|
27
31
|
import { SCROLL_TO_BOTTOM_ACCESSIBILITY_ACTION_NAME } from '../hooks/useScrollToBottomAccessibilityAction';
|
|
@@ -1290,12 +1294,12 @@ describe('MessageList in a thread', () => {
|
|
|
1290
1294
|
generateMessage({ parent_id: parentMessage.id, text: `reply-${i}` }),
|
|
1291
1295
|
),
|
|
1292
1296
|
) as LocalMessage[];
|
|
1297
|
+
// Seeded as the thread seeds `latest_replies`: one complete page, which is the newest one.
|
|
1293
1298
|
act(() =>
|
|
1294
|
-
threadInstance.messagePaginator.
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
items: replies,
|
|
1299
|
+
threadInstance.messagePaginator.setItems({
|
|
1300
|
+
valueOrFactory: replies,
|
|
1301
|
+
isFirstPage: true,
|
|
1302
|
+
isLastPage: true,
|
|
1299
1303
|
}),
|
|
1300
1304
|
);
|
|
1301
1305
|
|
|
@@ -1375,7 +1379,9 @@ describe('MessageList in a thread', () => {
|
|
|
1375
1379
|
expect(markReadLocally).not.toHaveBeenCalled();
|
|
1376
1380
|
});
|
|
1377
1381
|
|
|
1378
|
-
|
|
1382
|
+
// The LLC seeds the thread's snapshot from the channel's read state, which says nothing about the
|
|
1383
|
+
// replies, so a thread draws no separator from either snapshot.
|
|
1384
|
+
it('draws no unread separator in a thread', async () => {
|
|
1379
1385
|
const { channel, queryAllByLabelText, replies, threadInstance } = await setup();
|
|
1380
1386
|
|
|
1381
1387
|
act(() =>
|
|
@@ -1386,12 +1392,107 @@ describe('MessageList in a thread', () => {
|
|
|
1386
1392
|
);
|
|
1387
1393
|
expect(queryAllByLabelText('Inline unread indicator')).toHaveLength(0);
|
|
1388
1394
|
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1395
|
+
// The first reply too, whose separator row would be the parent message.
|
|
1396
|
+
for (const firstUnread of [replies[0], replies[3]]) {
|
|
1397
|
+
await act(async () => {
|
|
1398
|
+
threadInstance.messagePaginator.unreadStateSnapshot.partialNext({
|
|
1399
|
+
firstUnreadMessageId: firstUnread.id,
|
|
1400
|
+
unreadCount: 2,
|
|
1401
|
+
});
|
|
1402
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
1403
|
+
});
|
|
1404
|
+
expect(queryAllByLabelText('Inline unread indicator')).toHaveLength(0);
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
// The live boundary, from the read time rather than a frozen first-unread ID.
|
|
1408
|
+
await act(async () => {
|
|
1409
|
+
threadInstance.messagePaginator.unreadStateSnapshot.next({
|
|
1410
|
+
firstUnreadMessageId: null,
|
|
1411
|
+
lastReadAt: replies[1].created_at,
|
|
1412
|
+
lastReadMessageId: replies[1].id,
|
|
1413
|
+
unreadCount: 3,
|
|
1414
|
+
});
|
|
1415
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
1416
|
+
});
|
|
1417
|
+
expect(queryAllByLabelText('Inline unread indicator')).toHaveLength(0);
|
|
1396
1418
|
});
|
|
1397
1419
|
});
|
|
1420
|
+
|
|
1421
|
+
describe('MessageList optimistic edit', () => {
|
|
1422
|
+
afterEach(() => {
|
|
1423
|
+
cleanup();
|
|
1424
|
+
jest.restoreAllMocks();
|
|
1425
|
+
});
|
|
1426
|
+
|
|
1427
|
+
// A UI renders `i18n.<language>_text` in place of `text`, so an optimistic edit that kept the
|
|
1428
|
+
// translations of the old text showed the "Edited" label over the old message until the server
|
|
1429
|
+
// responded (or, offline, until the edit was replayed).
|
|
1430
|
+
it('shows an edit of an auto-translated message before the request resolves', async () => {
|
|
1431
|
+
const me = generateUser({ id: 'testID' });
|
|
1432
|
+
const mine = generateMessage({
|
|
1433
|
+
i18n: { en_text: 'before edit', es_text: 'antes de editar', language: 'en' },
|
|
1434
|
+
text: 'before edit',
|
|
1435
|
+
user: me,
|
|
1436
|
+
});
|
|
1437
|
+
const mockedChannel = generateChannelResponse({
|
|
1438
|
+
members: [generateMember({ user: me })],
|
|
1439
|
+
messages: [mine],
|
|
1440
|
+
});
|
|
1441
|
+
mine.cid = mockedChannel.channel.cid;
|
|
1442
|
+
|
|
1443
|
+
const chatClient = await getTestClientWithUser(me);
|
|
1444
|
+
useMockedApis(chatClient, [getOrCreateChannelApi(mockedChannel)]);
|
|
1445
|
+
const channel = chatClient.channel('messaging', mockedChannel.channel.id);
|
|
1446
|
+
await channel.watch();
|
|
1447
|
+
// Never settles, so whatever is on screen is the optimistic state.
|
|
1448
|
+
const updateMessage = jest
|
|
1449
|
+
.spyOn(chatClient, 'updateMessage')
|
|
1450
|
+
.mockImplementation(() => new Promise(() => undefined));
|
|
1451
|
+
|
|
1452
|
+
let startEditing: (message: LocalMessage) => void = () => undefined;
|
|
1453
|
+
let submit: () => Promise<void> = () => Promise.resolve();
|
|
1454
|
+
let composer: ReturnType<typeof useMessageComposer> | undefined;
|
|
1455
|
+
const EditDriver = () => {
|
|
1456
|
+
const { setEditingState } = useMessageComposerAPIContext();
|
|
1457
|
+
const { sendMessage } = useMessageInputContext();
|
|
1458
|
+
const messageComposer = useMessageComposer();
|
|
1459
|
+
useEffect(() => {
|
|
1460
|
+
startEditing = setEditingState;
|
|
1461
|
+
submit = sendMessage;
|
|
1462
|
+
composer = messageComposer;
|
|
1463
|
+
});
|
|
1464
|
+
return null;
|
|
1465
|
+
};
|
|
1466
|
+
|
|
1467
|
+
const { getByTestId } = render(
|
|
1468
|
+
<OverlayProvider>
|
|
1469
|
+
<Chat client={chatClient}>
|
|
1470
|
+
<Channel channel={channel}>
|
|
1471
|
+
<MessageList />
|
|
1472
|
+
<MessageComposer />
|
|
1473
|
+
<EditDriver />
|
|
1474
|
+
</Channel>
|
|
1475
|
+
</Chat>
|
|
1476
|
+
</OverlayProvider>,
|
|
1477
|
+
);
|
|
1478
|
+
await waitFor(() =>
|
|
1479
|
+
expect(
|
|
1480
|
+
within(getByTestId(`message-list-item-${mine.id}`)).getByText('before edit'),
|
|
1481
|
+
).toBeTruthy(),
|
|
1482
|
+
);
|
|
1483
|
+
|
|
1484
|
+
act(() => startEditing(channel.messagePaginator.getItem(mine.id) as LocalMessage));
|
|
1485
|
+
await waitFor(() => expect(composer?.editedMessage?.id).toBe(mine.id));
|
|
1486
|
+
act(() => composer?.textComposer.setText('after edit'));
|
|
1487
|
+
act(() => {
|
|
1488
|
+
void submit();
|
|
1489
|
+
});
|
|
1490
|
+
|
|
1491
|
+
await waitFor(() => expect(updateMessage).toHaveBeenCalled());
|
|
1492
|
+
await waitFor(() => {
|
|
1493
|
+
const row = within(getByTestId(`message-list-item-${mine.id}`));
|
|
1494
|
+
expect(row.getByText('after edit')).toBeTruthy();
|
|
1495
|
+
expect(row.queryByText('before edit')).toBeNull();
|
|
1496
|
+
});
|
|
1497
|
+
}, 15000);
|
|
1498
|
+
});
|
|
@@ -75,7 +75,7 @@ describe('ScrollToBottomButton', () => {
|
|
|
75
75
|
const i18nInstance = new Streami18n();
|
|
76
76
|
const translators = await i18nInstance.init();
|
|
77
77
|
// The button reads OUR user's count from `channel.state` (a v10 reactive StateStore) via
|
|
78
|
-
// `useStateStore`, keyed by the chat client's
|
|
78
|
+
// `useStateStore`, keyed by the chat client's `userId`. Seed the `read` slice with 3 unread
|
|
79
79
|
// for that user.
|
|
80
80
|
const channel = {
|
|
81
81
|
state: generateChannelState({
|
|
@@ -91,7 +91,7 @@ describe('ScrollToBottomButton', () => {
|
|
|
91
91
|
const { getByTestId, getByText } = render(
|
|
92
92
|
<ThemeProvider>
|
|
93
93
|
<TranslationProvider value={{ ...translators, t } as unknown as TranslationContextValue}>
|
|
94
|
-
<ChatProvider value={{ client: {
|
|
94
|
+
<ChatProvider value={{ client: { userId: 'me' } } as unknown as ChatContextValue}>
|
|
95
95
|
<ChannelProvider value={{ channel } as unknown as ChannelContextValue}>
|
|
96
96
|
<ScrollToBottomButton onPress={() => null} showNotification={true} />
|
|
97
97
|
</ChannelProvider>
|
|
@@ -139,7 +139,7 @@ describe('ScrollToBottomButton', () => {
|
|
|
139
139
|
<ThemeProvider>
|
|
140
140
|
<AccessibilityProvider value={{ enabled: true }}>
|
|
141
141
|
<TranslationProvider value={{ ...translators, userLanguage: 'en' }}>
|
|
142
|
-
<ChatProvider value={{ client: {
|
|
142
|
+
<ChatProvider value={{ client: { userId: 'me' } } as unknown as ChatContextValue}>
|
|
143
143
|
<ChannelProvider value={{ channel } as unknown as ChannelContextValue}>
|
|
144
144
|
<ScrollToBottomButton onPress={() => null} showNotification={true} />
|
|
145
145
|
</ChannelProvider>
|
|
@@ -14,7 +14,7 @@ import { useStateStore } from '../../../hooks/useStateStore';
|
|
|
14
14
|
*/
|
|
15
15
|
export const useOwnUnreadCount = (channel: Channel | undefined) => {
|
|
16
16
|
const { client } = useChatContext();
|
|
17
|
-
const userId = client?.
|
|
17
|
+
const userId = client?.userId;
|
|
18
18
|
const selector = useMemo(
|
|
19
19
|
() => (state: ReadState) => ({
|
|
20
20
|
unreadCount: userId ? (state.read[userId]?.unread_messages ?? 0) : 0,
|
|
@@ -36,7 +36,7 @@ export const MessageUserReactionsItem = ({
|
|
|
36
36
|
const styles = useStyles();
|
|
37
37
|
|
|
38
38
|
const { client } = useChatContext();
|
|
39
|
-
const isOwnReaction = client.
|
|
39
|
+
const isOwnReaction = client.userId === id;
|
|
40
40
|
const { t } = useTranslationContext();
|
|
41
41
|
|
|
42
42
|
const { handleReaction } = useMessageContext();
|
|
@@ -10,9 +10,9 @@ export const useMessageOwnReactions = () => {
|
|
|
10
10
|
const ownReactionTypes = message?.own_reactions?.map((reaction) => reaction.type) || [];
|
|
11
11
|
const latestReactionTypesByCurrentUser =
|
|
12
12
|
message?.latest_reactions
|
|
13
|
-
?.filter((reaction) => reaction.user?.id === client.
|
|
13
|
+
?.filter((reaction) => reaction.user?.id === client.userId)
|
|
14
14
|
.map((reaction) => reaction.type) || [];
|
|
15
15
|
|
|
16
16
|
return Array.from(new Set([...ownReactionTypes, ...latestReactionTypesByCurrentUser]));
|
|
17
|
-
}, [client.
|
|
17
|
+
}, [client.userId, message?.latest_reactions, message?.own_reactions]);
|
|
18
18
|
};
|
|
@@ -96,7 +96,7 @@ export const PollAnswerListItem = ({ answer }: { answer: PollVoteResponseData })
|
|
|
96
96
|
[answer.updated_at, t, tDateTimeParser],
|
|
97
97
|
);
|
|
98
98
|
|
|
99
|
-
const isMyAnswer = client.
|
|
99
|
+
const isMyAnswer = client.userId === answer.user?.id;
|
|
100
100
|
|
|
101
101
|
const isAnonymous = useMemo(
|
|
102
102
|
() => votingVisibility === 'anonymous' && !isMyAnswer,
|
|
@@ -229,7 +229,7 @@ export const EndVoteButton = () => {
|
|
|
229
229
|
const { client } = useChatContext();
|
|
230
230
|
const styles = useStyles();
|
|
231
231
|
|
|
232
|
-
return !isClosed && createdBy?.id === client.
|
|
232
|
+
return !isClosed && createdBy?.id === client.userId ? (
|
|
233
233
|
<GenericPollButton
|
|
234
234
|
label={t('poll.endVote.label', 'End Vote')}
|
|
235
235
|
onPress={endVote}
|
|
@@ -138,7 +138,7 @@ export const Thread = (props: PropsWithChildren<ThreadProps>) => {
|
|
|
138
138
|
.toTail()
|
|
139
139
|
.catch((err: unknown) => console.warn('Reloading the thread replies failed:', err));
|
|
140
140
|
|
|
141
|
-
return <LoadingErrorIndicator error={lastQueryError} listType='
|
|
141
|
+
return <LoadingErrorIndicator error={lastQueryError} listType='thread' retry={retry} />;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
return (
|