@sendbird/uikit-react-native 3.1.1 → 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/ChatFlatList/index.js +15 -3
- package/lib/commonjs/components/ChatFlatList/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 +84 -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/useMentionSuggestion.js +1 -1
- package/lib/commonjs/hooks/useMentionSuggestion.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/ChatFlatList/index.js +15 -3
- package/lib/module/components/ChatFlatList/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 +86 -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/useMentionSuggestion.js +1 -1
- package/lib/module/hooks/useMentionSuggestion.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 +18 -6
- 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/ChatFlatList/index.tsx +14 -3
- 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 +105 -54
- 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/useMentionSuggestion.ts +2 -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
|
@@ -1,20 +1,28 @@
|
|
|
1
|
-
import React, { createContext, useCallback, useState } from 'react';
|
|
1
|
+
import React, { createContext, useCallback, useRef, useState } from 'react';
|
|
2
|
+
import type { FlatList } from 'react-native';
|
|
2
3
|
|
|
3
4
|
import { useChannelHandler } from '@sendbird/uikit-chat-hooks';
|
|
4
5
|
import {
|
|
6
|
+
ContextValue,
|
|
7
|
+
Logger,
|
|
5
8
|
NOOP,
|
|
6
9
|
SendbirdFileMessage,
|
|
7
10
|
SendbirdGroupChannel,
|
|
11
|
+
SendbirdMessage,
|
|
8
12
|
SendbirdUser,
|
|
9
13
|
SendbirdUserMessage,
|
|
14
|
+
getGroupChannelChatAvailableState,
|
|
10
15
|
isDifferentChannel,
|
|
16
|
+
useFreshCallback,
|
|
11
17
|
useUniqHandlerId,
|
|
12
18
|
} from '@sendbird/uikit-utils';
|
|
13
19
|
|
|
14
20
|
import ProviderLayout from '../../../components/ProviderLayout';
|
|
21
|
+
import { MESSAGE_FOCUS_ANIMATION_DELAY } from '../../../constants';
|
|
15
22
|
import { useLocalization, useSendbirdChat } from '../../../hooks/useContext';
|
|
16
23
|
import type { PubSub } from '../../../utils/pubsub';
|
|
17
24
|
import type { GroupChannelContextsType, GroupChannelModule, GroupChannelPubSubContextPayload } from '../types';
|
|
25
|
+
import { GroupChannelProps } from '../types';
|
|
18
26
|
|
|
19
27
|
export const GroupChannelContexts: GroupChannelContextsType = {
|
|
20
28
|
Fragment: createContext({
|
|
@@ -30,6 +38,16 @@ export const GroupChannelContexts: GroupChannelContextsType = {
|
|
|
30
38
|
publish: NOOP,
|
|
31
39
|
subscribe: () => NOOP,
|
|
32
40
|
} as PubSub<GroupChannelPubSubContextPayload>),
|
|
41
|
+
MessageList: createContext({
|
|
42
|
+
flatListRef: { current: null },
|
|
43
|
+
scrollToMessage: () => false,
|
|
44
|
+
lazyScrollToBottom: () => {
|
|
45
|
+
// noop
|
|
46
|
+
},
|
|
47
|
+
lazyScrollToIndex: () => {
|
|
48
|
+
// noop
|
|
49
|
+
},
|
|
50
|
+
} as MessageListContextValue),
|
|
33
51
|
};
|
|
34
52
|
|
|
35
53
|
export const GroupChannelContextsProvider: GroupChannelModule['Provider'] = ({
|
|
@@ -38,6 +56,8 @@ export const GroupChannelContextsProvider: GroupChannelModule['Provider'] = ({
|
|
|
38
56
|
enableTypingIndicator,
|
|
39
57
|
keyboardAvoidOffset = 0,
|
|
40
58
|
groupChannelPubSub,
|
|
59
|
+
messages,
|
|
60
|
+
onUpdateSearchItem,
|
|
41
61
|
}) => {
|
|
42
62
|
if (!channel) throw new Error('GroupChannel is not provided to GroupChannelModule');
|
|
43
63
|
|
|
@@ -49,6 +69,11 @@ export const GroupChannelContextsProvider: GroupChannelModule['Provider'] = ({
|
|
|
49
69
|
const [messageToEdit, setMessageToEdit] = useState<SendbirdUserMessage | SendbirdFileMessage>();
|
|
50
70
|
const [messageToReply, setMessageToReply] = useState<SendbirdUserMessage | SendbirdFileMessage>();
|
|
51
71
|
|
|
72
|
+
const { flatListRef, lazyScrollToIndex, lazyScrollToBottom, scrollToMessage } = useScrollActions({
|
|
73
|
+
messages,
|
|
74
|
+
onUpdateSearchItem,
|
|
75
|
+
});
|
|
76
|
+
|
|
52
77
|
const updateInputMode = (mode: 'send' | 'edit' | 'reply', message?: SendbirdUserMessage | SendbirdFileMessage) => {
|
|
53
78
|
if (mode === 'send' || !message) {
|
|
54
79
|
setMessageToEdit(undefined);
|
|
@@ -73,7 +98,9 @@ export const GroupChannelContextsProvider: GroupChannelModule['Provider'] = ({
|
|
|
73
98
|
},
|
|
74
99
|
onChannelFrozen(frozenChannel) {
|
|
75
100
|
if (frozenChannel.url === channel.url) {
|
|
76
|
-
|
|
101
|
+
if (frozenChannel.isGroupChannel() && getGroupChannelChatAvailableState(channel).frozen) {
|
|
102
|
+
setMessageToReply(undefined);
|
|
103
|
+
}
|
|
77
104
|
}
|
|
78
105
|
},
|
|
79
106
|
onUserMuted(mutedChannel, user) {
|
|
@@ -101,12 +128,97 @@ export const GroupChannelContextsProvider: GroupChannelModule['Provider'] = ({
|
|
|
101
128
|
setMessageToReply: useCallback((message) => updateInputMode('reply', message), []),
|
|
102
129
|
}}
|
|
103
130
|
>
|
|
104
|
-
<GroupChannelContexts.
|
|
105
|
-
<GroupChannelContexts.
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
131
|
+
<GroupChannelContexts.PubSub.Provider value={groupChannelPubSub}>
|
|
132
|
+
<GroupChannelContexts.TypingIndicator.Provider value={{ typingUsers }}>
|
|
133
|
+
<GroupChannelContexts.MessageList.Provider
|
|
134
|
+
value={{
|
|
135
|
+
flatListRef,
|
|
136
|
+
scrollToMessage,
|
|
137
|
+
lazyScrollToIndex,
|
|
138
|
+
lazyScrollToBottom,
|
|
139
|
+
}}
|
|
140
|
+
>
|
|
141
|
+
{children}
|
|
142
|
+
</GroupChannelContexts.MessageList.Provider>
|
|
143
|
+
</GroupChannelContexts.TypingIndicator.Provider>
|
|
144
|
+
</GroupChannelContexts.PubSub.Provider>
|
|
109
145
|
</GroupChannelContexts.Fragment.Provider>
|
|
110
146
|
</ProviderLayout>
|
|
111
147
|
);
|
|
112
148
|
};
|
|
149
|
+
|
|
150
|
+
type MessageListContextValue = ContextValue<GroupChannelContextsType['MessageList']>;
|
|
151
|
+
const useScrollActions = (params: Pick<GroupChannelProps['Provider'], 'messages' | 'onUpdateSearchItem'>) => {
|
|
152
|
+
const { messages, onUpdateSearchItem } = params;
|
|
153
|
+
const flatListRef = useRef<FlatList<SendbirdMessage>>(null);
|
|
154
|
+
|
|
155
|
+
// FIXME: Workaround, should run after data has been applied to UI.
|
|
156
|
+
const lazyScrollToBottom = useFreshCallback<MessageListContextValue['lazyScrollToIndex']>((params) => {
|
|
157
|
+
if (!flatListRef.current) {
|
|
158
|
+
logFlatListRefWarning();
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
setTimeout(() => {
|
|
163
|
+
flatListRef.current?.scrollToOffset({ offset: 0, animated: params?.animated ?? false });
|
|
164
|
+
}, params?.timeout ?? 0);
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
// FIXME: Workaround, should run after data has been applied to UI.
|
|
168
|
+
const lazyScrollToIndex = useFreshCallback<MessageListContextValue['lazyScrollToIndex']>((params) => {
|
|
169
|
+
if (!flatListRef.current) {
|
|
170
|
+
logFlatListRefWarning();
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
setTimeout(() => {
|
|
175
|
+
flatListRef.current?.scrollToIndex({
|
|
176
|
+
index: params?.index ?? 0,
|
|
177
|
+
animated: params?.animated ?? false,
|
|
178
|
+
viewPosition: params?.viewPosition ?? 0.5,
|
|
179
|
+
});
|
|
180
|
+
}, params?.timeout ?? 0);
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
const scrollToMessage = useFreshCallback<MessageListContextValue['scrollToMessage']>((messageId, options) => {
|
|
184
|
+
if (!flatListRef.current) {
|
|
185
|
+
logFlatListRefWarning();
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const foundMessageIndex = messages.findIndex((it) => it.messageId === messageId);
|
|
190
|
+
const isIncludedInList = foundMessageIndex > -1;
|
|
191
|
+
|
|
192
|
+
if (isIncludedInList) {
|
|
193
|
+
if (options?.focusAnimated) {
|
|
194
|
+
setTimeout(
|
|
195
|
+
() => onUpdateSearchItem({ startingPoint: messages[foundMessageIndex].createdAt }),
|
|
196
|
+
MESSAGE_FOCUS_ANIMATION_DELAY,
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
lazyScrollToIndex({
|
|
200
|
+
index: foundMessageIndex,
|
|
201
|
+
animated: true,
|
|
202
|
+
timeout: 0,
|
|
203
|
+
viewPosition: options?.viewPosition,
|
|
204
|
+
});
|
|
205
|
+
return true;
|
|
206
|
+
} else {
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
return {
|
|
212
|
+
flatListRef,
|
|
213
|
+
lazyScrollToIndex,
|
|
214
|
+
lazyScrollToBottom,
|
|
215
|
+
scrollToMessage,
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
const logFlatListRefWarning = () => {
|
|
220
|
+
Logger.warn(
|
|
221
|
+
'Cannot find flatListRef.current, please render FlatList and pass the flatListRef' +
|
|
222
|
+
'or please try again after FlatList has been rendered.',
|
|
223
|
+
);
|
|
224
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
+
import type { FlatList } from 'react-native';
|
|
2
3
|
|
|
3
4
|
import type { UseGroupChannelMessagesOptions } from '@sendbird/uikit-chat-hooks';
|
|
4
5
|
import type {
|
|
@@ -95,6 +96,10 @@ export interface GroupChannelProps {
|
|
|
95
96
|
enableTypingIndicator: boolean;
|
|
96
97
|
keyboardAvoidOffset?: number;
|
|
97
98
|
groupChannelPubSub: PubSub<GroupChannelPubSubContextPayload>;
|
|
99
|
+
|
|
100
|
+
messages: SendbirdMessage[];
|
|
101
|
+
// Changing the search item will trigger the focus animation on messages.
|
|
102
|
+
onUpdateSearchItem: (searchItem?: GroupChannelProps['MessageList']['searchItem']) => void;
|
|
98
103
|
};
|
|
99
104
|
}
|
|
100
105
|
|
|
@@ -117,6 +122,42 @@ export interface GroupChannelContextsType {
|
|
|
117
122
|
typingUsers: SendbirdUser[];
|
|
118
123
|
}>;
|
|
119
124
|
PubSub: React.Context<PubSub<GroupChannelPubSubContextPayload>>;
|
|
125
|
+
MessageList: React.Context<{
|
|
126
|
+
/**
|
|
127
|
+
* ref object for FlatList of MessageList
|
|
128
|
+
* */
|
|
129
|
+
flatListRef: React.MutableRefObject<FlatList | null>;
|
|
130
|
+
/**
|
|
131
|
+
* Function that scrolls to a message within a group channel.
|
|
132
|
+
* @param messageId {number} - The id of the message to scroll.
|
|
133
|
+
* @param options {object} - Scroll options (optional).
|
|
134
|
+
* @param options.focusAnimated {boolean} - Enable a shake animation on the message component upon completion of scrolling.
|
|
135
|
+
* @param options.viewPosition {number} - Position information to adjust the visible area during scrolling. bottom(0) ~ top(1.0)
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```
|
|
139
|
+
* const { scrollToMessage } = useContext(GroupChannelContexts.MessageList);
|
|
140
|
+
* const messageIncludedInMessageList = scrollToMessage(lastMessage.messageId, { focusAnimated: true, viewPosition: 1 });
|
|
141
|
+
* if (!messageIncludedInMessageList) console.warn('Message not found in the message list.');
|
|
142
|
+
* ```
|
|
143
|
+
* */
|
|
144
|
+
scrollToMessage: (messageId: number, options?: { focusAnimated?: boolean; viewPosition?: number }) => boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Call the FlatList function asynchronously to scroll to bottom lazily
|
|
147
|
+
* to avoid scrolling before data rendering has been committed.
|
|
148
|
+
* */
|
|
149
|
+
lazyScrollToBottom: (params?: { animated?: boolean; timeout?: number }) => void;
|
|
150
|
+
/**
|
|
151
|
+
* Call the FlatList function asynchronously to scroll to index lazily.
|
|
152
|
+
* to avoid scrolling before data rendering has been committed.
|
|
153
|
+
* */
|
|
154
|
+
lazyScrollToIndex: (params?: {
|
|
155
|
+
index?: number;
|
|
156
|
+
animated?: boolean;
|
|
157
|
+
timeout?: number;
|
|
158
|
+
viewPosition?: number;
|
|
159
|
+
}) => void;
|
|
160
|
+
}>;
|
|
120
161
|
}
|
|
121
162
|
export interface GroupChannelModule {
|
|
122
163
|
Provider: CommonComponent<GroupChannelProps['Provider']>;
|
|
@@ -7,8 +7,8 @@ import type { CommonComponent } from '../../types';
|
|
|
7
7
|
export interface UserListProps<User> {
|
|
8
8
|
/** Props for `UserListModule.Header` **/
|
|
9
9
|
Header: {
|
|
10
|
-
right?: React.
|
|
11
|
-
left?: React.
|
|
10
|
+
right?: React.ReactNode;
|
|
11
|
+
left?: React.ReactNode;
|
|
12
12
|
onPressHeaderLeft: () => void;
|
|
13
13
|
onPressHeaderRight: (selectedUsers: User[]) => Promise<void>;
|
|
14
14
|
shouldActivateHeaderRight?: (selectedUsers: User[]) => boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback, useMemo, useState } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import { ReplyType } from '@sendbird/chat/message';
|
|
4
4
|
import { useGroupChannelMessages } from '@sendbird/uikit-chat-hooks';
|
|
@@ -25,7 +25,7 @@ import type {
|
|
|
25
25
|
GroupChannelProps,
|
|
26
26
|
GroupChannelPubSubContextPayload,
|
|
27
27
|
} from '../domain/groupChannel/types';
|
|
28
|
-
import { useSendbirdChat } from '../hooks/useContext';
|
|
28
|
+
import { usePlatformService, useSendbirdChat } from '../hooks/useContext';
|
|
29
29
|
import pubsub from '../utils/pubsub';
|
|
30
30
|
|
|
31
31
|
const createGroupChannelFragment = (initModule?: Partial<GroupChannelModule>): GroupChannelFragment => {
|
|
@@ -52,6 +52,7 @@ const createGroupChannelFragment = (initModule?: Partial<GroupChannelModule>): G
|
|
|
52
52
|
sortComparator = messageComparator,
|
|
53
53
|
flatListProps,
|
|
54
54
|
}) => {
|
|
55
|
+
const { playerService, recorderService } = usePlatformService();
|
|
55
56
|
const { sdk, currentUser, sbOptions } = useSendbirdChat();
|
|
56
57
|
|
|
57
58
|
const [internalSearchItem, setInternalSearchItem] = useState(searchItem);
|
|
@@ -97,6 +98,30 @@ const createGroupChannelFragment = (initModule?: Partial<GroupChannelModule>): G
|
|
|
97
98
|
enableCollectionWithoutLocalCache: true,
|
|
98
99
|
});
|
|
99
100
|
|
|
101
|
+
const onBlurFragment = () => {
|
|
102
|
+
return Promise.allSettled([playerService.reset(), recorderService.reset()]);
|
|
103
|
+
};
|
|
104
|
+
const _onPressHeaderLeft = useFreshCallback(async () => {
|
|
105
|
+
await onBlurFragment();
|
|
106
|
+
onPressHeaderLeft();
|
|
107
|
+
});
|
|
108
|
+
const _onPressHeaderRight = useFreshCallback(async () => {
|
|
109
|
+
await onBlurFragment();
|
|
110
|
+
onPressHeaderRight();
|
|
111
|
+
});
|
|
112
|
+
const _onPressMediaMessage: NonNullable<GroupChannelProps['MessageList']['onPressMediaMessage']> = useFreshCallback(
|
|
113
|
+
async (message, deleteMessage, uri) => {
|
|
114
|
+
await onBlurFragment();
|
|
115
|
+
onPressMediaMessage(message, deleteMessage, uri);
|
|
116
|
+
},
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
return () => {
|
|
121
|
+
onBlurFragment();
|
|
122
|
+
};
|
|
123
|
+
}, []);
|
|
124
|
+
|
|
100
125
|
const renderItem: GroupChannelProps['MessageList']['renderMessage'] = useFreshCallback((props) => {
|
|
101
126
|
if (renderMessage) return renderMessage(props);
|
|
102
127
|
return <GroupChannelMessageRenderer {...props} />;
|
|
@@ -171,11 +196,13 @@ const createGroupChannelFragment = (initModule?: Partial<GroupChannelModule>): G
|
|
|
171
196
|
groupChannelPubSub={groupChannelPubSub}
|
|
172
197
|
enableTypingIndicator={enableTypingIndicator ?? sbOptions.uikit.groupChannel.channel.enableTypingIndicator}
|
|
173
198
|
keyboardAvoidOffset={keyboardAvoidOffset}
|
|
199
|
+
messages={messages}
|
|
200
|
+
onUpdateSearchItem={onUpdateSearchItem}
|
|
174
201
|
>
|
|
175
202
|
<GroupChannelModule.Header
|
|
176
203
|
shouldHideRight={navigateFromMessageSearch}
|
|
177
|
-
onPressHeaderLeft={
|
|
178
|
-
onPressHeaderRight={
|
|
204
|
+
onPressHeaderLeft={_onPressHeaderLeft}
|
|
205
|
+
onPressHeaderRight={_onPressHeaderRight}
|
|
179
206
|
/>
|
|
180
207
|
<StatusComposition loading={loading} LoadingComponent={<GroupChannelModule.StatusLoading />}>
|
|
181
208
|
<GroupChannelModule.MessageList
|
|
@@ -198,7 +225,7 @@ const createGroupChannelFragment = (initModule?: Partial<GroupChannelModule>): G
|
|
|
198
225
|
renderScrollToBottomButton={renderScrollToBottomButton}
|
|
199
226
|
onResendFailedMessage={resendMessage}
|
|
200
227
|
onDeleteMessage={deleteMessage}
|
|
201
|
-
onPressMediaMessage={
|
|
228
|
+
onPressMediaMessage={_onPressMediaMessage}
|
|
202
229
|
flatListProps={memoizedFlatListProps}
|
|
203
230
|
/>
|
|
204
231
|
<GroupChannelModule.Input
|
|
@@ -104,7 +104,7 @@ const useMessageSearch = (
|
|
|
104
104
|
const query = getMessageSearchQuery(sdk, {
|
|
105
105
|
keyword,
|
|
106
106
|
channelUrl: channel.url,
|
|
107
|
-
messageTimestampFrom:
|
|
107
|
+
messageTimestampFrom: channel.messageOffsetTimestamp,
|
|
108
108
|
order: MessageSearchOrder.TIMESTAMP,
|
|
109
109
|
queryCreator,
|
|
110
110
|
});
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { BottomSheetItem, useAlert, useToast } from '@sendbird/uikit-react-native-foundation';
|
|
2
|
+
import { SendbirdChannel, isImage, shouldCompressImage, useIIFE } from '@sendbird/uikit-utils';
|
|
3
|
+
|
|
4
|
+
import SBUError from '../libs/SBUError';
|
|
5
|
+
import SBUUtils from '../libs/SBUUtils';
|
|
6
|
+
import { FileType } from '../platform/types';
|
|
7
|
+
import { useLocalization, usePlatformService, useSendbirdChat } from './useContext';
|
|
8
|
+
|
|
9
|
+
export const useChannelInputItems = (channel: SendbirdChannel, sendFileMessage: (file: FileType) => void) => {
|
|
10
|
+
const { sbOptions, imageCompressionConfig } = useSendbirdChat();
|
|
11
|
+
const { STRINGS } = useLocalization();
|
|
12
|
+
const { fileService, mediaService } = usePlatformService();
|
|
13
|
+
const { alert } = useAlert();
|
|
14
|
+
const toast = useToast();
|
|
15
|
+
|
|
16
|
+
const sheetItems: BottomSheetItem['sheetItems'] = [];
|
|
17
|
+
const input = useIIFE(() => {
|
|
18
|
+
switch (true) {
|
|
19
|
+
case channel.isOpenChannel():
|
|
20
|
+
return sbOptions.uikit.openChannel.channel.input;
|
|
21
|
+
case channel.isGroupChannel():
|
|
22
|
+
return sbOptions.uikit.groupChannel.channel.input;
|
|
23
|
+
default:
|
|
24
|
+
return {
|
|
25
|
+
enableDocument: true,
|
|
26
|
+
camera: { enablePhoto: true, enableVideo: true },
|
|
27
|
+
gallery: { enablePhoto: true, enableVideo: true },
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
if (input.camera.enablePhoto) {
|
|
33
|
+
sheetItems.push({
|
|
34
|
+
title: STRINGS.LABELS.CHANNEL_INPUT_ATTACHMENT_CAMERA_PHOTO,
|
|
35
|
+
icon: 'camera',
|
|
36
|
+
onPress: async () => {
|
|
37
|
+
const mediaFile = await fileService.openCamera({
|
|
38
|
+
mediaType: 'photo',
|
|
39
|
+
onOpenFailure: (error) => {
|
|
40
|
+
if (error.code === SBUError.CODE.ERR_PERMISSIONS_DENIED) {
|
|
41
|
+
alert({
|
|
42
|
+
title: STRINGS.DIALOG.ALERT_PERMISSIONS_TITLE,
|
|
43
|
+
message: STRINGS.DIALOG.ALERT_PERMISSIONS_MESSAGE(
|
|
44
|
+
STRINGS.LABELS.PERMISSION_CAMERA,
|
|
45
|
+
STRINGS.LABELS.PERMISSION_APP_NAME,
|
|
46
|
+
),
|
|
47
|
+
buttons: [{ text: STRINGS.DIALOG.ALERT_PERMISSIONS_OK, onPress: () => SBUUtils.openSettings() }],
|
|
48
|
+
});
|
|
49
|
+
} else {
|
|
50
|
+
toast.show(STRINGS.TOAST.OPEN_CAMERA_ERROR, 'error');
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
if (mediaFile) {
|
|
56
|
+
// Image compression
|
|
57
|
+
if (
|
|
58
|
+
isImage(mediaFile.uri, mediaFile.type) &&
|
|
59
|
+
shouldCompressImage(mediaFile.type, sbOptions.chat.imageCompressionEnabled)
|
|
60
|
+
) {
|
|
61
|
+
await SBUUtils.safeRun(async () => {
|
|
62
|
+
const compressed = await mediaService.compressImage({
|
|
63
|
+
uri: mediaFile.uri,
|
|
64
|
+
maxWidth: imageCompressionConfig.width,
|
|
65
|
+
maxHeight: imageCompressionConfig.height,
|
|
66
|
+
compressionRate: imageCompressionConfig.compressionRate,
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
if (compressed) {
|
|
70
|
+
mediaFile.uri = compressed.uri;
|
|
71
|
+
mediaFile.size = compressed.size;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
sendFileMessage(mediaFile);
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (input.camera.enableVideo) {
|
|
83
|
+
sheetItems.push({
|
|
84
|
+
title: STRINGS.LABELS.CHANNEL_INPUT_ATTACHMENT_CAMERA_VIDEO,
|
|
85
|
+
icon: 'camera',
|
|
86
|
+
onPress: async () => {
|
|
87
|
+
const mediaFile = await fileService.openCamera({
|
|
88
|
+
mediaType: 'video',
|
|
89
|
+
onOpenFailure: (error) => {
|
|
90
|
+
if (error.code === SBUError.CODE.ERR_PERMISSIONS_DENIED) {
|
|
91
|
+
alert({
|
|
92
|
+
title: STRINGS.DIALOG.ALERT_PERMISSIONS_TITLE,
|
|
93
|
+
message: STRINGS.DIALOG.ALERT_PERMISSIONS_MESSAGE(
|
|
94
|
+
STRINGS.LABELS.PERMISSION_CAMERA,
|
|
95
|
+
STRINGS.LABELS.PERMISSION_APP_NAME,
|
|
96
|
+
),
|
|
97
|
+
buttons: [{ text: STRINGS.DIALOG.ALERT_PERMISSIONS_OK, onPress: () => SBUUtils.openSettings() }],
|
|
98
|
+
});
|
|
99
|
+
} else {
|
|
100
|
+
toast.show(STRINGS.TOAST.OPEN_CAMERA_ERROR, 'error');
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
if (mediaFile) {
|
|
106
|
+
sendFileMessage(mediaFile);
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (input.gallery.enablePhoto || input.gallery.enableVideo) {
|
|
113
|
+
const mediaType = (() => {
|
|
114
|
+
switch (true) {
|
|
115
|
+
case input.gallery.enablePhoto && input.gallery.enableVideo:
|
|
116
|
+
return 'all';
|
|
117
|
+
case input.gallery.enablePhoto && !input.gallery.enableVideo:
|
|
118
|
+
return 'photo';
|
|
119
|
+
case !input.gallery.enablePhoto && input.gallery.enableVideo:
|
|
120
|
+
return 'video';
|
|
121
|
+
default:
|
|
122
|
+
return 'all';
|
|
123
|
+
}
|
|
124
|
+
})();
|
|
125
|
+
|
|
126
|
+
sheetItems.push({
|
|
127
|
+
title: STRINGS.LABELS.CHANNEL_INPUT_ATTACHMENT_PHOTO_LIBRARY,
|
|
128
|
+
icon: 'photo',
|
|
129
|
+
onPress: async () => {
|
|
130
|
+
const mediaFiles = await fileService.openMediaLibrary({
|
|
131
|
+
selectionLimit: 1,
|
|
132
|
+
mediaType,
|
|
133
|
+
onOpenFailure: (error) => {
|
|
134
|
+
if (error.code === SBUError.CODE.ERR_PERMISSIONS_DENIED) {
|
|
135
|
+
alert({
|
|
136
|
+
title: STRINGS.DIALOG.ALERT_PERMISSIONS_TITLE,
|
|
137
|
+
message: STRINGS.DIALOG.ALERT_PERMISSIONS_MESSAGE(
|
|
138
|
+
STRINGS.LABELS.PERMISSION_DEVICE_STORAGE,
|
|
139
|
+
STRINGS.LABELS.PERMISSION_APP_NAME,
|
|
140
|
+
),
|
|
141
|
+
buttons: [{ text: STRINGS.DIALOG.ALERT_PERMISSIONS_OK, onPress: () => SBUUtils.openSettings() }],
|
|
142
|
+
});
|
|
143
|
+
} else {
|
|
144
|
+
toast.show(STRINGS.TOAST.OPEN_PHOTO_LIBRARY_ERROR, 'error');
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
if (mediaFiles && mediaFiles[0]) {
|
|
150
|
+
const mediaFile = mediaFiles[0];
|
|
151
|
+
|
|
152
|
+
// Image compression
|
|
153
|
+
if (
|
|
154
|
+
isImage(mediaFile.uri, mediaFile.type) &&
|
|
155
|
+
shouldCompressImage(mediaFile.type, sbOptions.chat.imageCompressionEnabled)
|
|
156
|
+
) {
|
|
157
|
+
await SBUUtils.safeRun(async () => {
|
|
158
|
+
const compressed = await mediaService.compressImage({
|
|
159
|
+
uri: mediaFile.uri,
|
|
160
|
+
maxWidth: imageCompressionConfig.width,
|
|
161
|
+
maxHeight: imageCompressionConfig.height,
|
|
162
|
+
compressionRate: imageCompressionConfig.compressionRate,
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
if (compressed) {
|
|
166
|
+
mediaFile.uri = compressed.uri;
|
|
167
|
+
mediaFile.size = compressed.size;
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
sendFileMessage(mediaFile);
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (input.enableDocument) {
|
|
179
|
+
sheetItems.push({
|
|
180
|
+
title: STRINGS.LABELS.CHANNEL_INPUT_ATTACHMENT_FILES,
|
|
181
|
+
icon: 'document',
|
|
182
|
+
onPress: async () => {
|
|
183
|
+
const documentFile = await fileService.openDocument({
|
|
184
|
+
onOpenFailure: () => toast.show(STRINGS.TOAST.OPEN_FILES_ERROR, 'error'),
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
if (documentFile) {
|
|
188
|
+
// Image compression
|
|
189
|
+
if (
|
|
190
|
+
isImage(documentFile.uri, documentFile.type) &&
|
|
191
|
+
shouldCompressImage(documentFile.type, sbOptions.chat.imageCompressionEnabled)
|
|
192
|
+
) {
|
|
193
|
+
await SBUUtils.safeRun(async () => {
|
|
194
|
+
const compressed = await mediaService.compressImage({
|
|
195
|
+
uri: documentFile.uri,
|
|
196
|
+
maxWidth: imageCompressionConfig.width,
|
|
197
|
+
maxHeight: imageCompressionConfig.height,
|
|
198
|
+
compressionRate: imageCompressionConfig.compressionRate,
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
if (compressed) {
|
|
202
|
+
documentFile.uri = compressed.uri;
|
|
203
|
+
documentFile.size = compressed.size;
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
sendFileMessage(documentFile);
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return sheetItems;
|
|
215
|
+
};
|
|
@@ -67,7 +67,7 @@ const useConnection = () => {
|
|
|
67
67
|
Logger.warn('[useConnection]', 'clear cached-data');
|
|
68
68
|
await sdk.clearCachedData().catch((e) => Logger.warn('[useConnection]', 'clear cached-data failure', e));
|
|
69
69
|
} else if (sdk.currentUser) {
|
|
70
|
-
await initEmoji(sdk, emojiManager);
|
|
70
|
+
await Promise.allSettled([initEmoji(sdk, emojiManager), initDashboardConfigs(sdk)]);
|
|
71
71
|
|
|
72
72
|
Logger.debug('[useConnection]', 'connected! (offline)');
|
|
73
73
|
setCurrentUser(sdk.currentUser);
|
|
@@ -93,7 +93,8 @@ const useMentionSuggestion = (params: {
|
|
|
93
93
|
.filter(
|
|
94
94
|
(member) =>
|
|
95
95
|
member.nickname?.toLowerCase().startsWith(searchString.toLowerCase()) &&
|
|
96
|
-
member.userId !== currentUser?.userId
|
|
96
|
+
member.userId !== currentUser?.userId &&
|
|
97
|
+
member.isActive,
|
|
97
98
|
)
|
|
98
99
|
.slice(0, mentionManager.config.suggestionLimit);
|
|
99
100
|
}
|