@sendbird/uikit-react-native 2.5.0 → 3.0.0-rc.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 +6 -1
- package/lib/commonjs/components/{MessageRenderer/MessageTime.js → ChannelInput/AttachmentsButton.js} +20 -17
- package/lib/commonjs/components/ChannelInput/AttachmentsButton.js.map +1 -0
- package/lib/commonjs/components/ChannelInput/EditInput.js +10 -18
- package/lib/commonjs/components/ChannelInput/EditInput.js.map +1 -1
- package/lib/commonjs/components/ChannelInput/SendInput.js +220 -163
- package/lib/commonjs/components/ChannelInput/SendInput.js.map +1 -1
- package/lib/commonjs/components/ChannelInput/index.js +5 -3
- package/lib/commonjs/components/ChannelInput/index.js.map +1 -1
- package/lib/commonjs/components/ChannelMessageList/index.js +27 -27
- package/lib/commonjs/components/ChannelMessageList/index.js.map +1 -1
- package/lib/commonjs/components/ChatFlatList.js +18 -6
- package/lib/commonjs/components/ChatFlatList.js.map +1 -1
- package/lib/commonjs/components/{MessageRenderer/MessageDateSeparator.js → GroupChannelMessageRenderer/GroupChannelMessageDateSeparator.js} +3 -3
- package/lib/commonjs/components/GroupChannelMessageRenderer/GroupChannelMessageDateSeparator.js.map +1 -0
- package/lib/commonjs/components/GroupChannelMessageRenderer/GroupChannelMessageFocusAnimation.js +47 -0
- package/lib/commonjs/components/GroupChannelMessageRenderer/GroupChannelMessageFocusAnimation.js.map +1 -0
- package/lib/commonjs/components/{MessageRenderer/MessageOutgoingStatus.js → GroupChannelMessageRenderer/GroupChannelMessageOutgoingStatus.js} +11 -14
- package/lib/commonjs/components/GroupChannelMessageRenderer/GroupChannelMessageOutgoingStatus.js.map +1 -0
- package/lib/commonjs/components/GroupChannelMessageRenderer/index.js +204 -0
- package/lib/commonjs/components/GroupChannelMessageRenderer/index.js.map +1 -0
- package/lib/commonjs/components/MessageSearchResultItem.js +3 -2
- package/lib/commonjs/components/MessageSearchResultItem.js.map +1 -1
- package/lib/commonjs/components/OpenChannelMessageRenderer/index.js +15 -9
- package/lib/commonjs/components/OpenChannelMessageRenderer/index.js.map +1 -1
- package/lib/commonjs/constants.js +1 -7
- package/lib/commonjs/constants.js.map +1 -1
- package/lib/commonjs/containers/GroupChannelPreviewContainer.js +13 -13
- package/lib/commonjs/containers/GroupChannelPreviewContainer.js.map +1 -1
- package/lib/commonjs/containers/SendbirdUIKitContainer.js +29 -19
- package/lib/commonjs/containers/SendbirdUIKitContainer.js.map +1 -1
- package/lib/commonjs/contexts/SendbirdChatCtx.js +17 -14
- package/lib/commonjs/contexts/SendbirdChatCtx.js.map +1 -1
- package/lib/commonjs/contexts/UserProfileCtx.js +6 -4
- package/lib/commonjs/contexts/UserProfileCtx.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/component/GroupChannelInput.js +4 -13
- package/lib/commonjs/domain/groupChannel/component/GroupChannelInput.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/types.js.map +1 -1
- package/lib/commonjs/domain/groupChannelList/component/GroupChannelListList.js +10 -6
- package/lib/commonjs/domain/groupChannelList/component/GroupChannelListList.js.map +1 -1
- package/lib/commonjs/domain/groupChannelList/component/GroupChannelListTypeSelector.js +3 -3
- package/lib/commonjs/domain/groupChannelList/component/GroupChannelListTypeSelector.js.map +1 -1
- package/lib/commonjs/domain/groupChannelList/types.js.map +1 -1
- package/lib/commonjs/domain/groupChannelSettings/component/GroupChannelSettingsMenu.js +11 -10
- package/lib/commonjs/domain/groupChannelSettings/component/GroupChannelSettingsMenu.js.map +1 -1
- package/lib/commonjs/domain/openChannel/component/OpenChannelInput.js +4 -8
- package/lib/commonjs/domain/openChannel/component/OpenChannelInput.js.map +1 -1
- package/lib/commonjs/domain/openChannel/types.js.map +1 -1
- package/lib/commonjs/domain/openChannelList/component/OpenChannelListList.js +3 -1
- package/lib/commonjs/domain/openChannelList/component/OpenChannelListList.js.map +1 -1
- package/lib/commonjs/domain/openChannelList/types.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelCreateFragment.js +1 -1
- package/lib/commonjs/fragments/createGroupChannelCreateFragment.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelFragment.js +22 -100
- package/lib/commonjs/fragments/createGroupChannelFragment.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelInviteFragment.js +1 -1
- package/lib/commonjs/fragments/createGroupChannelInviteFragment.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelListFragment.js +8 -13
- package/lib/commonjs/fragments/createGroupChannelListFragment.js.map +1 -1
- package/lib/commonjs/fragments/createMessageSearchFragment.js +2 -2
- package/lib/commonjs/fragments/createMessageSearchFragment.js.map +1 -1
- package/lib/commonjs/fragments/createOpenChannelFragment.js +1 -7
- package/lib/commonjs/fragments/createOpenChannelFragment.js.map +1 -1
- package/lib/commonjs/fragments/createOpenChannelListFragment.js +2 -1
- package/lib/commonjs/fragments/createOpenChannelListFragment.js.map +1 -1
- package/lib/commonjs/hooks/useConnection.js +11 -7
- package/lib/commonjs/hooks/useConnection.js.map +1 -1
- package/lib/commonjs/hooks/useMentionTextInput.js +3 -2
- package/lib/commonjs/hooks/useMentionTextInput.js.map +1 -1
- package/lib/commonjs/index.js +20 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/libs/MentionManager.js +8 -9
- package/lib/commonjs/libs/MentionManager.js.map +1 -1
- package/lib/commonjs/libs/SBUUtils.js +7 -3
- package/lib/commonjs/libs/SBUUtils.js.map +1 -1
- package/lib/commonjs/localization/StringSet.type.js.map +1 -1
- package/lib/commonjs/localization/createBaseStringSet.js +20 -62
- package/lib/commonjs/localization/createBaseStringSet.js.map +1 -1
- package/lib/module/components/ChannelInput/AttachmentsButton.js +29 -0
- package/lib/module/components/ChannelInput/AttachmentsButton.js.map +1 -0
- package/lib/module/components/ChannelInput/EditInput.js +10 -18
- package/lib/module/components/ChannelInput/EditInput.js.map +1 -1
- package/lib/module/components/ChannelInput/SendInput.js +221 -164
- package/lib/module/components/ChannelInput/SendInput.js.map +1 -1
- package/lib/module/components/ChannelInput/index.js +5 -3
- package/lib/module/components/ChannelInput/index.js.map +1 -1
- package/lib/module/components/ChannelMessageList/index.js +28 -28
- package/lib/module/components/ChannelMessageList/index.js.map +1 -1
- package/lib/module/components/ChatFlatList.js +17 -5
- package/lib/module/components/ChatFlatList.js.map +1 -1
- package/lib/module/components/{MessageRenderer/MessageDateSeparator.js → GroupChannelMessageRenderer/GroupChannelMessageDateSeparator.js} +3 -3
- package/lib/module/components/GroupChannelMessageRenderer/GroupChannelMessageDateSeparator.js.map +1 -0
- package/lib/module/components/GroupChannelMessageRenderer/GroupChannelMessageFocusAnimation.js +38 -0
- package/lib/module/components/GroupChannelMessageRenderer/GroupChannelMessageFocusAnimation.js.map +1 -0
- package/lib/module/components/{MessageRenderer/MessageOutgoingStatus.js → GroupChannelMessageRenderer/GroupChannelMessageOutgoingStatus.js} +12 -15
- package/lib/module/components/GroupChannelMessageRenderer/GroupChannelMessageOutgoingStatus.js.map +1 -0
- package/lib/module/components/GroupChannelMessageRenderer/index.js +196 -0
- package/lib/module/components/GroupChannelMessageRenderer/index.js.map +1 -0
- package/lib/module/components/MessageSearchResultItem.js +2 -1
- package/lib/module/components/MessageSearchResultItem.js.map +1 -1
- package/lib/module/components/OpenChannelMessageRenderer/index.js +16 -10
- package/lib/module/components/OpenChannelMessageRenderer/index.js.map +1 -1
- package/lib/module/constants.js +0 -5
- package/lib/module/constants.js.map +1 -1
- package/lib/module/containers/GroupChannelPreviewContainer.js +13 -13
- package/lib/module/containers/GroupChannelPreviewContainer.js.map +1 -1
- package/lib/module/containers/SendbirdUIKitContainer.js +29 -19
- package/lib/module/containers/SendbirdUIKitContainer.js.map +1 -1
- package/lib/module/contexts/SendbirdChatCtx.js +17 -14
- package/lib/module/contexts/SendbirdChatCtx.js.map +1 -1
- package/lib/module/contexts/UserProfileCtx.js +6 -4
- package/lib/module/contexts/UserProfileCtx.js.map +1 -1
- package/lib/module/domain/groupChannel/component/GroupChannelInput.js +4 -13
- package/lib/module/domain/groupChannel/component/GroupChannelInput.js.map +1 -1
- package/lib/module/domain/groupChannel/types.js.map +1 -1
- package/lib/module/domain/groupChannelList/component/GroupChannelListList.js +9 -4
- package/lib/module/domain/groupChannelList/component/GroupChannelListList.js.map +1 -1
- package/lib/module/domain/groupChannelList/component/GroupChannelListTypeSelector.js +3 -3
- package/lib/module/domain/groupChannelList/component/GroupChannelListTypeSelector.js.map +1 -1
- package/lib/module/domain/groupChannelList/types.js.map +1 -1
- package/lib/module/domain/groupChannelSettings/component/GroupChannelSettingsMenu.js +11 -10
- package/lib/module/domain/groupChannelSettings/component/GroupChannelSettingsMenu.js.map +1 -1
- package/lib/module/domain/openChannel/component/OpenChannelInput.js +4 -8
- package/lib/module/domain/openChannel/component/OpenChannelInput.js.map +1 -1
- package/lib/module/domain/openChannel/types.js.map +1 -1
- package/lib/module/domain/openChannelList/component/OpenChannelListList.js +3 -1
- package/lib/module/domain/openChannelList/component/OpenChannelListList.js.map +1 -1
- package/lib/module/domain/openChannelList/types.js.map +1 -1
- package/lib/module/fragments/createGroupChannelCreateFragment.js +1 -1
- package/lib/module/fragments/createGroupChannelCreateFragment.js.map +1 -1
- package/lib/module/fragments/createGroupChannelFragment.js +24 -102
- package/lib/module/fragments/createGroupChannelFragment.js.map +1 -1
- package/lib/module/fragments/createGroupChannelInviteFragment.js +1 -1
- package/lib/module/fragments/createGroupChannelInviteFragment.js.map +1 -1
- package/lib/module/fragments/createGroupChannelListFragment.js +8 -13
- package/lib/module/fragments/createGroupChannelListFragment.js.map +1 -1
- package/lib/module/fragments/createMessageSearchFragment.js +1 -1
- package/lib/module/fragments/createMessageSearchFragment.js.map +1 -1
- package/lib/module/fragments/createOpenChannelFragment.js +2 -8
- package/lib/module/fragments/createOpenChannelFragment.js.map +1 -1
- package/lib/module/fragments/createOpenChannelListFragment.js +2 -1
- package/lib/module/fragments/createOpenChannelListFragment.js.map +1 -1
- package/lib/module/hooks/useConnection.js +11 -7
- package/lib/module/hooks/useConnection.js.map +1 -1
- package/lib/module/hooks/useMentionTextInput.js +3 -2
- package/lib/module/hooks/useMentionTextInput.js.map +1 -1
- package/lib/module/index.js +5 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/libs/MentionManager.js +8 -9
- package/lib/module/libs/MentionManager.js.map +1 -1
- package/lib/module/libs/SBUUtils.js +7 -3
- package/lib/module/libs/SBUUtils.js.map +1 -1
- package/lib/module/localization/StringSet.type.js.map +1 -1
- package/lib/module/localization/createBaseStringSet.js +20 -62
- package/lib/module/localization/createBaseStringSet.js.map +1 -1
- package/lib/typescript/src/components/ChannelInput/AttachmentsButton.d.ts +6 -0
- package/lib/typescript/src/components/ChannelInput/index.d.ts +2 -14
- package/lib/typescript/src/components/ChannelMessageList/index.d.ts +2 -4
- package/lib/typescript/src/components/ChatFlatList.d.ts +1 -5
- package/lib/typescript/src/components/GroupChannelMessageRenderer/GroupChannelMessageDateSeparator.d.ts +6 -0
- package/lib/typescript/src/components/GroupChannelMessageRenderer/GroupChannelMessageFocusAnimation.d.ts +5 -0
- package/lib/typescript/src/components/{MessageRenderer/MessageOutgoingStatus.d.ts → GroupChannelMessageRenderer/GroupChannelMessageOutgoingStatus.d.ts} +3 -1
- package/lib/typescript/src/components/{MessageRenderer → GroupChannelMessageRenderer}/index.d.ts +2 -13
- package/lib/typescript/src/components/MessageSearchResultItem.d.ts +2 -1
- package/lib/typescript/src/components/OpenChannelMessageRenderer/index.d.ts +1 -1
- package/lib/typescript/src/constants.d.ts +0 -5
- package/lib/typescript/src/containers/SendbirdUIKitContainer.d.ts +15 -10
- package/lib/typescript/src/contexts/SendbirdChatCtx.d.ts +33 -19
- package/lib/typescript/src/domain/groupChannel/component/GroupChannelInput.d.ts +1 -1
- package/lib/typescript/src/domain/groupChannel/component/GroupChannelMessageList.d.ts +1 -4
- package/lib/typescript/src/domain/groupChannel/types.d.ts +2 -9
- package/lib/typescript/src/domain/groupChannelList/component/GroupChannelListList.d.ts +1 -1
- package/lib/typescript/src/domain/groupChannelList/types.d.ts +8 -23
- package/lib/typescript/src/domain/openChannel/component/OpenChannelHeader.d.ts +1 -1
- 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/types.d.ts +2 -2
- package/lib/typescript/src/domain/openChannelList/component/OpenChannelListList.d.ts +1 -1
- package/lib/typescript/src/domain/openChannelList/types.d.ts +3 -12
- package/lib/typescript/src/index.d.ts +4 -1
- package/lib/typescript/src/libs/MentionManager.d.ts +4 -5
- package/lib/typescript/src/libs/SBUUtils.d.ts +1 -1
- package/lib/typescript/src/localization/StringSet.type.d.ts +2 -43
- package/package.json +13 -10
- package/src/components/ChannelInput/AttachmentsButton.tsx +32 -0
- package/src/components/ChannelInput/EditInput.tsx +17 -18
- package/src/components/ChannelInput/SendInput.tsx +237 -181
- package/src/components/ChannelInput/index.tsx +8 -21
- package/src/components/ChannelMessageList/index.tsx +33 -41
- package/src/components/ChatFlatList.tsx +39 -13
- package/src/components/{MessageRenderer/MessageDateSeparator.tsx → GroupChannelMessageRenderer/GroupChannelMessageDateSeparator.tsx} +7 -5
- package/src/components/GroupChannelMessageRenderer/GroupChannelMessageFocusAnimation.tsx +29 -0
- package/src/components/{MessageRenderer/MessageOutgoingStatus.tsx → GroupChannelMessageRenderer/GroupChannelMessageOutgoingStatus.tsx} +15 -15
- package/src/components/GroupChannelMessageRenderer/index.tsx +203 -0
- package/src/components/MessageSearchResultItem.tsx +3 -1
- package/src/components/OpenChannelMessageRenderer/index.tsx +10 -5
- package/src/constants.ts +0 -5
- package/src/containers/GroupChannelPreviewContainer.tsx +14 -13
- package/src/containers/SendbirdUIKitContainer.tsx +98 -90
- package/src/contexts/SendbirdChatCtx.tsx +49 -36
- package/src/contexts/UserProfileCtx.tsx +10 -5
- package/src/domain/groupChannel/component/GroupChannelInput.tsx +1 -10
- package/src/domain/groupChannel/types.ts +1 -14
- package/src/domain/groupChannelList/component/GroupChannelListList.tsx +8 -4
- package/src/domain/groupChannelList/component/GroupChannelListTypeSelector.tsx +3 -3
- package/src/domain/groupChannelList/types.ts +8 -30
- package/src/domain/groupChannelSettings/component/GroupChannelSettingsMenu.tsx +22 -10
- package/src/domain/openChannel/component/OpenChannelInput.tsx +1 -5
- package/src/domain/openChannel/types.ts +1 -1
- package/src/domain/openChannelList/component/OpenChannelListList.tsx +2 -1
- package/src/domain/openChannelList/types.ts +6 -13
- package/src/fragments/createGroupChannelCreateFragment.tsx +1 -1
- package/src/fragments/createGroupChannelFragment.tsx +21 -97
- package/src/fragments/createGroupChannelInviteFragment.tsx +1 -1
- package/src/fragments/createGroupChannelListFragment.tsx +9 -15
- package/src/fragments/createMessageSearchFragment.tsx +1 -1
- package/src/fragments/createOpenChannelFragment.tsx +2 -3
- package/src/fragments/createOpenChannelListFragment.tsx +2 -1
- package/src/hooks/useConnection.ts +9 -7
- package/src/hooks/useMentionTextInput.ts +7 -2
- package/src/index.ts +4 -2
- package/src/libs/MentionManager.tsx +8 -7
- package/src/libs/SBUUtils.ts +7 -3
- package/src/localization/StringSet.type.ts +2 -46
- package/src/localization/createBaseStringSet.ts +19 -71
- package/src/version.ts +1 -1
- package/lib/commonjs/components/MessageRenderer/AdminMessage/index.js +0 -46
- package/lib/commonjs/components/MessageRenderer/AdminMessage/index.js.map +0 -1
- package/lib/commonjs/components/MessageRenderer/FileMessage/BaseFileMessage.js +0 -73
- package/lib/commonjs/components/MessageRenderer/FileMessage/BaseFileMessage.js.map +0 -1
- package/lib/commonjs/components/MessageRenderer/FileMessage/ImageFileMessage.js +0 -93
- package/lib/commonjs/components/MessageRenderer/FileMessage/ImageFileMessage.js.map +0 -1
- package/lib/commonjs/components/MessageRenderer/FileMessage/VideoFileMessage.js +0 -132
- package/lib/commonjs/components/MessageRenderer/FileMessage/VideoFileMessage.js.map +0 -1
- package/lib/commonjs/components/MessageRenderer/FileMessage/index.js +0 -24
- package/lib/commonjs/components/MessageRenderer/FileMessage/index.js.map +0 -1
- package/lib/commonjs/components/MessageRenderer/MessageContainer.js +0 -27
- package/lib/commonjs/components/MessageRenderer/MessageContainer.js.map +0 -1
- package/lib/commonjs/components/MessageRenderer/MessageDateSeparator.js.map +0 -1
- package/lib/commonjs/components/MessageRenderer/MessageIncomingAvatar.js +0 -41
- package/lib/commonjs/components/MessageRenderer/MessageIncomingAvatar.js.map +0 -1
- package/lib/commonjs/components/MessageRenderer/MessageIncomingSenderName.js +0 -41
- package/lib/commonjs/components/MessageRenderer/MessageIncomingSenderName.js.map +0 -1
- package/lib/commonjs/components/MessageRenderer/MessageOutgoingStatus.js.map +0 -1
- package/lib/commonjs/components/MessageRenderer/MessageTime.js.map +0 -1
- package/lib/commonjs/components/MessageRenderer/UnknownMessage/index.js +0 -46
- package/lib/commonjs/components/MessageRenderer/UnknownMessage/index.js.map +0 -1
- package/lib/commonjs/components/MessageRenderer/UserMessage/BaseUserMessage.js +0 -113
- package/lib/commonjs/components/MessageRenderer/UserMessage/BaseUserMessage.js.map +0 -1
- package/lib/commonjs/components/MessageRenderer/UserMessage/OpenGraphUserMessage.js +0 -200
- package/lib/commonjs/components/MessageRenderer/UserMessage/OpenGraphUserMessage.js.map +0 -1
- package/lib/commonjs/components/MessageRenderer/UserMessage/index.js +0 -22
- package/lib/commonjs/components/MessageRenderer/UserMessage/index.js.map +0 -1
- package/lib/commonjs/components/MessageRenderer/index.js +0 -186
- package/lib/commonjs/components/MessageRenderer/index.js.map +0 -1
- package/lib/module/components/MessageRenderer/AdminMessage/index.js +0 -38
- package/lib/module/components/MessageRenderer/AdminMessage/index.js.map +0 -1
- package/lib/module/components/MessageRenderer/FileMessage/BaseFileMessage.js +0 -65
- package/lib/module/components/MessageRenderer/FileMessage/BaseFileMessage.js.map +0 -1
- package/lib/module/components/MessageRenderer/FileMessage/ImageFileMessage.js +0 -84
- package/lib/module/components/MessageRenderer/FileMessage/ImageFileMessage.js.map +0 -1
- package/lib/module/components/MessageRenderer/FileMessage/VideoFileMessage.js +0 -123
- package/lib/module/components/MessageRenderer/FileMessage/VideoFileMessage.js.map +0 -1
- package/lib/module/components/MessageRenderer/FileMessage/index.js +0 -16
- package/lib/module/components/MessageRenderer/FileMessage/index.js.map +0 -1
- package/lib/module/components/MessageRenderer/MessageContainer.js +0 -19
- package/lib/module/components/MessageRenderer/MessageContainer.js.map +0 -1
- package/lib/module/components/MessageRenderer/MessageDateSeparator.js.map +0 -1
- package/lib/module/components/MessageRenderer/MessageIncomingAvatar.js +0 -33
- package/lib/module/components/MessageRenderer/MessageIncomingAvatar.js.map +0 -1
- package/lib/module/components/MessageRenderer/MessageIncomingSenderName.js +0 -33
- package/lib/module/components/MessageRenderer/MessageIncomingSenderName.js.map +0 -1
- package/lib/module/components/MessageRenderer/MessageOutgoingStatus.js.map +0 -1
- package/lib/module/components/MessageRenderer/MessageTime.js +0 -26
- package/lib/module/components/MessageRenderer/MessageTime.js.map +0 -1
- package/lib/module/components/MessageRenderer/UnknownMessage/index.js +0 -38
- package/lib/module/components/MessageRenderer/UnknownMessage/index.js.map +0 -1
- package/lib/module/components/MessageRenderer/UserMessage/BaseUserMessage.js +0 -105
- package/lib/module/components/MessageRenderer/UserMessage/BaseUserMessage.js.map +0 -1
- package/lib/module/components/MessageRenderer/UserMessage/OpenGraphUserMessage.js +0 -190
- package/lib/module/components/MessageRenderer/UserMessage/OpenGraphUserMessage.js.map +0 -1
- package/lib/module/components/MessageRenderer/UserMessage/index.js +0 -14
- package/lib/module/components/MessageRenderer/UserMessage/index.js.map +0 -1
- package/lib/module/components/MessageRenderer/index.js +0 -178
- package/lib/module/components/MessageRenderer/index.js.map +0 -1
- package/lib/typescript/src/components/MessageRenderer/AdminMessage/index.d.ts +0 -5
- package/lib/typescript/src/components/MessageRenderer/FileMessage/BaseFileMessage.d.ts +0 -6
- package/lib/typescript/src/components/MessageRenderer/FileMessage/ImageFileMessage.d.ts +0 -3
- package/lib/typescript/src/components/MessageRenderer/FileMessage/VideoFileMessage.d.ts +0 -3
- package/lib/typescript/src/components/MessageRenderer/FileMessage/index.d.ts +0 -15
- package/lib/typescript/src/components/MessageRenderer/MessageContainer.d.ts +0 -3
- package/lib/typescript/src/components/MessageRenderer/MessageDateSeparator.d.ts +0 -7
- package/lib/typescript/src/components/MessageRenderer/MessageIncomingAvatar.d.ts +0 -7
- package/lib/typescript/src/components/MessageRenderer/MessageIncomingSenderName.d.ts +0 -7
- package/lib/typescript/src/components/MessageRenderer/MessageTime.d.ts +0 -9
- package/lib/typescript/src/components/MessageRenderer/UnknownMessage/index.d.ts +0 -4
- package/lib/typescript/src/components/MessageRenderer/UserMessage/BaseUserMessage.d.ts +0 -3
- package/lib/typescript/src/components/MessageRenderer/UserMessage/OpenGraphUserMessage.d.ts +0 -7
- package/lib/typescript/src/components/MessageRenderer/UserMessage/index.d.ts +0 -9
- package/src/components/MessageRenderer/AdminMessage/index.tsx +0 -40
- package/src/components/MessageRenderer/FileMessage/BaseFileMessage.tsx +0 -51
- package/src/components/MessageRenderer/FileMessage/ImageFileMessage.tsx +0 -98
- package/src/components/MessageRenderer/FileMessage/VideoFileMessage.tsx +0 -113
- package/src/components/MessageRenderer/FileMessage/index.tsx +0 -20
- package/src/components/MessageRenderer/MessageContainer.tsx +0 -17
- package/src/components/MessageRenderer/MessageIncomingAvatar.tsx +0 -34
- package/src/components/MessageRenderer/MessageIncomingSenderName.tsx +0 -36
- package/src/components/MessageRenderer/MessageTime.tsx +0 -28
- package/src/components/MessageRenderer/UnknownMessage/index.tsx +0 -34
- package/src/components/MessageRenderer/UserMessage/BaseUserMessage.tsx +0 -102
- package/src/components/MessageRenderer/UserMessage/OpenGraphUserMessage.tsx +0 -188
- package/src/components/MessageRenderer/UserMessage/index.tsx +0 -24
- package/src/components/MessageRenderer/index.tsx +0 -198
|
@@ -5,6 +5,7 @@ import Sendbird from '@sendbird/chat';
|
|
|
5
5
|
import { GroupChannelModule } from '@sendbird/chat/groupChannel';
|
|
6
6
|
import { OpenChannelModule } from '@sendbird/chat/openChannel';
|
|
7
7
|
import { DialogProvider, Header, HeaderStyleProvider, LightUIKitTheme, ToastProvider, UIKitThemeProvider } from '@sendbird/uikit-react-native-foundation';
|
|
8
|
+
import { UIKitConfigProvider } from '@sendbird/uikit-tools';
|
|
8
9
|
import { NOOP, useIsFirstMount } from '@sendbird/uikit-utils';
|
|
9
10
|
import { LocalizationContext, LocalizationProvider } from '../contexts/LocalizationCtx';
|
|
10
11
|
import { PlatformServiceProvider } from '../contexts/PlatformServiceCtx';
|
|
@@ -26,12 +27,8 @@ export const SendbirdUIKit = Object.freeze({
|
|
|
26
27
|
PLATFORM: Platform.OS.toLowerCase(),
|
|
27
28
|
DEFAULT: {
|
|
28
29
|
AUTO_PUSH_TOKEN_REGISTRATION: true,
|
|
29
|
-
CHANNEL_LIST_TYPING_INDICATOR: false,
|
|
30
|
-
CHANNEL_LIST_MESSAGE_RECEIPT_STATUS: false,
|
|
31
30
|
USE_USER_ID_FOR_NICKNAME: false,
|
|
32
|
-
|
|
33
|
-
IMAGE_COMPRESSION: true,
|
|
34
|
-
MESSAGE_SEARCH: false
|
|
31
|
+
IMAGE_COMPRESSION: true
|
|
35
32
|
}
|
|
36
33
|
});
|
|
37
34
|
const SendbirdUIKitContainer = _ref => {
|
|
@@ -39,6 +36,7 @@ const SendbirdUIKitContainer = _ref => {
|
|
|
39
36
|
children,
|
|
40
37
|
appId,
|
|
41
38
|
chatOptions,
|
|
39
|
+
uikitOptions,
|
|
42
40
|
platformServices,
|
|
43
41
|
localization,
|
|
44
42
|
styles,
|
|
@@ -48,12 +46,15 @@ const SendbirdUIKitContainer = _ref => {
|
|
|
48
46
|
userMention,
|
|
49
47
|
imageCompression
|
|
50
48
|
} = _ref;
|
|
49
|
+
if (!chatOptions.localCacheStorage) {
|
|
50
|
+
throw new Error('SendbirdUIKitContainer: chatOptions.localCacheStorage is required');
|
|
51
|
+
}
|
|
51
52
|
const defaultStringSet = (localization === null || localization === void 0 ? void 0 : localization.stringSet) ?? StringSetEn;
|
|
52
53
|
const isFirstMount = useIsFirstMount();
|
|
53
54
|
const unsubscribes = useRef([]);
|
|
54
|
-
const internalStorage =
|
|
55
|
+
const [internalStorage] = useState(() => new InternalLocalCacheStorage(chatOptions.localCacheStorage));
|
|
55
56
|
const [sdkInstance, setSdkInstance] = useState(() => {
|
|
56
|
-
const sendbird = initializeSendbird(appId, internalStorage, chatOptions
|
|
57
|
+
const sendbird = initializeSendbird(appId, internalStorage, chatOptions.onInitialized);
|
|
57
58
|
unsubscribes.current = sendbird.unsubscribes;
|
|
58
59
|
return sendbird.chatSDK;
|
|
59
60
|
});
|
|
@@ -66,8 +67,8 @@ const SendbirdUIKitContainer = _ref => {
|
|
|
66
67
|
delimiter: MentionConfig.DEFAULT.DELIMITER,
|
|
67
68
|
trigger: MentionConfig.DEFAULT.TRIGGER
|
|
68
69
|
});
|
|
69
|
-
return new MentionManager(config
|
|
70
|
-
}, [
|
|
70
|
+
return new MentionManager(config);
|
|
71
|
+
}, [userMention === null || userMention === void 0 ? void 0 : userMention.mentionLimit, userMention === null || userMention === void 0 ? void 0 : userMention.suggestionLimit, userMention === null || userMention === void 0 ? void 0 : userMention.debounceMills]);
|
|
71
72
|
const imageCompressionConfig = useMemo(() => {
|
|
72
73
|
return new ImageCompressionConfig({
|
|
73
74
|
compressionRate: (imageCompression === null || imageCompression === void 0 ? void 0 : imageCompression.compressionRate) || ImageCompressionConfig.DEFAULT.COMPRESSION_RATE,
|
|
@@ -77,7 +78,7 @@ const SendbirdUIKitContainer = _ref => {
|
|
|
77
78
|
}, [imageCompression === null || imageCompression === void 0 ? void 0 : imageCompression.compressionRate, imageCompression === null || imageCompression === void 0 ? void 0 : imageCompression.width, imageCompression === null || imageCompression === void 0 ? void 0 : imageCompression.height]);
|
|
78
79
|
useLayoutEffect(() => {
|
|
79
80
|
if (!isFirstMount) {
|
|
80
|
-
const sendbird = initializeSendbird(appId, internalStorage, chatOptions
|
|
81
|
+
const sendbird = initializeSendbird(appId, internalStorage, chatOptions.onInitialized);
|
|
81
82
|
setSdkInstance(sendbird.chatSDK);
|
|
82
83
|
unsubscribes.current = sendbird.unsubscribes;
|
|
83
84
|
}
|
|
@@ -98,18 +99,27 @@ const SendbirdUIKitContainer = _ref => {
|
|
|
98
99
|
return /*#__PURE__*/React.createElement(InternalErrorBoundaryContainer, errorBoundary, children);
|
|
99
100
|
}
|
|
100
101
|
};
|
|
101
|
-
return /*#__PURE__*/React.createElement(SafeAreaProvider, null, /*#__PURE__*/React.createElement(
|
|
102
|
+
return /*#__PURE__*/React.createElement(SafeAreaProvider, null, /*#__PURE__*/React.createElement(UIKitConfigProvider, {
|
|
103
|
+
storage: internalStorage,
|
|
104
|
+
localConfigs: {
|
|
105
|
+
common: uikitOptions === null || uikitOptions === void 0 ? void 0 : uikitOptions.common,
|
|
106
|
+
groupChannel: {
|
|
107
|
+
channel: uikitOptions === null || uikitOptions === void 0 ? void 0 : uikitOptions.groupChannel,
|
|
108
|
+
channelList: uikitOptions === null || uikitOptions === void 0 ? void 0 : uikitOptions.groupChannelList,
|
|
109
|
+
setting: uikitOptions === null || uikitOptions === void 0 ? void 0 : uikitOptions.groupChannelSettings
|
|
110
|
+
},
|
|
111
|
+
openChannel: {
|
|
112
|
+
channel: uikitOptions === null || uikitOptions === void 0 ? void 0 : uikitOptions.openChannel
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}, /*#__PURE__*/React.createElement(SendbirdChatProvider, {
|
|
102
116
|
sdkInstance: sdkInstance,
|
|
103
117
|
emojiManager: emojiManager,
|
|
104
118
|
mentionManager: mentionManager,
|
|
105
119
|
imageCompressionConfig: imageCompressionConfig,
|
|
106
|
-
enableAutoPushTokenRegistration:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
enableUseUserIdForNickname: (chatOptions === null || chatOptions === void 0 ? void 0 : chatOptions.enableUseUserIdForNickname) ?? SendbirdUIKit.DEFAULT.USE_USER_ID_FOR_NICKNAME,
|
|
110
|
-
enableUserMention: (chatOptions === null || chatOptions === void 0 ? void 0 : chatOptions.enableUserMention) ?? SendbirdUIKit.DEFAULT.USER_MENTION,
|
|
111
|
-
enableImageCompression: (chatOptions === null || chatOptions === void 0 ? void 0 : chatOptions.enableImageCompression) ?? SendbirdUIKit.DEFAULT.IMAGE_COMPRESSION,
|
|
112
|
-
enableMessageSearch: (chatOptions === null || chatOptions === void 0 ? void 0 : chatOptions.enableMessageSearch) ?? SendbirdUIKit.DEFAULT.MESSAGE_SEARCH
|
|
120
|
+
enableAutoPushTokenRegistration: chatOptions.enableAutoPushTokenRegistration ?? SendbirdUIKit.DEFAULT.AUTO_PUSH_TOKEN_REGISTRATION,
|
|
121
|
+
enableUseUserIdForNickname: chatOptions.enableUseUserIdForNickname ?? SendbirdUIKit.DEFAULT.USE_USER_ID_FOR_NICKNAME,
|
|
122
|
+
enableImageCompression: chatOptions.enableImageCompression ?? SendbirdUIKit.DEFAULT.IMAGE_COMPRESSION
|
|
113
123
|
}, /*#__PURE__*/React.createElement(LocalizationProvider, {
|
|
114
124
|
stringSet: defaultStringSet
|
|
115
125
|
}, /*#__PURE__*/React.createElement(PlatformServiceProvider, {
|
|
@@ -143,7 +153,7 @@ const SendbirdUIKitContainer = _ref => {
|
|
|
143
153
|
}
|
|
144
154
|
}
|
|
145
155
|
}, renderChildren());
|
|
146
|
-
}))))))))));
|
|
156
|
+
})))))))))));
|
|
147
157
|
};
|
|
148
158
|
const initializeSendbird = (appId, internalStorage, onInitialized) => {
|
|
149
159
|
const unsubscribes = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useLayoutEffect","useMemo","useRef","useState","Platform","SafeAreaProvider","Sendbird","GroupChannelModule","OpenChannelModule","DialogProvider","Header","HeaderStyleProvider","LightUIKitTheme","ToastProvider","UIKitThemeProvider","NOOP","useIsFirstMount","LocalizationContext","LocalizationProvider","PlatformServiceProvider","ReactionProvider","SendbirdChatProvider","UserProfileProvider","EmojiManager","ImageCompressionConfig","InternalLocalCacheStorage","MentionConfig","MentionManager","StringSetEn","SBUDynamicModule","VERSION","InternalErrorBoundaryContainer","NetInfo","get","SendbirdUIKit","Object","freeze","PLATFORM","OS","toLowerCase","DEFAULT","AUTO_PUSH_TOKEN_REGISTRATION","CHANNEL_LIST_TYPING_INDICATOR","CHANNEL_LIST_MESSAGE_RECEIPT_STATUS","USE_USER_ID_FOR_NICKNAME","USER_MENTION","IMAGE_COMPRESSION","MESSAGE_SEARCH","SendbirdUIKitContainer","_ref","children","appId","chatOptions","platformServices","localization","styles","errorBoundary","toast","userProfile","userMention","imageCompression","defaultStringSet","stringSet","isFirstMount","unsubscribes","internalStorage","localCacheStorage","undefined","sdkInstance","setSdkInstance","sendbird","initializeSendbird","onInitialized","current","chatSDK","emojiManager","mentionManager","config","mentionLimit","MENTION_LIMIT","suggestionLimit","SUGGESTION_LIMIT","debounceMills","DEBOUNCE_MILLS","delimiter","DELIMITER","trigger","TRIGGER","enableUserMention","imageCompressionConfig","compressionRate","COMPRESSION_RATE","width","height","forEach","u","renderChildren","disabled","createElement","enableAutoPushTokenRegistration","enableChannelListTypingIndicator","enableChannelListMessageReceiptStatus","enableUseUserIdForNickname","enableImageCompression","enableMessageSearch","fileService","file","notificationService","notification","clipboardService","clipboard","mediaService","media","theme","HeaderComponent","defaultTitleAlign","defaultHeaderTitleAlign","statusBarTranslucent","dismissTimeout","onCreateChannel","onBeforeCreateChannel","Consumer","value","STRINGS","defaultLabels","alert","ok","DIALOG","ALERT_DEFAULT_OK","prompt","PROMPT_DEFAULT_OK","cancel","PROMPT_DEFAULT_CANCEL","placeholder","PROMPT_DEFAULT_PLACEHOLDER","init","modules","localCacheEnabled","Boolean","useAsyncStorageStore","newInstance","addExtension","addEventListener","_chatSDK$setOnlineLis","_chatSDK","_chatSDK$setOfflineLi","_chatSDK2","listener","callback","callbackType","callCount","unsubscribe","state","online","isConnected","isInternetReachable","push","setOnlineListener","call","onOnline","setOfflineListener","onOffline"],"sources":["SendbirdUIKitContainer.tsx"],"sourcesContent":["import React, { useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport { Platform } from 'react-native';\nimport { SafeAreaProvider } from 'react-native-safe-area-context';\n\nimport Sendbird from '@sendbird/chat';\nimport { GroupChannelModule } from '@sendbird/chat/groupChannel';\nimport { OpenChannelModule } from '@sendbird/chat/openChannel';\nimport type { HeaderStyleContextType, UIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport {\n DialogProvider,\n Header,\n HeaderStyleProvider,\n LightUIKitTheme,\n ToastProvider,\n UIKitThemeProvider,\n} from '@sendbird/uikit-react-native-foundation';\nimport type {\n SendbirdChatSDK,\n SendbirdGroupChannel,\n SendbirdGroupChannelCreateParams,\n SendbirdMember,\n SendbirdUser,\n} from '@sendbird/uikit-utils';\nimport { NOOP, useIsFirstMount } from '@sendbird/uikit-utils';\n\nimport { LocalizationContext, LocalizationProvider } from '../contexts/LocalizationCtx';\nimport { PlatformServiceProvider } from '../contexts/PlatformServiceCtx';\nimport { ReactionProvider } from '../contexts/ReactionCtx';\nimport type { UIKitFeaturesInSendbirdChatContext } from '../contexts/SendbirdChatCtx';\nimport { SendbirdChatProvider } from '../contexts/SendbirdChatCtx';\nimport { UserProfileProvider } from '../contexts/UserProfileCtx';\nimport EmojiManager from '../libs/EmojiManager';\nimport type { ImageCompressionConfigInterface } from '../libs/ImageCompressionConfig';\nimport ImageCompressionConfig from '../libs/ImageCompressionConfig';\nimport InternalLocalCacheStorage from '../libs/InternalLocalCacheStorage';\nimport MentionConfig, { MentionConfigInterface } from '../libs/MentionConfig';\nimport MentionManager from '../libs/MentionManager';\nimport StringSetEn from '../localization/StringSet.en';\nimport type { StringSet } from '../localization/StringSet.type';\nimport SBUDynamicModule from '../platform/dynamicModule';\nimport type {\n ClipboardServiceInterface,\n FileServiceInterface,\n MediaServiceInterface,\n NotificationServiceInterface,\n} from '../platform/types';\nimport type { ErrorBoundaryProps, LocalCacheStorage } from '../types';\nimport VERSION from '../version';\nimport InternalErrorBoundaryContainer from './InternalErrorBoundaryContainer';\n\nconst NetInfo = SBUDynamicModule.get('@react-native-community/netinfo', 'warn');\n\nexport const SendbirdUIKit = Object.freeze({\n VERSION,\n PLATFORM: Platform.OS.toLowerCase(),\n DEFAULT: {\n AUTO_PUSH_TOKEN_REGISTRATION: true,\n CHANNEL_LIST_TYPING_INDICATOR: false,\n CHANNEL_LIST_MESSAGE_RECEIPT_STATUS: false,\n USE_USER_ID_FOR_NICKNAME: false,\n USER_MENTION: false,\n IMAGE_COMPRESSION: true,\n MESSAGE_SEARCH: false,\n },\n});\n\nexport type SendbirdUIKitContainerProps = React.PropsWithChildren<{\n appId: string;\n platformServices: {\n file: FileServiceInterface;\n notification: NotificationServiceInterface;\n clipboard: ClipboardServiceInterface;\n media: MediaServiceInterface;\n };\n chatOptions?: {\n localCacheStorage?: LocalCacheStorage;\n onInitialized?: (sdkInstance: SendbirdChatSDK) => SendbirdChatSDK;\n } & Partial<UIKitFeaturesInSendbirdChatContext>;\n localization?: {\n stringSet?: StringSet;\n };\n styles?: {\n theme?: UIKitTheme;\n statusBarTranslucent?: boolean;\n defaultHeaderTitleAlign?: 'left' | 'center';\n defaultHeaderHeight?: number;\n HeaderComponent?: HeaderStyleContextType['HeaderComponent'];\n };\n errorBoundary?: {\n disabled?: boolean;\n onError?: (props: ErrorBoundaryProps) => void;\n ErrorInfoComponent?: (props: ErrorBoundaryProps) => JSX.Element;\n };\n toast?: {\n dismissTimeout?: number;\n };\n userProfile?: {\n onCreateChannel: (channel: SendbirdGroupChannel) => void;\n onBeforeCreateChannel?: (\n channelParams: SendbirdGroupChannelCreateParams,\n users: SendbirdUser[] | SendbirdMember[],\n ) => SendbirdGroupChannelCreateParams | Promise<SendbirdGroupChannelCreateParams>;\n };\n userMention?: Pick<Partial<MentionConfigInterface>, 'mentionLimit' | 'suggestionLimit' | 'debounceMills'>;\n imageCompression?: Partial<ImageCompressionConfigInterface>;\n}>;\n\nconst SendbirdUIKitContainer = ({\n children,\n appId,\n chatOptions,\n platformServices,\n localization,\n styles,\n errorBoundary,\n toast,\n userProfile,\n userMention,\n imageCompression,\n}: SendbirdUIKitContainerProps) => {\n const defaultStringSet = localization?.stringSet ?? StringSetEn;\n\n const isFirstMount = useIsFirstMount();\n const unsubscribes = useRef<Array<() => void>>([]);\n const internalStorage = useMemo(\n () => (chatOptions?.localCacheStorage ? new InternalLocalCacheStorage(chatOptions.localCacheStorage) : undefined),\n [chatOptions?.localCacheStorage],\n );\n\n const [sdkInstance, setSdkInstance] = useState<SendbirdChatSDK>(() => {\n const sendbird = initializeSendbird(appId, internalStorage, chatOptions?.onInitialized);\n unsubscribes.current = sendbird.unsubscribes;\n return sendbird.chatSDK;\n });\n\n const emojiManager = useMemo(() => new EmojiManager(internalStorage), [internalStorage]);\n\n const mentionManager = useMemo(() => {\n const config = new MentionConfig({\n mentionLimit: userMention?.mentionLimit || MentionConfig.DEFAULT.MENTION_LIMIT,\n suggestionLimit: userMention?.suggestionLimit || MentionConfig.DEFAULT.SUGGESTION_LIMIT,\n debounceMills: userMention?.debounceMills ?? MentionConfig.DEFAULT.DEBOUNCE_MILLS,\n delimiter: MentionConfig.DEFAULT.DELIMITER,\n trigger: MentionConfig.DEFAULT.TRIGGER,\n });\n return new MentionManager(config, chatOptions?.enableUserMention ?? SendbirdUIKit.DEFAULT.USER_MENTION);\n }, [\n chatOptions?.enableUserMention,\n userMention?.mentionLimit,\n userMention?.suggestionLimit,\n userMention?.debounceMills,\n ]);\n\n const imageCompressionConfig = useMemo(() => {\n return new ImageCompressionConfig({\n compressionRate: imageCompression?.compressionRate || ImageCompressionConfig.DEFAULT.COMPRESSION_RATE,\n width: imageCompression?.width,\n height: imageCompression?.height,\n });\n }, [imageCompression?.compressionRate, imageCompression?.width, imageCompression?.height]);\n\n useLayoutEffect(() => {\n if (!isFirstMount) {\n const sendbird = initializeSendbird(appId, internalStorage, chatOptions?.onInitialized);\n setSdkInstance(sendbird.chatSDK);\n unsubscribes.current = sendbird.unsubscribes;\n }\n\n return () => {\n if (!isFirstMount) {\n unsubscribes.current.forEach((u) => {\n try {\n u();\n } catch {}\n });\n }\n };\n }, [appId, internalStorage]);\n\n const renderChildren = () => {\n if (errorBoundary?.disabled) {\n return children;\n } else {\n return <InternalErrorBoundaryContainer {...errorBoundary}>{children}</InternalErrorBoundaryContainer>;\n }\n };\n\n return (\n <SafeAreaProvider>\n <SendbirdChatProvider\n sdkInstance={sdkInstance}\n emojiManager={emojiManager}\n mentionManager={mentionManager}\n imageCompressionConfig={imageCompressionConfig}\n enableAutoPushTokenRegistration={\n chatOptions?.enableAutoPushTokenRegistration ?? SendbirdUIKit.DEFAULT.AUTO_PUSH_TOKEN_REGISTRATION\n }\n enableChannelListTypingIndicator={\n chatOptions?.enableChannelListTypingIndicator ?? SendbirdUIKit.DEFAULT.CHANNEL_LIST_TYPING_INDICATOR\n }\n enableChannelListMessageReceiptStatus={\n chatOptions?.enableChannelListMessageReceiptStatus ??\n SendbirdUIKit.DEFAULT.CHANNEL_LIST_MESSAGE_RECEIPT_STATUS\n }\n enableUseUserIdForNickname={\n chatOptions?.enableUseUserIdForNickname ?? SendbirdUIKit.DEFAULT.USE_USER_ID_FOR_NICKNAME\n }\n enableUserMention={chatOptions?.enableUserMention ?? SendbirdUIKit.DEFAULT.USER_MENTION}\n enableImageCompression={chatOptions?.enableImageCompression ?? SendbirdUIKit.DEFAULT.IMAGE_COMPRESSION}\n enableMessageSearch={chatOptions?.enableMessageSearch ?? SendbirdUIKit.DEFAULT.MESSAGE_SEARCH}\n >\n <LocalizationProvider stringSet={defaultStringSet}>\n <PlatformServiceProvider\n fileService={platformServices.file}\n notificationService={platformServices.notification}\n clipboardService={platformServices.clipboard}\n mediaService={platformServices.media}\n >\n <UIKitThemeProvider theme={styles?.theme ?? LightUIKitTheme}>\n <HeaderStyleProvider\n HeaderComponent={styles?.HeaderComponent ?? Header}\n defaultTitleAlign={styles?.defaultHeaderTitleAlign ?? 'left'}\n statusBarTranslucent={styles?.statusBarTranslucent ?? true}\n >\n <ToastProvider dismissTimeout={toast?.dismissTimeout}>\n <UserProfileProvider\n onCreateChannel={userProfile?.onCreateChannel}\n onBeforeCreateChannel={userProfile?.onBeforeCreateChannel}\n statusBarTranslucent={styles?.statusBarTranslucent ?? true}\n >\n <ReactionProvider>\n <LocalizationContext.Consumer>\n {(value) => {\n const STRINGS = value?.STRINGS || defaultStringSet;\n return (\n <DialogProvider\n defaultLabels={{\n alert: { ok: STRINGS.DIALOG.ALERT_DEFAULT_OK },\n prompt: {\n ok: STRINGS.DIALOG.PROMPT_DEFAULT_OK,\n cancel: STRINGS.DIALOG.PROMPT_DEFAULT_CANCEL,\n placeholder: STRINGS.DIALOG.PROMPT_DEFAULT_PLACEHOLDER,\n },\n }}\n >\n {renderChildren()}\n </DialogProvider>\n );\n }}\n </LocalizationContext.Consumer>\n </ReactionProvider>\n </UserProfileProvider>\n </ToastProvider>\n </HeaderStyleProvider>\n </UIKitThemeProvider>\n </PlatformServiceProvider>\n </LocalizationProvider>\n </SendbirdChatProvider>\n </SafeAreaProvider>\n );\n};\n\nconst initializeSendbird = (\n appId: string,\n internalStorage?: InternalLocalCacheStorage,\n onInitialized?: (sdk: SendbirdChatSDK) => SendbirdChatSDK,\n) => {\n const unsubscribes: Array<() => void> = [];\n let chatSDK: SendbirdChatSDK;\n\n chatSDK = Sendbird.init({\n appId,\n modules: [new GroupChannelModule(), new OpenChannelModule()],\n localCacheEnabled: Boolean(internalStorage),\n useAsyncStorageStore: internalStorage as never,\n newInstance: true,\n });\n\n if (onInitialized) {\n chatSDK = onInitialized(chatSDK);\n }\n\n if (SendbirdUIKit.VERSION) {\n chatSDK.addExtension('sb_uikit', SendbirdUIKit.VERSION);\n }\n\n if (SendbirdUIKit.PLATFORM) {\n chatSDK.addExtension('device-os-platform', SendbirdUIKit.PLATFORM);\n }\n\n if (NetInfo?.addEventListener) {\n try {\n // NOTE: For removing buggy behavior of NetInfo.addEventListener\n // When you first add an event listener, it is assumed that the initialization of the internal event detector is done simultaneously.\n // In other words, when you call the first event listener two events are triggered immediately\n // - the one that is called when adding the event listener\n // - and the internal initialization event\n NetInfo.addEventListener(NOOP)();\n } catch {}\n\n const listener = (callback: () => void, callbackType: 'online' | 'offline') => {\n let callCount = 0;\n const unsubscribe = NetInfo.addEventListener((state) => {\n const online = Boolean(state.isConnected) || Boolean(state.isInternetReachable);\n\n // NOTE: When NetInfo.addEventListener is called\n // the event is immediately triggered regardless of whether the event actually occurred.\n // This is why it filters the first event.\n if (callCount === 0) {\n callCount++;\n return;\n }\n\n if (online && callbackType === 'online') callback();\n if (!online && callbackType === 'offline') callback();\n });\n unsubscribes.push(unsubscribe);\n return unsubscribe;\n };\n chatSDK.setOnlineListener?.((onOnline) => listener(onOnline, 'online'));\n chatSDK.setOfflineListener?.((onOffline) => listener(onOffline, 'offline'));\n }\n return { chatSDK, unsubscribes };\n};\n\nexport default SendbirdUIKitContainer;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,eAAe,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACzE,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,gBAAgB,QAAQ,gCAAgC;AAEjE,OAAOC,QAAQ,MAAM,gBAAgB;AACrC,SAASC,kBAAkB,QAAQ,6BAA6B;AAChE,SAASC,iBAAiB,QAAQ,4BAA4B;AAE9D,SACEC,cAAc,EACdC,MAAM,EACNC,mBAAmB,EACnBC,eAAe,EACfC,aAAa,EACbC,kBAAkB,QACb,yCAAyC;AAQhD,SAASC,IAAI,EAAEC,eAAe,QAAQ,uBAAuB;AAE7D,SAASC,mBAAmB,EAAEC,oBAAoB,QAAQ,6BAA6B;AACvF,SAASC,uBAAuB,QAAQ,gCAAgC;AACxE,SAASC,gBAAgB,QAAQ,yBAAyB;AAE1D,SAASC,oBAAoB,QAAQ,6BAA6B;AAClE,SAASC,mBAAmB,QAAQ,4BAA4B;AAChE,OAAOC,YAAY,MAAM,sBA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tE,OAAO,EAACmF,iBAAiB,cAAAd,qBAAA,uBAAzBA,qBAAA,CAAAe,IAAA,CAAAd,QAAA,EAA6Be,QAAQ,IAAKZ,QAAQ,CAACY,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACvE,CAAAd,qBAAA,IAAAC,SAAA,GAAAxE,OAAO,EAACsF,kBAAkB,cAAAf,qBAAA,uBAA1BA,qBAAA,CAAAa,IAAA,CAAAZ,SAAA,EAA8Be,SAAS,IAAKd,QAAQ,CAACc,SAAS,EAAE,SAAS,CAAC,CAAC;EAC7E;EACA,OAAO;IAAEvF,OAAO;IAAEV;EAAa,CAAC;AAClC,CAAC;AAED,eAAehB,sBAAsB"}
|
|
1
|
+
{"version":3,"names":["React","useLayoutEffect","useMemo","useRef","useState","Platform","SafeAreaProvider","Sendbird","GroupChannelModule","OpenChannelModule","DialogProvider","Header","HeaderStyleProvider","LightUIKitTheme","ToastProvider","UIKitThemeProvider","UIKitConfigProvider","NOOP","useIsFirstMount","LocalizationContext","LocalizationProvider","PlatformServiceProvider","ReactionProvider","SendbirdChatProvider","UserProfileProvider","EmojiManager","ImageCompressionConfig","InternalLocalCacheStorage","MentionConfig","MentionManager","StringSetEn","SBUDynamicModule","VERSION","InternalErrorBoundaryContainer","NetInfo","get","SendbirdUIKit","Object","freeze","PLATFORM","OS","toLowerCase","DEFAULT","AUTO_PUSH_TOKEN_REGISTRATION","USE_USER_ID_FOR_NICKNAME","IMAGE_COMPRESSION","SendbirdUIKitContainer","_ref","children","appId","chatOptions","uikitOptions","platformServices","localization","styles","errorBoundary","toast","userProfile","userMention","imageCompression","localCacheStorage","Error","defaultStringSet","stringSet","isFirstMount","unsubscribes","internalStorage","sdkInstance","setSdkInstance","sendbird","initializeSendbird","onInitialized","current","chatSDK","emojiManager","mentionManager","config","mentionLimit","MENTION_LIMIT","suggestionLimit","SUGGESTION_LIMIT","debounceMills","DEBOUNCE_MILLS","delimiter","DELIMITER","trigger","TRIGGER","imageCompressionConfig","compressionRate","COMPRESSION_RATE","width","height","forEach","u","renderChildren","disabled","createElement","storage","localConfigs","common","groupChannel","channel","channelList","groupChannelList","setting","groupChannelSettings","openChannel","enableAutoPushTokenRegistration","enableUseUserIdForNickname","enableImageCompression","fileService","file","notificationService","notification","clipboardService","clipboard","mediaService","media","theme","HeaderComponent","defaultTitleAlign","defaultHeaderTitleAlign","statusBarTranslucent","dismissTimeout","onCreateChannel","onBeforeCreateChannel","Consumer","value","STRINGS","defaultLabels","alert","ok","DIALOG","ALERT_DEFAULT_OK","prompt","PROMPT_DEFAULT_OK","cancel","PROMPT_DEFAULT_CANCEL","placeholder","PROMPT_DEFAULT_PLACEHOLDER","init","modules","localCacheEnabled","Boolean","useAsyncStorageStore","newInstance","addExtension","addEventListener","_chatSDK$setOnlineLis","_chatSDK","_chatSDK$setOfflineLi","_chatSDK2","listener","callback","callbackType","callCount","unsubscribe","state","online","isConnected","isInternetReachable","push","setOnlineListener","call","onOnline","setOfflineListener","onOffline"],"sources":["SendbirdUIKitContainer.tsx"],"sourcesContent":["import React, { useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport { Platform } from 'react-native';\nimport { SafeAreaProvider } from 'react-native-safe-area-context';\n\nimport Sendbird from '@sendbird/chat';\nimport { GroupChannelModule } from '@sendbird/chat/groupChannel';\nimport { OpenChannelModule } from '@sendbird/chat/openChannel';\nimport type { HeaderStyleContextType, UIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport {\n DialogProvider,\n Header,\n HeaderStyleProvider,\n LightUIKitTheme,\n ToastProvider,\n UIKitThemeProvider,\n} from '@sendbird/uikit-react-native-foundation';\nimport { SBUConfig, UIKitConfigProvider } from '@sendbird/uikit-tools';\nimport type {\n PartialDeep,\n SendbirdChatSDK,\n SendbirdGroupChannel,\n SendbirdGroupChannelCreateParams,\n SendbirdMember,\n SendbirdUser,\n} from '@sendbird/uikit-utils';\nimport { NOOP, useIsFirstMount } from '@sendbird/uikit-utils';\n\nimport { LocalizationContext, LocalizationProvider } from '../contexts/LocalizationCtx';\nimport { PlatformServiceProvider } from '../contexts/PlatformServiceCtx';\nimport { ReactionProvider } from '../contexts/ReactionCtx';\nimport type { ChatRelatedFeaturesInUIKit } from '../contexts/SendbirdChatCtx';\nimport { SendbirdChatProvider } from '../contexts/SendbirdChatCtx';\nimport { UserProfileProvider } from '../contexts/UserProfileCtx';\nimport EmojiManager from '../libs/EmojiManager';\nimport type { ImageCompressionConfigInterface } from '../libs/ImageCompressionConfig';\nimport ImageCompressionConfig from '../libs/ImageCompressionConfig';\nimport InternalLocalCacheStorage from '../libs/InternalLocalCacheStorage';\nimport MentionConfig, { MentionConfigInterface } from '../libs/MentionConfig';\nimport MentionManager from '../libs/MentionManager';\nimport StringSetEn from '../localization/StringSet.en';\nimport type { StringSet } from '../localization/StringSet.type';\nimport SBUDynamicModule from '../platform/dynamicModule';\nimport type {\n ClipboardServiceInterface,\n FileServiceInterface,\n MediaServiceInterface,\n NotificationServiceInterface,\n} from '../platform/types';\nimport type { ErrorBoundaryProps, LocalCacheStorage } from '../types';\nimport VERSION from '../version';\nimport InternalErrorBoundaryContainer from './InternalErrorBoundaryContainer';\n\nconst NetInfo = SBUDynamicModule.get('@react-native-community/netinfo', 'warn');\ntype UnimplementedFeatures = 'enableVoiceMessage' | 'threadReplySelectType' | 'replyType';\nexport const SendbirdUIKit = Object.freeze({\n VERSION,\n PLATFORM: Platform.OS.toLowerCase(),\n DEFAULT: {\n AUTO_PUSH_TOKEN_REGISTRATION: true,\n USE_USER_ID_FOR_NICKNAME: false,\n IMAGE_COMPRESSION: true,\n },\n});\n\nexport type SendbirdUIKitContainerProps = React.PropsWithChildren<{\n appId: string;\n platformServices: {\n file: FileServiceInterface;\n notification: NotificationServiceInterface;\n clipboard: ClipboardServiceInterface;\n media: MediaServiceInterface;\n };\n chatOptions: {\n localCacheStorage: LocalCacheStorage;\n onInitialized?: (sdkInstance: SendbirdChatSDK) => SendbirdChatSDK;\n } & Partial<ChatRelatedFeaturesInUIKit>;\n uikitOptions?: PartialDeep<{\n common: SBUConfig['common'];\n groupChannel: Omit<SBUConfig['groupChannel']['channel'], UnimplementedFeatures>;\n groupChannelList: SBUConfig['groupChannel']['channelList'];\n groupChannelSettings: SBUConfig['groupChannel']['setting'];\n openChannel: SBUConfig['openChannel']['channel'];\n }>;\n localization?: {\n stringSet?: StringSet;\n };\n styles?: {\n theme?: UIKitTheme;\n statusBarTranslucent?: boolean;\n defaultHeaderTitleAlign?: 'left' | 'center';\n defaultHeaderHeight?: number;\n HeaderComponent?: HeaderStyleContextType['HeaderComponent'];\n };\n errorBoundary?: {\n disabled?: boolean;\n onError?: (props: ErrorBoundaryProps) => void;\n ErrorInfoComponent?: (props: ErrorBoundaryProps) => JSX.Element;\n };\n toast?: {\n dismissTimeout?: number;\n };\n userProfile?: {\n onCreateChannel: (channel: SendbirdGroupChannel) => void;\n onBeforeCreateChannel?: (\n channelParams: SendbirdGroupChannelCreateParams,\n users: SendbirdUser[] | SendbirdMember[],\n ) => SendbirdGroupChannelCreateParams | Promise<SendbirdGroupChannelCreateParams>;\n };\n userMention?: Pick<Partial<MentionConfigInterface>, 'mentionLimit' | 'suggestionLimit' | 'debounceMills'>;\n imageCompression?: Partial<ImageCompressionConfigInterface>;\n}>;\n\nconst SendbirdUIKitContainer = ({\n children,\n appId,\n chatOptions,\n uikitOptions,\n platformServices,\n localization,\n styles,\n errorBoundary,\n toast,\n userProfile,\n userMention,\n imageCompression,\n}: SendbirdUIKitContainerProps) => {\n if (!chatOptions.localCacheStorage) {\n throw new Error('SendbirdUIKitContainer: chatOptions.localCacheStorage is required');\n }\n\n const defaultStringSet = localization?.stringSet ?? StringSetEn;\n\n const isFirstMount = useIsFirstMount();\n const unsubscribes = useRef<Array<() => void>>([]);\n\n const [internalStorage] = useState(() => new InternalLocalCacheStorage(chatOptions.localCacheStorage));\n const [sdkInstance, setSdkInstance] = useState<SendbirdChatSDK>(() => {\n const sendbird = initializeSendbird(appId, internalStorage, chatOptions.onInitialized);\n unsubscribes.current = sendbird.unsubscribes;\n return sendbird.chatSDK;\n });\n\n const emojiManager = useMemo(() => new EmojiManager(internalStorage), [internalStorage]);\n\n const mentionManager = useMemo(() => {\n const config = new MentionConfig({\n mentionLimit: userMention?.mentionLimit || MentionConfig.DEFAULT.MENTION_LIMIT,\n suggestionLimit: userMention?.suggestionLimit || MentionConfig.DEFAULT.SUGGESTION_LIMIT,\n debounceMills: userMention?.debounceMills ?? MentionConfig.DEFAULT.DEBOUNCE_MILLS,\n delimiter: MentionConfig.DEFAULT.DELIMITER,\n trigger: MentionConfig.DEFAULT.TRIGGER,\n });\n return new MentionManager(config);\n }, [userMention?.mentionLimit, userMention?.suggestionLimit, userMention?.debounceMills]);\n\n const imageCompressionConfig = useMemo(() => {\n return new ImageCompressionConfig({\n compressionRate: imageCompression?.compressionRate || ImageCompressionConfig.DEFAULT.COMPRESSION_RATE,\n width: imageCompression?.width,\n height: imageCompression?.height,\n });\n }, [imageCompression?.compressionRate, imageCompression?.width, imageCompression?.height]);\n\n useLayoutEffect(() => {\n if (!isFirstMount) {\n const sendbird = initializeSendbird(appId, internalStorage, chatOptions.onInitialized);\n setSdkInstance(sendbird.chatSDK);\n unsubscribes.current = sendbird.unsubscribes;\n }\n\n return () => {\n if (!isFirstMount) {\n unsubscribes.current.forEach((u) => {\n try {\n u();\n } catch {}\n });\n }\n };\n }, [appId, internalStorage]);\n\n const renderChildren = () => {\n if (errorBoundary?.disabled) {\n return children;\n } else {\n return <InternalErrorBoundaryContainer {...errorBoundary}>{children}</InternalErrorBoundaryContainer>;\n }\n };\n\n return (\n <SafeAreaProvider>\n <UIKitConfigProvider\n storage={internalStorage}\n localConfigs={{\n common: uikitOptions?.common,\n groupChannel: {\n channel: uikitOptions?.groupChannel,\n channelList: uikitOptions?.groupChannelList,\n setting: uikitOptions?.groupChannelSettings,\n },\n openChannel: {\n channel: uikitOptions?.openChannel,\n },\n }}\n >\n <SendbirdChatProvider\n sdkInstance={sdkInstance}\n emojiManager={emojiManager}\n mentionManager={mentionManager}\n imageCompressionConfig={imageCompressionConfig}\n enableAutoPushTokenRegistration={\n chatOptions.enableAutoPushTokenRegistration ?? SendbirdUIKit.DEFAULT.AUTO_PUSH_TOKEN_REGISTRATION\n }\n enableUseUserIdForNickname={\n chatOptions.enableUseUserIdForNickname ?? SendbirdUIKit.DEFAULT.USE_USER_ID_FOR_NICKNAME\n }\n enableImageCompression={chatOptions.enableImageCompression ?? SendbirdUIKit.DEFAULT.IMAGE_COMPRESSION}\n >\n <LocalizationProvider stringSet={defaultStringSet}>\n <PlatformServiceProvider\n fileService={platformServices.file}\n notificationService={platformServices.notification}\n clipboardService={platformServices.clipboard}\n mediaService={platformServices.media}\n >\n <UIKitThemeProvider theme={styles?.theme ?? LightUIKitTheme}>\n <HeaderStyleProvider\n HeaderComponent={styles?.HeaderComponent ?? Header}\n defaultTitleAlign={styles?.defaultHeaderTitleAlign ?? 'left'}\n statusBarTranslucent={styles?.statusBarTranslucent ?? true}\n >\n <ToastProvider dismissTimeout={toast?.dismissTimeout}>\n <UserProfileProvider\n onCreateChannel={userProfile?.onCreateChannel}\n onBeforeCreateChannel={userProfile?.onBeforeCreateChannel}\n statusBarTranslucent={styles?.statusBarTranslucent ?? true}\n >\n <ReactionProvider>\n <LocalizationContext.Consumer>\n {(value) => {\n const STRINGS = value?.STRINGS || defaultStringSet;\n return (\n <DialogProvider\n defaultLabels={{\n alert: { ok: STRINGS.DIALOG.ALERT_DEFAULT_OK },\n prompt: {\n ok: STRINGS.DIALOG.PROMPT_DEFAULT_OK,\n cancel: STRINGS.DIALOG.PROMPT_DEFAULT_CANCEL,\n placeholder: STRINGS.DIALOG.PROMPT_DEFAULT_PLACEHOLDER,\n },\n }}\n >\n {renderChildren()}\n </DialogProvider>\n );\n }}\n </LocalizationContext.Consumer>\n </ReactionProvider>\n </UserProfileProvider>\n </ToastProvider>\n </HeaderStyleProvider>\n </UIKitThemeProvider>\n </PlatformServiceProvider>\n </LocalizationProvider>\n </SendbirdChatProvider>\n </UIKitConfigProvider>\n </SafeAreaProvider>\n );\n};\n\nconst initializeSendbird = (\n appId: string,\n internalStorage?: InternalLocalCacheStorage,\n onInitialized?: (sdk: SendbirdChatSDK) => SendbirdChatSDK,\n) => {\n const unsubscribes: Array<() => void> = [];\n let chatSDK: SendbirdChatSDK;\n\n chatSDK = Sendbird.init({\n appId,\n modules: [new GroupChannelModule(), new OpenChannelModule()],\n localCacheEnabled: Boolean(internalStorage),\n useAsyncStorageStore: internalStorage as never,\n newInstance: true,\n });\n\n if (onInitialized) {\n chatSDK = onInitialized(chatSDK);\n }\n\n if (SendbirdUIKit.VERSION) {\n chatSDK.addExtension('sb_uikit', SendbirdUIKit.VERSION);\n }\n\n if (SendbirdUIKit.PLATFORM) {\n chatSDK.addExtension('device-os-platform', SendbirdUIKit.PLATFORM);\n }\n\n if (NetInfo?.addEventListener) {\n try {\n // NOTE: For removing buggy behavior of NetInfo.addEventListener\n // When you first add an event listener, it is assumed that the initialization of the internal event detector is done simultaneously.\n // In other words, when you call the first event listener two events are triggered immediately\n // - the one that is called when adding the event listener\n // - and the internal initialization event\n NetInfo.addEventListener(NOOP)();\n } catch {}\n\n const listener = (callback: () => void, callbackType: 'online' | 'offline') => {\n let callCount = 0;\n const unsubscribe = NetInfo.addEventListener((state) => {\n const online = Boolean(state.isConnected) || Boolean(state.isInternetReachable);\n\n // NOTE: When NetInfo.addEventListener is called\n // the event is immediately triggered regardless of whether the event actually occurred.\n // This is why it filters the first event.\n if (callCount === 0) {\n callCount++;\n return;\n }\n\n if (online && callbackType === 'online') callback();\n if (!online && callbackType === 'offline') callback();\n });\n unsubscribes.push(unsubscribe);\n return unsubscribe;\n };\n chatSDK.setOnlineListener?.((onOnline) => listener(onOnline, 'online'));\n chatSDK.setOfflineListener?.((onOffline) => listener(onOffline, 'offline'));\n }\n return { chatSDK, unsubscribes };\n};\n\nexport default SendbirdUIKitContainer;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,eAAe,EAA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AAED,QAAQ,EAAE;QACnD,IAAI,CAACK,MAAM,IAAIJ,YAAY,KAAK,SAAS,EAAED,QAAQ,EAAE;MACvD,CAAC,CAAC;MACFxF,YAAY,CAACgG,IAAI,CAACL,WAAW,CAAC;MAC9B,OAAOA,WAAW;IACpB,CAAC;IACD,CAAAR,qBAAA,IAAAC,QAAA,GAAA5E,OAAO,EAACyF,iBAAiB,cAAAd,qBAAA,uBAAzBA,qBAAA,CAAAe,IAAA,CAAAd,QAAA,EAA6Be,QAAQ,IAAKZ,QAAQ,CAACY,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACvE,CAAAd,qBAAA,IAAAC,SAAA,GAAA9E,OAAO,EAAC4F,kBAAkB,cAAAf,qBAAA,uBAA1BA,qBAAA,CAAAa,IAAA,CAAAZ,SAAA,EAA8Be,SAAS,IAAKd,QAAQ,CAACc,SAAS,EAAE,SAAS,CAAC,CAAC;EAC7E;EACA,OAAO;IAAE7F,OAAO;IAAER;EAAa,CAAC;AAClC,CAAC;AAED,eAAenB,sBAAsB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useState } from 'react';
|
|
2
2
|
import { useAppFeatures } from '@sendbird/uikit-chat-hooks';
|
|
3
|
+
import { useUIKitConfig } from '@sendbird/uikit-tools';
|
|
3
4
|
import { confirmAndMarkAsDelivered, useAppState, useForceUpdate } from '@sendbird/uikit-utils';
|
|
4
5
|
export const SendbirdChatContext = /*#__PURE__*/React.createContext(null);
|
|
5
6
|
export const SendbirdChatProvider = _ref => {
|
|
@@ -10,16 +11,16 @@ export const SendbirdChatProvider = _ref => {
|
|
|
10
11
|
mentionManager,
|
|
11
12
|
imageCompressionConfig,
|
|
12
13
|
enableAutoPushTokenRegistration,
|
|
13
|
-
enableChannelListMessageReceiptStatus,
|
|
14
|
-
enableChannelListTypingIndicator,
|
|
15
14
|
enableUseUserIdForNickname,
|
|
16
|
-
|
|
17
|
-
enableImageCompression,
|
|
18
|
-
enableMessageSearch
|
|
15
|
+
enableImageCompression
|
|
19
16
|
} = _ref;
|
|
20
17
|
const [currentUser, _setCurrentUser] = useState();
|
|
21
18
|
const forceUpdate = useForceUpdate();
|
|
22
19
|
const appFeatures = useAppFeatures(sdkInstance);
|
|
20
|
+
const {
|
|
21
|
+
configs,
|
|
22
|
+
configsWithAppAttr
|
|
23
|
+
} = useUIKitConfig();
|
|
23
24
|
const setCurrentUser = useCallback(user => {
|
|
24
25
|
// NOTE: Sendbird SDK handle User object is always same object, so force update after setCurrentUser
|
|
25
26
|
_setCurrentUser(user);
|
|
@@ -63,15 +64,17 @@ export const SendbirdChatProvider = _ref => {
|
|
|
63
64
|
setCurrentUser,
|
|
64
65
|
updateCurrentUserInfo,
|
|
65
66
|
markAsDeliveredWithChannel,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
67
|
+
// TODO: Options should be moved to the common area at the higher level to be passed to the context of each product.
|
|
68
|
+
// For example, common -> chat context, common -> calls context
|
|
69
|
+
sbOptions: {
|
|
70
|
+
appInfo: appFeatures,
|
|
71
|
+
uikit: configs,
|
|
72
|
+
uikitWithAppInfo: configsWithAppAttr(sdkInstance),
|
|
73
|
+
chat: {
|
|
74
|
+
autoPushTokenRegistrationEnabled: enableAutoPushTokenRegistration,
|
|
75
|
+
useUserIdForNicknameEnabled: enableUseUserIdForNickname,
|
|
76
|
+
imageCompressionEnabled: enableImageCompression
|
|
77
|
+
}
|
|
75
78
|
}
|
|
76
79
|
};
|
|
77
80
|
return /*#__PURE__*/React.createElement(SendbirdChatContext.Provider, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useState","useAppFeatures","confirmAndMarkAsDelivered","useAppState","useForceUpdate","SendbirdChatContext","createContext","SendbirdChatProvider","_ref","children","sdkInstance","emojiManager","mentionManager","imageCompressionConfig","enableAutoPushTokenRegistration","
|
|
1
|
+
{"version":3,"names":["React","useCallback","useState","useAppFeatures","useUIKitConfig","confirmAndMarkAsDelivered","useAppState","useForceUpdate","SendbirdChatContext","createContext","SendbirdChatProvider","_ref","children","sdkInstance","emojiManager","mentionManager","imageCompressionConfig","enableAutoPushTokenRegistration","enableUseUserIdForNickname","enableImageCompression","currentUser","_setCurrentUser","forceUpdate","appFeatures","configs","configsWithAppAttr","setCurrentUser","user","updateCurrentUserInfo","nickname","profile","Error","params","profileUrl","profileImage","markAsDeliveredWithChannel","channel","deliveryReceiptEnabled","status","connectionState","setForegroundState","setBackgroundState","value","sdk","sbOptions","appInfo","uikit","uikitWithAppInfo","chat","autoPushTokenRegistrationEnabled","useUserIdForNicknameEnabled","imageCompressionEnabled","createElement","Provider"],"sources":["SendbirdChatCtx.tsx"],"sourcesContent":["import React, { useCallback, useState } from 'react';\n\nimport { useAppFeatures } from '@sendbird/uikit-chat-hooks';\nimport { SBUConfig, useUIKitConfig } from '@sendbird/uikit-tools';\nimport type {\n SendbirdChatSDK,\n SendbirdGroupChannel,\n SendbirdUser,\n SendbirdUserUpdateParams,\n} from '@sendbird/uikit-utils';\nimport { confirmAndMarkAsDelivered, useAppState, useForceUpdate } from '@sendbird/uikit-utils';\n\nimport type EmojiManager from '../libs/EmojiManager';\nimport type ImageCompressionConfig from '../libs/ImageCompressionConfig';\nimport type MentionManager from '../libs/MentionManager';\nimport type { FileType } from '../platform/types';\n\nexport interface ChatRelatedFeaturesInUIKit {\n enableAutoPushTokenRegistration: boolean;\n enableUseUserIdForNickname: boolean;\n enableImageCompression: boolean;\n}\n\ninterface Props extends ChatRelatedFeaturesInUIKit, React.PropsWithChildren {\n sdkInstance: SendbirdChatSDK;\n emojiManager: EmojiManager;\n mentionManager: MentionManager;\n imageCompressionConfig: ImageCompressionConfig;\n}\n\nexport type SendbirdChatContextType = {\n sdk: SendbirdChatSDK;\n emojiManager: EmojiManager;\n mentionManager: MentionManager;\n imageCompressionConfig: ImageCompressionConfig;\n currentUser?: SendbirdUser;\n setCurrentUser: React.Dispatch<React.SetStateAction<SendbirdUser | undefined>>;\n\n // helper functions\n updateCurrentUserInfo: (nickname?: string, profile?: string | FileType) => Promise<SendbirdUser>;\n markAsDeliveredWithChannel: (channel: SendbirdGroupChannel) => void;\n\n sbOptions: {\n // UIKit options\n uikit: SBUConfig;\n uikitWithAppInfo: {\n groupChannel: {\n channel: {\n enableReactions: boolean;\n enableOgtag: boolean;\n };\n setting: {\n enableMessageSearch: boolean;\n };\n };\n openChannel: {\n channel: {\n enableOgtag: boolean;\n };\n };\n };\n\n // Chat related options in UIKit\n chat: {\n imageCompressionEnabled: boolean;\n useUserIdForNicknameEnabled: boolean;\n autoPushTokenRegistrationEnabled: boolean; // RN only\n };\n\n // Sendbird application options\n appInfo: {\n deliveryReceiptEnabled: boolean;\n broadcastChannelEnabled: boolean;\n superGroupChannelEnabled: boolean;\n reactionEnabled: boolean;\n };\n };\n};\n\nexport const SendbirdChatContext = React.createContext<SendbirdChatContextType | null>(null);\nexport const SendbirdChatProvider = ({\n children,\n sdkInstance,\n emojiManager,\n mentionManager,\n imageCompressionConfig,\n enableAutoPushTokenRegistration,\n enableUseUserIdForNickname,\n enableImageCompression,\n}: Props) => {\n const [currentUser, _setCurrentUser] = useState<SendbirdUser>();\n const forceUpdate = useForceUpdate();\n const appFeatures = useAppFeatures(sdkInstance);\n const { configs, configsWithAppAttr } = useUIKitConfig();\n\n const setCurrentUser: SendbirdChatContextType['setCurrentUser'] = useCallback((user) => {\n // NOTE: Sendbird SDK handle User object is always same object, so force update after setCurrentUser\n _setCurrentUser(user);\n forceUpdate();\n }, []);\n\n const updateCurrentUserInfo: SendbirdChatContextType['updateCurrentUserInfo'] = useCallback(\n async (nickname, profile) => {\n let user = currentUser;\n\n if (!user) throw new Error('Current user is not defined, please connect using `useConnection()` hook first');\n\n const params: SendbirdUserUpdateParams = {};\n\n if (!nickname) {\n params.nickname = user.nickname;\n } else {\n params.nickname = nickname;\n }\n\n if (!profile) {\n params.profileUrl = user.profileUrl;\n } else if (typeof profile === 'string') {\n params.profileUrl = profile;\n } else if (typeof profile === 'object') {\n params.profileImage = profile;\n } else {\n throw new Error(`Cannot update profile, not supported profile type(${typeof profile})`);\n }\n\n user = await sdkInstance.updateCurrentUserInfo(params);\n\n setCurrentUser(user);\n return user;\n },\n [sdkInstance, currentUser, setCurrentUser],\n );\n\n const markAsDeliveredWithChannel: SendbirdChatContextType['markAsDeliveredWithChannel'] = useCallback(\n (channel: SendbirdGroupChannel) => {\n if (appFeatures.deliveryReceiptEnabled) confirmAndMarkAsDelivered([channel]);\n },\n [sdkInstance, appFeatures.deliveryReceiptEnabled],\n );\n\n useAppState('change', (status) => {\n // 'active' | 'background' | 'inactive' | 'unknown' | 'extension';\n if (status === 'active') sdkInstance.connectionState === 'CLOSED' && sdkInstance.setForegroundState();\n else if (status === 'background') sdkInstance.connectionState === 'OPEN' && sdkInstance.setBackgroundState();\n });\n\n const value: SendbirdChatContextType = {\n sdk: sdkInstance,\n emojiManager,\n mentionManager,\n imageCompressionConfig,\n currentUser,\n setCurrentUser,\n\n updateCurrentUserInfo,\n markAsDeliveredWithChannel,\n\n // TODO: Options should be moved to the common area at the higher level to be passed to the context of each product.\n // For example, common -> chat context, common -> calls context\n sbOptions: {\n appInfo: appFeatures,\n uikit: configs,\n uikitWithAppInfo: configsWithAppAttr(sdkInstance),\n chat: {\n autoPushTokenRegistrationEnabled: enableAutoPushTokenRegistration,\n useUserIdForNicknameEnabled: enableUseUserIdForNickname,\n imageCompressionEnabled: enableImageCompression,\n },\n },\n };\n\n return <SendbirdChatContext.Provider value={value}>{children}</SendbirdChatContext.Provider>;\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,QAAQ,QAAQ,OAAO;AAEpD,SAASC,cAAc,QAAQ,4BAA4B;AAC3D,SAAoBC,cAAc,QAAQ,uBAAuB;AAOjE,SAASC,yBAAyB,EAAEC,WAAW,EAAEC,cAAc,QAAQ,uBAAuB;A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;EACF,CAAC;EAED,oBAAOnB,KAAA,CAAAoD,aAAA,CAAC5C,mBAAmB,CAAC6C,QAAQ;IAACX,KAAK,EAAEA;EAAM,GAAE9B,QAAQ,CAAgC;AAC9F,CAAC"}
|
|
@@ -30,10 +30,12 @@ export const UserProfileProvider = _ref => {
|
|
|
30
30
|
const [visible, setVisible] = useState(false);
|
|
31
31
|
const [hideMessageButton, setHideMessageButton] = useState(false);
|
|
32
32
|
const show = useCallback((user, options) => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
if (chatContext.sbOptions.uikit.common.enableUsingDefaultUserProfile) {
|
|
34
|
+
setUser(user);
|
|
35
|
+
setVisible(true);
|
|
36
|
+
setHideMessageButton(Boolean(options === null || options === void 0 ? void 0 : options.hideMessageButton));
|
|
37
|
+
}
|
|
38
|
+
}, [chatContext.sbOptions.uikit.common.enableUsingDefaultUserProfile]);
|
|
37
39
|
const hide = useCallback(() => {
|
|
38
40
|
setVisible(false);
|
|
39
41
|
}, []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useContext","useState","useSafeAreaInsets","Modal","OutlinedButton","ProfileCard","createStyleSheet","Logger","PASS","getDefaultGroupChannelCreateParams","useIIFE","LocalizationContext","SendbirdChatContext","WARN_onCreateChannel","UserProfileContext","createContext","UserProfileProvider","_ref","children","onCreateChannel","onBeforeCreateChannel","statusBarTranslucent","chatContext","localizationContext","Error","__DEV__","warn","bottom","left","right","user","setUser","visible","setVisible","hideMessageButton","setHideMessageButton","show","options","Boolean","hide","onDismiss","undefined","userProfileButton","isMe","currentUser","userId","onPressMessageButton","_chatContext$currentU","params","invitedUserIds","currentUserId","processedParams","channel","sdk","groupChannel","createChannel","createElement","onPress","STRINGS","PROFILE_CARD","BUTTON_MESSAGE","Provider","value","type","onClose","backgroundStyle","styles","modal","containerStyle","profileCardContainer","paddingLeft","paddingRight","paddingBottom","uri","profileUrl","username","nickname","LABELS","USER_NO_NAME","bodyLabel","BODY_LABEL","body","BODY","button","justifyContent","borderTopLeftRadius","borderTopRightRadius"],"sources":["UserProfileCtx.tsx"],"sourcesContent":["import React, { useCallback, useContext, useState } from 'react';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\nimport { Modal, OutlinedButton, ProfileCard, createStyleSheet } from '@sendbird/uikit-react-native-foundation';\nimport type {\n SendbirdGroupChannel,\n SendbirdGroupChannelCreateParams,\n SendbirdMember,\n SendbirdUser,\n} from '@sendbird/uikit-utils';\nimport { Logger, PASS, getDefaultGroupChannelCreateParams, useIIFE } from '@sendbird/uikit-utils';\n\nimport { LocalizationContext } from '../contexts/LocalizationCtx';\nimport { SendbirdChatContext } from '../contexts/SendbirdChatCtx';\n\ntype OnCreateChannel = (channel: SendbirdGroupChannel) => void;\ntype OnBeforeCreateChannel = (\n channelParams: SendbirdGroupChannelCreateParams,\n users: SendbirdUser[] | SendbirdMember[],\n) => SendbirdGroupChannelCreateParams | Promise<SendbirdGroupChannelCreateParams>;\n\ntype ShowOptions = {\n hideMessageButton?: boolean;\n};\n\nexport type UserProfileContextType = {\n show(user: SendbirdUser | SendbirdMember, options?: ShowOptions): void;\n hide(): void;\n};\n\ntype Props = React.PropsWithChildren<{\n onCreateChannel?: OnCreateChannel;\n onBeforeCreateChannel?: OnBeforeCreateChannel;\n statusBarTranslucent?: boolean;\n}>;\n\nlet WARN_onCreateChannel = false;\n\nexport const UserProfileContext = React.createContext<UserProfileContextType | null>(null);\nexport const UserProfileProvider = ({\n children,\n onCreateChannel,\n onBeforeCreateChannel = PASS,\n statusBarTranslucent = true,\n}: Props) => {\n const chatContext = useContext(SendbirdChatContext);\n const localizationContext = useContext(LocalizationContext);\n\n if (!chatContext) throw new Error('SendbirdChatContext is not provided');\n if (!localizationContext) throw new Error('LocalizationContext is not provided');\n\n if (__DEV__ && !WARN_onCreateChannel && !onCreateChannel) {\n Logger.warn(\n 'You should pass `userProfile.onCreateChannel` prop to SendbirdUIKitContainer if want to use message in a user profile',\n );\n WARN_onCreateChannel = true;\n }\n\n const { bottom, left, right } = useSafeAreaInsets();\n\n const [user, setUser] = useState<SendbirdUser | SendbirdMember>();\n const [visible, setVisible] = useState(false);\n const [hideMessageButton, setHideMessageButton] = useState(false);\n\n const show: UserProfileContextType['show'] = useCallback((user, options) => {\n setUser(user);\n setVisible(true);\n setHideMessageButton(Boolean(options?.hideMessageButton));\n }, []);\n\n const hide: UserProfileContextType['hide'] = useCallback(() => {\n setVisible(false);\n }, []);\n\n const onDismiss = () => {\n setUser(undefined);\n setHideMessageButton(false);\n };\n\n const userProfileButton = useIIFE(() => {\n const isMe = chatContext.currentUser && user?.userId === chatContext.currentUser.userId;\n if (isMe) return undefined;\n if (hideMessageButton) return undefined;\n\n const onPressMessageButton = async () => {\n if (user) {\n const params = getDefaultGroupChannelCreateParams({\n invitedUserIds: [user.userId],\n currentUserId: chatContext.currentUser?.userId,\n });\n\n const processedParams = await onBeforeCreateChannel(params, [user]);\n hide();\n const channel = await chatContext.sdk.groupChannel.createChannel(processedParams);\n\n if (onCreateChannel) {\n onCreateChannel(channel);\n } else {\n Logger.warn(\n 'Please set `onCreateChannel` before message to user from profile card, see `userProfile` prop in the `SendbirdUIKitContainer` props',\n );\n }\n }\n };\n\n return (\n <OutlinedButton onPress={onPressMessageButton}>\n {localizationContext.STRINGS.PROFILE_CARD.BUTTON_MESSAGE}\n </OutlinedButton>\n );\n });\n\n return (\n <UserProfileContext.Provider value={{ show, hide }}>\n {children}\n <Modal\n type={'slide'}\n onClose={hide}\n onDismiss={onDismiss}\n visible={visible && Boolean(user)}\n backgroundStyle={styles.modal}\n statusBarTranslucent={statusBarTranslucent}\n >\n {user && (\n <ProfileCard\n containerStyle={[\n styles.profileCardContainer,\n { paddingLeft: left, paddingRight: right, paddingBottom: bottom },\n ]}\n uri={user.profileUrl}\n username={user.nickname || localizationContext.STRINGS.LABELS.USER_NO_NAME}\n bodyLabel={localizationContext.STRINGS.PROFILE_CARD.BODY_LABEL}\n body={localizationContext.STRINGS.PROFILE_CARD.BODY(user)}\n button={userProfileButton}\n />\n )}\n </Modal>\n </UserProfileContext.Provider>\n );\n};\n\nconst styles = createStyleSheet({\n modal: {\n justifyContent: 'flex-end',\n },\n profileCardContainer: {\n borderTopLeftRadius: 8,\n borderTopRightRadius: 8,\n },\n});\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,OAAO;AAChE,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE,SAASC,KAAK,EAAEC,cAAc,EAAEC,WAAW,EAAEC,gBAAgB,QAAQ,yCAAyC;AAO9G,SAASC,MAAM,EAAEC,IAAI,EAAEC,kCAAkC,EAAEC,OAAO,QAAQ,uBAAuB;AAEjG,SAASC,mBAAmB,QAAQ,6BAA6B;AACjE,SAASC,mBAAmB,QAAQ,6BAA6B;AAuBjE,IAAIC,oBAAoB,GAAG,KAAK;AAEhC,OAAO,MAAMC,kBAAkB,gBAAGhB,KAAK,CAACiB,aAAa,CAAgC,IAAI,CAAC;AAC1F,OAAO,MAAMC,mBAAmB,GAAGC,IAAA,IAKtB;EAAA,IALuB;IAClCC,QAAQ;IACRC,eAAe;IACfC,qBAAqB,GAAGZ,IAAI;IAC5Ba,oBAAoB,GAAG;EAClB,CAAC,GAAAJ,IAAA;EACN,MAAMK,WAAW,GAAGtB,UAAU,CAACY,mBAAmB,CAAC;EACnD,MAAMW,mBAAmB,GAAGvB,UAAU,CAACW,mBAAmB,CAAC;EAE3D,IAAI,CAACW,WAAW,EAAE,MAAM,IAAIE,KAAK,CAAC,qCAAqC,CAAC;EACxE,IAAI,CAACD,mBAAmB,EAAE,MAAM,IAAIC,KAAK,CAAC,qCAAqC,CAAC;EAEhF,IAAIC,OAAO,IAAI,CAACZ,oBAAoB,IAAI,CAACM,eAAe,EAAE;IACxDZ,MAAM,CAACmB,IAAI,CACT,uHAAuH,CACxH;IACDb,oBAAoB,GAAG,IAAI;EAC7B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IAAO,CAAC,CACjE;IACF8C,GAAG,EAAE3C,IAAI,CAAC4C,UAAW;IACrBC,QAAQ,EAAE7C,IAAI,CAAC8C,QAAQ,IAAIrD,mBAAmB,CAACmC,OAAO,CAACmB,MAAM,CAACC,YAAa;IAC3EC,SAAS,EAAExD,mBAAmB,CAACmC,OAAO,CAACC,YAAY,CAACqB,UAAW;IAC/DC,IAAI,EAAE1D,mBAAmB,CAACmC,OAAO,CAACC,YAAY,CAACuB,IAAI,CAACpD,IAAI,CAAE;IAC1DqD,MAAM,EAAEzC;EAAkB,EAE7B,CACK,CACoB;AAElC,CAAC;AAED,MAAMwB,MAAM,GAAG5D,gBAAgB,CAAC;EAC9B6D,KAAK,EAAE;IACLiB,cAAc,EAAE;EAClB,CAAC;EACDf,oBAAoB,EAAE;IACpBgB,mBAAmB,EAAE,CAAC;IACtBC,oBAAoB,EAAE;EACxB;AACF,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"names":["React","useCallback","useContext","useState","useSafeAreaInsets","Modal","OutlinedButton","ProfileCard","createStyleSheet","Logger","PASS","getDefaultGroupChannelCreateParams","useIIFE","LocalizationContext","SendbirdChatContext","WARN_onCreateChannel","UserProfileContext","createContext","UserProfileProvider","_ref","children","onCreateChannel","onBeforeCreateChannel","statusBarTranslucent","chatContext","localizationContext","Error","__DEV__","warn","bottom","left","right","user","setUser","visible","setVisible","hideMessageButton","setHideMessageButton","show","options","sbOptions","uikit","common","enableUsingDefaultUserProfile","Boolean","hide","onDismiss","undefined","userProfileButton","isMe","currentUser","userId","onPressMessageButton","_chatContext$currentU","params","invitedUserIds","currentUserId","processedParams","channel","sdk","groupChannel","createChannel","createElement","onPress","STRINGS","PROFILE_CARD","BUTTON_MESSAGE","Provider","value","type","onClose","backgroundStyle","styles","modal","containerStyle","profileCardContainer","paddingLeft","paddingRight","paddingBottom","uri","profileUrl","username","nickname","LABELS","USER_NO_NAME","bodyLabel","BODY_LABEL","body","BODY","button","justifyContent","borderTopLeftRadius","borderTopRightRadius"],"sources":["UserProfileCtx.tsx"],"sourcesContent":["import React, { useCallback, useContext, useState } from 'react';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\nimport { Modal, OutlinedButton, ProfileCard, createStyleSheet } from '@sendbird/uikit-react-native-foundation';\nimport type {\n SendbirdGroupChannel,\n SendbirdGroupChannelCreateParams,\n SendbirdMember,\n SendbirdUser,\n} from '@sendbird/uikit-utils';\nimport { Logger, PASS, getDefaultGroupChannelCreateParams, useIIFE } from '@sendbird/uikit-utils';\n\nimport { LocalizationContext } from '../contexts/LocalizationCtx';\nimport { SendbirdChatContext } from '../contexts/SendbirdChatCtx';\n\ntype OnCreateChannel = (channel: SendbirdGroupChannel) => void;\ntype OnBeforeCreateChannel = (\n channelParams: SendbirdGroupChannelCreateParams,\n users: SendbirdUser[] | SendbirdMember[],\n) => SendbirdGroupChannelCreateParams | Promise<SendbirdGroupChannelCreateParams>;\n\ntype ShowOptions = {\n hideMessageButton?: boolean;\n};\n\nexport type UserProfileContextType = {\n show(user: SendbirdUser | SendbirdMember, options?: ShowOptions): void;\n hide(): void;\n};\n\ntype Props = React.PropsWithChildren<{\n onCreateChannel?: OnCreateChannel;\n onBeforeCreateChannel?: OnBeforeCreateChannel;\n statusBarTranslucent?: boolean;\n}>;\n\nlet WARN_onCreateChannel = false;\n\nexport const UserProfileContext = React.createContext<UserProfileContextType | null>(null);\nexport const UserProfileProvider = ({\n children,\n onCreateChannel,\n onBeforeCreateChannel = PASS,\n statusBarTranslucent = true,\n}: Props) => {\n const chatContext = useContext(SendbirdChatContext);\n const localizationContext = useContext(LocalizationContext);\n\n if (!chatContext) throw new Error('SendbirdChatContext is not provided');\n if (!localizationContext) throw new Error('LocalizationContext is not provided');\n\n if (__DEV__ && !WARN_onCreateChannel && !onCreateChannel) {\n Logger.warn(\n 'You should pass `userProfile.onCreateChannel` prop to SendbirdUIKitContainer if want to use message in a user profile',\n );\n WARN_onCreateChannel = true;\n }\n\n const { bottom, left, right } = useSafeAreaInsets();\n\n const [user, setUser] = useState<SendbirdUser | SendbirdMember>();\n const [visible, setVisible] = useState(false);\n const [hideMessageButton, setHideMessageButton] = useState(false);\n\n const show: UserProfileContextType['show'] = useCallback(\n (user, options) => {\n if (chatContext.sbOptions.uikit.common.enableUsingDefaultUserProfile) {\n setUser(user);\n setVisible(true);\n setHideMessageButton(Boolean(options?.hideMessageButton));\n }\n },\n [chatContext.sbOptions.uikit.common.enableUsingDefaultUserProfile],\n );\n\n const hide: UserProfileContextType['hide'] = useCallback(() => {\n setVisible(false);\n }, []);\n\n const onDismiss = () => {\n setUser(undefined);\n setHideMessageButton(false);\n };\n\n const userProfileButton = useIIFE(() => {\n const isMe = chatContext.currentUser && user?.userId === chatContext.currentUser.userId;\n if (isMe) return undefined;\n if (hideMessageButton) return undefined;\n\n const onPressMessageButton = async () => {\n if (user) {\n const params = getDefaultGroupChannelCreateParams({\n invitedUserIds: [user.userId],\n currentUserId: chatContext.currentUser?.userId,\n });\n\n const processedParams = await onBeforeCreateChannel(params, [user]);\n hide();\n const channel = await chatContext.sdk.groupChannel.createChannel(processedParams);\n\n if (onCreateChannel) {\n onCreateChannel(channel);\n } else {\n Logger.warn(\n 'Please set `onCreateChannel` before message to user from profile card, see `userProfile` prop in the `SendbirdUIKitContainer` props',\n );\n }\n }\n };\n\n return (\n <OutlinedButton onPress={onPressMessageButton}>\n {localizationContext.STRINGS.PROFILE_CARD.BUTTON_MESSAGE}\n </OutlinedButton>\n );\n });\n\n return (\n <UserProfileContext.Provider value={{ show, hide }}>\n {children}\n <Modal\n type={'slide'}\n onClose={hide}\n onDismiss={onDismiss}\n visible={visible && Boolean(user)}\n backgroundStyle={styles.modal}\n statusBarTranslucent={statusBarTranslucent}\n >\n {user && (\n <ProfileCard\n containerStyle={[\n styles.profileCardContainer,\n { paddingLeft: left, paddingRight: right, paddingBottom: bottom },\n ]}\n uri={user.profileUrl}\n username={user.nickname || localizationContext.STRINGS.LABELS.USER_NO_NAME}\n bodyLabel={localizationContext.STRINGS.PROFILE_CARD.BODY_LABEL}\n body={localizationContext.STRINGS.PROFILE_CARD.BODY(user)}\n button={userProfileButton}\n />\n )}\n </Modal>\n </UserProfileContext.Provider>\n );\n};\n\nconst styles = createStyleSheet({\n modal: {\n justifyContent: 'flex-end',\n },\n profileCardContainer: {\n borderTopLeftRadius: 8,\n borderTopRightRadius: 8,\n },\n});\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,OAAO;AAChE,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE,SAASC,KAAK,EAAEC,cAAc,EAAEC,WAAW,EAAEC,gBAAgB,QAAQ,yCAAyC;AAO9G,SAASC,MAAM,EAAEC,IAAI,EAAEC,kCAAkC,EAAEC,OAAO,QAAQ,uBAAuB;AAEjG,SAASC,mBAAmB,QAAQ,6BAA6B;AACjE,SAASC,mBAAmB,QAAQ,6BAA6B;AAuBjE,IAAIC,oBAAoB,GAAG,KAAK;AAEhC,OAAO,MAAMC,kBAAkB,gBAAGhB,KAAK,CAACiB,aAAa,CAAgC,IAAI,CAAC;AAC1F,OAAO,MAAMC,mBAAmB,GAAGC,IAAA,IAKtB;EAAA,IALuB;IAClCC,QAAQ;IACRC,eAAe;IACfC,qBAAqB,GAAGZ,IAAI;IAC5Ba,oBAAoB,GAAG;EAClB,CAAC,GAAAJ,IAAA;EACN,MAAMK,WAAW,GAAGtB,UAAU,CAACY,mBAAmB,CAAC;EACnD,MAAMW,mBAAmB,GAAGvB,UAAU,CAACW,mBAAmB,CAAC;EAE3D,IAAI,CAACW,WAAW,EAAE,MAAM,IAAIE,KAAK,CAAC,qCAAqC,CAAC;EACxE,IAAI,CAACD,mBAAmB,EAAE,MAAM,IAAIC,KAAK,CAAC,qCAAqC,CAAC;EAEhF,IAAIC,OAAO,IAAI,CAACZ,oBAAoB,IAAI,CAACM,eAAe,EAAE;IACxDZ,MAAM,CAACmB,IAAI,CACT,uHAAuH,CACxH;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AAI,iBACHhC,KAAA,CAAA8D,aAAA,CAACvD,WAAW;IACVmE,cAAc,EAAE,CACdF,MAAM,CAACG,oBAAoB,EAC3B;MAAEC,WAAW,EAAE9C,IAAI;MAAE+C,YAAY,EAAE9C,KAAK;MAAE+C,aAAa,EAAEjD;IAAO,CAAC,CACjE;IACFkD,GAAG,EAAE/C,IAAI,CAACgD,UAAW;IACrBC,QAAQ,EAAEjD,IAAI,CAACkD,QAAQ,IAAIzD,mBAAmB,CAACuC,OAAO,CAACmB,MAAM,CAACC,YAAa;IAC3EC,SAAS,EAAE5D,mBAAmB,CAACuC,OAAO,CAACC,YAAY,CAACqB,UAAW;IAC/DC,IAAI,EAAE9D,mBAAmB,CAACuC,OAAO,CAACC,YAAY,CAACuB,IAAI,CAACxD,IAAI,CAAE;IAC1DyD,MAAM,EAAEzC;EAAkB,EAE7B,CACK,CACoB;AAElC,CAAC;AAED,MAAMwB,MAAM,GAAGhE,gBAAgB,CAAC;EAC9BiE,KAAK,EAAE;IACLiB,cAAc,EAAE;EAClB,CAAC;EACDf,oBAAoB,EAAE;IACpBgB,mBAAmB,EAAE,CAAC;IACtBC,oBAAoB,EAAE;EACxB;AACF,CAAC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
1
2
|
import React, { useContext } from 'react';
|
|
2
3
|
import { getGroupChannelChatAvailableState } from '@sendbird/uikit-utils';
|
|
3
4
|
import ChannelInput from '../../../components/ChannelInput';
|
|
@@ -10,25 +11,15 @@ const GroupChannelInput = props => {
|
|
|
10
11
|
keyboardAvoidOffset = 0
|
|
11
12
|
} = useContext(GroupChannelContexts.Fragment);
|
|
12
13
|
const chatAvailableState = getGroupChannelChatAvailableState(channel);
|
|
13
|
-
return /*#__PURE__*/React.createElement(ChannelInput, {
|
|
14
|
+
return /*#__PURE__*/React.createElement(ChannelInput, _extends({
|
|
14
15
|
channel: channel,
|
|
15
16
|
messageToEdit: messageToEdit,
|
|
16
17
|
setMessageToEdit: setMessageToEdit,
|
|
17
18
|
inputMuted: chatAvailableState.muted,
|
|
18
19
|
inputFrozen: chatAvailableState.frozen,
|
|
19
20
|
inputDisabled: chatAvailableState.disabled,
|
|
20
|
-
keyboardAvoidOffset: keyboardAvoidOffset
|
|
21
|
-
|
|
22
|
-
onPressSendUserMessage: props.onPressSendUserMessage,
|
|
23
|
-
onPressSendFileMessage: props.onPressSendFileMessage,
|
|
24
|
-
onPressUpdateUserMessage: props.onPressUpdateUserMessage,
|
|
25
|
-
onPressUpdateFileMessage: props.onPressUpdateFileMessage,
|
|
26
|
-
SuggestedMentionList: props.SuggestedMentionList,
|
|
27
|
-
onSendFileMessage: props.onSendFileMessage,
|
|
28
|
-
onSendUserMessage: props.onSendUserMessage,
|
|
29
|
-
onUpdateFileMessage: props.onUpdateFileMessage,
|
|
30
|
-
onUpdateUserMessage: props.onUpdateUserMessage
|
|
31
|
-
});
|
|
21
|
+
keyboardAvoidOffset: keyboardAvoidOffset
|
|
22
|
+
}, props));
|
|
32
23
|
};
|
|
33
24
|
export default /*#__PURE__*/React.memo(GroupChannelInput);
|
|
34
25
|
//# sourceMappingURL=GroupChannelInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useContext","getGroupChannelChatAvailableState","ChannelInput","GroupChannelContexts","GroupChannelInput","props","channel","messageToEdit","setMessageToEdit","keyboardAvoidOffset","Fragment","chatAvailableState","createElement","inputMuted","muted","inputFrozen","frozen","inputDisabled","disabled","
|
|
1
|
+
{"version":3,"names":["React","useContext","getGroupChannelChatAvailableState","ChannelInput","GroupChannelContexts","GroupChannelInput","props","channel","messageToEdit","setMessageToEdit","keyboardAvoidOffset","Fragment","chatAvailableState","createElement","_extends","inputMuted","muted","inputFrozen","frozen","inputDisabled","disabled","memo"],"sources":["GroupChannelInput.tsx"],"sourcesContent":["import React, { useContext } from 'react';\n\nimport { getGroupChannelChatAvailableState } from '@sendbird/uikit-utils';\n\nimport ChannelInput from '../../../components/ChannelInput';\nimport { GroupChannelContexts } from '../module/moduleContext';\nimport type { GroupChannelProps } from '../types';\n\nconst GroupChannelInput = (props: GroupChannelProps['Input']) => {\n const {\n channel,\n messageToEdit,\n setMessageToEdit,\n keyboardAvoidOffset = 0,\n } = useContext(GroupChannelContexts.Fragment);\n\n const chatAvailableState = getGroupChannelChatAvailableState(channel);\n\n return (\n <ChannelInput\n channel={channel}\n messageToEdit={messageToEdit}\n setMessageToEdit={setMessageToEdit}\n inputMuted={chatAvailableState.muted}\n inputFrozen={chatAvailableState.frozen}\n inputDisabled={chatAvailableState.disabled}\n keyboardAvoidOffset={keyboardAvoidOffset}\n {...props}\n />\n );\n};\n\nexport default React.memo(GroupChannelInput);\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AAEzC,SAASC,iCAAiC,QAAQ,uBAAuB;AAEzE,OAAOC,YAAY,MAAM,kCAAkC;AAC3D,SAASC,oBAAoB,QAAQ,yBAAyB;AAG9D,MAAMC,iBAAiB,GAAIC,KAAiC,IAAK;EAC/D,MAAM;IACJC,OAAO;IACPC,aAAa;IACbC,gBAAgB;IAChBC,mBAAmB,GAAG;EACxB,CAAC,GAAGT,UAAU,CAACG,oBAAoB,CAACO,QAAQ,CAAC;EAE7C,MAAMC,kBAAkB,GAAGV,iCAAiC,CAACK,OAAO,CAAC;EAErE,oBACEP,KAAA,CAAAa,aAAA,CAACV,YAAY,EAAAW,QAAA;IACXP,OAAO,EAAEA,OAAQ;IACjBC,aAAa,EAAEA,aAAc;IAC7BC,gBAAgB,EAAEA,gBAAiB;IACnCM,UAAU,EAAEH,kBAAkB,CAACI,KAAM;IACrCC,WAAW,EAAEL,kBAAkB,CAACM,MAAO;IACvCC,aAAa,EAAEP,kBAAkB,CAACQ,QAAS;IAC3CV,mBAAmB,EAAEA;EAAoB,GACrCJ,KAAK,EACT;AAEN,CAAC;AAED,4BAAeN,KAAK,CAACqB,IAAI,CAAChB,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type React from 'react';\n\nimport type { UseGroupChannelMessagesOptions } from '@sendbird/uikit-chat-hooks';\nimport type {\n OnBeforeHandler,\n SendbirdFileMessage,\n SendbirdFileMessageCreateParams,\n SendbirdFileMessageUpdateParams,\n SendbirdGroupChannel,\n SendbirdMessage,\n SendbirdUser,\n SendbirdUserMessage,\n SendbirdUserMessageCreateParams,\n SendbirdUserMessageUpdateParams,\n} from '@sendbird/uikit-utils';\n\nimport type { ChannelInputProps, SuggestedMentionListProps } from '../../components/ChannelInput';\nimport type { ChannelMessageListProps } from '../../components/ChannelMessageList';\nimport type { CommonComponent } from '../../types';\nimport type { PubSub } from '../../utils/pubsub';\n\nexport interface GroupChannelProps {\n Fragment: {\n channel: SendbirdGroupChannel;\n onChannelDeleted: () => void;\n onPressHeaderLeft: GroupChannelProps['Header']['onPressHeaderLeft'];\n onPressHeaderRight: GroupChannelProps['Header']['onPressHeaderRight'];\n onPressMediaMessage?: GroupChannelProps['MessageList']['onPressMediaMessage'];\n\n onBeforeSendUserMessage?: OnBeforeHandler<SendbirdUserMessageCreateParams>;\n onBeforeSendFileMessage?: OnBeforeHandler<SendbirdFileMessageCreateParams>;\n onBeforeUpdateUserMessage?: OnBeforeHandler<SendbirdUserMessageUpdateParams>;\n onBeforeUpdateFileMessage?: OnBeforeHandler<SendbirdFileMessageUpdateParams>;\n\n renderMessage?: GroupChannelProps['MessageList']['renderMessage'];\n renderNewMessagesButton?: GroupChannelProps['MessageList']['renderNewMessagesButton'];\n renderScrollToBottomButton?: GroupChannelProps['MessageList']['renderScrollToBottomButton'];\n\n enableTypingIndicator?: GroupChannelProps['Provider']['enableTypingIndicator'];\n enableMessageGrouping?: GroupChannelProps['MessageList']['enableMessageGrouping'];\n\n keyboardAvoidOffset?: GroupChannelProps['Provider']['keyboardAvoidOffset'];\n flatListProps?: GroupChannelProps['MessageList']['flatListProps'];\n sortComparator?: UseGroupChannelMessagesOptions['sortComparator'];\n collectionCreator?: UseGroupChannelMessagesOptions['collectionCreator'];\n
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type React from 'react';\n\nimport type { UseGroupChannelMessagesOptions } from '@sendbird/uikit-chat-hooks';\nimport type {\n OnBeforeHandler,\n SendbirdFileMessage,\n SendbirdFileMessageCreateParams,\n SendbirdFileMessageUpdateParams,\n SendbirdGroupChannel,\n SendbirdMessage,\n SendbirdUser,\n SendbirdUserMessage,\n SendbirdUserMessageCreateParams,\n SendbirdUserMessageUpdateParams,\n} from '@sendbird/uikit-utils';\n\nimport type { ChannelInputProps, SuggestedMentionListProps } from '../../components/ChannelInput';\nimport type { ChannelMessageListProps } from '../../components/ChannelMessageList';\nimport type { CommonComponent } from '../../types';\nimport type { PubSub } from '../../utils/pubsub';\n\nexport interface GroupChannelProps {\n Fragment: {\n channel: SendbirdGroupChannel;\n onChannelDeleted: () => void;\n onPressHeaderLeft: GroupChannelProps['Header']['onPressHeaderLeft'];\n onPressHeaderRight: GroupChannelProps['Header']['onPressHeaderRight'];\n onPressMediaMessage?: GroupChannelProps['MessageList']['onPressMediaMessage'];\n\n onBeforeSendUserMessage?: OnBeforeHandler<SendbirdUserMessageCreateParams>;\n onBeforeSendFileMessage?: OnBeforeHandler<SendbirdFileMessageCreateParams>;\n onBeforeUpdateUserMessage?: OnBeforeHandler<SendbirdUserMessageUpdateParams>;\n onBeforeUpdateFileMessage?: OnBeforeHandler<SendbirdFileMessageUpdateParams>;\n\n renderMessage?: GroupChannelProps['MessageList']['renderMessage'];\n renderNewMessagesButton?: GroupChannelProps['MessageList']['renderNewMessagesButton'];\n renderScrollToBottomButton?: GroupChannelProps['MessageList']['renderScrollToBottomButton'];\n\n enableTypingIndicator?: GroupChannelProps['Provider']['enableTypingIndicator'];\n enableMessageGrouping?: GroupChannelProps['MessageList']['enableMessageGrouping'];\n\n keyboardAvoidOffset?: GroupChannelProps['Provider']['keyboardAvoidOffset'];\n flatListProps?: GroupChannelProps['MessageList']['flatListProps'];\n sortComparator?: UseGroupChannelMessagesOptions['sortComparator'];\n collectionCreator?: UseGroupChannelMessagesOptions['collectionCreator'];\n\n searchItem?: GroupChannelProps['MessageList']['searchItem'];\n };\n Header: {\n shouldHideRight: () => boolean;\n onPressHeaderLeft: () => void;\n onPressHeaderRight: () => void;\n };\n MessageList: Pick<\n ChannelMessageListProps<SendbirdGroupChannel>,\n | 'enableMessageGrouping'\n | 'currentUserId'\n | 'channel'\n | 'messages'\n | 'newMessages'\n | 'scrolledAwayFromBottom'\n | 'onScrolledAwayFromBottom'\n | 'onTopReached'\n | 'onBottomReached'\n | 'onResendFailedMessage'\n | 'onDeleteMessage'\n | 'onPressMediaMessage'\n | 'renderMessage'\n | 'renderNewMessagesButton'\n | 'renderScrollToBottomButton'\n | 'flatListProps'\n | 'hasNext'\n | 'searchItem'\n > & {\n onResetMessageList: (callback?: () => void) => void;\n };\n Input: Pick<\n ChannelInputProps,\n | 'shouldRenderInput'\n | 'onPressSendUserMessage'\n | 'onPressSendFileMessage'\n | 'onPressUpdateUserMessage'\n | 'onPressUpdateFileMessage'\n | 'SuggestedMentionList'\n | 'AttachmentsButton'\n >;\n\n SuggestedMentionList: SuggestedMentionListProps;\n Provider: {\n channel: SendbirdGroupChannel;\n enableTypingIndicator: boolean;\n keyboardAvoidOffset?: number;\n groupChannelPubSub: PubSub<GroupChannelPubSubContextPayload>;\n };\n}\n\n/**\n * Internal context for GroupChannel\n * For example, the developer can create a custom header\n * with getting data from the domain context\n * */\nexport interface GroupChannelContextsType {\n Fragment: React.Context<{\n headerTitle: string;\n channel: SendbirdGroupChannel;\n messageToEdit?: SendbirdUserMessage | SendbirdFileMessage;\n setMessageToEdit: (msg?: SendbirdUserMessage | SendbirdFileMessage) => void;\n keyboardAvoidOffset?: number;\n }>;\n TypingIndicator: React.Context<{\n typingUsers: SendbirdUser[];\n }>;\n PubSub: React.Context<PubSub<GroupChannelPubSubContextPayload>>;\n}\nexport interface GroupChannelModule {\n Provider: CommonComponent<GroupChannelProps['Provider']>;\n Header: CommonComponent<GroupChannelProps['Header']>;\n MessageList: CommonComponent<GroupChannelProps['MessageList']>;\n Input: CommonComponent<GroupChannelProps['Input']>;\n SuggestedMentionList: CommonComponent<GroupChannelProps['SuggestedMentionList']>;\n StatusEmpty: CommonComponent;\n StatusLoading: CommonComponent;\n}\n\nexport type GroupChannelFragment = CommonComponent<GroupChannelProps['Fragment']>;\n\nexport type GroupChannelPubSubContextPayload =\n | {\n type: 'MESSAGE_SENT_PENDING' | 'MESSAGE_SENT_SUCCESS';\n data: {\n message: SendbirdUserMessage | SendbirdFileMessage;\n };\n }\n | {\n type: 'MESSAGES_RECEIVED';\n data: {\n messages: SendbirdMessage[];\n };\n };\n"],"mappings":""}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
import React
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { FlatList } from 'react-native';
|
|
4
4
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
5
5
|
import { PushTriggerOption } from '@sendbird/chat';
|
|
@@ -8,6 +8,7 @@ import { NOOP, PASS, getChannelUniqId, useFreshCallback } from '@sendbird/uikit-
|
|
|
8
8
|
import { useLocalization, useSendbirdChat } from '../../../hooks/useContext';
|
|
9
9
|
const GroupChannelListList = _ref => {
|
|
10
10
|
let {
|
|
11
|
+
onPressChannel,
|
|
11
12
|
renderGroupChannelPreview,
|
|
12
13
|
groupChannels,
|
|
13
14
|
onLoadNext,
|
|
@@ -51,12 +52,16 @@ const GroupChannelListList = _ref => {
|
|
|
51
52
|
});
|
|
52
53
|
openMenu(menuItem);
|
|
53
54
|
});
|
|
54
|
-
const renderItem =
|
|
55
|
+
const renderItem = useFreshCallback(_ref2 => {
|
|
55
56
|
let {
|
|
56
57
|
item
|
|
57
58
|
} = _ref2;
|
|
58
|
-
return renderGroupChannelPreview === null || renderGroupChannelPreview === void 0 ? void 0 : renderGroupChannelPreview(
|
|
59
|
-
|
|
59
|
+
return renderGroupChannelPreview === null || renderGroupChannelPreview === void 0 ? void 0 : renderGroupChannelPreview({
|
|
60
|
+
channel: item,
|
|
61
|
+
onPress: () => onPressChannel(item),
|
|
62
|
+
onLongPress: () => onLongPress(item)
|
|
63
|
+
});
|
|
64
|
+
});
|
|
60
65
|
const {
|
|
61
66
|
left,
|
|
62
67
|
right
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","
|
|
1
|
+
{"version":3,"names":["React","FlatList","useSafeAreaInsets","PushTriggerOption","useActionMenu","useToast","NOOP","PASS","getChannelUniqId","useFreshCallback","useLocalization","useSendbirdChat","GroupChannelListList","_ref","onPressChannel","renderGroupChannelPreview","groupChannels","onLoadNext","flatListProps","menuItemCreator","toast","openMenu","STRINGS","sdk","currentUser","onLongPress","channel","action","myPushTriggerOption","menuItem","title","GROUP_CHANNEL_LIST","DIALOG_CHANNEL_TITLE","userId","menuItems","DIALOG_CHANNEL_NOTIFICATION","onPress","setMyPushTriggerOption","DEFAULT","OFF","onError","show","TOAST","TURN_ON_NOTIFICATIONS_ERROR","TURN_OFF_NOTIFICATIONS_ERROR","DIALOG_CHANNEL_LEAVE","leave","then","clearCachedMessages","url","catch","LEAVE_CHANNEL_ERROR","renderItem","_ref2","item","left","right","createElement","_extends","bounces","data","onEndReached","contentContainerStyle","paddingLeft","paddingRight","keyExtractor"],"sources":["GroupChannelListList.tsx"],"sourcesContent":["import React from 'react';\nimport { FlatList, ListRenderItem } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\nimport { PushTriggerOption } from '@sendbird/chat';\nimport { useActionMenu, useToast } from '@sendbird/uikit-react-native-foundation';\nimport { NOOP, PASS, SendbirdGroupChannel, getChannelUniqId, useFreshCallback } from '@sendbird/uikit-utils';\n\nimport { useLocalization, useSendbirdChat } from '../../../hooks/useContext';\nimport type { GroupChannelListProps } from '../types';\n\nconst GroupChannelListList = ({\n onPressChannel,\n renderGroupChannelPreview,\n groupChannels,\n onLoadNext,\n flatListProps,\n menuItemCreator = PASS,\n}: GroupChannelListProps['List']) => {\n const toast = useToast();\n const { openMenu } = useActionMenu();\n const { STRINGS } = useLocalization();\n const { sdk, currentUser } = useSendbirdChat();\n\n const onLongPress = useFreshCallback((channel: SendbirdGroupChannel) => {\n const action = channel.myPushTriggerOption === 'off' ? 'on' : 'off';\n const menuItem = menuItemCreator({\n title: STRINGS.GROUP_CHANNEL_LIST.DIALOG_CHANNEL_TITLE(currentUser?.userId ?? '', channel),\n menuItems: [\n {\n title: STRINGS.GROUP_CHANNEL_LIST.DIALOG_CHANNEL_NOTIFICATION(channel),\n onPress: async () => {\n if (action === 'on') {\n await channel.setMyPushTriggerOption(PushTriggerOption.DEFAULT);\n } else {\n await channel.setMyPushTriggerOption(PushTriggerOption.OFF);\n }\n },\n onError: () => {\n toast.show(\n action === 'on' ? STRINGS.TOAST.TURN_ON_NOTIFICATIONS_ERROR : STRINGS.TOAST.TURN_OFF_NOTIFICATIONS_ERROR,\n 'error',\n );\n },\n },\n {\n title: STRINGS.GROUP_CHANNEL_LIST.DIALOG_CHANNEL_LEAVE,\n onPress: async () => {\n channel.leave().then(() => sdk.clearCachedMessages([channel.url]).catch(NOOP));\n },\n onError: () => toast.show(STRINGS.TOAST.LEAVE_CHANNEL_ERROR, 'error'),\n },\n ],\n });\n\n openMenu(menuItem);\n });\n\n const renderItem: ListRenderItem<SendbirdGroupChannel> = useFreshCallback(({ item }) =>\n renderGroupChannelPreview?.({\n channel: item,\n onPress: () => onPressChannel(item),\n onLongPress: () => onLongPress(item),\n }),\n );\n\n const { left, right } = useSafeAreaInsets();\n return (\n <FlatList\n bounces={false}\n data={groupChannels}\n renderItem={renderItem}\n onEndReached={onLoadNext}\n {...flatListProps}\n contentContainerStyle={[flatListProps?.contentContainerStyle, { paddingLeft: left, paddingRight: right }]}\n keyExtractor={getChannelUniqId}\n />\n );\n};\n\nexport default GroupChannelListList;\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,QAAwB,cAAc;AACvD,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE,SAASC,iBAAiB,QAAQ,gBAAgB;AAClD,SAASC,aAAa,EAAEC,QAAQ,QAAQ,yCAAyC;AACjF,SAASC,IAAI,EAAEC,IAAI,EAAwBC,gBAAgB,EAAEC,gBAAgB,QAAQ,uBAAuB;AAE5G,SAASC,eAAe,EAAEC,eAAe,QAAQ,2BAA2B;AAG5E,MAAMC,oBAAoB,GAAGC,IAAA,IAOQ;EAAA,IAPP;IAC5BC,cAAc;IACdC,yBAAyB;IACzBC,aAAa;IACbC,UAAU;IACVC,aAAa;IACbC,eAAe,GAAGZ;EACW,CAAC,GAAAM,IAAA;EAC9B,MAAMO,KAAK,GAAGf,QAAQ,EAAE;EACxB,MAAM;IAAEgB;EAAS,CAAC,GAAGjB,aAAa,EAAE;EACpC,MAAM;IAAEkB;EAAQ,CAAC,GAAGZ,eAAe,EAAE;EACrC,MAAM;IAAEa,GAAG;IAAEC;EAAY,CAAC,GAAGb,eAAe,EAAE;EAE9C,MAAMc,WAAW,GAAGhB,gBAAgB,CAAEiB,OAA6B,IAAK;IACtE,MAAMC,MAAM,GAAGD,OAAO,CAACE,mBAAmB,KAAK,KAAK,GAAG,IAAI,GAAG,KAAK;IACnE,MAAMC,QAAQ,GAAGV,eAAe,CAAC;MAC/BW,KAAK,EAAER,OAAO,CAACS,kBAAkB,CAACC,oBAAoB,CAAC,CA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zBA,yBAAyB,CAAG;MAC1BW,OAAO,EAAE4B,IAAI;MACblB,OAAO,EAAEA,CAAA,KAAMtB,cAAc,CAACwC,IAAI,CAAC;MACnC7B,WAAW,EAAEA,CAAA,KAAMA,WAAW,CAAC6B,IAAI;IACrC,CAAC,CAAC;EAAA,EACH;EAED,MAAM;IAAEC,IAAI;IAAEC;EAAM,CAAC,GAAGtD,iBAAiB,EAAE;EAC3C,oBACEF,KAAA,CAAAyD,aAAA,CAACxD,QAAQ,EAAAyD,QAAA;IACPC,OAAO,EAAE,KAAM;IACfC,IAAI,EAAE5C,aAAc;IACpBoC,UAAU,EAAEA,UAAW;IACvBS,YAAY,EAAE5C;EAAW,GACrBC,aAAa;IACjB4C,qBAAqB,EAAE,CAAC5C,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAE4C,qBAAqB,EAAE;MAAEC,WAAW,EAAER,IAAI;MAAES,YAAY,EAAER;IAAM,CAAC,CAAE;IAC1GS,YAAY,EAAEzD;EAAiB,GAC/B;AAEN,CAAC;AAED,eAAeI,oBAAoB"}
|
|
@@ -26,7 +26,7 @@ const GroupChannelListTypeSelector = _ref => {
|
|
|
26
26
|
colors
|
|
27
27
|
} = useUIKitTheme();
|
|
28
28
|
const {
|
|
29
|
-
|
|
29
|
+
sbOptions
|
|
30
30
|
} = useSendbirdChat();
|
|
31
31
|
const typeSelector = useContext(GroupChannelListContexts.TypeSelector);
|
|
32
32
|
const {
|
|
@@ -56,10 +56,10 @@ const GroupChannelListTypeSelector = _ref => {
|
|
|
56
56
|
}, /*#__PURE__*/React.createElement(View, {
|
|
57
57
|
style: styles.buttonArea
|
|
58
58
|
}, TYPES.map(type => {
|
|
59
|
-
if (type === 'SUPER_GROUP' && !
|
|
59
|
+
if (type === 'SUPER_GROUP' && !sbOptions.appInfo.superGroupChannelEnabled) {
|
|
60
60
|
return null;
|
|
61
61
|
}
|
|
62
|
-
if (type === 'BROADCAST' && !
|
|
62
|
+
if (type === 'BROADCAST' && !sbOptions.appInfo.broadcastChannelEnabled) {
|
|
63
63
|
return null;
|
|
64
64
|
}
|
|
65
65
|
return /*#__PURE__*/React.createElement(TouchableOpacity, {
|