@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
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TouchableOpacity, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
Icon,
|
|
6
|
+
ImageWithPlaceholder,
|
|
7
|
+
Text,
|
|
8
|
+
VideoThumbnail,
|
|
9
|
+
createStyleSheet,
|
|
10
|
+
useUIKitTheme,
|
|
11
|
+
} from '@sendbird/uikit-react-native-foundation';
|
|
12
|
+
import {
|
|
13
|
+
FileIcon,
|
|
14
|
+
SendbirdBaseMessage,
|
|
15
|
+
SendbirdFileMessage,
|
|
16
|
+
SendbirdUserMessage,
|
|
17
|
+
getFileIconFromMessageType,
|
|
18
|
+
getMessageType,
|
|
19
|
+
getThumbnailUriFromFileMessage,
|
|
20
|
+
} from '@sendbird/uikit-utils';
|
|
21
|
+
|
|
22
|
+
import { useLocalization, usePlatformService } from '../../hooks/useContext';
|
|
23
|
+
|
|
24
|
+
export type MessageToReplyPreviewProps = {
|
|
25
|
+
messageToReply?: SendbirdFileMessage | SendbirdUserMessage;
|
|
26
|
+
setMessageToReply?: (message?: undefined | SendbirdFileMessage | SendbirdUserMessage) => void;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const MessageToReplyPreview = ({ messageToReply, setMessageToReply }: MessageToReplyPreviewProps) => {
|
|
30
|
+
const { colors, select, palette } = useUIKitTheme();
|
|
31
|
+
const { mediaService } = usePlatformService();
|
|
32
|
+
const { STRINGS } = useLocalization();
|
|
33
|
+
|
|
34
|
+
const getFileIconAsImage = (url: string) => {
|
|
35
|
+
return <ImageWithPlaceholder source={{ uri: url }} style={styles.previewImage} />;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const getFileIconAsVideoThumbnail = (url: string) => {
|
|
39
|
+
return (
|
|
40
|
+
<VideoThumbnail
|
|
41
|
+
style={styles.previewImage}
|
|
42
|
+
iconSize={0}
|
|
43
|
+
source={url}
|
|
44
|
+
fetchThumbnailFromVideoSource={(uri) => mediaService.getVideoThumbnail({ url: uri, timeMills: 1000 })}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const getFileIconAsSymbol = (icon: FileIcon) => {
|
|
50
|
+
return (
|
|
51
|
+
<Icon
|
|
52
|
+
icon={icon}
|
|
53
|
+
size={20}
|
|
54
|
+
color={colors.onBackground02}
|
|
55
|
+
containerStyle={[
|
|
56
|
+
styles.fileIcon,
|
|
57
|
+
{
|
|
58
|
+
backgroundColor: select({ light: palette.background100, dark: palette.background500 }),
|
|
59
|
+
},
|
|
60
|
+
]}
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const getFileIcon = (messageToReply: SendbirdBaseMessage) => {
|
|
66
|
+
if (messageToReply?.isFileMessage()) {
|
|
67
|
+
const messageType = getMessageType(messageToReply);
|
|
68
|
+
switch (messageType) {
|
|
69
|
+
case 'file.image':
|
|
70
|
+
return getFileIconAsImage(getThumbnailUriFromFileMessage(messageToReply));
|
|
71
|
+
case 'file.video':
|
|
72
|
+
return getFileIconAsVideoThumbnail(getThumbnailUriFromFileMessage(messageToReply));
|
|
73
|
+
case 'file.voice':
|
|
74
|
+
return null;
|
|
75
|
+
default:
|
|
76
|
+
return getFileIconAsSymbol(getFileIconFromMessageType(messageType));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return null;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
if (!messageToReply) return null;
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<View style={[styles.messageToReplyContainer, { borderColor: colors.onBackground04 }]}>
|
|
86
|
+
<View style={{ flex: 1, flexDirection: 'row' }}>
|
|
87
|
+
{getFileIcon(messageToReply)}
|
|
88
|
+
<View style={{ flex: 1, flexDirection: 'column' }}>
|
|
89
|
+
<Text numberOfLines={1} style={{ fontSize: 13, fontWeight: '900', marginBottom: 4 }}>
|
|
90
|
+
{STRINGS.LABELS.CHANNEL_INPUT_REPLY_PREVIEW_TITLE(messageToReply.sender)}
|
|
91
|
+
</Text>
|
|
92
|
+
<Text numberOfLines={1} style={{ fontSize: 13, color: colors.onBackground03 }}>
|
|
93
|
+
{STRINGS.LABELS.CHANNEL_INPUT_REPLY_PREVIEW_BODY(messageToReply)}
|
|
94
|
+
</Text>
|
|
95
|
+
</View>
|
|
96
|
+
</View>
|
|
97
|
+
<TouchableOpacity onPress={() => setMessageToReply?.(undefined)}>
|
|
98
|
+
<Icon icon={'close'} size={24} color={colors.onBackground01} containerStyle={styles.closeIcon} />
|
|
99
|
+
</TouchableOpacity>
|
|
100
|
+
</View>
|
|
101
|
+
);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const styles = createStyleSheet({
|
|
105
|
+
previewImage: {
|
|
106
|
+
width: 36,
|
|
107
|
+
height: 36,
|
|
108
|
+
borderRadius: 10,
|
|
109
|
+
marginTop: 2,
|
|
110
|
+
marginRight: 10,
|
|
111
|
+
overflow: 'hidden',
|
|
112
|
+
},
|
|
113
|
+
messageToReplyContainer: {
|
|
114
|
+
flexDirection: 'row',
|
|
115
|
+
paddingLeft: 18,
|
|
116
|
+
paddingRight: 16,
|
|
117
|
+
paddingTop: 10,
|
|
118
|
+
paddingBottom: 8,
|
|
119
|
+
alignItems: 'center',
|
|
120
|
+
borderTopWidth: 1,
|
|
121
|
+
},
|
|
122
|
+
fileIcon: {
|
|
123
|
+
width: 36,
|
|
124
|
+
height: 36,
|
|
125
|
+
borderRadius: 10,
|
|
126
|
+
marginRight: 10,
|
|
127
|
+
marginTop: 2,
|
|
128
|
+
},
|
|
129
|
+
closeIcon: {
|
|
130
|
+
marginLeft: 4,
|
|
131
|
+
padding: 4,
|
|
132
|
+
},
|
|
133
|
+
});
|
|
@@ -8,35 +8,22 @@ import {
|
|
|
8
8
|
View,
|
|
9
9
|
} from 'react-native';
|
|
10
10
|
|
|
11
|
-
import { MentionType } from '@sendbird/chat/message';
|
|
12
|
-
import type { BottomSheetItem } from '@sendbird/uikit-react-native-foundation';
|
|
11
|
+
import { MentionType, MessageMetaArray } from '@sendbird/chat/message';
|
|
13
12
|
import {
|
|
14
13
|
Icon,
|
|
15
|
-
|
|
16
|
-
Text,
|
|
14
|
+
Modal,
|
|
17
15
|
TextInput,
|
|
18
|
-
VideoThumbnail,
|
|
19
16
|
createStyleSheet,
|
|
20
17
|
useAlert,
|
|
21
18
|
useBottomSheet,
|
|
22
19
|
useToast,
|
|
23
20
|
useUIKitTheme,
|
|
24
21
|
} from '@sendbird/uikit-react-native-foundation';
|
|
25
|
-
import {
|
|
26
|
-
FileIcon,
|
|
27
|
-
Logger,
|
|
28
|
-
SendbirdBaseMessage,
|
|
29
|
-
SendbirdChannel,
|
|
30
|
-
getFileIconFromMessageType,
|
|
31
|
-
getMessageType,
|
|
32
|
-
getThumbnailUriFromFileMessage,
|
|
33
|
-
isImage,
|
|
34
|
-
shouldCompressImage,
|
|
35
|
-
useIIFE,
|
|
36
|
-
} from '@sendbird/uikit-utils';
|
|
22
|
+
import { Logger, useDeferredModalState, useIIFE } from '@sendbird/uikit-utils';
|
|
37
23
|
|
|
24
|
+
import { VOICE_MESSAGE_META_ARRAY_DURATION_KEY, VOICE_MESSAGE_META_ARRAY_MESSAGE_TYPE_KEY } from '../../constants';
|
|
25
|
+
import { useChannelInputItems } from '../../hooks/useChannelInputItems';
|
|
38
26
|
import { useLocalization, usePlatformService, useSendbirdChat } from '../../hooks/useContext';
|
|
39
|
-
import SBUError from '../../libs/SBUError';
|
|
40
27
|
import SBUUtils from '../../libs/SBUUtils';
|
|
41
28
|
import type { FileType } from '../../platform/types';
|
|
42
29
|
import type { MentionedUser } from '../../types';
|
|
@@ -51,6 +38,8 @@ interface SendInputProps extends ChannelInputProps {
|
|
|
51
38
|
|
|
52
39
|
const SendInput = forwardRef<RNTextInput, SendInputProps>(function SendInput(
|
|
53
40
|
{
|
|
41
|
+
VoiceMessageInput,
|
|
42
|
+
MessageToReplyPreview,
|
|
54
43
|
AttachmentsButton,
|
|
55
44
|
onPressSendUserMessage,
|
|
56
45
|
onPressSendFileMessage,
|
|
@@ -67,12 +56,18 @@ const SendInput = forwardRef<RNTextInput, SendInputProps>(function SendInput(
|
|
|
67
56
|
},
|
|
68
57
|
ref,
|
|
69
58
|
) {
|
|
59
|
+
const { playerService, recorderService } = usePlatformService();
|
|
70
60
|
const { mentionManager, sbOptions } = useSendbirdChat();
|
|
71
|
-
const { select, colors, palette } = useUIKitTheme();
|
|
72
61
|
const { STRINGS } = useLocalization();
|
|
73
62
|
const { openSheet } = useBottomSheet();
|
|
74
63
|
const toast = useToast();
|
|
75
|
-
|
|
64
|
+
|
|
65
|
+
const {
|
|
66
|
+
onClose,
|
|
67
|
+
onDismiss,
|
|
68
|
+
visible: voiceMessageInputVisible,
|
|
69
|
+
setVisible: setVoiceMessageInputVisible,
|
|
70
|
+
} = useDeferredModalState();
|
|
76
71
|
|
|
77
72
|
const messageReplyParams = useIIFE(() => {
|
|
78
73
|
const { groupChannel } = sbOptions.uikit;
|
|
@@ -122,8 +117,35 @@ const SendInput = forwardRef<RNTextInput, SendInputProps>(function SendInput(
|
|
|
122
117
|
setMessageToReply?.();
|
|
123
118
|
};
|
|
124
119
|
|
|
120
|
+
const sendVoiceMessage = (file: FileType, durationMills: number) => {
|
|
121
|
+
if (inputMuted) {
|
|
122
|
+
toast.show(STRINGS.TOAST.USER_MUTED_ERROR, 'error');
|
|
123
|
+
Logger.error(STRINGS.TOAST.USER_MUTED_ERROR);
|
|
124
|
+
} else if (inputFrozen) {
|
|
125
|
+
toast.show(STRINGS.TOAST.CHANNEL_FROZEN_ERROR, 'error');
|
|
126
|
+
Logger.error(STRINGS.TOAST.CHANNEL_FROZEN_ERROR);
|
|
127
|
+
} else {
|
|
128
|
+
onPressSendFileMessage({
|
|
129
|
+
file,
|
|
130
|
+
metaArrays: [
|
|
131
|
+
new MessageMetaArray({
|
|
132
|
+
key: VOICE_MESSAGE_META_ARRAY_DURATION_KEY,
|
|
133
|
+
value: [String(durationMills)],
|
|
134
|
+
}),
|
|
135
|
+
new MessageMetaArray({
|
|
136
|
+
key: VOICE_MESSAGE_META_ARRAY_MESSAGE_TYPE_KEY,
|
|
137
|
+
value: [`voice/${recorderService.options.extension}`],
|
|
138
|
+
}),
|
|
139
|
+
],
|
|
140
|
+
...messageReplyParams,
|
|
141
|
+
}).catch(onFailureToSend);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
onChangeText('');
|
|
145
|
+
setMessageToReply?.();
|
|
146
|
+
};
|
|
147
|
+
|
|
125
148
|
const sheetItems = useChannelInputItems(channel, sendFileMessage);
|
|
126
|
-
const onPressAttachment = () => openSheet({ sheetItems });
|
|
127
149
|
|
|
128
150
|
const getPlaceholder = () => {
|
|
129
151
|
if (inputMuted) return STRINGS.LABELS.CHANNEL_INPUT_PLACEHOLDER_MUTED;
|
|
@@ -134,90 +156,16 @@ const SendInput = forwardRef<RNTextInput, SendInputProps>(function SendInput(
|
|
|
134
156
|
return STRINGS.LABELS.CHANNEL_INPUT_PLACEHOLDER_ACTIVE;
|
|
135
157
|
};
|
|
136
158
|
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
const getFileIconAsVideoThumbnail = (url: string) => {
|
|
142
|
-
return (
|
|
143
|
-
<VideoThumbnail
|
|
144
|
-
style={styles.previewImage}
|
|
145
|
-
iconSize={0}
|
|
146
|
-
source={url}
|
|
147
|
-
fetchThumbnailFromVideoSource={(uri) => mediaService.getVideoThumbnail({ url: uri, timeMills: 1000 })}
|
|
148
|
-
/>
|
|
149
|
-
);
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
const getFileIconAsSymbol = (icon: FileIcon) => {
|
|
153
|
-
return (
|
|
154
|
-
<Icon
|
|
155
|
-
icon={icon}
|
|
156
|
-
size={20}
|
|
157
|
-
color={colors.onBackground02}
|
|
158
|
-
containerStyle={{
|
|
159
|
-
backgroundColor: select({
|
|
160
|
-
light: palette.background100,
|
|
161
|
-
dark: palette.background500,
|
|
162
|
-
}),
|
|
163
|
-
width: 36,
|
|
164
|
-
height: 36,
|
|
165
|
-
borderRadius: 10,
|
|
166
|
-
marginRight: 10,
|
|
167
|
-
marginTop: 2,
|
|
168
|
-
}}
|
|
169
|
-
/>
|
|
170
|
-
);
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
const getFileIcon = (messageToReply: SendbirdBaseMessage) => {
|
|
174
|
-
if (messageToReply?.isFileMessage()) {
|
|
175
|
-
const messageType = getMessageType(messageToReply);
|
|
176
|
-
switch (messageType) {
|
|
177
|
-
case 'file.image':
|
|
178
|
-
return getFileIconAsImage(getThumbnailUriFromFileMessage(messageToReply));
|
|
179
|
-
case 'file.video':
|
|
180
|
-
return getFileIconAsVideoThumbnail(getThumbnailUriFromFileMessage(messageToReply));
|
|
181
|
-
default:
|
|
182
|
-
return getFileIconAsSymbol(getFileIconFromMessageType(messageType));
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
return null;
|
|
186
|
-
};
|
|
159
|
+
const voiceMessageEnabled = channel.isGroupChannel() && sbOptions.uikit.groupChannel.channel.enableVoiceMessage;
|
|
160
|
+
const sendButtonVisible = Boolean(text.trim());
|
|
187
161
|
|
|
188
162
|
return (
|
|
189
163
|
<View>
|
|
190
|
-
{
|
|
191
|
-
<
|
|
192
|
-
style={{
|
|
193
|
-
flexDirection: 'row',
|
|
194
|
-
paddingLeft: 18,
|
|
195
|
-
paddingRight: 16,
|
|
196
|
-
paddingTop: 10,
|
|
197
|
-
paddingBottom: 8,
|
|
198
|
-
alignItems: 'center',
|
|
199
|
-
borderTopWidth: 1,
|
|
200
|
-
borderColor: colors.onBackground04,
|
|
201
|
-
}}
|
|
202
|
-
>
|
|
203
|
-
<View style={{ flex: 1, flexDirection: 'row' }}>
|
|
204
|
-
{getFileIcon(messageToReply)}
|
|
205
|
-
<View style={{ flex: 1, flexDirection: 'column' }}>
|
|
206
|
-
<Text numberOfLines={1} style={{ fontSize: 13, fontWeight: '900', marginBottom: 4 }}>
|
|
207
|
-
{STRINGS.LABELS.CHANNEL_INPUT_REPLY_PREVIEW_TITLE(messageToReply.sender)}
|
|
208
|
-
</Text>
|
|
209
|
-
<Text numberOfLines={1} style={{ fontSize: 13, color: colors.onBackground03 }}>
|
|
210
|
-
{STRINGS.LABELS.CHANNEL_INPUT_REPLY_PREVIEW_BODY(messageToReply)}
|
|
211
|
-
</Text>
|
|
212
|
-
</View>
|
|
213
|
-
</View>
|
|
214
|
-
<TouchableOpacity onPress={() => setMessageToReply?.(undefined)}>
|
|
215
|
-
<Icon icon={'close'} size={24} color={colors.onBackground01} containerStyle={styles.iconSend} />
|
|
216
|
-
</TouchableOpacity>
|
|
217
|
-
</View>
|
|
164
|
+
{MessageToReplyPreview && (
|
|
165
|
+
<MessageToReplyPreview messageToReply={messageToReply} setMessageToReply={setMessageToReply} />
|
|
218
166
|
)}
|
|
219
167
|
<View style={styles.sendInputContainer}>
|
|
220
|
-
{AttachmentsButton && <AttachmentsButton onPress={
|
|
168
|
+
{AttachmentsButton && <AttachmentsButton onPress={() => openSheet({ sheetItems })} disabled={inputDisabled} />}
|
|
221
169
|
<TextInput
|
|
222
170
|
ref={ref}
|
|
223
171
|
multiline
|
|
@@ -235,229 +183,98 @@ const SendInput = forwardRef<RNTextInput, SendInputProps>(function SendInput(
|
|
|
235
183
|
)}
|
|
236
184
|
</TextInput>
|
|
237
185
|
|
|
238
|
-
{
|
|
239
|
-
<
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
186
|
+
{voiceMessageEnabled && (
|
|
187
|
+
<VoiceMessageButton
|
|
188
|
+
visible={!sendButtonVisible}
|
|
189
|
+
disabled={inputDisabled}
|
|
190
|
+
onPress={() => setVoiceMessageInputVisible(true)}
|
|
191
|
+
/>
|
|
192
|
+
)}
|
|
193
|
+
<UserMessageSendButton visible={sendButtonVisible} disabled={inputDisabled} onPress={sendUserMessage} />
|
|
194
|
+
{voiceMessageEnabled && VoiceMessageInput && (
|
|
195
|
+
<Modal
|
|
196
|
+
disableBackgroundClose
|
|
197
|
+
onClose={onClose}
|
|
198
|
+
onDismiss={() => {
|
|
199
|
+
onDismiss();
|
|
200
|
+
Promise.allSettled([playerService.reset(), recorderService.reset()]);
|
|
201
|
+
}}
|
|
202
|
+
backgroundStyle={{ justifyContent: 'flex-end' }}
|
|
203
|
+
visible={voiceMessageInputVisible}
|
|
204
|
+
type={'slide-no-gesture'}
|
|
205
|
+
>
|
|
206
|
+
<VoiceMessageInput onClose={onClose} onSend={({ file, duration }) => sendVoiceMessage(file, duration)} />
|
|
207
|
+
</Modal>
|
|
249
208
|
)}
|
|
250
209
|
</View>
|
|
251
210
|
</View>
|
|
252
211
|
);
|
|
253
212
|
});
|
|
254
213
|
|
|
255
|
-
|
|
256
|
-
|
|
214
|
+
type InputButtonProps = { visible: boolean; disabled: boolean; onPress: () => void };
|
|
215
|
+
const VoiceMessageButton = ({ visible, disabled, onPress }: InputButtonProps) => {
|
|
257
216
|
const { STRINGS } = useLocalization();
|
|
258
|
-
const { fileService, mediaService } = usePlatformService();
|
|
259
217
|
const { alert } = useAlert();
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
218
|
+
const { playerService, recorderService } = usePlatformService();
|
|
219
|
+
const { colors } = useUIKitTheme();
|
|
220
|
+
if (!visible) return null;
|
|
221
|
+
|
|
222
|
+
const onPressWithPermissionCheck = async () => {
|
|
223
|
+
const recorderGranted = await recorderService.requestPermission();
|
|
224
|
+
if (!recorderGranted) {
|
|
225
|
+
alert({
|
|
226
|
+
title: STRINGS.DIALOG.ALERT_PERMISSIONS_TITLE,
|
|
227
|
+
message: STRINGS.DIALOG.ALERT_PERMISSIONS_MESSAGE(
|
|
228
|
+
STRINGS.LABELS.PERMISSION_MICROPHONE,
|
|
229
|
+
STRINGS.LABELS.PERMISSION_APP_NAME,
|
|
230
|
+
),
|
|
231
|
+
buttons: [{ text: STRINGS.DIALOG.ALERT_PERMISSIONS_OK, onPress: () => SBUUtils.openSettings() }],
|
|
232
|
+
});
|
|
233
|
+
Logger.error('Failed to request permission for recorder');
|
|
234
|
+
return;
|
|
275
235
|
}
|
|
276
|
-
});
|
|
277
236
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
STRINGS.LABELS.PERMISSION_APP_NAME,
|
|
292
|
-
),
|
|
293
|
-
buttons: [{ text: STRINGS.DIALOG.ALERT_PERMISSIONS_OK, onPress: () => SBUUtils.openSettings() }],
|
|
294
|
-
});
|
|
295
|
-
} else {
|
|
296
|
-
toast.show(STRINGS.TOAST.OPEN_CAMERA_ERROR, 'error');
|
|
297
|
-
}
|
|
298
|
-
},
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
if (mediaFile) {
|
|
302
|
-
// Image compression
|
|
303
|
-
if (
|
|
304
|
-
isImage(mediaFile.uri, mediaFile.type) &&
|
|
305
|
-
shouldCompressImage(mediaFile.type, sbOptions.chat.imageCompressionEnabled)
|
|
306
|
-
) {
|
|
307
|
-
await SBUUtils.safeRun(async () => {
|
|
308
|
-
const compressed = await mediaService.compressImage({
|
|
309
|
-
uri: mediaFile.uri,
|
|
310
|
-
maxWidth: imageCompressionConfig.width,
|
|
311
|
-
maxHeight: imageCompressionConfig.height,
|
|
312
|
-
compressionRate: imageCompressionConfig.compressionRate,
|
|
313
|
-
});
|
|
314
|
-
|
|
315
|
-
if (compressed) {
|
|
316
|
-
mediaFile.uri = compressed.uri;
|
|
317
|
-
mediaFile.size = compressed.size;
|
|
318
|
-
}
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
sendFileMessage(mediaFile);
|
|
323
|
-
}
|
|
324
|
-
},
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
if (input.camera.enableVideo) {
|
|
329
|
-
sheetItems.push({
|
|
330
|
-
title: STRINGS.LABELS.CHANNEL_INPUT_ATTACHMENT_CAMERA_VIDEO,
|
|
331
|
-
icon: 'camera',
|
|
332
|
-
onPress: async () => {
|
|
333
|
-
const mediaFile = await fileService.openCamera({
|
|
334
|
-
mediaType: 'video',
|
|
335
|
-
onOpenFailure: (error) => {
|
|
336
|
-
if (error.code === SBUError.CODE.ERR_PERMISSIONS_DENIED) {
|
|
337
|
-
alert({
|
|
338
|
-
title: STRINGS.DIALOG.ALERT_PERMISSIONS_TITLE,
|
|
339
|
-
message: STRINGS.DIALOG.ALERT_PERMISSIONS_MESSAGE(
|
|
340
|
-
STRINGS.LABELS.PERMISSION_CAMERA,
|
|
341
|
-
STRINGS.LABELS.PERMISSION_APP_NAME,
|
|
342
|
-
),
|
|
343
|
-
buttons: [{ text: STRINGS.DIALOG.ALERT_PERMISSIONS_OK, onPress: () => SBUUtils.openSettings() }],
|
|
344
|
-
});
|
|
345
|
-
} else {
|
|
346
|
-
toast.show(STRINGS.TOAST.OPEN_CAMERA_ERROR, 'error');
|
|
347
|
-
}
|
|
348
|
-
},
|
|
349
|
-
});
|
|
350
|
-
|
|
351
|
-
if (mediaFile) {
|
|
352
|
-
sendFileMessage(mediaFile);
|
|
353
|
-
}
|
|
354
|
-
},
|
|
355
|
-
});
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
if (input.gallery.enablePhoto || input.gallery.enableVideo) {
|
|
359
|
-
const mediaType = (() => {
|
|
360
|
-
switch (true) {
|
|
361
|
-
case input.gallery.enablePhoto && input.gallery.enableVideo:
|
|
362
|
-
return 'all';
|
|
363
|
-
case input.gallery.enablePhoto && !input.gallery.enableVideo:
|
|
364
|
-
return 'photo';
|
|
365
|
-
case !input.gallery.enablePhoto && input.gallery.enableVideo:
|
|
366
|
-
return 'video';
|
|
367
|
-
default:
|
|
368
|
-
return 'all';
|
|
369
|
-
}
|
|
370
|
-
})();
|
|
371
|
-
|
|
372
|
-
sheetItems.push({
|
|
373
|
-
title: STRINGS.LABELS.CHANNEL_INPUT_ATTACHMENT_PHOTO_LIBRARY,
|
|
374
|
-
icon: 'photo',
|
|
375
|
-
onPress: async () => {
|
|
376
|
-
const mediaFiles = await fileService.openMediaLibrary({
|
|
377
|
-
selectionLimit: 1,
|
|
378
|
-
mediaType,
|
|
379
|
-
onOpenFailure: (error) => {
|
|
380
|
-
if (error.code === SBUError.CODE.ERR_PERMISSIONS_DENIED) {
|
|
381
|
-
alert({
|
|
382
|
-
title: STRINGS.DIALOG.ALERT_PERMISSIONS_TITLE,
|
|
383
|
-
message: STRINGS.DIALOG.ALERT_PERMISSIONS_MESSAGE(
|
|
384
|
-
STRINGS.LABELS.PERMISSION_DEVICE_STORAGE,
|
|
385
|
-
STRINGS.LABELS.PERMISSION_APP_NAME,
|
|
386
|
-
),
|
|
387
|
-
buttons: [{ text: STRINGS.DIALOG.ALERT_PERMISSIONS_OK, onPress: () => SBUUtils.openSettings() }],
|
|
388
|
-
});
|
|
389
|
-
} else {
|
|
390
|
-
toast.show(STRINGS.TOAST.OPEN_PHOTO_LIBRARY_ERROR, 'error');
|
|
391
|
-
}
|
|
392
|
-
},
|
|
393
|
-
});
|
|
394
|
-
|
|
395
|
-
if (mediaFiles && mediaFiles[0]) {
|
|
396
|
-
const mediaFile = mediaFiles[0];
|
|
397
|
-
|
|
398
|
-
// Image compression
|
|
399
|
-
if (
|
|
400
|
-
isImage(mediaFile.uri, mediaFile.type) &&
|
|
401
|
-
shouldCompressImage(mediaFile.type, sbOptions.chat.imageCompressionEnabled)
|
|
402
|
-
) {
|
|
403
|
-
await SBUUtils.safeRun(async () => {
|
|
404
|
-
const compressed = await mediaService.compressImage({
|
|
405
|
-
uri: mediaFile.uri,
|
|
406
|
-
maxWidth: imageCompressionConfig.width,
|
|
407
|
-
maxHeight: imageCompressionConfig.height,
|
|
408
|
-
compressionRate: imageCompressionConfig.compressionRate,
|
|
409
|
-
});
|
|
410
|
-
|
|
411
|
-
if (compressed) {
|
|
412
|
-
mediaFile.uri = compressed.uri;
|
|
413
|
-
mediaFile.size = compressed.size;
|
|
414
|
-
}
|
|
415
|
-
});
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
sendFileMessage(mediaFile);
|
|
419
|
-
}
|
|
420
|
-
},
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
if (input.enableDocument) {
|
|
425
|
-
sheetItems.push({
|
|
426
|
-
title: STRINGS.LABELS.CHANNEL_INPUT_ATTACHMENT_FILES,
|
|
427
|
-
icon: 'document',
|
|
428
|
-
onPress: async () => {
|
|
429
|
-
const documentFile = await fileService.openDocument({
|
|
430
|
-
onOpenFailure: () => toast.show(STRINGS.TOAST.OPEN_FILES_ERROR, 'error'),
|
|
431
|
-
});
|
|
432
|
-
|
|
433
|
-
if (documentFile) {
|
|
434
|
-
// Image compression
|
|
435
|
-
if (
|
|
436
|
-
isImage(documentFile.uri, documentFile.type) &&
|
|
437
|
-
shouldCompressImage(documentFile.type, sbOptions.chat.imageCompressionEnabled)
|
|
438
|
-
) {
|
|
439
|
-
await SBUUtils.safeRun(async () => {
|
|
440
|
-
const compressed = await mediaService.compressImage({
|
|
441
|
-
uri: documentFile.uri,
|
|
442
|
-
maxWidth: imageCompressionConfig.width,
|
|
443
|
-
maxHeight: imageCompressionConfig.height,
|
|
444
|
-
compressionRate: imageCompressionConfig.compressionRate,
|
|
445
|
-
});
|
|
446
|
-
|
|
447
|
-
if (compressed) {
|
|
448
|
-
documentFile.uri = compressed.uri;
|
|
449
|
-
documentFile.size = compressed.size;
|
|
450
|
-
}
|
|
451
|
-
});
|
|
452
|
-
}
|
|
237
|
+
const playerGranted = await playerService.requestPermission();
|
|
238
|
+
if (!playerGranted) {
|
|
239
|
+
alert({
|
|
240
|
+
title: STRINGS.DIALOG.ALERT_PERMISSIONS_TITLE,
|
|
241
|
+
message: STRINGS.DIALOG.ALERT_PERMISSIONS_MESSAGE(
|
|
242
|
+
STRINGS.LABELS.PERMISSION_DEVICE_STORAGE,
|
|
243
|
+
STRINGS.LABELS.PERMISSION_APP_NAME,
|
|
244
|
+
),
|
|
245
|
+
buttons: [{ text: STRINGS.DIALOG.ALERT_PERMISSIONS_OK, onPress: () => SBUUtils.openSettings() }],
|
|
246
|
+
});
|
|
247
|
+
Logger.error('Failed to request permission for player');
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
453
250
|
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
},
|
|
457
|
-
});
|
|
458
|
-
}
|
|
251
|
+
onPress();
|
|
252
|
+
};
|
|
459
253
|
|
|
460
|
-
return
|
|
254
|
+
return (
|
|
255
|
+
<TouchableOpacity onPress={onPressWithPermissionCheck} disabled={disabled}>
|
|
256
|
+
<Icon
|
|
257
|
+
color={disabled ? colors.ui.input.default.disabled.highlight : colors.ui.input.default.active.highlight}
|
|
258
|
+
icon={'audio-on'}
|
|
259
|
+
size={24}
|
|
260
|
+
containerStyle={styles.sendIcon}
|
|
261
|
+
/>
|
|
262
|
+
</TouchableOpacity>
|
|
263
|
+
);
|
|
264
|
+
};
|
|
265
|
+
const UserMessageSendButton = ({ visible, disabled, onPress }: InputButtonProps) => {
|
|
266
|
+
const { colors } = useUIKitTheme();
|
|
267
|
+
if (!visible) return null;
|
|
268
|
+
return (
|
|
269
|
+
<TouchableOpacity onPress={onPress} disabled={disabled}>
|
|
270
|
+
<Icon
|
|
271
|
+
color={disabled ? colors.ui.input.default.disabled.highlight : colors.ui.input.default.active.highlight}
|
|
272
|
+
icon={'send'}
|
|
273
|
+
size={24}
|
|
274
|
+
containerStyle={styles.sendIcon}
|
|
275
|
+
/>
|
|
276
|
+
</TouchableOpacity>
|
|
277
|
+
);
|
|
461
278
|
};
|
|
462
279
|
|
|
463
280
|
const styles = createStyleSheet({
|
|
@@ -474,18 +291,10 @@ const styles = createStyleSheet({
|
|
|
474
291
|
maxHeight: 36 * Platform.select({ ios: 2.5, default: 2 }),
|
|
475
292
|
borderRadius: 20,
|
|
476
293
|
},
|
|
477
|
-
|
|
294
|
+
sendIcon: {
|
|
478
295
|
marginLeft: 4,
|
|
479
296
|
padding: 4,
|
|
480
297
|
},
|
|
481
|
-
previewImage: {
|
|
482
|
-
width: 36,
|
|
483
|
-
height: 36,
|
|
484
|
-
borderRadius: 10,
|
|
485
|
-
marginTop: 2,
|
|
486
|
-
marginRight: 10,
|
|
487
|
-
overflow: 'hidden',
|
|
488
|
-
},
|
|
489
298
|
});
|
|
490
299
|
|
|
491
300
|
export default SendInput;
|