@sendbird/uikit-react-native 3.1.2 → 3.2.0
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 +67 -42
- package/lib/commonjs/components/ChannelInput/MessageToReplyPreview.js +145 -0
- package/lib/commonjs/components/ChannelInput/MessageToReplyPreview.js.map +1 -0
- package/lib/commonjs/components/ChannelInput/SendInput.js +147 -312
- package/lib/commonjs/components/ChannelInput/SendInput.js.map +1 -1
- package/lib/commonjs/components/ChannelInput/VoiceMessageInput.js +238 -0
- package/lib/commonjs/components/ChannelInput/VoiceMessageInput.js.map +1 -0
- package/lib/commonjs/components/ChannelInput/index.js +5 -1
- package/lib/commonjs/components/ChannelInput/index.js.map +1 -1
- package/lib/commonjs/components/ChannelMessageList/index.js +1 -1
- package/lib/commonjs/components/ChannelMessageList/index.js.map +1 -1
- package/lib/commonjs/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.js +24 -13
- package/lib/commonjs/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.js.map +1 -1
- package/lib/commonjs/components/GroupChannelMessageRenderer/index.js +100 -5
- package/lib/commonjs/components/GroupChannelMessageRenderer/index.js.map +1 -1
- package/lib/commonjs/components/MessageSearchResultItem.js +1 -0
- package/lib/commonjs/components/MessageSearchResultItem.js.map +1 -1
- package/lib/commonjs/components/OpenChannelMessageRenderer/index.js +1 -0
- package/lib/commonjs/components/OpenChannelMessageRenderer/index.js.map +1 -1
- package/lib/commonjs/components/ReactionBottomSheets/ReactionUserListBottomSheet.js +2 -2
- package/lib/commonjs/components/ReactionBottomSheets/ReactionUserListBottomSheet.js.map +1 -1
- package/lib/commonjs/components/ReactionBottomSheets/index.js.map +1 -1
- package/lib/commonjs/components/StatusComposition.js.map +1 -1
- package/lib/commonjs/constants.js +5 -1
- package/lib/commonjs/constants.js.map +1 -1
- package/lib/commonjs/containers/GroupChannelPreviewContainer.js +1 -0
- package/lib/commonjs/containers/GroupChannelPreviewContainer.js.map +1 -1
- package/lib/commonjs/containers/InternalErrorBoundaryContainer.js.map +1 -1
- package/lib/commonjs/containers/SendbirdUIKitContainer.js +72 -34
- package/lib/commonjs/containers/SendbirdUIKitContainer.js.map +1 -1
- package/lib/commonjs/contexts/PlatformServiceCtx.js +16 -12
- package/lib/commonjs/contexts/PlatformServiceCtx.js.map +1 -1
- package/lib/commonjs/contexts/ReactionCtx.js +3 -2
- package/lib/commonjs/contexts/ReactionCtx.js.map +1 -1
- package/lib/commonjs/contexts/SendbirdChatCtx.js +2 -0
- package/lib/commonjs/contexts/SendbirdChatCtx.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js +27 -42
- package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/module/moduleContext.js +109 -5
- package/lib/commonjs/domain/groupChannel/module/moduleContext.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/types.js.map +1 -1
- package/lib/commonjs/domain/userList/types.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelFragment.js +30 -4
- package/lib/commonjs/fragments/createGroupChannelFragment.js.map +1 -1
- package/lib/commonjs/fragments/createMessageSearchFragment.js +1 -1
- package/lib/commonjs/fragments/createMessageSearchFragment.js.map +1 -1
- package/lib/commonjs/hooks/useChannelInputItems.js +211 -0
- package/lib/commonjs/hooks/useChannelInputItems.js.map +1 -0
- package/lib/commonjs/hooks/useConnection.js +1 -1
- package/lib/commonjs/hooks/useConnection.js.map +1 -1
- package/lib/commonjs/hooks/useVoiceMessageInput.js +207 -0
- package/lib/commonjs/hooks/useVoiceMessageInput.js.map +1 -0
- package/lib/commonjs/index.js +32 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/libs/MentionManager.js.map +1 -1
- package/lib/commonjs/libs/SBUUtils.js +4 -0
- package/lib/commonjs/libs/SBUUtils.js.map +1 -1
- package/lib/commonjs/libs/VoiceMessageConfig.js +30 -0
- package/lib/commonjs/libs/VoiceMessageConfig.js.map +1 -0
- package/lib/commonjs/localization/StringSet.type.js.map +1 -1
- package/lib/commonjs/localization/createBaseStringSet.js +24 -9
- package/lib/commonjs/localization/createBaseStringSet.js.map +1 -1
- package/lib/commonjs/platform/createFileService.expo.js +10 -0
- package/lib/commonjs/platform/createFileService.expo.js.map +1 -1
- package/lib/commonjs/platform/createFileService.native.js +19 -0
- package/lib/commonjs/platform/createFileService.native.js.map +1 -1
- package/lib/commonjs/platform/createPlayerService.expo.js +137 -0
- package/lib/commonjs/platform/createPlayerService.expo.js.map +1 -0
- package/lib/commonjs/platform/createPlayerService.native.js +139 -0
- package/lib/commonjs/platform/createPlayerService.native.js.map +1 -0
- package/lib/commonjs/platform/createRecorderService.expo.js +158 -0
- package/lib/commonjs/platform/createRecorderService.expo.js.map +1 -0
- package/lib/commonjs/platform/createRecorderService.native.js +157 -0
- package/lib/commonjs/platform/createRecorderService.native.js.map +1 -0
- package/lib/commonjs/platform/types.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/components/ChannelInput/MessageToReplyPreview.js +137 -0
- package/lib/module/components/ChannelInput/MessageToReplyPreview.js.map +1 -0
- package/lib/module/components/ChannelInput/SendInput.js +149 -314
- package/lib/module/components/ChannelInput/SendInput.js.map +1 -1
- package/lib/module/components/ChannelInput/VoiceMessageInput.js +228 -0
- package/lib/module/components/ChannelInput/VoiceMessageInput.js.map +1 -0
- package/lib/module/components/ChannelInput/index.js +5 -1
- package/lib/module/components/ChannelInput/index.js.map +1 -1
- package/lib/module/components/ChannelMessageList/index.js +2 -2
- package/lib/module/components/ChannelMessageList/index.js.map +1 -1
- package/lib/module/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.js +24 -13
- package/lib/module/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.js.map +1 -1
- package/lib/module/components/GroupChannelMessageRenderer/index.js +99 -6
- package/lib/module/components/GroupChannelMessageRenderer/index.js.map +1 -1
- package/lib/module/components/MessageSearchResultItem.js +2 -1
- package/lib/module/components/MessageSearchResultItem.js.map +1 -1
- package/lib/module/components/OpenChannelMessageRenderer/index.js +1 -0
- package/lib/module/components/OpenChannelMessageRenderer/index.js.map +1 -1
- package/lib/module/components/ReactionBottomSheets/ReactionUserListBottomSheet.js +2 -2
- package/lib/module/components/ReactionBottomSheets/ReactionUserListBottomSheet.js.map +1 -1
- package/lib/module/components/ReactionBottomSheets/index.js.map +1 -1
- package/lib/module/components/StatusComposition.js.map +1 -1
- package/lib/module/constants.js +2 -0
- package/lib/module/constants.js.map +1 -1
- package/lib/module/containers/GroupChannelPreviewContainer.js +2 -1
- package/lib/module/containers/GroupChannelPreviewContainer.js.map +1 -1
- package/lib/module/containers/InternalErrorBoundaryContainer.js.map +1 -1
- package/lib/module/containers/SendbirdUIKitContainer.js +74 -36
- package/lib/module/containers/SendbirdUIKitContainer.js.map +1 -1
- package/lib/module/contexts/PlatformServiceCtx.js +14 -11
- package/lib/module/contexts/PlatformServiceCtx.js.map +1 -1
- package/lib/module/contexts/ReactionCtx.js +3 -2
- package/lib/module/contexts/ReactionCtx.js.map +1 -1
- package/lib/module/contexts/SendbirdChatCtx.js +2 -0
- package/lib/module/contexts/SendbirdChatCtx.js.map +1 -1
- package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js +28 -43
- package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
- package/lib/module/domain/groupChannel/module/moduleContext.js +111 -7
- package/lib/module/domain/groupChannel/module/moduleContext.js.map +1 -1
- package/lib/module/domain/groupChannel/types.js.map +1 -1
- package/lib/module/domain/userList/types.js.map +1 -1
- package/lib/module/fragments/createGroupChannelFragment.js +32 -6
- package/lib/module/fragments/createGroupChannelFragment.js.map +1 -1
- package/lib/module/fragments/createMessageSearchFragment.js +1 -1
- package/lib/module/fragments/createMessageSearchFragment.js.map +1 -1
- package/lib/module/hooks/useChannelInputItems.js +203 -0
- package/lib/module/hooks/useChannelInputItems.js.map +1 -0
- package/lib/module/hooks/useConnection.js +1 -1
- package/lib/module/hooks/useConnection.js.map +1 -1
- package/lib/module/hooks/useVoiceMessageInput.js +199 -0
- package/lib/module/hooks/useVoiceMessageInput.js.map +1 -0
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/libs/MentionManager.js.map +1 -1
- package/lib/module/libs/SBUUtils.js +4 -0
- package/lib/module/libs/SBUUtils.js.map +1 -1
- package/lib/module/libs/VoiceMessageConfig.js +23 -0
- package/lib/module/libs/VoiceMessageConfig.js.map +1 -0
- package/lib/module/localization/StringSet.type.js.map +1 -1
- package/lib/module/localization/createBaseStringSet.js +25 -10
- package/lib/module/localization/createBaseStringSet.js.map +1 -1
- package/lib/module/platform/createFileService.expo.js +10 -0
- package/lib/module/platform/createFileService.expo.js.map +1 -1
- package/lib/module/platform/createFileService.native.js +19 -0
- package/lib/module/platform/createFileService.native.js.map +1 -1
- package/lib/module/platform/createPlayerService.expo.js +129 -0
- package/lib/module/platform/createPlayerService.expo.js.map +1 -0
- package/lib/module/platform/createPlayerService.native.js +132 -0
- package/lib/module/platform/createPlayerService.native.js.map +1 -0
- package/lib/module/platform/createRecorderService.expo.js +150 -0
- package/lib/module/platform/createRecorderService.expo.js.map +1 -0
- package/lib/module/platform/createRecorderService.native.js +149 -0
- package/lib/module/platform/createRecorderService.native.js.map +1 -0
- package/lib/module/platform/types.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/src/components/ChannelCover.d.ts +2 -1
- package/lib/typescript/src/components/ChannelInput/AttachmentsButton.d.ts +2 -1
- package/lib/typescript/src/components/ChannelInput/MessageToReplyPreview.d.ts +7 -0
- package/lib/typescript/src/components/ChannelInput/VoiceMessageInput.d.ts +11 -0
- package/lib/typescript/src/components/ChannelInput/index.d.ts +7 -3
- package/lib/typescript/src/components/ChannelMessageList/index.d.ts +1 -1
- package/lib/typescript/src/components/FileViewer.d.ts +2 -1
- package/lib/typescript/src/components/GroupChannelMessageRenderer/GroupChannelMessageDateSeparator.d.ts +2 -1
- package/lib/typescript/src/components/GroupChannelMessageRenderer/GroupChannelMessageFocusAnimation.d.ts +1 -1
- package/lib/typescript/src/components/GroupChannelMessageRenderer/GroupChannelMessageOutgoingStatus.d.ts +1 -1
- package/lib/typescript/src/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.d.ts +4 -2
- package/lib/typescript/src/components/NewMessagesButton.d.ts +1 -1
- package/lib/typescript/src/components/OpenChannelMessageRenderer/OpenChannelMessageDateSeparator.d.ts +2 -1
- package/lib/typescript/src/components/ProviderLayout.d.ts +1 -1
- package/lib/typescript/src/components/ReactionAddons/BottomSheetReactionAddon.d.ts +2 -1
- package/lib/typescript/src/components/ReactionAddons/MessageReactionAddon.d.ts +2 -1
- package/lib/typescript/src/components/ReactionAddons/ReactionRoundedButton.d.ts +3 -2
- package/lib/typescript/src/components/ReactionAddons/index.d.ts +3 -2
- package/lib/typescript/src/components/ReactionBottomSheets/ReactionListBottomSheet.d.ts +2 -1
- package/lib/typescript/src/components/ReactionBottomSheets/ReactionUserListBottomSheet.d.ts +2 -1
- package/lib/typescript/src/components/ReactionBottomSheets/index.d.ts +4 -4
- package/lib/typescript/src/components/ScrollToBottomButton.d.ts +1 -1
- package/lib/typescript/src/components/StatusComposition.d.ts +4 -4
- package/lib/typescript/src/components/TypedPlaceholder.d.ts +2 -1
- package/lib/typescript/src/components/UserActionBar.d.ts +2 -1
- package/lib/typescript/src/components/UserSelectableBar.d.ts +2 -1
- package/lib/typescript/src/constants.d.ts +2 -0
- package/lib/typescript/src/containers/GroupChannelPreviewContainer.d.ts +2 -1
- package/lib/typescript/src/containers/InternalErrorBoundaryContainer.d.ts +3 -3
- package/lib/typescript/src/containers/SendbirdUIKitContainer.d.ts +19 -8
- package/lib/typescript/src/contexts/LocalizationCtx.d.ts +1 -1
- package/lib/typescript/src/contexts/PlatformServiceCtx.d.ts +8 -8
- package/lib/typescript/src/contexts/ReactionCtx.d.ts +5 -2
- package/lib/typescript/src/contexts/SendbirdChatCtx.d.ts +6 -3
- package/lib/typescript/src/contexts/UserProfileCtx.d.ts +1 -1
- package/lib/typescript/src/domain/groupChannel/component/GroupChannelHeader.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannel/component/GroupChannelInput.d.ts +1 -1
- package/lib/typescript/src/domain/groupChannel/component/GroupChannelMessageList.d.ts +1 -1
- package/lib/typescript/src/domain/groupChannel/component/GroupChannelStatusEmpty.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannel/component/GroupChannelStatusLoading.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannel/component/GroupChannelSuggestedMentionList.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannel/types.d.ts +45 -0
- package/lib/typescript/src/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersHeader.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersList.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersStatusEmpty.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersStatusLoading.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelList/component/GroupChannelListHeader.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelList/component/GroupChannelListList.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelList/component/GroupChannelListStatusEmpty.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelList/component/GroupChannelListStatusLoading.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelList/component/GroupChannelListTypeSelector.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelModeration/component/GroupChannelModerationHeader.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelModeration/component/GroupChannelModerationMenu.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersHeader.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersList.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersStatusEmpty.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersStatusLoading.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelNotifications/component/GroupChannelNotificationsHeader.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelNotifications/component/GroupChannelNotificationsView.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelOperators/component/GroupChannelOperatorsHeader.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelOperators/component/GroupChannelOperatorsList.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelOperators/component/GroupChannelOperatorsStatusEmpty.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelOperators/component/GroupChannelOperatorsStatusLoading.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelSettings/component/GroupChannelSettingsHeader.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelSettings/component/GroupChannelSettingsInfo.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannelSettings/component/GroupChannelSettingsMenu.d.ts +2 -1
- package/lib/typescript/src/domain/messageSearch/component/MessageSearchHeader.d.ts +2 -1
- package/lib/typescript/src/domain/messageSearch/component/MessageSearchList.d.ts +2 -1
- package/lib/typescript/src/domain/messageSearch/component/MessageSearchStatusEmpty.d.ts +2 -1
- package/lib/typescript/src/domain/messageSearch/component/MessageSearchStatusLoading.d.ts +2 -1
- package/lib/typescript/src/domain/openChannel/component/OpenChannelHeader.d.ts +2 -2
- package/lib/typescript/src/domain/openChannel/component/OpenChannelInput.d.ts +1 -1
- package/lib/typescript/src/domain/openChannel/component/OpenChannelMessageList.d.ts +1 -1
- package/lib/typescript/src/domain/openChannel/component/OpenChannelStatusEmpty.d.ts +2 -1
- package/lib/typescript/src/domain/openChannel/component/OpenChannelStatusLoading.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelBannedUsers/component/OpenChannelBannedUsersHeader.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelBannedUsers/component/OpenChannelBannedUsersList.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelBannedUsers/component/OpenChannelBannedUsersStatusEmpty.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelBannedUsers/component/OpenChannelBannedUsersStatusLoading.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelCreate/component/OpenChannelCreateHeader.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelCreate/component/OpenChannelCreateProfileInput.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelCreate/component/OpenChannelCreateStatusLoading.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelList/component/OpenChannelListHeader.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelList/component/OpenChannelListList.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelList/component/OpenChannelListStatusEmpty.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelList/component/OpenChannelListStatusLoading.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelModeration/component/OpenChannelModerationHeader.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelModeration/component/OpenChannelModerationMenu.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelMutedParticipants/component/OpenChannelMutedParticipantsHeader.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelMutedParticipants/component/OpenChannelMutedParticipantsList.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelMutedParticipants/component/OpenChannelMutedParticipantsStatusEmpty.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelMutedParticipants/component/OpenChannelMutedParticipantsStatusLoading.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelOperators/component/OpenChannelOperatorsHeader.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelOperators/component/OpenChannelOperatorsList.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelOperators/component/OpenChannelOperatorsStatusEmpty.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelOperators/component/OpenChannelOperatorsStatusLoading.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelSettings/component/OpenChannelSettingsHeader.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelSettings/component/OpenChannelSettingsInfo.d.ts +2 -1
- package/lib/typescript/src/domain/openChannelSettings/component/OpenChannelSettingsMenu.d.ts +2 -1
- package/lib/typescript/src/domain/userList/component/UserListHeader.d.ts +3 -3
- package/lib/typescript/src/domain/userList/component/UserListList.d.ts +1 -1
- package/lib/typescript/src/domain/userList/component/UserListStatusEmpty.d.ts +2 -1
- package/lib/typescript/src/domain/userList/component/UserListStatusLoading.d.ts +2 -1
- package/lib/typescript/src/domain/userList/types.d.ts +2 -2
- package/lib/typescript/src/hooks/useChannelInputItems.d.ts +10 -0
- package/lib/typescript/src/hooks/useVoiceMessageInput.d.ts +53 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/libs/MentionManager.d.ts +2 -1
- package/lib/typescript/src/libs/SBUUtils.d.ts +1 -0
- package/lib/typescript/src/libs/VoiceMessageConfig.d.ts +25 -0
- package/lib/typescript/src/localization/StringSet.type.d.ts +7 -0
- package/lib/typescript/src/platform/createPlayerService.expo.d.ts +7 -0
- package/lib/typescript/src/platform/createPlayerService.native.d.ts +9 -0
- package/lib/typescript/src/platform/createRecorderService.expo.d.ts +7 -0
- package/lib/typescript/src/platform/createRecorderService.native.d.ts +9 -0
- package/lib/typescript/src/platform/types.d.ts +100 -1
- package/lib/typescript/src/types.d.ts +1 -1
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +9 -11
- package/src/components/ChannelInput/MessageToReplyPreview.tsx +133 -0
- package/src/components/ChannelInput/SendInput.tsx +129 -320
- package/src/components/ChannelInput/VoiceMessageInput.tsx +206 -0
- package/src/components/ChannelInput/index.tsx +12 -4
- package/src/components/ChannelMessageList/index.tsx +3 -1
- package/src/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.tsx +24 -11
- package/src/components/GroupChannelMessageRenderer/index.tsx +80 -3
- package/src/components/MessageSearchResultItem.tsx +2 -1
- package/src/components/OpenChannelMessageRenderer/index.tsx +1 -0
- package/src/components/ReactionBottomSheets/ReactionUserListBottomSheet.tsx +2 -2
- package/src/components/ReactionBottomSheets/index.tsx +3 -2
- package/src/components/StatusComposition.tsx +3 -3
- package/src/constants.ts +2 -0
- package/src/containers/GroupChannelPreviewContainer.tsx +2 -0
- package/src/containers/InternalErrorBoundaryContainer.tsx +1 -1
- package/src/containers/SendbirdUIKitContainer.tsx +103 -59
- package/src/contexts/PlatformServiceCtx.tsx +22 -20
- package/src/contexts/ReactionCtx.tsx +7 -5
- package/src/contexts/SendbirdChatCtx.tsx +10 -2
- package/src/domain/groupChannel/component/GroupChannelMessageList.tsx +29 -43
- package/src/domain/groupChannel/module/moduleContext.tsx +119 -7
- package/src/domain/groupChannel/types.ts +41 -0
- package/src/domain/userList/types.ts +2 -2
- package/src/fragments/createGroupChannelFragment.tsx +32 -5
- package/src/fragments/createMessageSearchFragment.tsx +1 -1
- package/src/hooks/useChannelInputItems.ts +215 -0
- package/src/hooks/useConnection.ts +1 -1
- package/src/hooks/useVoiceMessageInput.ts +237 -0
- package/src/index.ts +4 -0
- package/src/libs/MentionManager.tsx +1 -1
- package/src/libs/SBUUtils.ts +5 -0
- package/src/libs/VoiceMessageConfig.ts +28 -0
- package/src/localization/StringSet.type.ts +8 -0
- package/src/localization/createBaseStringSet.ts +27 -11
- package/src/platform/createFileService.expo.ts +10 -0
- package/src/platform/createFileService.native.ts +19 -0
- package/src/platform/createPlayerService.expo.tsx +142 -0
- package/src/platform/createPlayerService.native.tsx +148 -0
- package/src/platform/createRecorderService.expo.tsx +160 -0
- package/src/platform/createRecorderService.native.tsx +170 -0
- package/src/platform/types.ts +114 -1
- package/src/types.ts +1 -1
- package/src/version.ts +1 -1
|
@@ -2,7 +2,7 @@ import React, { useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
|
2
2
|
import { Platform } from 'react-native';
|
|
3
3
|
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import SendbirdChat, { DeviceOsPlatform, SendbirdChatParams, SendbirdPlatform, SendbirdProduct } from '@sendbird/chat';
|
|
6
6
|
import { GroupChannelModule } from '@sendbird/chat/groupChannel';
|
|
7
7
|
import { OpenChannelModule } from '@sendbird/chat/openChannel';
|
|
8
8
|
import type { HeaderStyleContextType, UIKitTheme } from '@sendbird/uikit-react-native-foundation';
|
|
@@ -18,7 +18,6 @@ import { SBUConfig, UIKitConfigProvider } from '@sendbird/uikit-tools';
|
|
|
18
18
|
import type {
|
|
19
19
|
PartialDeep,
|
|
20
20
|
SendbirdChatSDK,
|
|
21
|
-
SendbirdEncryption,
|
|
22
21
|
SendbirdGroupChannel,
|
|
23
22
|
SendbirdGroupChannelCreateParams,
|
|
24
23
|
SendbirdMember,
|
|
@@ -38,6 +37,7 @@ import ImageCompressionConfig from '../libs/ImageCompressionConfig';
|
|
|
38
37
|
import InternalLocalCacheStorage from '../libs/InternalLocalCacheStorage';
|
|
39
38
|
import MentionConfig, { MentionConfigInterface } from '../libs/MentionConfig';
|
|
40
39
|
import MentionManager from '../libs/MentionManager';
|
|
40
|
+
import VoiceMessageConfig, { VoiceMessageConfigInterface } from '../libs/VoiceMessageConfig';
|
|
41
41
|
import StringSetEn from '../localization/StringSet.en';
|
|
42
42
|
import type { StringSet } from '../localization/StringSet.type';
|
|
43
43
|
import SBUDynamicModule from '../platform/dynamicModule';
|
|
@@ -46,13 +46,14 @@ import type {
|
|
|
46
46
|
FileServiceInterface,
|
|
47
47
|
MediaServiceInterface,
|
|
48
48
|
NotificationServiceInterface,
|
|
49
|
+
PlayerServiceInterface,
|
|
50
|
+
RecorderServiceInterface,
|
|
49
51
|
} from '../platform/types';
|
|
50
52
|
import type { ErrorBoundaryProps, LocalCacheStorage } from '../types';
|
|
51
53
|
import VERSION from '../version';
|
|
52
54
|
import InternalErrorBoundaryContainer from './InternalErrorBoundaryContainer';
|
|
53
55
|
|
|
54
56
|
const NetInfo = SBUDynamicModule.get('@react-native-community/netinfo', 'warn');
|
|
55
|
-
type UnimplementedFeatures = 'enableVoiceMessage' | 'threadReplySelectType' | 'replyType';
|
|
56
57
|
export const SendbirdUIKit = Object.freeze({
|
|
57
58
|
VERSION,
|
|
58
59
|
PLATFORM: Platform.OS.toLowerCase(),
|
|
@@ -63,6 +64,27 @@ export const SendbirdUIKit = Object.freeze({
|
|
|
63
64
|
},
|
|
64
65
|
});
|
|
65
66
|
|
|
67
|
+
type UnimplementedFeatures = 'threadReplySelectType' | 'replyType';
|
|
68
|
+
export type ChatOmittedInitParams = Omit<
|
|
69
|
+
SendbirdChatParams<[GroupChannelModule, OpenChannelModule]>,
|
|
70
|
+
(typeof chatOmitKeys)[number]
|
|
71
|
+
>;
|
|
72
|
+
|
|
73
|
+
const chatOmitKeys = [
|
|
74
|
+
'appId',
|
|
75
|
+
'newInstance',
|
|
76
|
+
'modules',
|
|
77
|
+
'debugMode',
|
|
78
|
+
'appVersion',
|
|
79
|
+
'localCacheEnabled',
|
|
80
|
+
'useAsyncStorageStore',
|
|
81
|
+
] as const;
|
|
82
|
+
function sanitizeChatOptions<T extends Record<string, unknown>>(chatOptions: T): T {
|
|
83
|
+
const opts = { ...chatOptions };
|
|
84
|
+
chatOmitKeys.forEach((key) => delete opts[key]);
|
|
85
|
+
return opts;
|
|
86
|
+
}
|
|
87
|
+
|
|
66
88
|
export type SendbirdUIKitContainerProps = React.PropsWithChildren<{
|
|
67
89
|
appId: string;
|
|
68
90
|
platformServices: {
|
|
@@ -70,12 +92,14 @@ export type SendbirdUIKitContainerProps = React.PropsWithChildren<{
|
|
|
70
92
|
notification: NotificationServiceInterface;
|
|
71
93
|
clipboard: ClipboardServiceInterface;
|
|
72
94
|
media: MediaServiceInterface;
|
|
95
|
+
player: PlayerServiceInterface;
|
|
96
|
+
recorder: RecorderServiceInterface;
|
|
73
97
|
};
|
|
74
98
|
chatOptions: {
|
|
75
99
|
localCacheStorage: LocalCacheStorage;
|
|
76
|
-
localCacheEncryption?: SendbirdEncryption;
|
|
77
100
|
onInitialized?: (sdkInstance: SendbirdChatSDK) => SendbirdChatSDK;
|
|
78
|
-
} & Partial<
|
|
101
|
+
} & Partial<ChatOmittedInitParams> &
|
|
102
|
+
Partial<ChatRelatedFeaturesInUIKit>;
|
|
79
103
|
uikitOptions?: PartialDeep<{
|
|
80
104
|
common: SBUConfig['common'];
|
|
81
105
|
groupChannel: Omit<SBUConfig['groupChannel']['channel'], UnimplementedFeatures> & {
|
|
@@ -98,7 +122,7 @@ export type SendbirdUIKitContainerProps = React.PropsWithChildren<{
|
|
|
98
122
|
errorBoundary?: {
|
|
99
123
|
disabled?: boolean;
|
|
100
124
|
onError?: (props: ErrorBoundaryProps) => void;
|
|
101
|
-
ErrorInfoComponent?: (props: ErrorBoundaryProps) =>
|
|
125
|
+
ErrorInfoComponent?: (props: ErrorBoundaryProps) => React.ReactNode;
|
|
102
126
|
};
|
|
103
127
|
toast?: {
|
|
104
128
|
dismissTimeout?: number;
|
|
@@ -110,24 +134,29 @@ export type SendbirdUIKitContainerProps = React.PropsWithChildren<{
|
|
|
110
134
|
users: SendbirdUser[] | SendbirdMember[],
|
|
111
135
|
) => SendbirdGroupChannelCreateParams | Promise<SendbirdGroupChannelCreateParams>;
|
|
112
136
|
};
|
|
137
|
+
reaction?: {
|
|
138
|
+
onPressUserProfile?: (user: SendbirdUser | SendbirdMember) => void;
|
|
139
|
+
};
|
|
113
140
|
userMention?: Pick<Partial<MentionConfigInterface>, 'mentionLimit' | 'suggestionLimit' | 'debounceMills'>;
|
|
114
141
|
imageCompression?: Partial<ImageCompressionConfigInterface>;
|
|
142
|
+
voiceMessage?: PartialDeep<VoiceMessageConfigInterface>;
|
|
115
143
|
}>;
|
|
116
144
|
|
|
117
|
-
const SendbirdUIKitContainer = ({
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
145
|
+
const SendbirdUIKitContainer = (props: SendbirdUIKitContainerProps) => {
|
|
146
|
+
const {
|
|
147
|
+
children,
|
|
148
|
+
appId,
|
|
149
|
+
chatOptions,
|
|
150
|
+
uikitOptions,
|
|
151
|
+
platformServices,
|
|
152
|
+
localization,
|
|
153
|
+
styles,
|
|
154
|
+
errorBoundary,
|
|
155
|
+
toast,
|
|
156
|
+
userProfile,
|
|
157
|
+
reaction,
|
|
158
|
+
} = props;
|
|
159
|
+
|
|
131
160
|
if (!chatOptions.localCacheStorage) {
|
|
132
161
|
throw new Error('SendbirdUIKitContainer: chatOptions.localCacheStorage is required');
|
|
133
162
|
}
|
|
@@ -139,35 +168,18 @@ const SendbirdUIKitContainer = ({
|
|
|
139
168
|
|
|
140
169
|
const [internalStorage] = useState(() => new InternalLocalCacheStorage(chatOptions.localCacheStorage));
|
|
141
170
|
const [sdkInstance, setSdkInstance] = useState<SendbirdChatSDK>(() => {
|
|
142
|
-
const sendbird = initializeSendbird(appId, { internalStorage, ...chatOptions });
|
|
171
|
+
const sendbird = initializeSendbird(appId, { internalStorage, ...sanitizeChatOptions(chatOptions) });
|
|
143
172
|
unsubscribes.current = sendbird.unsubscribes;
|
|
144
173
|
return sendbird.chatSDK;
|
|
145
174
|
});
|
|
146
175
|
|
|
176
|
+
const { imageCompressionConfig, voiceMessageConfig, mentionConfig } = useConfigInstance(props);
|
|
147
177
|
const emojiManager = useMemo(() => new EmojiManager(internalStorage), [internalStorage]);
|
|
148
|
-
|
|
149
|
-
const mentionManager = useMemo(() => {
|
|
150
|
-
const config = new MentionConfig({
|
|
151
|
-
mentionLimit: userMention?.mentionLimit || MentionConfig.DEFAULT.MENTION_LIMIT,
|
|
152
|
-
suggestionLimit: userMention?.suggestionLimit || MentionConfig.DEFAULT.SUGGESTION_LIMIT,
|
|
153
|
-
debounceMills: userMention?.debounceMills ?? MentionConfig.DEFAULT.DEBOUNCE_MILLS,
|
|
154
|
-
delimiter: MentionConfig.DEFAULT.DELIMITER,
|
|
155
|
-
trigger: MentionConfig.DEFAULT.TRIGGER,
|
|
156
|
-
});
|
|
157
|
-
return new MentionManager(config);
|
|
158
|
-
}, [userMention?.mentionLimit, userMention?.suggestionLimit, userMention?.debounceMills]);
|
|
159
|
-
|
|
160
|
-
const imageCompressionConfig = useMemo(() => {
|
|
161
|
-
return new ImageCompressionConfig({
|
|
162
|
-
compressionRate: imageCompression?.compressionRate || ImageCompressionConfig.DEFAULT.COMPRESSION_RATE,
|
|
163
|
-
width: imageCompression?.width,
|
|
164
|
-
height: imageCompression?.height,
|
|
165
|
-
});
|
|
166
|
-
}, [imageCompression?.compressionRate, imageCompression?.width, imageCompression?.height]);
|
|
178
|
+
const mentionManager = useMemo(() => new MentionManager(mentionConfig), [mentionConfig]);
|
|
167
179
|
|
|
168
180
|
useLayoutEffect(() => {
|
|
169
181
|
if (!isFirstMount) {
|
|
170
|
-
const sendbird = initializeSendbird(appId, { internalStorage, ...chatOptions });
|
|
182
|
+
const sendbird = initializeSendbird(appId, { internalStorage, ...sanitizeChatOptions(chatOptions) });
|
|
171
183
|
setSdkInstance(sendbird.chatSDK);
|
|
172
184
|
unsubscribes.current = sendbird.unsubscribes;
|
|
173
185
|
}
|
|
@@ -210,6 +222,7 @@ const SendbirdUIKitContainer = ({
|
|
|
210
222
|
emojiManager={emojiManager}
|
|
211
223
|
mentionManager={mentionManager}
|
|
212
224
|
imageCompressionConfig={imageCompressionConfig}
|
|
225
|
+
voiceMessageConfig={voiceMessageConfig}
|
|
213
226
|
enableAutoPushTokenRegistration={
|
|
214
227
|
chatOptions.enableAutoPushTokenRegistration ?? SendbirdUIKit.DEFAULT.AUTO_PUSH_TOKEN_REGISTRATION
|
|
215
228
|
}
|
|
@@ -224,6 +237,9 @@ const SendbirdUIKitContainer = ({
|
|
|
224
237
|
notificationService={platformServices.notification}
|
|
225
238
|
clipboardService={platformServices.clipboard}
|
|
226
239
|
mediaService={platformServices.media}
|
|
240
|
+
playerService={platformServices.player}
|
|
241
|
+
recorderService={platformServices.recorder}
|
|
242
|
+
voiceMessageConfig={voiceMessageConfig}
|
|
227
243
|
>
|
|
228
244
|
<UIKitThemeProvider theme={styles?.theme ?? LightUIKitTheme}>
|
|
229
245
|
<HeaderStyleProvider
|
|
@@ -232,12 +248,8 @@ const SendbirdUIKitContainer = ({
|
|
|
232
248
|
statusBarTranslucent={styles?.statusBarTranslucent ?? true}
|
|
233
249
|
>
|
|
234
250
|
<ToastProvider dismissTimeout={toast?.dismissTimeout}>
|
|
235
|
-
<UserProfileProvider
|
|
236
|
-
|
|
237
|
-
onBeforeCreateChannel={userProfile?.onBeforeCreateChannel}
|
|
238
|
-
statusBarTranslucent={styles?.statusBarTranslucent ?? true}
|
|
239
|
-
>
|
|
240
|
-
<ReactionProvider>
|
|
251
|
+
<UserProfileProvider {...userProfile} statusBarTranslucent={styles?.statusBarTranslucent ?? true}>
|
|
252
|
+
<ReactionProvider {...reaction}>
|
|
241
253
|
<LocalizationContext.Consumer>
|
|
242
254
|
{(value) => {
|
|
243
255
|
const STRINGS = value?.STRINGS || defaultStringSet;
|
|
@@ -270,25 +282,22 @@ const SendbirdUIKitContainer = ({
|
|
|
270
282
|
);
|
|
271
283
|
};
|
|
272
284
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
localCacheEncryption?: SendbirdEncryption;
|
|
279
|
-
},
|
|
280
|
-
) => {
|
|
285
|
+
interface InitOptions extends ChatOmittedInitParams {
|
|
286
|
+
internalStorage: InternalLocalCacheStorage;
|
|
287
|
+
onInitialized?: (sdk: SendbirdChatSDK) => SendbirdChatSDK;
|
|
288
|
+
}
|
|
289
|
+
const initializeSendbird = (appId: string, options: InitOptions) => {
|
|
281
290
|
let chatSDK: SendbirdChatSDK;
|
|
282
291
|
const unsubscribes: Array<() => void> = [];
|
|
283
|
-
const { internalStorage,
|
|
292
|
+
const { internalStorage, onInitialized, ...chatInitParams } = options;
|
|
284
293
|
|
|
285
|
-
chatSDK =
|
|
294
|
+
chatSDK = SendbirdChat.init({
|
|
295
|
+
...chatInitParams,
|
|
286
296
|
appId,
|
|
287
297
|
newInstance: true,
|
|
288
298
|
modules: [new GroupChannelModule(), new OpenChannelModule()],
|
|
289
|
-
localCacheEnabled:
|
|
299
|
+
localCacheEnabled: true,
|
|
290
300
|
useAsyncStorageStore: internalStorage as never,
|
|
291
|
-
localCacheEncryption,
|
|
292
301
|
});
|
|
293
302
|
|
|
294
303
|
if (onInitialized) {
|
|
@@ -368,4 +377,39 @@ function getReactNativeVersion() {
|
|
|
368
377
|
return `${major}.${minor}.${patch}`;
|
|
369
378
|
}
|
|
370
379
|
|
|
380
|
+
const useConfigInstance = ({ imageCompression, userMention, voiceMessage }: SendbirdUIKitContainerProps) => {
|
|
381
|
+
const mentionConfig = useMemo(() => {
|
|
382
|
+
return new MentionConfig({
|
|
383
|
+
mentionLimit: userMention?.mentionLimit || MentionConfig.DEFAULT.MENTION_LIMIT,
|
|
384
|
+
suggestionLimit: userMention?.suggestionLimit || MentionConfig.DEFAULT.SUGGESTION_LIMIT,
|
|
385
|
+
debounceMills: userMention?.debounceMills ?? MentionConfig.DEFAULT.DEBOUNCE_MILLS,
|
|
386
|
+
delimiter: MentionConfig.DEFAULT.DELIMITER,
|
|
387
|
+
trigger: MentionConfig.DEFAULT.TRIGGER,
|
|
388
|
+
});
|
|
389
|
+
}, [userMention?.mentionLimit, userMention?.suggestionLimit, userMention?.debounceMills]);
|
|
390
|
+
|
|
391
|
+
const imageCompressionConfig = useMemo(() => {
|
|
392
|
+
return new ImageCompressionConfig({
|
|
393
|
+
compressionRate: imageCompression?.compressionRate || ImageCompressionConfig.DEFAULT.COMPRESSION_RATE,
|
|
394
|
+
width: imageCompression?.width,
|
|
395
|
+
height: imageCompression?.height,
|
|
396
|
+
});
|
|
397
|
+
}, [imageCompression?.compressionRate, imageCompression?.width, imageCompression?.height]);
|
|
398
|
+
|
|
399
|
+
const voiceMessageConfig = useMemo(() => {
|
|
400
|
+
return new VoiceMessageConfig({
|
|
401
|
+
recorder: {
|
|
402
|
+
minDuration: voiceMessage?.recorder?.minDuration ?? VoiceMessageConfig.DEFAULT.RECORDER.MIN_DURATION,
|
|
403
|
+
maxDuration: voiceMessage?.recorder?.maxDuration ?? VoiceMessageConfig.DEFAULT.RECORDER.MAX_DURATION,
|
|
404
|
+
},
|
|
405
|
+
});
|
|
406
|
+
}, [voiceMessage?.recorder?.minDuration, voiceMessage?.recorder?.maxDuration]);
|
|
407
|
+
|
|
408
|
+
return {
|
|
409
|
+
mentionConfig,
|
|
410
|
+
imageCompressionConfig,
|
|
411
|
+
voiceMessageConfig,
|
|
412
|
+
};
|
|
413
|
+
};
|
|
414
|
+
|
|
371
415
|
export default SendbirdUIKitContainer;
|
|
@@ -1,37 +1,39 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
|
|
3
|
+
import { useAppState } from '@sendbird/uikit-utils';
|
|
4
|
+
|
|
5
|
+
import VoiceMessageConfig from '../libs/VoiceMessageConfig';
|
|
3
6
|
import type {
|
|
4
7
|
ClipboardServiceInterface,
|
|
5
8
|
FileServiceInterface,
|
|
6
9
|
MediaServiceInterface,
|
|
7
10
|
NotificationServiceInterface,
|
|
11
|
+
PlayerServiceInterface,
|
|
12
|
+
RecorderServiceInterface,
|
|
8
13
|
} from '../platform/types';
|
|
9
14
|
|
|
10
|
-
type Props = React.PropsWithChildren<{
|
|
11
|
-
fileService: FileServiceInterface;
|
|
12
|
-
clipboardService: ClipboardServiceInterface;
|
|
13
|
-
notificationService: NotificationServiceInterface;
|
|
14
|
-
mediaService: MediaServiceInterface;
|
|
15
|
-
}>;
|
|
16
|
-
|
|
17
15
|
export type PlatformServiceContextType = {
|
|
18
16
|
fileService: FileServiceInterface;
|
|
19
17
|
clipboardService: ClipboardServiceInterface;
|
|
20
18
|
notificationService: NotificationServiceInterface;
|
|
21
19
|
mediaService: MediaServiceInterface;
|
|
20
|
+
recorderService: RecorderServiceInterface;
|
|
21
|
+
playerService: PlayerServiceInterface;
|
|
22
22
|
};
|
|
23
|
+
type Props = React.PropsWithChildren<PlatformServiceContextType & { voiceMessageConfig: VoiceMessageConfig }>;
|
|
23
24
|
|
|
24
25
|
export const PlatformServiceContext = React.createContext<PlatformServiceContextType | null>(null);
|
|
25
|
-
export const PlatformServiceProvider = ({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
export const PlatformServiceProvider = ({ children, voiceMessageConfig, ...services }: Props) => {
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
services.recorderService.options.minDuration = voiceMessageConfig.recorder.minDuration;
|
|
29
|
+
services.recorderService.options.maxDuration = voiceMessageConfig.recorder.maxDuration;
|
|
30
|
+
}, [voiceMessageConfig]);
|
|
31
|
+
|
|
32
|
+
useAppState('change', (state) => {
|
|
33
|
+
if (state !== 'active') {
|
|
34
|
+
Promise.allSettled([services.playerService.reset(), services.recorderService.reset()]);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
return <PlatformServiceContext.Provider value={services}>{children}</PlatformServiceContext.Provider>;
|
|
37
39
|
};
|
|
@@ -3,7 +3,7 @@ import React, { useCallback, useContext, useReducer, useRef, useState } from 're
|
|
|
3
3
|
import type { SendbirdBaseChannel, SendbirdBaseMessage } from '@sendbird/uikit-utils';
|
|
4
4
|
import { NOOP } from '@sendbird/uikit-utils';
|
|
5
5
|
|
|
6
|
-
import { ReactionBottomSheets } from '../components/ReactionBottomSheets';
|
|
6
|
+
import { ReactionBottomSheetProps, ReactionBottomSheets } from '../components/ReactionBottomSheets';
|
|
7
7
|
import { LocalizationContext } from '../contexts/LocalizationCtx';
|
|
8
8
|
import { SendbirdChatContext } from '../contexts/SendbirdChatCtx';
|
|
9
9
|
import { UserProfileContext } from '../contexts/UserProfileCtx';
|
|
@@ -19,10 +19,12 @@ export type ReactionContextType = {
|
|
|
19
19
|
focusIndex: number;
|
|
20
20
|
} & State;
|
|
21
21
|
|
|
22
|
-
type Props = React.PropsWithChildren<{
|
|
22
|
+
type Props = React.PropsWithChildren<{
|
|
23
|
+
onPressUserProfile?: ReactionBottomSheetProps['onPressUserProfile'];
|
|
24
|
+
}>;
|
|
23
25
|
|
|
24
26
|
export const ReactionContext = React.createContext<ReactionContextType | null>(null);
|
|
25
|
-
export const ReactionProvider = ({ children }: Props) => {
|
|
27
|
+
export const ReactionProvider = ({ children, onPressUserProfile }: Props) => {
|
|
26
28
|
const chatCtx = useContext(SendbirdChatContext);
|
|
27
29
|
const localizationCtx = useContext(LocalizationContext);
|
|
28
30
|
const userProfileCtx = useContext(UserProfileContext);
|
|
@@ -73,11 +75,11 @@ export const ReactionProvider = ({ children }: Props) => {
|
|
|
73
75
|
focusIndex: reactionUserListFocusIndex,
|
|
74
76
|
};
|
|
75
77
|
|
|
76
|
-
const sheetProps = {
|
|
78
|
+
const sheetProps: Omit<ReactionBottomSheetProps, 'visible' | 'onClose'> = {
|
|
77
79
|
chatCtx,
|
|
78
80
|
reactionCtx,
|
|
79
81
|
localizationCtx,
|
|
80
|
-
userProfileCtx,
|
|
82
|
+
onPressUserProfile: onPressUserProfile ?? userProfileCtx.show,
|
|
81
83
|
onDismiss: () => {
|
|
82
84
|
setState({});
|
|
83
85
|
closeResolver.current?.();
|
|
@@ -13,6 +13,7 @@ import { confirmAndMarkAsDelivered, useAppState, useForceUpdate } from '@sendbir
|
|
|
13
13
|
import type EmojiManager from '../libs/EmojiManager';
|
|
14
14
|
import type ImageCompressionConfig from '../libs/ImageCompressionConfig';
|
|
15
15
|
import type MentionManager from '../libs/MentionManager';
|
|
16
|
+
import type VoiceMessageConfig from '../libs/VoiceMessageConfig';
|
|
16
17
|
import type { FileType } from '../platform/types';
|
|
17
18
|
|
|
18
19
|
export interface ChatRelatedFeaturesInUIKit {
|
|
@@ -23,18 +24,23 @@ export interface ChatRelatedFeaturesInUIKit {
|
|
|
23
24
|
|
|
24
25
|
interface Props extends ChatRelatedFeaturesInUIKit, React.PropsWithChildren {
|
|
25
26
|
sdkInstance: SendbirdChatSDK;
|
|
27
|
+
|
|
26
28
|
emojiManager: EmojiManager;
|
|
27
29
|
mentionManager: MentionManager;
|
|
28
30
|
imageCompressionConfig: ImageCompressionConfig;
|
|
31
|
+
voiceMessageConfig: VoiceMessageConfig;
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
export type SendbirdChatContextType = {
|
|
32
35
|
sdk: SendbirdChatSDK;
|
|
36
|
+
currentUser?: SendbirdUser;
|
|
37
|
+
setCurrentUser: React.Dispatch<React.SetStateAction<SendbirdUser | undefined>>;
|
|
38
|
+
|
|
39
|
+
// feature related instances
|
|
33
40
|
emojiManager: EmojiManager;
|
|
34
41
|
mentionManager: MentionManager;
|
|
35
42
|
imageCompressionConfig: ImageCompressionConfig;
|
|
36
|
-
|
|
37
|
-
setCurrentUser: React.Dispatch<React.SetStateAction<SendbirdUser | undefined>>;
|
|
43
|
+
voiceMessageConfig: VoiceMessageConfig;
|
|
38
44
|
|
|
39
45
|
// helper functions
|
|
40
46
|
updateCurrentUserInfo: (nickname?: string, profile?: string | FileType) => Promise<SendbirdUser>;
|
|
@@ -84,6 +90,7 @@ export const SendbirdChatProvider = ({
|
|
|
84
90
|
emojiManager,
|
|
85
91
|
mentionManager,
|
|
86
92
|
imageCompressionConfig,
|
|
93
|
+
voiceMessageConfig,
|
|
87
94
|
enableAutoPushTokenRegistration,
|
|
88
95
|
enableUseUserIdForNickname,
|
|
89
96
|
enableImageCompression,
|
|
@@ -155,6 +162,7 @@ export const SendbirdChatProvider = ({
|
|
|
155
162
|
emojiManager,
|
|
156
163
|
mentionManager,
|
|
157
164
|
imageCompressionConfig,
|
|
165
|
+
voiceMessageConfig,
|
|
158
166
|
currentUser,
|
|
159
167
|
setCurrentUser,
|
|
160
168
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import React, { useContext, useEffect
|
|
2
|
-
import type { FlatList } from 'react-native';
|
|
1
|
+
import React, { useContext, useEffect } from 'react';
|
|
3
2
|
|
|
4
3
|
import { useChannelHandler } from '@sendbird/uikit-chat-hooks';
|
|
5
4
|
import { useToast } from '@sendbird/uikit-react-native-foundation';
|
|
@@ -18,45 +17,32 @@ const GroupChannelMessageList = (props: GroupChannelProps['MessageList']) => {
|
|
|
18
17
|
const { sdk } = useSendbirdChat();
|
|
19
18
|
const { setMessageToEdit, setMessageToReply } = useContext(GroupChannelContexts.Fragment);
|
|
20
19
|
const { subscribe } = useContext(GroupChannelContexts.PubSub);
|
|
20
|
+
const { flatListRef, lazyScrollToBottom, lazyScrollToIndex } = useContext(GroupChannelContexts.MessageList);
|
|
21
21
|
|
|
22
22
|
const id = useUniqHandlerId('GroupChannelMessageList');
|
|
23
|
-
const ref = useRef<FlatList<SendbirdMessage>>(null);
|
|
24
23
|
const isFirstMount = useIsFirstMount();
|
|
25
24
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}, timeout);
|
|
31
|
-
};
|
|
25
|
+
const scrollToMessageWithCreatedAt = useFreshCallback(
|
|
26
|
+
(createdAt: number, focusAnimated: boolean, timeout: number): boolean => {
|
|
27
|
+
const foundMessageIndex = props.messages.findIndex((it) => it.createdAt === createdAt);
|
|
28
|
+
const isIncludedInList = foundMessageIndex > -1;
|
|
32
29
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const scrollToMessage = useFreshCallback((createdAt: number, focusAnimated = false): boolean => {
|
|
41
|
-
const foundMessageIndex = props.messages.findIndex((it) => it.createdAt === createdAt);
|
|
42
|
-
const isIncludedInList = foundMessageIndex > -1;
|
|
43
|
-
|
|
44
|
-
if (isIncludedInList) {
|
|
45
|
-
if (focusAnimated) {
|
|
46
|
-
setTimeout(() => props.onUpdateSearchItem({ startingPoint: createdAt }), MESSAGE_FOCUS_ANIMATION_DELAY);
|
|
47
|
-
}
|
|
48
|
-
lazyScrollToIndex(foundMessageIndex, true, isFirstMount ? MESSAGE_SEARCH_SAFE_SCROLL_DELAY : 0);
|
|
49
|
-
} else {
|
|
50
|
-
if (props.channel.messageOffsetTimestamp <= createdAt) {
|
|
51
|
-
if (focusAnimated) props.onUpdateSearchItem({ startingPoint: createdAt });
|
|
52
|
-
props.onResetMessageListWithStartingPoint(createdAt);
|
|
30
|
+
if (isIncludedInList) {
|
|
31
|
+
if (focusAnimated) {
|
|
32
|
+
setTimeout(() => props.onUpdateSearchItem({ startingPoint: createdAt }), MESSAGE_FOCUS_ANIMATION_DELAY);
|
|
33
|
+
}
|
|
34
|
+
lazyScrollToIndex({ index: foundMessageIndex, animated: true, timeout });
|
|
53
35
|
} else {
|
|
54
|
-
|
|
36
|
+
if (props.channel.messageOffsetTimestamp <= createdAt) {
|
|
37
|
+
if (focusAnimated) props.onUpdateSearchItem({ startingPoint: createdAt });
|
|
38
|
+
props.onResetMessageListWithStartingPoint(createdAt);
|
|
39
|
+
} else {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
55
42
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
});
|
|
43
|
+
return true;
|
|
44
|
+
},
|
|
45
|
+
);
|
|
60
46
|
|
|
61
47
|
const scrollToBottom = useFreshCallback((animated = false) => {
|
|
62
48
|
if (props.hasNext()) {
|
|
@@ -65,10 +51,10 @@ const GroupChannelMessageList = (props: GroupChannelProps['MessageList']) => {
|
|
|
65
51
|
|
|
66
52
|
props.onResetMessageList(() => {
|
|
67
53
|
props.onScrolledAwayFromBottom(false);
|
|
68
|
-
lazyScrollToBottom(animated);
|
|
54
|
+
lazyScrollToBottom({ animated });
|
|
69
55
|
});
|
|
70
56
|
} else {
|
|
71
|
-
lazyScrollToBottom(animated);
|
|
57
|
+
lazyScrollToBottom({ animated });
|
|
72
58
|
}
|
|
73
59
|
});
|
|
74
60
|
|
|
@@ -79,7 +65,7 @@ const GroupChannelMessageList = (props: GroupChannelProps['MessageList']) => {
|
|
|
79
65
|
const isRecentMessage = recentMessage && recentMessage.messageId === event.messageId;
|
|
80
66
|
const scrollReachedBottomAndCanScroll = !props.scrolledAwayFromBottom && !props.hasNext();
|
|
81
67
|
if (isRecentMessage && scrollReachedBottomAndCanScroll) {
|
|
82
|
-
lazyScrollToBottom(true, 250);
|
|
68
|
+
lazyScrollToBottom({ animated: true, timeout: 250 });
|
|
83
69
|
}
|
|
84
70
|
},
|
|
85
71
|
});
|
|
@@ -102,24 +88,24 @@ const GroupChannelMessageList = (props: GroupChannelProps['MessageList']) => {
|
|
|
102
88
|
});
|
|
103
89
|
}, [props.scrolledAwayFromBottom]);
|
|
104
90
|
|
|
105
|
-
// Only trigger once when message list mount with initial props.searchItem
|
|
106
|
-
// - Search screen + searchItem > mount message list
|
|
107
|
-
// - Reset message list + searchItem > re-mount message list
|
|
108
91
|
useEffect(() => {
|
|
92
|
+
// Only trigger once when message list mount with initial props.searchItem
|
|
93
|
+
// - Search screen + searchItem > mount message list
|
|
94
|
+
// - Reset message list + searchItem > re-mount message list
|
|
109
95
|
if (isFirstMount && props.searchItem) {
|
|
110
|
-
|
|
96
|
+
scrollToMessageWithCreatedAt(props.searchItem.startingPoint, false, MESSAGE_SEARCH_SAFE_SCROLL_DELAY);
|
|
111
97
|
}
|
|
112
98
|
}, [isFirstMount]);
|
|
113
99
|
|
|
114
100
|
const onPressParentMessage = useFreshCallback((message: SendbirdMessage) => {
|
|
115
|
-
const canScrollToParent =
|
|
101
|
+
const canScrollToParent = scrollToMessageWithCreatedAt(message.createdAt, true, 0);
|
|
116
102
|
if (!canScrollToParent) toast.show(STRINGS.TOAST.FIND_PARENT_MSG_ERROR, 'error');
|
|
117
103
|
});
|
|
118
104
|
|
|
119
105
|
return (
|
|
120
106
|
<ChannelMessageList
|
|
121
107
|
{...props}
|
|
122
|
-
ref={
|
|
108
|
+
ref={flatListRef}
|
|
123
109
|
onReplyMessage={setMessageToReply}
|
|
124
110
|
onEditMessage={setMessageToEdit}
|
|
125
111
|
onPressParentMessage={onPressParentMessage}
|