@sendbird/uikit-react-native 2.0.3 → 2.1.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 +2 -2
- package/lib/commonjs/components/ChannelCover.js +22 -1
- package/lib/commonjs/components/ChannelCover.js.map +1 -1
- package/lib/commonjs/components/MessageRenderer/MessageIncomingAvatar.js +9 -2
- package/lib/commonjs/components/MessageRenderer/MessageIncomingAvatar.js.map +1 -1
- package/lib/commonjs/components/MessageRenderer/index.js +1 -1
- package/lib/commonjs/components/MessageRenderer/index.js.map +1 -1
- package/lib/commonjs/components/TypedPlaceholder.js +2 -2
- package/lib/commonjs/components/TypedPlaceholder.js.map +1 -1
- package/lib/commonjs/components/UserActionBar.js +7 -4
- package/lib/commonjs/components/UserActionBar.js.map +1 -1
- package/lib/commonjs/containers/GroupChannelPreviewContainer.js +5 -0
- package/lib/commonjs/containers/GroupChannelPreviewContainer.js.map +1 -1
- package/lib/commonjs/containers/SendbirdUIKitContainer.js +15 -8
- package/lib/commonjs/containers/SendbirdUIKitContainer.js.map +1 -1
- package/lib/commonjs/contexts/{Localization.js → LocalizationCtx.js} +1 -1
- package/lib/commonjs/contexts/LocalizationCtx.js.map +1 -0
- package/lib/commonjs/contexts/{PlatformService.js → PlatformServiceCtx.js} +1 -1
- package/lib/commonjs/contexts/PlatformServiceCtx.js.map +1 -0
- package/lib/commonjs/contexts/{SendbirdChat.js → SendbirdChatCtx.js} +5 -3
- package/lib/commonjs/contexts/SendbirdChatCtx.js.map +1 -0
- package/lib/commonjs/contexts/UserProfileCtx.js +116 -0
- package/lib/commonjs/contexts/UserProfileCtx.js.map +1 -0
- package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/EditInput.js +3 -1
- package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/EditInput.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/SendInput.js +4 -2
- package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/SendInput.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/index.js +15 -10
- package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/index.js.map +1 -1
- package/lib/commonjs/domain/groupChannel/types.js.map +1 -1
- package/lib/commonjs/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersHeader.js +39 -0
- package/lib/commonjs/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersHeader.js.map +1 -0
- package/lib/commonjs/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersList.js +53 -0
- package/lib/commonjs/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersList.js.map +1 -0
- package/lib/commonjs/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersStatusEmpty.js +34 -0
- package/lib/commonjs/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersStatusEmpty.js.map +1 -0
- package/lib/commonjs/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersStatusError.js +38 -0
- package/lib/commonjs/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersStatusError.js.map +1 -0
- package/lib/commonjs/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersStatusLoading.js +34 -0
- package/lib/commonjs/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersStatusLoading.js.map +1 -0
- package/lib/commonjs/domain/groupChannelBannedUsers/index.js +62 -0
- package/lib/commonjs/domain/groupChannelBannedUsers/index.js.map +1 -0
- package/lib/commonjs/domain/groupChannelBannedUsers/module/createGroupChannelBannedUsersModule.js +45 -0
- package/lib/commonjs/domain/groupChannelBannedUsers/module/createGroupChannelBannedUsersModule.js.map +1 -0
- package/lib/commonjs/domain/groupChannelBannedUsers/module/moduleContext.js +45 -0
- package/lib/commonjs/domain/groupChannelBannedUsers/module/moduleContext.js.map +1 -0
- package/lib/commonjs/domain/groupChannelBannedUsers/types.js +6 -0
- package/lib/commonjs/domain/groupChannelBannedUsers/types.js.map +1 -0
- package/lib/commonjs/domain/groupChannelList/component/GroupChannelListTypeSelector.js +32 -30
- 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/groupChannelModeration/component/GroupChannelModerationHeader.js +39 -0
- package/lib/commonjs/domain/groupChannelModeration/component/GroupChannelModerationHeader.js.map +1 -0
- package/lib/commonjs/domain/groupChannelModeration/component/GroupChannelModerationMenu.js +103 -0
- package/lib/commonjs/domain/groupChannelModeration/component/GroupChannelModerationMenu.js.map +1 -0
- package/lib/commonjs/domain/groupChannelModeration/index.js +46 -0
- package/lib/commonjs/domain/groupChannelModeration/index.js.map +1 -0
- package/lib/commonjs/domain/groupChannelModeration/module/createGroupChannelModerationModule.js +33 -0
- package/lib/commonjs/domain/groupChannelModeration/module/createGroupChannelModerationModule.js.map +1 -0
- package/lib/commonjs/domain/groupChannelModeration/module/moduleContext.js +46 -0
- package/lib/commonjs/domain/groupChannelModeration/module/moduleContext.js.map +1 -0
- package/lib/commonjs/domain/groupChannelModeration/types.js +6 -0
- package/lib/commonjs/domain/groupChannelModeration/types.js.map +1 -0
- package/lib/commonjs/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersHeader.js +39 -0
- package/lib/commonjs/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersHeader.js.map +1 -0
- package/lib/commonjs/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersList.js +51 -0
- package/lib/commonjs/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersList.js.map +1 -0
- package/lib/commonjs/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersStatusEmpty.js +34 -0
- package/lib/commonjs/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersStatusEmpty.js.map +1 -0
- package/lib/commonjs/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersStatusError.js +38 -0
- package/lib/commonjs/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersStatusError.js.map +1 -0
- package/lib/commonjs/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersStatusLoading.js +34 -0
- package/lib/commonjs/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersStatusLoading.js.map +1 -0
- package/lib/commonjs/domain/groupChannelMutedMembers/index.js +70 -0
- package/lib/commonjs/domain/groupChannelMutedMembers/index.js.map +1 -0
- package/lib/commonjs/domain/groupChannelMutedMembers/module/createGroupChannelMutedMembersModule.js +45 -0
- package/lib/commonjs/domain/groupChannelMutedMembers/module/createGroupChannelMutedMembersModule.js.map +1 -0
- package/lib/commonjs/domain/groupChannelMutedMembers/module/moduleContext.js +45 -0
- package/lib/commonjs/domain/groupChannelMutedMembers/module/moduleContext.js.map +1 -0
- package/lib/commonjs/domain/groupChannelMutedMembers/types.js +6 -0
- package/lib/commonjs/domain/groupChannelMutedMembers/types.js.map +1 -0
- package/lib/commonjs/domain/groupChannelOperators/component/GroupChannelOperatorsHeader.js +44 -0
- package/lib/commonjs/domain/groupChannelOperators/component/GroupChannelOperatorsHeader.js.map +1 -0
- package/lib/commonjs/domain/groupChannelOperators/component/GroupChannelOperatorsList.js +51 -0
- package/lib/commonjs/domain/groupChannelOperators/component/GroupChannelOperatorsList.js.map +1 -0
- package/lib/commonjs/domain/groupChannelOperators/component/GroupChannelOperatorsStatusEmpty.js +34 -0
- package/lib/commonjs/domain/groupChannelOperators/component/GroupChannelOperatorsStatusEmpty.js.map +1 -0
- package/lib/commonjs/domain/groupChannelOperators/component/GroupChannelOperatorsStatusError.js +38 -0
- package/lib/commonjs/domain/groupChannelOperators/component/GroupChannelOperatorsStatusError.js.map +1 -0
- package/lib/commonjs/domain/groupChannelOperators/component/GroupChannelOperatorsStatusLoading.js +34 -0
- package/lib/commonjs/domain/groupChannelOperators/component/GroupChannelOperatorsStatusLoading.js.map +1 -0
- package/lib/commonjs/domain/groupChannelOperators/index.js +70 -0
- package/lib/commonjs/domain/groupChannelOperators/index.js.map +1 -0
- package/lib/commonjs/domain/groupChannelOperators/module/createGroupChannelOperatorsModule.js +45 -0
- package/lib/commonjs/domain/groupChannelOperators/module/createGroupChannelOperatorsModule.js.map +1 -0
- package/lib/commonjs/domain/groupChannelOperators/module/moduleContext.js +45 -0
- package/lib/commonjs/domain/groupChannelOperators/module/moduleContext.js.map +1 -0
- package/lib/commonjs/domain/groupChannelOperators/types.js +6 -0
- package/lib/commonjs/domain/groupChannelOperators/types.js.map +1 -0
- package/lib/commonjs/domain/groupChannelSettings/component/GroupChannelSettingsInfo.js +1 -8
- package/lib/commonjs/domain/groupChannelSettings/component/GroupChannelSettingsInfo.js.map +1 -1
- package/lib/commonjs/domain/groupChannelSettings/component/GroupChannelSettingsMenu.js +11 -0
- package/lib/commonjs/domain/groupChannelSettings/component/GroupChannelSettingsMenu.js.map +1 -1
- package/lib/commonjs/domain/groupChannelSettings/types.js.map +1 -1
- package/lib/commonjs/domain/groupChannelUserList/types.js.map +1 -1
- package/lib/commonjs/domain/userList/component/UserListStatusError.js +2 -2
- package/lib/commonjs/domain/userList/component/UserListStatusError.js.map +1 -1
- package/lib/commonjs/domain/userList/types.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelBannedUsersFragment.js +101 -0
- package/lib/commonjs/fragments/createGroupChannelBannedUsersFragment.js.map +1 -0
- package/lib/commonjs/fragments/createGroupChannelCreateFragment.js +9 -25
- package/lib/commonjs/fragments/createGroupChannelCreateFragment.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelFragment.js +11 -4
- package/lib/commonjs/fragments/createGroupChannelFragment.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelInviteFragment.js +21 -37
- package/lib/commonjs/fragments/createGroupChannelInviteFragment.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelListFragment.js +3 -11
- package/lib/commonjs/fragments/createGroupChannelListFragment.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelMembersFragment.js +95 -51
- package/lib/commonjs/fragments/createGroupChannelMembersFragment.js.map +1 -1
- package/lib/commonjs/fragments/createGroupChannelModerationFragment.js +68 -0
- package/lib/commonjs/fragments/createGroupChannelModerationFragment.js.map +1 -0
- package/lib/commonjs/fragments/createGroupChannelMutedMembersFragment.js +116 -0
- package/lib/commonjs/fragments/createGroupChannelMutedMembersFragment.js.map +1 -0
- package/lib/commonjs/fragments/createGroupChannelOperatorsFragment.js +129 -0
- package/lib/commonjs/fragments/createGroupChannelOperatorsFragment.js.map +1 -0
- package/lib/commonjs/fragments/createGroupChannelRegisterOperatorFragment.js +114 -0
- package/lib/commonjs/fragments/createGroupChannelRegisterOperatorFragment.js.map +1 -0
- package/lib/commonjs/fragments/createGroupChannelSettingsFragment.js +2 -0
- package/lib/commonjs/fragments/createGroupChannelSettingsFragment.js.map +1 -1
- package/lib/commonjs/hooks/useConnection.js +4 -0
- package/lib/commonjs/hooks/useConnection.js.map +1 -1
- package/lib/commonjs/hooks/useContext.js +17 -7
- package/lib/commonjs/hooks/useContext.js.map +1 -1
- package/lib/commonjs/index.js +77 -9
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/localization/StringSet.type.js +60 -11
- package/lib/commonjs/localization/StringSet.type.js.map +1 -1
- package/lib/commonjs/platform/createFileService.native.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/components/ChannelCover.js +22 -2
- package/lib/module/components/ChannelCover.js.map +1 -1
- package/lib/module/components/MessageRenderer/MessageIncomingAvatar.js +9 -3
- package/lib/module/components/MessageRenderer/MessageIncomingAvatar.js.map +1 -1
- package/lib/module/components/MessageRenderer/index.js +1 -1
- package/lib/module/components/MessageRenderer/index.js.map +1 -1
- package/lib/module/components/TypedPlaceholder.js +2 -2
- package/lib/module/components/TypedPlaceholder.js.map +1 -1
- package/lib/module/components/UserActionBar.js +8 -5
- package/lib/module/components/UserActionBar.js.map +1 -1
- package/lib/module/containers/GroupChannelPreviewContainer.js +5 -0
- package/lib/module/containers/GroupChannelPreviewContainer.js.map +1 -1
- package/lib/module/containers/SendbirdUIKitContainer.js +11 -5
- package/lib/module/containers/SendbirdUIKitContainer.js.map +1 -1
- package/lib/module/contexts/{Localization.js → LocalizationCtx.js} +1 -1
- package/lib/module/contexts/LocalizationCtx.js.map +1 -0
- package/lib/module/contexts/{PlatformService.js → PlatformServiceCtx.js} +1 -1
- package/lib/module/contexts/PlatformServiceCtx.js.map +1 -0
- package/lib/module/contexts/{SendbirdChat.js → SendbirdChatCtx.js} +5 -3
- package/lib/module/contexts/SendbirdChatCtx.js.map +1 -0
- package/lib/module/contexts/UserProfileCtx.js +94 -0
- package/lib/module/contexts/UserProfileCtx.js.map +1 -0
- package/lib/module/domain/groupChannel/component/GroupChannelInput/EditInput.js +3 -1
- package/lib/module/domain/groupChannel/component/GroupChannelInput/EditInput.js.map +1 -1
- package/lib/module/domain/groupChannel/component/GroupChannelInput/SendInput.js +4 -2
- package/lib/module/domain/groupChannel/component/GroupChannelInput/SendInput.js.map +1 -1
- package/lib/module/domain/groupChannel/component/GroupChannelInput/index.js +16 -11
- package/lib/module/domain/groupChannel/component/GroupChannelInput/index.js.map +1 -1
- package/lib/module/domain/groupChannel/types.js.map +1 -1
- package/lib/module/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersHeader.js +25 -0
- package/lib/module/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersHeader.js.map +1 -0
- package/lib/module/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersList.js +40 -0
- package/lib/module/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersList.js.map +1 -0
- package/lib/module/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersStatusEmpty.js +21 -0
- package/lib/module/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersStatusEmpty.js.map +1 -0
- package/lib/module/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersStatusError.js +25 -0
- package/lib/module/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersStatusError.js.map +1 -0
- package/lib/module/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersStatusLoading.js +21 -0
- package/lib/module/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersStatusLoading.js.map +1 -0
- package/lib/module/domain/groupChannelBannedUsers/index.js +7 -0
- package/lib/module/domain/groupChannelBannedUsers/index.js.map +1 -0
- package/lib/module/domain/groupChannelBannedUsers/module/createGroupChannelBannedUsersModule.js +30 -0
- package/lib/module/domain/groupChannelBannedUsers/module/createGroupChannelBannedUsersModule.js.map +1 -0
- package/lib/module/domain/groupChannelBannedUsers/module/moduleContext.js +25 -0
- package/lib/module/domain/groupChannelBannedUsers/module/moduleContext.js.map +1 -0
- package/lib/module/domain/groupChannelBannedUsers/types.js +2 -0
- package/lib/module/domain/groupChannelBannedUsers/types.js.map +1 -0
- package/lib/module/domain/groupChannelList/component/GroupChannelListTypeSelector.js +34 -33
- 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/groupChannelModeration/component/GroupChannelModerationHeader.js +25 -0
- package/lib/module/domain/groupChannelModeration/component/GroupChannelModerationHeader.js.map +1 -0
- package/lib/module/domain/groupChannelModeration/component/GroupChannelModerationMenu.js +87 -0
- package/lib/module/domain/groupChannelModeration/component/GroupChannelModerationMenu.js.map +1 -0
- package/lib/module/domain/groupChannelModeration/index.js +5 -0
- package/lib/module/domain/groupChannelModeration/index.js.map +1 -0
- package/lib/module/domain/groupChannelModeration/module/createGroupChannelModerationModule.js +21 -0
- package/lib/module/domain/groupChannelModeration/module/createGroupChannelModerationModule.js.map +1 -0
- package/lib/module/domain/groupChannelModeration/module/moduleContext.js +26 -0
- package/lib/module/domain/groupChannelModeration/module/moduleContext.js.map +1 -0
- package/lib/module/domain/groupChannelModeration/types.js +2 -0
- package/lib/module/domain/groupChannelModeration/types.js.map +1 -0
- package/lib/module/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersHeader.js +25 -0
- package/lib/module/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersHeader.js.map +1 -0
- package/lib/module/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersList.js +38 -0
- package/lib/module/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersList.js.map +1 -0
- package/lib/module/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersStatusEmpty.js +21 -0
- package/lib/module/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersStatusEmpty.js.map +1 -0
- package/lib/module/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersStatusError.js +25 -0
- package/lib/module/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersStatusError.js.map +1 -0
- package/lib/module/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersStatusLoading.js +21 -0
- package/lib/module/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersStatusLoading.js.map +1 -0
- package/lib/module/domain/groupChannelMutedMembers/index.js +8 -0
- package/lib/module/domain/groupChannelMutedMembers/index.js.map +1 -0
- package/lib/module/domain/groupChannelMutedMembers/module/createGroupChannelMutedMembersModule.js +30 -0
- package/lib/module/domain/groupChannelMutedMembers/module/createGroupChannelMutedMembersModule.js.map +1 -0
- package/lib/module/domain/groupChannelMutedMembers/module/moduleContext.js +25 -0
- package/lib/module/domain/groupChannelMutedMembers/module/moduleContext.js.map +1 -0
- package/lib/module/domain/groupChannelMutedMembers/types.js +2 -0
- package/lib/module/domain/groupChannelMutedMembers/types.js.map +1 -0
- package/lib/module/domain/groupChannelOperators/component/GroupChannelOperatorsHeader.js +30 -0
- package/lib/module/domain/groupChannelOperators/component/GroupChannelOperatorsHeader.js.map +1 -0
- package/lib/module/domain/groupChannelOperators/component/GroupChannelOperatorsList.js +38 -0
- package/lib/module/domain/groupChannelOperators/component/GroupChannelOperatorsList.js.map +1 -0
- package/lib/module/domain/groupChannelOperators/component/GroupChannelOperatorsStatusEmpty.js +21 -0
- package/lib/module/domain/groupChannelOperators/component/GroupChannelOperatorsStatusEmpty.js.map +1 -0
- package/lib/module/domain/groupChannelOperators/component/GroupChannelOperatorsStatusError.js +25 -0
- package/lib/module/domain/groupChannelOperators/component/GroupChannelOperatorsStatusError.js.map +1 -0
- package/lib/module/domain/groupChannelOperators/component/GroupChannelOperatorsStatusLoading.js +21 -0
- package/lib/module/domain/groupChannelOperators/component/GroupChannelOperatorsStatusLoading.js.map +1 -0
- package/lib/module/domain/groupChannelOperators/index.js +8 -0
- package/lib/module/domain/groupChannelOperators/index.js.map +1 -0
- package/lib/module/domain/groupChannelOperators/module/createGroupChannelOperatorsModule.js +30 -0
- package/lib/module/domain/groupChannelOperators/module/createGroupChannelOperatorsModule.js.map +1 -0
- package/lib/module/domain/groupChannelOperators/module/moduleContext.js +25 -0
- package/lib/module/domain/groupChannelOperators/module/moduleContext.js.map +1 -0
- package/lib/module/domain/groupChannelOperators/types.js +2 -0
- package/lib/module/domain/groupChannelOperators/types.js.map +1 -0
- package/lib/module/domain/groupChannelSettings/component/GroupChannelSettingsInfo.js +2 -8
- package/lib/module/domain/groupChannelSettings/component/GroupChannelSettingsInfo.js.map +1 -1
- package/lib/module/domain/groupChannelSettings/component/GroupChannelSettingsMenu.js +11 -0
- package/lib/module/domain/groupChannelSettings/component/GroupChannelSettingsMenu.js.map +1 -1
- package/lib/module/domain/groupChannelSettings/types.js.map +1 -1
- package/lib/module/domain/groupChannelUserList/types.js.map +1 -1
- package/lib/module/domain/userList/component/UserListStatusError.js +2 -2
- package/lib/module/domain/userList/component/UserListStatusError.js.map +1 -1
- package/lib/module/domain/userList/types.js.map +1 -1
- package/lib/module/fragments/createGroupChannelBannedUsersFragment.js +84 -0
- package/lib/module/fragments/createGroupChannelBannedUsersFragment.js.map +1 -0
- package/lib/module/fragments/createGroupChannelCreateFragment.js +10 -26
- package/lib/module/fragments/createGroupChannelCreateFragment.js.map +1 -1
- package/lib/module/fragments/createGroupChannelFragment.js +11 -4
- package/lib/module/fragments/createGroupChannelFragment.js.map +1 -1
- package/lib/module/fragments/createGroupChannelInviteFragment.js +22 -37
- package/lib/module/fragments/createGroupChannelInviteFragment.js.map +1 -1
- package/lib/module/fragments/createGroupChannelListFragment.js +4 -11
- package/lib/module/fragments/createGroupChannelListFragment.js.map +1 -1
- package/lib/module/fragments/createGroupChannelMembersFragment.js +99 -56
- package/lib/module/fragments/createGroupChannelMembersFragment.js.map +1 -1
- package/lib/module/fragments/createGroupChannelModerationFragment.js +53 -0
- package/lib/module/fragments/createGroupChannelModerationFragment.js.map +1 -0
- package/lib/module/fragments/createGroupChannelMutedMembersFragment.js +98 -0
- package/lib/module/fragments/createGroupChannelMutedMembersFragment.js.map +1 -0
- package/lib/module/fragments/createGroupChannelOperatorsFragment.js +111 -0
- package/lib/module/fragments/createGroupChannelOperatorsFragment.js.map +1 -0
- package/lib/module/fragments/createGroupChannelRegisterOperatorFragment.js +94 -0
- package/lib/module/fragments/createGroupChannelRegisterOperatorFragment.js.map +1 -0
- package/lib/module/fragments/createGroupChannelSettingsFragment.js +2 -0
- package/lib/module/fragments/createGroupChannelSettingsFragment.js.map +1 -1
- package/lib/module/hooks/useConnection.js +4 -0
- package/lib/module/hooks/useConnection.js.map +1 -1
- package/lib/module/hooks/useContext.js +9 -3
- package/lib/module/hooks/useContext.js.map +1 -1
- package/lib/module/index.js +10 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/localization/StringSet.type.js +60 -11
- package/lib/module/localization/StringSet.type.js.map +1 -1
- package/lib/module/platform/createFileService.native.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/src/components/ChannelCover.d.ts +1 -1
- package/lib/typescript/src/components/TypedPlaceholder.d.ts +1 -1
- package/lib/typescript/src/components/UserActionBar.d.ts +4 -2
- package/lib/typescript/src/containers/SendbirdUIKitContainer.d.ts +9 -7
- package/lib/typescript/src/contexts/{Localization.d.ts → LocalizationCtx.d.ts} +0 -0
- package/lib/typescript/src/contexts/{PlatformService.d.ts → PlatformServiceCtx.d.ts} +0 -0
- package/lib/typescript/src/contexts/{SendbirdChat.d.ts → SendbirdChatCtx.d.ts} +8 -4
- package/lib/typescript/src/contexts/UserProfileCtx.d.ts +15 -0
- package/lib/typescript/src/domain/groupChannel/component/GroupChannelInput/EditInput.d.ts +2 -1
- package/lib/typescript/src/domain/groupChannel/component/GroupChannelInput/SendInput.d.ts +3 -1
- package/lib/typescript/src/domain/groupChannel/component/GroupChannelInput/index.d.ts +1 -1
- package/lib/typescript/src/domain/groupChannel/types.d.ts +1 -1
- package/lib/typescript/src/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersHeader.d.ts +3 -0
- package/lib/typescript/src/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersList.d.ts +3 -0
- package/lib/typescript/src/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersStatusEmpty.d.ts +2 -0
- package/lib/typescript/src/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersStatusError.d.ts +3 -0
- package/lib/typescript/src/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersStatusLoading.d.ts +2 -0
- package/lib/typescript/src/domain/groupChannelBannedUsers/index.d.ts +6 -0
- package/lib/typescript/src/domain/groupChannelBannedUsers/module/createGroupChannelBannedUsersModule.d.ts +3 -0
- package/lib/typescript/src/domain/groupChannelBannedUsers/module/moduleContext.d.ts +3 -0
- package/lib/typescript/src/domain/groupChannelBannedUsers/types.d.ts +47 -0
- package/lib/typescript/src/domain/groupChannelList/component/GroupChannelListTypeSelector.d.ts +1 -1
- package/lib/typescript/src/domain/groupChannelList/types.d.ts +3 -9
- package/lib/typescript/src/domain/groupChannelModeration/component/GroupChannelModerationHeader.d.ts +3 -0
- package/lib/typescript/src/domain/groupChannelModeration/component/GroupChannelModerationMenu.d.ts +3 -0
- package/lib/typescript/src/domain/groupChannelModeration/index.d.ts +4 -0
- package/lib/typescript/src/domain/groupChannelModeration/module/createGroupChannelModerationModule.d.ts +3 -0
- package/lib/typescript/src/domain/groupChannelModeration/module/moduleContext.d.ts +3 -0
- package/lib/typescript/src/domain/groupChannelModeration/types.d.ts +43 -0
- package/lib/typescript/src/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersHeader.d.ts +3 -0
- package/lib/typescript/src/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersList.d.ts +3 -0
- package/lib/typescript/src/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersStatusEmpty.d.ts +2 -0
- package/lib/typescript/src/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersStatusError.d.ts +3 -0
- package/lib/typescript/src/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersStatusLoading.d.ts +2 -0
- package/lib/typescript/src/domain/groupChannelMutedMembers/index.d.ts +7 -0
- package/lib/typescript/src/domain/groupChannelMutedMembers/module/createGroupChannelMutedMembersModule.d.ts +3 -0
- package/lib/typescript/src/domain/groupChannelMutedMembers/module/moduleContext.d.ts +3 -0
- package/lib/typescript/src/domain/groupChannelMutedMembers/types.d.ts +47 -0
- package/lib/typescript/src/domain/groupChannelOperators/component/GroupChannelOperatorsHeader.d.ts +3 -0
- package/lib/typescript/src/domain/groupChannelOperators/component/GroupChannelOperatorsList.d.ts +3 -0
- package/lib/typescript/src/domain/groupChannelOperators/component/GroupChannelOperatorsStatusEmpty.d.ts +2 -0
- package/lib/typescript/src/domain/groupChannelOperators/component/GroupChannelOperatorsStatusError.d.ts +3 -0
- package/lib/typescript/src/domain/groupChannelOperators/component/GroupChannelOperatorsStatusLoading.d.ts +2 -0
- package/lib/typescript/src/domain/groupChannelOperators/index.d.ts +7 -0
- package/lib/typescript/src/domain/groupChannelOperators/module/createGroupChannelOperatorsModule.d.ts +3 -0
- package/lib/typescript/src/domain/groupChannelOperators/module/moduleContext.d.ts +3 -0
- package/lib/typescript/src/domain/groupChannelOperators/types.d.ts +49 -0
- package/lib/typescript/src/domain/groupChannelSettings/component/GroupChannelSettingsInfo.d.ts +1 -1
- package/lib/typescript/src/domain/groupChannelSettings/component/GroupChannelSettingsMenu.d.ts +1 -1
- package/lib/typescript/src/domain/groupChannelSettings/types.d.ts +2 -0
- package/lib/typescript/src/domain/groupChannelUserList/types.d.ts +18 -12
- package/lib/typescript/src/domain/userList/component/UserListStatusError.d.ts +2 -2
- package/lib/typescript/src/domain/userList/types.d.ts +4 -3
- package/lib/typescript/src/fragments/createGroupChannelBannedUsersFragment.d.ts +3 -0
- package/lib/typescript/src/fragments/createGroupChannelCreateFragment.d.ts +2 -1
- package/lib/typescript/src/fragments/createGroupChannelInviteFragment.d.ts +2 -1
- package/lib/typescript/src/fragments/createGroupChannelModerationFragment.d.ts +3 -0
- package/lib/typescript/src/fragments/createGroupChannelMutedMembersFragment.d.ts +3 -0
- package/lib/typescript/src/fragments/createGroupChannelOperatorsFragment.d.ts +3 -0
- package/lib/typescript/src/fragments/createGroupChannelRegisterOperatorFragment.d.ts +5 -0
- package/lib/typescript/src/hooks/useContext.d.ts +3 -1
- package/lib/typescript/src/index.d.ts +10 -4
- package/lib/typescript/src/localization/StringSet.type.d.ts +47 -7
- package/lib/typescript/src/platform/createFileService.native.d.ts +1 -1
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +10 -10
- package/src/components/ChannelCover.tsx +23 -3
- package/src/components/MessageRenderer/MessageIncomingAvatar.tsx +9 -2
- package/src/components/MessageRenderer/index.tsx +1 -1
- package/src/components/TypedPlaceholder.tsx +4 -4
- package/src/components/UserActionBar.tsx +10 -4
- package/src/containers/GroupChannelPreviewContainer.tsx +5 -0
- package/src/containers/SendbirdUIKitContainer.tsx +29 -10
- package/src/contexts/{Localization.tsx → LocalizationCtx.tsx} +0 -0
- package/src/contexts/{PlatformService.tsx → PlatformServiceCtx.tsx} +0 -0
- package/src/contexts/{SendbirdChat.tsx → SendbirdChatCtx.tsx} +10 -4
- package/src/contexts/UserProfileCtx.tsx +126 -0
- package/src/domain/groupChannel/component/GroupChannelInput/EditInput.tsx +3 -1
- package/src/domain/groupChannel/component/GroupChannelInput/SendInput.tsx +17 -3
- package/src/domain/groupChannel/component/GroupChannelInput/index.tsx +11 -8
- package/src/domain/groupChannel/types.ts +1 -1
- package/src/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersHeader.tsx +14 -0
- package/src/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersList.tsx +32 -0
- package/src/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersStatusEmpty.tsx +18 -0
- package/src/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersStatusError.tsx +19 -0
- package/src/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersStatusLoading.tsx +18 -0
- package/src/domain/groupChannelBannedUsers/index.ts +6 -0
- package/src/domain/groupChannelBannedUsers/module/createGroupChannelBannedUsersModule.tsx +21 -0
- package/src/domain/groupChannelBannedUsers/module/moduleContext.tsx +30 -0
- package/src/domain/groupChannelBannedUsers/types.ts +50 -0
- package/src/domain/groupChannelList/component/GroupChannelListTypeSelector.tsx +37 -43
- package/src/domain/groupChannelList/types.ts +3 -9
- package/src/domain/groupChannelModeration/component/GroupChannelModerationHeader.tsx +14 -0
- package/src/domain/groupChannelModeration/component/GroupChannelModerationMenu.tsx +84 -0
- package/src/domain/groupChannelModeration/index.ts +4 -0
- package/src/domain/groupChannelModeration/module/createGroupChannelModerationModule.tsx +15 -0
- package/src/domain/groupChannelModeration/module/moduleContext.tsx +33 -0
- package/src/domain/groupChannelModeration/types.ts +48 -0
- package/src/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersHeader.tsx +14 -0
- package/src/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersList.tsx +30 -0
- package/src/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersStatusEmpty.tsx +18 -0
- package/src/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersStatusError.tsx +19 -0
- package/src/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersStatusLoading.tsx +18 -0
- package/src/domain/groupChannelMutedMembers/index.ts +7 -0
- package/src/domain/groupChannelMutedMembers/module/createGroupChannelMutedMembersModule.tsx +21 -0
- package/src/domain/groupChannelMutedMembers/module/moduleContext.tsx +30 -0
- package/src/domain/groupChannelMutedMembers/types.ts +50 -0
- package/src/domain/groupChannelOperators/component/GroupChannelOperatorsHeader.tsx +25 -0
- package/src/domain/groupChannelOperators/component/GroupChannelOperatorsList.tsx +29 -0
- package/src/domain/groupChannelOperators/component/GroupChannelOperatorsStatusEmpty.tsx +18 -0
- package/src/domain/groupChannelOperators/component/GroupChannelOperatorsStatusError.tsx +19 -0
- package/src/domain/groupChannelOperators/component/GroupChannelOperatorsStatusLoading.tsx +18 -0
- package/src/domain/groupChannelOperators/index.ts +7 -0
- package/src/domain/groupChannelOperators/module/createGroupChannelOperatorsModule.tsx +21 -0
- package/src/domain/groupChannelOperators/module/moduleContext.tsx +30 -0
- package/src/domain/groupChannelOperators/types.ts +52 -0
- package/src/domain/groupChannelSettings/component/GroupChannelSettingsInfo.tsx +2 -7
- package/src/domain/groupChannelSettings/component/GroupChannelSettingsMenu.tsx +9 -0
- package/src/domain/groupChannelSettings/types.ts +2 -0
- package/src/domain/groupChannelUserList/types.ts +27 -12
- package/src/domain/userList/component/UserListStatusError.tsx +2 -2
- package/src/domain/userList/types.ts +4 -1
- package/src/fragments/createGroupChannelBannedUsersFragment.tsx +80 -0
- package/src/fragments/createGroupChannelCreateFragment.tsx +13 -33
- package/src/fragments/createGroupChannelFragment.tsx +12 -5
- package/src/fragments/createGroupChannelInviteFragment.tsx +28 -50
- package/src/fragments/createGroupChannelListFragment.tsx +4 -10
- package/src/fragments/createGroupChannelMembersFragment.tsx +110 -67
- package/src/fragments/createGroupChannelModerationFragment.tsx +57 -0
- package/src/fragments/createGroupChannelMutedMembersFragment.tsx +93 -0
- package/src/fragments/createGroupChannelOperatorsFragment.tsx +101 -0
- package/src/fragments/createGroupChannelRegisterOperatorFragment.tsx +94 -0
- package/src/fragments/createGroupChannelSettingsFragment.tsx +9 -1
- package/src/hooks/useConnection.ts +2 -0
- package/src/hooks/useContext.ts +10 -3
- package/src/index.ts +10 -4
- package/src/localization/StringSet.type.ts +99 -14
- package/src/platform/createFileService.native.ts +1 -1
- package/src/version.ts +1 -1
- package/lib/commonjs/contexts/Localization.js.map +0 -1
- package/lib/commonjs/contexts/PlatformService.js.map +0 -1
- package/lib/commonjs/contexts/SendbirdChat.js.map +0 -1
- package/lib/module/contexts/Localization.js.map +0 -1
- package/lib/module/contexts/PlatformService.js.map +0 -1
- package/lib/module/contexts/SendbirdChat.js.map +0 -1
|
@@ -5,9 +5,10 @@ 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 { LocalizationProvider } from '../contexts/
|
|
9
|
-
import { PlatformServiceProvider } from '../contexts/
|
|
10
|
-
import { SendbirdChatProvider } from '../contexts/
|
|
8
|
+
import { LocalizationProvider } from '../contexts/LocalizationCtx';
|
|
9
|
+
import { PlatformServiceProvider } from '../contexts/PlatformServiceCtx';
|
|
10
|
+
import { SendbirdChatProvider } from '../contexts/SendbirdChatCtx';
|
|
11
|
+
import { UserProfileProvider } from '../contexts/UserProfileCtx';
|
|
11
12
|
import { useLocalization } from '../hooks/useContext';
|
|
12
13
|
import InternalLocalCacheStorage from '../libs/InternalLocalCacheStorage';
|
|
13
14
|
import StringSetEn from '../localization/StringSet.en';
|
|
@@ -29,6 +30,7 @@ const SendbirdUIKitContainer = _ref => {
|
|
|
29
30
|
localization,
|
|
30
31
|
styles,
|
|
31
32
|
toast,
|
|
33
|
+
userProfile,
|
|
32
34
|
errorBoundary
|
|
33
35
|
} = _ref;
|
|
34
36
|
const unsubscribes = useRef([]).current;
|
|
@@ -90,7 +92,8 @@ const SendbirdUIKitContainer = _ref => {
|
|
|
90
92
|
sdkInstance: sdkInstance,
|
|
91
93
|
enableAutoPushTokenRegistration: (chatOptions === null || chatOptions === void 0 ? void 0 : chatOptions.enableAutoPushTokenRegistration) ?? true,
|
|
92
94
|
enableChannelListTypingIndicator: (chatOptions === null || chatOptions === void 0 ? void 0 : chatOptions.enableChannelListTypingIndicator) ?? false,
|
|
93
|
-
enableChannelListMessageReceiptStatus: (chatOptions === null || chatOptions === void 0 ? void 0 : chatOptions.enableChannelListMessageReceiptStatus) ?? false
|
|
95
|
+
enableChannelListMessageReceiptStatus: (chatOptions === null || chatOptions === void 0 ? void 0 : chatOptions.enableChannelListMessageReceiptStatus) ?? false,
|
|
96
|
+
enableUseUserIdForNickname: (chatOptions === null || chatOptions === void 0 ? void 0 : chatOptions.enableUseUserIdForNickname) ?? false
|
|
94
97
|
}, /*#__PURE__*/React.createElement(LocalizationProvider, {
|
|
95
98
|
stringSet: (localization === null || localization === void 0 ? void 0 : localization.stringSet) ?? StringSetEn
|
|
96
99
|
}, /*#__PURE__*/React.createElement(PlatformServiceProvider, {
|
|
@@ -106,7 +109,10 @@ const SendbirdUIKitContainer = _ref => {
|
|
|
106
109
|
statusBarTranslucent: (styles === null || styles === void 0 ? void 0 : styles.statusBarTranslucent) ?? true
|
|
107
110
|
}, /*#__PURE__*/React.createElement(LocalizedDialogProvider, null, /*#__PURE__*/React.createElement(ToastProvider, {
|
|
108
111
|
dismissTimeout: toast === null || toast === void 0 ? void 0 : toast.dismissTimeout
|
|
109
|
-
}, /*#__PURE__*/React.createElement(
|
|
112
|
+
}, /*#__PURE__*/React.createElement(UserProfileProvider, {
|
|
113
|
+
onCreateChannel: userProfile === null || userProfile === void 0 ? void 0 : userProfile.onCreateChannel,
|
|
114
|
+
onBeforeCreateChannel: userProfile === null || userProfile === void 0 ? void 0 : userProfile.onBeforeCreateChannel
|
|
115
|
+
}, /*#__PURE__*/React.createElement(InternalErrorBoundaryContainer, errorBoundary, children))))))))));
|
|
110
116
|
};
|
|
111
117
|
|
|
112
118
|
const LocalizedDialogProvider = _ref2 => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","useRef","useState","Platform","SafeAreaProvider","Sendbird","GroupChannelModule","OpenChannelModule","DialogProvider","Header","HeaderStyleProvider","LightUIKitTheme","ToastProvider","UIKitThemeProvider","LocalizationProvider","PlatformServiceProvider","SendbirdChatProvider","useLocalization","InternalLocalCacheStorage","StringSetEn","SBUDynamicModule","VERSION","InternalErrorBoundaryContainer","NetInfo","get","SendbirdUIKit","Object","freeze","PLATFORM","OS","toLowerCase","SendbirdUIKitContainer","children","appId","chatOptions","platformServices","localization","styles","toast","errorBoundary","unsubscribes","current","getSendbirdSDK","sdk","init","modules","localCacheEnabled","Boolean","localCacheStorage","useAsyncStorageStore","undefined","onInitialized","addExtension","addEventListener","listener","callback","callbackType","unsubscribe","state","online","isConnected","isInternetReachable","push","setOnlineListener","onOnline","setOfflineListener","onOffline","sdkInstance","setSdkInstance","forEach","u","enableAutoPushTokenRegistration","enableChannelListTypingIndicator","enableChannelListMessageReceiptStatus","stringSet","file","notification","clipboard","media","theme","HeaderComponent","defaultHeaderTitleAlign","statusBarTranslucent","dismissTimeout","LocalizedDialogProvider","STRINGS","alert","ok","DIALOG","ALERT_DEFAULT_OK","prompt","PROMPT_DEFAULT_OK","cancel","PROMPT_DEFAULT_CANCEL","placeholder","PROMPT_DEFAULT_PLACEHOLDER"],"sources":["SendbirdUIKitContainer.tsx"],"sourcesContent":["import React, { useEffect, 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 { SendbirdChatSDK } from '@sendbird/uikit-utils';\n\nimport { LocalizationProvider } from '../contexts/Localization';\nimport { PlatformServiceProvider } from '../contexts/PlatformService';\nimport { SendbirdChatProvider } from '../contexts/SendbirdChat';\nimport { useLocalization } from '../hooks/useContext';\nimport InternalLocalCacheStorage from '../libs/InternalLocalCacheStorage';\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});\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 enableAutoPushTokenRegistration?: boolean;\n enableChannelListTypingIndicator?: boolean;\n enableChannelListMessageReceiptStatus?: boolean;\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 toast?: {\n dismissTimeout?: number;\n };\n errorBoundary?: {\n onError?: (props: ErrorBoundaryProps) => void;\n ErrorInfoComponent?: (props: ErrorBoundaryProps) => JSX.Element;\n };\n}>;\n\nconst SendbirdUIKitContainer = ({\n children,\n appId,\n chatOptions,\n platformServices,\n localization,\n styles,\n toast,\n errorBoundary,\n}: SendbirdUIKitContainerProps) => {\n const unsubscribes = useRef<(() => void)[]>([]).current;\n const getSendbirdSDK = () => {\n let sdk: SendbirdChatSDK;\n\n sdk = Sendbird.init({\n appId,\n modules: [new GroupChannelModule(), new OpenChannelModule()],\n localCacheEnabled: Boolean(chatOptions?.localCacheStorage),\n // @ts-ignore\n useAsyncStorageStore: chatOptions?.localCacheStorage\n ? new InternalLocalCacheStorage(chatOptions.localCacheStorage)\n : undefined,\n });\n\n if (chatOptions?.onInitialized) {\n sdk = chatOptions?.onInitialized(sdk);\n }\n\n if (SendbirdUIKit.VERSION) {\n sdk.addExtension('sb_uikit', SendbirdUIKit.VERSION);\n }\n\n if (SendbirdUIKit.PLATFORM) {\n sdk.addExtension('device-os-platform', SendbirdUIKit.PLATFORM);\n }\n\n if (NetInfo?.addEventListener) {\n const listener = (callback: () => void, callbackType: 'online' | 'offline') => {\n const unsubscribe = NetInfo.addEventListener((state) => {\n const online = Boolean(state.isConnected) || Boolean(state.isInternetReachable);\n if (online && callbackType === 'online') callback();\n if (!online && callbackType === 'offline') callback();\n });\n unsubscribes.push(unsubscribe);\n return unsubscribe;\n };\n sdk.setOnlineListener?.((onOnline) => listener(onOnline, 'online'));\n sdk.setOfflineListener?.((onOffline) => listener(onOffline, 'offline'));\n }\n return sdk;\n };\n\n const [sdkInstance, setSdkInstance] = useState<SendbirdChatSDK>(getSendbirdSDK);\n\n useEffect(() => {\n setSdkInstance(getSendbirdSDK);\n return () => {\n unsubscribes.forEach((u) => {\n try {\n u();\n } catch {}\n });\n };\n }, [appId, chatOptions?.localCacheStorage]);\n\n return (\n <SafeAreaProvider>\n <SendbirdChatProvider\n sdkInstance={sdkInstance}\n enableAutoPushTokenRegistration={chatOptions?.enableAutoPushTokenRegistration ?? true}\n enableChannelListTypingIndicator={chatOptions?.enableChannelListTypingIndicator ?? false}\n enableChannelListMessageReceiptStatus={chatOptions?.enableChannelListMessageReceiptStatus ?? false}\n >\n <LocalizationProvider stringSet={localization?.stringSet ?? StringSetEn}>\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 <LocalizedDialogProvider>\n <ToastProvider dismissTimeout={toast?.dismissTimeout}>\n <InternalErrorBoundaryContainer {...errorBoundary}>{children}</InternalErrorBoundaryContainer>\n </ToastProvider>\n </LocalizedDialogProvider>\n </HeaderStyleProvider>\n </UIKitThemeProvider>\n </PlatformServiceProvider>\n </LocalizationProvider>\n </SendbirdChatProvider>\n </SafeAreaProvider>\n );\n};\n\nconst LocalizedDialogProvider = ({ children }: React.PropsWithChildren) => {\n const { STRINGS } = useLocalization();\n return (\n <DialogProvider\n defaultLabels={{\n alert: {\n ok: STRINGS.DIALOG.ALERT_DEFAULT_OK,\n },\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 {children}\n </DialogProvider>\n );\n};\n\nexport default SendbirdUIKitContainer;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,MAA3B,EAAmCC,QAAnC,QAAmD,OAAnD;AACA,SAASC,QAAT,QAAyB,cAAzB;AACA,SAASC,gBAAT,QAAiC,gCAAjC;AAEA,OAAOC,QAAP,MAAqB,gBAArB;AACA,SAASC,kBAAT,QAAmC,6BAAnC;AACA,SAASC,iBAAT,QAAkC,4BAAlC;AAEA,SACEC,cADF,EAEEC,MAFF,EAGEC,mBAHF,EAIEC,eAJF,EAKEC,aALF,EAMEC,kBANF,QAOO,yCAPP;AAUA,SAASC,oBAAT,QAAqC,0BAArC;AACA,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A2BvE,MAD9C;IAEE,iBAAiB,EAAE,CAAA4B,MAAM,SAAN,IAAAA,MAAM,WAAN,YAAAA,MAAM,CAAE4C,uBAAR,KAAmC,MAFxD;IAGE,oBAAoB,EAAE,CAAA5C,MAAM,SAAN,IAAAA,MAAM,WAAN,YAAAA,MAAM,CAAE6C,oBAAR,KAAgC;EAHxD,gBAKE,oBAAC,uBAAD,qBACE,oBAAC,aAAD;IAAe,cAAc,EAAE5C,KAAF,aAAEA,KAAF,uBAAEA,KAAK,CAAE6C;EAAtC,gBACE,oBAAC,8BAAD,EAAoC5C,aAApC,EAAoDP,QAApD,CADF,CADF,CALF,CADF,CANF,CADF,CANF,CADF,CADF;AAiCD,CAlGD;;AAoGA,MAAMoD,uBAAuB,GAAG,SAA2C;EAAA,IAA1C;IAAEpD;EAAF,CAA0C;EACzE,MAAM;IAAEqD;EAAF,IAAcpE,eAAe,EAAnC;EACA,oBACE,oBAAC,cAAD;IACE,aAAa,EAAE;MACbqE,KAAK,EAAE;QACLC,EAAE,EAAEF,OAAO,CAACG,MAAR,CAAeC;MADd,CADM;MAIbC,MAAM,EAAE;QACNH,EAAE,EAAEF,OAAO,CAACG,MAAR,CAAeG,iBADb;QAENC,MAAM,EAAEP,OAAO,CAACG,MAAR,CAAeK,qBAFjB;QAGNC,WAAW,EAAET,OAAO,CAACG,MAAR,CAAeO;MAHtB;IAJK;EADjB,GAYG/D,QAZH,CADF;AAgBD,CAlBD;;AAoBA,eAAeD,sBAAf"}
|
|
1
|
+
{"version":3,"names":["React","useEffect","useRef","useState","Platform","SafeAreaProvider","Sendbird","GroupChannelModule","OpenChannelModule","DialogProvider","Header","HeaderStyleProvider","LightUIKitTheme","ToastProvider","UIKitThemeProvider","LocalizationProvider","PlatformServiceProvider","SendbirdChatProvider","UserProfileProvider","useLocalization","InternalLocalCacheStorage","StringSetEn","SBUDynamicModule","VERSION","InternalErrorBoundaryContainer","NetInfo","get","SendbirdUIKit","Object","freeze","PLATFORM","OS","toLowerCase","SendbirdUIKitContainer","children","appId","chatOptions","platformServices","localization","styles","toast","userProfile","errorBoundary","unsubscribes","current","getSendbirdSDK","sdk","init","modules","localCacheEnabled","Boolean","localCacheStorage","useAsyncStorageStore","undefined","onInitialized","addExtension","addEventListener","listener","callback","callbackType","unsubscribe","state","online","isConnected","isInternetReachable","push","setOnlineListener","onOnline","setOfflineListener","onOffline","sdkInstance","setSdkInstance","forEach","u","enableAutoPushTokenRegistration","enableChannelListTypingIndicator","enableChannelListMessageReceiptStatus","enableUseUserIdForNickname","stringSet","file","notification","clipboard","media","theme","HeaderComponent","defaultHeaderTitleAlign","statusBarTranslucent","dismissTimeout","onCreateChannel","onBeforeCreateChannel","LocalizedDialogProvider","STRINGS","alert","ok","DIALOG","ALERT_DEFAULT_OK","prompt","PROMPT_DEFAULT_OK","cancel","PROMPT_DEFAULT_CANCEL","placeholder","PROMPT_DEFAULT_PLACEHOLDER"],"sources":["SendbirdUIKitContainer.tsx"],"sourcesContent":["import React, { useEffect, 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 SendbirdBaseChannel,\n SendbirdChatSDK,\n SendbirdGroupChannelCreateParams,\n SendbirdMember,\n SendbirdUser,\n} from '@sendbird/uikit-utils';\n\nimport { LocalizationProvider } from '../contexts/LocalizationCtx';\nimport { PlatformServiceProvider } from '../contexts/PlatformServiceCtx';\nimport type { UIKitFeaturesInSendbirdChatContext } from '../contexts/SendbirdChatCtx';\nimport { SendbirdChatProvider } from '../contexts/SendbirdChatCtx';\nimport { UserProfileProvider } from '../contexts/UserProfileCtx';\nimport { useLocalization } from '../hooks/useContext';\nimport InternalLocalCacheStorage from '../libs/InternalLocalCacheStorage';\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});\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 toast?: {\n dismissTimeout?: number;\n };\n userProfile?: {\n onCreateChannel: (channel: SendbirdBaseChannel) => void;\n onBeforeCreateChannel?: (\n channelParams: SendbirdGroupChannelCreateParams,\n users: SendbirdUser[] | SendbirdMember[],\n ) => SendbirdGroupChannelCreateParams | Promise<SendbirdGroupChannelCreateParams>;\n };\n errorBoundary?: {\n onError?: (props: ErrorBoundaryProps) => void;\n ErrorInfoComponent?: (props: ErrorBoundaryProps) => JSX.Element;\n };\n}>;\n\nconst SendbirdUIKitContainer = ({\n children,\n appId,\n chatOptions,\n platformServices,\n localization,\n styles,\n toast,\n userProfile,\n errorBoundary,\n}: SendbirdUIKitContainerProps) => {\n const unsubscribes = useRef<(() => void)[]>([]).current;\n const getSendbirdSDK = () => {\n let sdk: SendbirdChatSDK;\n\n sdk = Sendbird.init({\n appId,\n modules: [new GroupChannelModule(), new OpenChannelModule()],\n localCacheEnabled: Boolean(chatOptions?.localCacheStorage),\n // @ts-ignore\n useAsyncStorageStore: chatOptions?.localCacheStorage\n ? new InternalLocalCacheStorage(chatOptions.localCacheStorage)\n : undefined,\n });\n\n if (chatOptions?.onInitialized) {\n sdk = chatOptions?.onInitialized(sdk);\n }\n\n if (SendbirdUIKit.VERSION) {\n sdk.addExtension('sb_uikit', SendbirdUIKit.VERSION);\n }\n\n if (SendbirdUIKit.PLATFORM) {\n sdk.addExtension('device-os-platform', SendbirdUIKit.PLATFORM);\n }\n\n if (NetInfo?.addEventListener) {\n const listener = (callback: () => void, callbackType: 'online' | 'offline') => {\n const unsubscribe = NetInfo.addEventListener((state) => {\n const online = Boolean(state.isConnected) || Boolean(state.isInternetReachable);\n if (online && callbackType === 'online') callback();\n if (!online && callbackType === 'offline') callback();\n });\n unsubscribes.push(unsubscribe);\n return unsubscribe;\n };\n sdk.setOnlineListener?.((onOnline) => listener(onOnline, 'online'));\n sdk.setOfflineListener?.((onOffline) => listener(onOffline, 'offline'));\n }\n return sdk;\n };\n\n const [sdkInstance, setSdkInstance] = useState<SendbirdChatSDK>(getSendbirdSDK);\n\n useEffect(() => {\n setSdkInstance(getSendbirdSDK);\n return () => {\n unsubscribes.forEach((u) => {\n try {\n u();\n } catch {}\n });\n };\n }, [appId, chatOptions?.localCacheStorage]);\n\n return (\n <SafeAreaProvider>\n <SendbirdChatProvider\n sdkInstance={sdkInstance}\n enableAutoPushTokenRegistration={chatOptions?.enableAutoPushTokenRegistration ?? true}\n enableChannelListTypingIndicator={chatOptions?.enableChannelListTypingIndicator ?? false}\n enableChannelListMessageReceiptStatus={chatOptions?.enableChannelListMessageReceiptStatus ?? false}\n enableUseUserIdForNickname={chatOptions?.enableUseUserIdForNickname ?? false}\n >\n <LocalizationProvider stringSet={localization?.stringSet ?? StringSetEn}>\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 <LocalizedDialogProvider>\n <ToastProvider dismissTimeout={toast?.dismissTimeout}>\n <UserProfileProvider\n onCreateChannel={userProfile?.onCreateChannel}\n onBeforeCreateChannel={userProfile?.onBeforeCreateChannel}\n >\n <InternalErrorBoundaryContainer {...errorBoundary}>{children}</InternalErrorBoundaryContainer>\n </UserProfileProvider>\n </ToastProvider>\n </LocalizedDialogProvider>\n </HeaderStyleProvider>\n </UIKitThemeProvider>\n </PlatformServiceProvider>\n </LocalizationProvider>\n </SendbirdChatProvider>\n </SafeAreaProvider>\n );\n};\n\nconst LocalizedDialogProvider = ({ children }: React.PropsWithChildren) => {\n const { STRINGS } = useLocalization();\n return (\n <DialogProvider\n defaultLabels={{\n alert: {\n ok: STRINGS.DIALOG.ALERT_DEFAULT_OK,\n },\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 {children}\n </DialogProvider>\n );\n};\n\nexport default SendbirdUIKitContainer;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,MAA3B,EAAmCC,QAAnC,QAAmD,OAAnD;AACA,SAASC,QAAT,QAAyB,cAAzB;AACA,SAASC,gBAAT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,CAACG,MAAR,CAAeC;MADd,CADM;MAIbC,MAAM,EAAE;QACNH,EAAE,EAAEF,OAAO,CAACG,MAAR,CAAeG,iBADb;QAENC,MAAM,EAAEP,OAAO,CAACG,MAAR,CAAeK,qBAFjB;QAGNC,WAAW,EAAET,OAAO,CAACG,MAAR,CAAeO;MAHtB;IAJK;EADjB,GAYGnE,QAZH,CADF;AAgBD,CAlBD;;AAoBA,eAAeD,sBAAf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","LocalizationContext","createContext","LocalizationProvider","children","stringSet","STRINGS"],"sources":["LocalizationCtx.tsx"],"sourcesContent":["import React from 'react';\n\nimport type { StringSet } from '../localization/StringSet.type';\n\ntype Props = React.PropsWithChildren<{\n stringSet: StringSet;\n}>;\n\nexport type LocalizationContextType = {\n STRINGS: StringSet;\n};\n\nexport const LocalizationContext = React.createContext<LocalizationContextType | null>(null);\nexport const LocalizationProvider = ({ children, stringSet }: Props) => {\n return <LocalizationContext.Provider value={{ STRINGS: stringSet }}>{children}</LocalizationContext.Provider>;\n};\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAYA,OAAO,MAAMC,mBAAmB,gBAAGD,KAAK,CAACE,aAAN,CAAoD,IAApD,CAA5B;AACP,OAAO,MAAMC,oBAAoB,GAAG,QAAoC;EAAA,IAAnC;IAAEC,QAAF;IAAYC;EAAZ,CAAmC;EACtE,oBAAO,oBAAC,mBAAD,CAAqB,QAArB;IAA8B,KAAK,EAAE;MAAEC,OAAO,EAAED;IAAX;EAArC,GAA8DD,QAA9D,CAAP;AACD,CAFM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","PlatformServiceContext","createContext","PlatformServiceProvider","children","fileService","clipboardService","notificationService","mediaService"],"sources":["PlatformServiceCtx.tsx"],"sourcesContent":["import React from 'react';\n\nimport type {\n ClipboardServiceInterface,\n FileServiceInterface,\n MediaServiceInterface,\n NotificationServiceInterface,\n} from '../platform/types';\n\ntype Props = React.PropsWithChildren<{\n fileService: FileServiceInterface;\n clipboardService: ClipboardServiceInterface;\n notificationService: NotificationServiceInterface;\n mediaService?: MediaServiceInterface;\n}>;\n\nexport const PlatformServiceContext = React.createContext<Props | null>(null);\nexport const PlatformServiceProvider = ({\n children,\n fileService,\n clipboardService,\n notificationService,\n mediaService,\n}: Props) => {\n return (\n <PlatformServiceContext.Provider value={{ fileService, clipboardService, notificationService, mediaService }}>\n {children}\n </PlatformServiceContext.Provider>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAgBA,OAAO,MAAMC,sBAAsB,gBAAGD,KAAK,CAACE,aAAN,CAAkC,IAAlC,CAA/B;AACP,OAAO,MAAMC,uBAAuB,GAAG,QAM1B;EAAA,IAN2B;IACtCC,QADsC;IAEtCC,WAFsC;IAGtCC,gBAHsC;IAItCC,mBAJsC;IAKtCC;EALsC,CAM3B;EACX,oBACE,oBAAC,sBAAD,CAAwB,QAAxB;IAAiC,KAAK,EAAE;MAAEH,WAAF;MAAeC,gBAAf;MAAiCC,mBAAjC;MAAsDC;IAAtD;EAAxC,GACGJ,QADH,CADF;AAKD,CAZM"}
|
|
@@ -9,7 +9,8 @@ export const SendbirdChatProvider = _ref => {
|
|
|
9
9
|
sdkInstance,
|
|
10
10
|
enableAutoPushTokenRegistration,
|
|
11
11
|
enableChannelListMessageReceiptStatus,
|
|
12
|
-
enableChannelListTypingIndicator
|
|
12
|
+
enableChannelListTypingIndicator,
|
|
13
|
+
enableUseUserIdForNickname
|
|
13
14
|
} = _ref;
|
|
14
15
|
const [currentUser, _setCurrentUser] = useState();
|
|
15
16
|
const forceUpdate = useForceUpdate();
|
|
@@ -60,11 +61,12 @@ export const SendbirdChatProvider = _ref => {
|
|
|
60
61
|
features: { ...appFeatures,
|
|
61
62
|
autoPushTokenRegistrationEnabled: enableAutoPushTokenRegistration,
|
|
62
63
|
channelListTypingIndicatorEnabled: enableChannelListTypingIndicator,
|
|
63
|
-
channelListMessageReceiptStatusEnabled: enableChannelListMessageReceiptStatus
|
|
64
|
+
channelListMessageReceiptStatusEnabled: enableChannelListMessageReceiptStatus,
|
|
65
|
+
useUserIdForNicknameEnabled: enableUseUserIdForNickname
|
|
64
66
|
}
|
|
65
67
|
};
|
|
66
68
|
return /*#__PURE__*/React.createElement(SendbirdChatContext.Provider, {
|
|
67
69
|
value: value
|
|
68
70
|
}, children);
|
|
69
71
|
};
|
|
70
|
-
//# sourceMappingURL=
|
|
72
|
+
//# sourceMappingURL=SendbirdChatCtx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useCallback","useEffect","useState","AppState","useAppFeatures","confirmAndMarkAsDelivered","useForceUpdate","SendbirdChatContext","createContext","SendbirdChatProvider","children","sdkInstance","enableAutoPushTokenRegistration","enableChannelListMessageReceiptStatus","enableChannelListTypingIndicator","enableUseUserIdForNickname","currentUser","_setCurrentUser","forceUpdate","appFeatures","setCurrentUser","user","updateCurrentUserInfo","nickname","profile","Error","params","profileUrl","profileImage","markAsDeliveredWithChannel","channel","deliveryReceiptEnabled","listener","status","connectionState","setForegroundState","setBackgroundState","subscriber","addEventListener","remove","value","sdk","features","autoPushTokenRegistrationEnabled","channelListTypingIndicatorEnabled","channelListMessageReceiptStatusEnabled","useUserIdForNicknameEnabled"],"sources":["SendbirdChatCtx.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useState } from 'react';\nimport { AppState, AppStateStatus } from 'react-native';\n\nimport { useAppFeatures } from '@sendbird/uikit-chat-hooks';\nimport type {\n SendbirdChatSDK,\n SendbirdGroupChannel,\n SendbirdUser,\n SendbirdUserUpdateParams,\n} from '@sendbird/uikit-utils';\nimport { confirmAndMarkAsDelivered, useForceUpdate } from '@sendbird/uikit-utils';\n\nimport type { FileType } from '../platform/types';\n\nexport interface UIKitFeaturesInSendbirdChatContext {\n enableAutoPushTokenRegistration: boolean;\n enableChannelListTypingIndicator: boolean;\n enableChannelListMessageReceiptStatus: boolean;\n enableUseUserIdForNickname: boolean;\n}\n\ninterface Props extends UIKitFeaturesInSendbirdChatContext, React.PropsWithChildren {\n sdkInstance: SendbirdChatSDK;\n}\n\ntype Context = {\n sdk: SendbirdChatSDK;\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 features: {\n // UIKit features\n autoPushTokenRegistrationEnabled: boolean;\n channelListTypingIndicatorEnabled: boolean;\n channelListMessageReceiptStatusEnabled: boolean;\n useUserIdForNicknameEnabled: boolean;\n\n // Sendbird application features\n deliveryReceiptEnabled: boolean;\n broadcastChannelEnabled: boolean;\n superGroupChannelEnabled: boolean;\n reactionEnabled: boolean;\n };\n};\n\nexport const SendbirdChatContext = React.createContext<Context | null>(null);\nexport const SendbirdChatProvider = ({\n children,\n sdkInstance,\n enableAutoPushTokenRegistration,\n enableChannelListMessageReceiptStatus,\n enableChannelListTypingIndicator,\n enableUseUserIdForNickname,\n}: Props) => {\n const [currentUser, _setCurrentUser] = useState<SendbirdUser>();\n const forceUpdate = useForceUpdate();\n const appFeatures = useAppFeatures(sdkInstance);\n\n const setCurrentUser: Context['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: Context['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 = { nickname };\n\n 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: Context['markAsDeliveredWithChannel'] = useCallback(\n (channel: SendbirdGroupChannel) => {\n if (appFeatures.deliveryReceiptEnabled) confirmAndMarkAsDelivered([channel]);\n },\n [sdkInstance, appFeatures.deliveryReceiptEnabled],\n );\n\n useEffect(() => {\n const listener = (status: AppStateStatus) => {\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 subscriber = AppState.addEventListener('change', listener);\n return () => subscriber.remove();\n }, [sdkInstance]);\n\n const value: Context = {\n sdk: sdkInstance,\n currentUser,\n setCurrentUser,\n\n updateCurrentUserInfo,\n markAsDeliveredWithChannel,\n\n features: {\n ...appFeatures,\n autoPushTokenRegistrationEnabled: enableAutoPushTokenRegistration,\n channelListTypingIndicatorEnabled: enableChannelListTypingIndicator,\n channelListMessageReceiptStatusEnabled: enableChannelListMessageReceiptStatus,\n useUserIdForNicknameEnabled: enableUseUserIdForNickname,\n },\n };\n\n return <SendbirdChatContext.Provider value={value}>{children}</SendbirdChatContext.Provider>;\n};\n"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,WAAhB,EAA6BC,SAA7B,EAAwCC,QAAxC,QAAwD,OAAxD;AACA,SAASC,QAAT,QAAyC,cAAzC;AAEA,SAASC,cAAT,QAA+B,4BAA/B;AAOA,SAASC,yBAAT,EAAoCC,cAApC,QAA0D,uBAA1D;AAuCA,OAAO,MAAMC,mBAAmB,gBAAGR,KAAK,CAACS,aAAN,CAAoC,IAApC,CAA5B;AACP,OAAO,MAAMC,oBAAoB,GAAG,QAOvB;EAAA,IAPwB;IACnCC,QADmC;IAEnCC,WAFmC;IAGnCC,+BAHmC;IAInCC,qCAJmC;IAKnCC,gCALmC;IAMnCC;EANm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AS,CAAC,MAAM;IACd,MAAM+B,QAAQ,GAAIC,MAAD,IAA4B;MAC3C;MACA,IAAIA,MAAM,KAAK,QAAf,EAAyBtB,WAAW,CAACuB,eAAZ,KAAgC,QAAhC,IAA4CvB,WAAW,CAACwB,kBAAZ,EAA5C,CAAzB,KACK,IAAIF,MAAM,KAAK,YAAf,EAA6BtB,WAAW,CAACuB,eAAZ,KAAgC,MAAhC,IAA0CvB,WAAW,CAACyB,kBAAZ,EAA1C;IACnC,CAJD;;IAMA,MAAMC,UAAU,GAAGlC,QAAQ,CAACmC,gBAAT,CAA0B,QAA1B,EAAoCN,QAApC,CAAnB;IACA,OAAO,MAAMK,UAAU,CAACE,MAAX,EAAb;EACD,CATQ,EASN,CAAC5B,WAAD,CATM,CAAT;EAWA,MAAM6B,KAAc,GAAG;IACrBC,GAAG,EAAE9B,WADgB;IAErBK,WAFqB;IAGrBI,cAHqB;IAKrBE,qBALqB;IAMrBO,0BANqB;IAQrBa,QAAQ,EAAE,EACR,GAAGvB,WADK;MAERwB,gCAAgC,EAAE/B,+BAF1B;MAGRgC,iCAAiC,EAAE9B,gCAH3B;MAIR+B,sCAAsC,EAAEhC,qCAJhC;MAKRiC,2BAA2B,EAAE/B;IALrB;EARW,CAAvB;EAiBA,oBAAO,oBAAC,mBAAD,CAAqB,QAArB;IAA8B,KAAK,EAAEyB;EAArC,GAA6C9B,QAA7C,CAAP;AACD,CA9EM"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import React, { useCallback, useContext, useState } from 'react';
|
|
2
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
3
|
+
import { Modal, OutlinedButton, ProfileCard, createStyleSheet } from '@sendbird/uikit-react-native-foundation';
|
|
4
|
+
import { Logger, PASS, useIIFE } from '@sendbird/uikit-utils';
|
|
5
|
+
import { LocalizationContext } from '../contexts/LocalizationCtx';
|
|
6
|
+
import { SendbirdChatContext } from '../contexts/SendbirdChatCtx';
|
|
7
|
+
export const UserProfileContext = /*#__PURE__*/React.createContext(null);
|
|
8
|
+
export const UserProfileProvider = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
children,
|
|
11
|
+
onCreateChannel,
|
|
12
|
+
onBeforeCreateChannel = PASS
|
|
13
|
+
} = _ref;
|
|
14
|
+
const chatContext = useContext(SendbirdChatContext);
|
|
15
|
+
const localizationContext = useContext(LocalizationContext);
|
|
16
|
+
if (!chatContext) throw new Error('SendbirdChatContext is not provided');
|
|
17
|
+
if (!localizationContext) throw new Error('LocalizationContext is not provided');
|
|
18
|
+
const {
|
|
19
|
+
bottom,
|
|
20
|
+
left,
|
|
21
|
+
right
|
|
22
|
+
} = useSafeAreaInsets();
|
|
23
|
+
const [user, setUser] = useState();
|
|
24
|
+
const [visible, setVisible] = useState(false);
|
|
25
|
+
const show = useCallback(user => {
|
|
26
|
+
setUser(user);
|
|
27
|
+
setVisible(true);
|
|
28
|
+
}, []);
|
|
29
|
+
const hide = useCallback(() => {
|
|
30
|
+
setVisible(false);
|
|
31
|
+
}, []);
|
|
32
|
+
const userProfileButton = useIIFE(() => {
|
|
33
|
+
const isMe = chatContext.currentUser && (user === null || user === void 0 ? void 0 : user.userId) === chatContext.currentUser.userId;
|
|
34
|
+
if (isMe) return undefined;
|
|
35
|
+
|
|
36
|
+
const onPressMessageButton = async () => {
|
|
37
|
+
if (user) {
|
|
38
|
+
const params = {
|
|
39
|
+
invitedUserIds: [user.userId],
|
|
40
|
+
name: '',
|
|
41
|
+
coverUrl: '',
|
|
42
|
+
isDistinct: false
|
|
43
|
+
};
|
|
44
|
+
if (chatContext.currentUser) params.operatorUserIds = [chatContext.currentUser.userId];
|
|
45
|
+
const processedParams = await onBeforeCreateChannel(params, [user]);
|
|
46
|
+
hide();
|
|
47
|
+
const channel = await chatContext.sdk.groupChannel.createChannel(processedParams);
|
|
48
|
+
|
|
49
|
+
if (onCreateChannel) {
|
|
50
|
+
onCreateChannel(channel);
|
|
51
|
+
} else {
|
|
52
|
+
Logger.warn('Please set `onCreateChannel` before message to user from profile card, see `userProfile` prop in the `SendbirdUIKitContainer` props');
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
return /*#__PURE__*/React.createElement(OutlinedButton, {
|
|
58
|
+
onPress: onPressMessageButton
|
|
59
|
+
}, localizationContext.STRINGS.PROFILE_CARD.BUTTON_MESSAGE);
|
|
60
|
+
});
|
|
61
|
+
return /*#__PURE__*/React.createElement(UserProfileContext.Provider, {
|
|
62
|
+
value: {
|
|
63
|
+
show,
|
|
64
|
+
hide
|
|
65
|
+
}
|
|
66
|
+
}, children, /*#__PURE__*/React.createElement(Modal, {
|
|
67
|
+
type: 'slide',
|
|
68
|
+
onClose: hide,
|
|
69
|
+
onDismiss: () => setUser(undefined),
|
|
70
|
+
visible: visible && Boolean(user),
|
|
71
|
+
backgroundStyle: styles.modal
|
|
72
|
+
}, user && /*#__PURE__*/React.createElement(ProfileCard, {
|
|
73
|
+
containerStyle: [styles.profileCardContainer, {
|
|
74
|
+
paddingLeft: left,
|
|
75
|
+
paddingRight: right,
|
|
76
|
+
paddingBottom: bottom
|
|
77
|
+
}],
|
|
78
|
+
uri: user.profileUrl,
|
|
79
|
+
username: user.nickname || localizationContext.STRINGS.LABELS.USER_NO_NAME,
|
|
80
|
+
bodyLabel: localizationContext.STRINGS.PROFILE_CARD.BODY_LABEL,
|
|
81
|
+
body: localizationContext.STRINGS.PROFILE_CARD.BODY(user),
|
|
82
|
+
button: userProfileButton
|
|
83
|
+
})));
|
|
84
|
+
};
|
|
85
|
+
const styles = createStyleSheet({
|
|
86
|
+
modal: {
|
|
87
|
+
justifyContent: 'flex-end'
|
|
88
|
+
},
|
|
89
|
+
profileCardContainer: {
|
|
90
|
+
borderTopLeftRadius: 8,
|
|
91
|
+
borderTopRightRadius: 8
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
//# sourceMappingURL=UserProfileCtx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useCallback","useContext","useState","useSafeAreaInsets","Modal","OutlinedButton","ProfileCard","createStyleSheet","Logger","PASS","useIIFE","LocalizationContext","SendbirdChatContext","UserProfileContext","createContext","UserProfileProvider","children","onCreateChannel","onBeforeCreateChannel","chatContext","localizationContext","Error","bottom","left","right","user","setUser","visible","setVisible","show","hide","userProfileButton","isMe","currentUser","userId","undefined","onPressMessageButton","params","invitedUserIds","name","coverUrl","isDistinct","operatorUserIds","processedParams","channel","sdk","groupChannel","createChannel","warn","STRINGS","PROFILE_CARD","BUTTON_MESSAGE","Boolean","styles","modal","profileCardContainer","paddingLeft","paddingRight","paddingBottom","profileUrl","nickname","LABELS","USER_NO_NAME","BODY_LABEL","BODY","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, 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\nexport type UserProfileContextType = {\n show(user: SendbirdUser | SendbirdMember): void;\n hide(): void;\n};\n\ntype Props = React.PropsWithChildren<{\n onCreateChannel?: OnCreateChannel;\n onBeforeCreateChannel?: OnBeforeCreateChannel;\n}>;\n\nexport const UserProfileContext = React.createContext<UserProfileContextType | null>(null);\nexport const UserProfileProvider = ({ children, onCreateChannel, onBeforeCreateChannel = PASS }: 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 const { bottom, left, right } = useSafeAreaInsets();\n\n const [user, setUser] = useState<SendbirdUser | SendbirdMember>();\n const [visible, setVisible] = useState(false);\n\n const show: UserProfileContextType['show'] = useCallback((user) => {\n setUser(user);\n setVisible(true);\n }, []);\n\n const hide: UserProfileContextType['hide'] = useCallback(() => {\n setVisible(false);\n }, []);\n\n const userProfileButton = useIIFE(() => {\n const isMe = chatContext.currentUser && user?.userId === chatContext.currentUser.userId;\n if (isMe) return undefined;\n\n const onPressMessageButton = async () => {\n if (user) {\n const params: SendbirdGroupChannelCreateParams = {\n invitedUserIds: [user.userId],\n name: '',\n coverUrl: '',\n isDistinct: false,\n };\n\n if (chatContext.currentUser) params.operatorUserIds = [chatContext.currentUser.userId];\n const processedParams = await onBeforeCreateChannel(params, [user]);\n\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={() => setUser(undefined)}\n visible={visible && Boolean(user)}\n backgroundStyle={styles.modal}\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,KAAP,IAAgBC,WAAhB,EAA6BC,UAA7B,EAAyCC,QAAzC,QAAyD,OAAzD;AACA,SAASC,iBAAT,QAAkC,gCAAlC;AAEA,SAASC,KAAT,EAAgBC,cAAhB,EAAgCC,WAAhC,EAA6CC,gBAA7C,QAAqE,yCAArE;AAOA,SAASC,MAAT,EAAiBC,IAAjB,EAAuBC,OAAvB,QAAsC,uBAAtC;AAEA,SAASC,mBAAT,QAAoC,6BAApC;AACA,SAASC,mBAAT,QAAoC,6BAApC;AAkBA,OAAO,MAAMC,kBAAkB,gBAAGd,KAAK,CAACe,aAAN,CAAmD,IAAnD,CAA3B;AACP,OAAO,MAAMC,mBAAmB,GAAG,QAAwE;EAAA,IAAvE;IAAEC,QAAF;IAAYC,eAAZ;IAA6BC,qBAAqB,GAAGT;EAArD,CAAuE;EACzG,MAAMU,WAAW,GAAGlB,UAAU,CAACW,mBAAD,CAA9B;EACA,MAAMQ,mBAAmB,GAAGnB,UAAU,CAACU,mBAAD,CAAtC;EAEA,IAAI,CAACQ,WAAL,EAAkB,MAAM,IAAIE,KAAJ,CAAU,qCAAV,CAAN;EAClB,IAAI,CAACD,mBAAL,EAA0B,MAAM,IAAIC,KAAJ,CAAU,qCAAV,CAAN;EAE1B,MAAM;IAAEC,MAAF;IAAUC,IAAV;IAAgBC;EAAhB,IAA0BrB,iBAAiB,EAAjD;EAEA,MAAM,CAACsB,IAAD,EAAOC,OAAP,IAAkBxB,QAAQ,EAAhC;EACA,MAAM,CAACyB,OAAD,EAAUC,UAAV,IAAwB1B,QAAQ,CAAC,K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ditInput = _ref => {
|
|
|
14
14
|
setText,
|
|
15
15
|
editMessage,
|
|
16
16
|
setEditMessage,
|
|
17
|
-
onUpdateUserMessage
|
|
17
|
+
onUpdateUserMessage,
|
|
18
|
+
disabled
|
|
18
19
|
} = _ref;
|
|
19
20
|
const {
|
|
20
21
|
STRINGS
|
|
@@ -51,6 +52,7 @@ const EditInput = _ref => {
|
|
|
51
52
|
}, /*#__PURE__*/React.createElement(View, {
|
|
52
53
|
style: styles.inputWrapper
|
|
53
54
|
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
55
|
+
editable: !disabled,
|
|
54
56
|
autoFocus: AUTO_FOCUS,
|
|
55
57
|
ref: inputRef,
|
|
56
58
|
multiline: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","useRef","Platform","View","Button","TextInput","createStyleSheet","useToast","useLocalization","AUTO_FOCUS","select","ios","android","default","EditInput","text","setText","editMessage","setEditMessage","onUpdateUserMessage","STRINGS","inputRef","toast","isUserMessage","message","setTimeout","current","focus","onPressCancel","onPressSave","catch","show","TOAST","UPDATE_MSG_ERROR","styles","editInputContainer","inputWrapper","input","GROUP_CHANNEL","INPUT_PLACEHOLDER_ACTIVE","marginTop","flexDirection","INPUT_EDIT_CANCEL","space","INPUT_EDIT_OK","paddingVertical","paddingHorizontal","alignItems","flex","marginRight","minHeight","maxHeight","borderRadius"],"sources":["EditInput.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport { Platform, TextInput as RNTextInput, View } from 'react-native';\n\nimport { Button, TextInput, createStyleSheet, useToast } from '@sendbird/uikit-react-native-foundation';\nimport type { SendbirdFileMessage, SendbirdUserMessage } from '@sendbird/uikit-utils';\n\nimport { useLocalization } from '../../../../hooks/useContext';\nimport type { GroupChannelProps } from '../../types';\n\ntype EditInputProps = GroupChannelProps['Input'] & {\n text: string;\n setText: (val: string) => void;\n editMessage: SendbirdUserMessage | SendbirdFileMessage;\n setEditMessage: (msg?: SendbirdUserMessage | SendbirdFileMessage) => void;\n};\n\nconst AUTO_FOCUS = Platform.select({ ios: false, android: true, default: false });\nconst EditInput = ({ text, setText, editMessage, setEditMessage, onUpdateUserMessage }: EditInputProps) => {\n const { STRINGS } = useLocalization();\n const inputRef = useRef<RNTextInput>(null);\n const toast = useToast();\n\n useEffect(() => {\n if (editMessage.isUserMessage()) {\n setText(editMessage.message ?? '');\n\n if (!AUTO_FOCUS) setTimeout(() => inputRef.current?.focus(), 500);\n }\n }, [editMessage]);\n\n const onPressCancel = () => {\n setEditMessage();\n setText('');\n };\n\n const onPressSave = () => {\n if (editMessage.isUserMessage()) {\n onUpdateUserMessage(text, editMessage).catch(() => toast.show(STRINGS.TOAST.UPDATE_MSG_ERROR, 'error'));\n }\n setEditMessage();\n setText('');\n };\n\n return (\n <View style={styles.editInputContainer}>\n <View style={styles.inputWrapper}>\n <TextInput\n autoFocus={AUTO_FOCUS}\n ref={inputRef}\n multiline\n value={text}\n onChangeText={setText}\n style={styles.input}\n placeholder={STRINGS.GROUP_CHANNEL.INPUT_PLACEHOLDER_ACTIVE}\n />\n </View>\n <View style={{ marginTop: 8, flexDirection: 'row' }}>\n <Button variant={'text'} onPress={onPressCancel}>\n {STRINGS.GROUP_CHANNEL.INPUT_EDIT_CANCEL}\n </Button>\n <View style={styles.space} />\n <Button variant={'contained'} onPress={onPressSave}>\n {STRINGS.GROUP_CHANNEL.INPUT_EDIT_OK}\n </Button>\n </View>\n </View>\n );\n};\n\nconst styles = createStyleSheet({\n editInputContainer: {\n paddingVertical: 10,\n paddingHorizontal: 16,\n flexDirection: 'column',\n alignItems: 'center',\n },\n input: {\n flex: 1,\n marginRight: 4,\n minHeight: 36,\n maxHeight: 36 * Platform.select({ ios: 2.5, default: 2 }),\n borderRadius: 20,\n },\n inputWrapper: {\n flexDirection: 'row',\n },\n space: {\n flex: 1,\n },\n});\n\nexport default EditInput;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,MAA3B,QAAyC,OAAzC;AACA,SAASC,QAAT,EAA6CC,IAA7C,QAAyD,cAAzD;AAEA,SAASC,MAAT,EAAiBC,SAAjB,EAA4BC,gBAA5B,EAA8CC,QAA9C,QAA8D,yCAA9D;AAGA,SAASC,eAAT,QAAgC,8BAAhC;
|
|
1
|
+
{"version":3,"names":["React","useEffect","useRef","Platform","View","Button","TextInput","createStyleSheet","useToast","useLocalization","AUTO_FOCUS","select","ios","android","default","EditInput","text","setText","editMessage","setEditMessage","onUpdateUserMessage","disabled","STRINGS","inputRef","toast","isUserMessage","message","setTimeout","current","focus","onPressCancel","onPressSave","catch","show","TOAST","UPDATE_MSG_ERROR","styles","editInputContainer","inputWrapper","input","GROUP_CHANNEL","INPUT_PLACEHOLDER_ACTIVE","marginTop","flexDirection","INPUT_EDIT_CANCEL","space","INPUT_EDIT_OK","paddingVertical","paddingHorizontal","alignItems","flex","marginRight","minHeight","maxHeight","borderRadius"],"sources":["EditInput.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport { Platform, TextInput as RNTextInput, View } from 'react-native';\n\nimport { Button, TextInput, createStyleSheet, useToast } from '@sendbird/uikit-react-native-foundation';\nimport type { SendbirdFileMessage, SendbirdUserMessage } from '@sendbird/uikit-utils';\n\nimport { useLocalization } from '../../../../hooks/useContext';\nimport type { GroupChannelProps } from '../../types';\n\ntype EditInputProps = GroupChannelProps['Input'] & {\n text: string;\n setText: (val: string) => void;\n editMessage: SendbirdUserMessage | SendbirdFileMessage;\n setEditMessage: (msg?: SendbirdUserMessage | SendbirdFileMessage) => void;\n disabled: boolean;\n};\n\nconst AUTO_FOCUS = Platform.select({ ios: false, android: true, default: false });\nconst EditInput = ({ text, setText, editMessage, setEditMessage, onUpdateUserMessage, disabled }: EditInputProps) => {\n const { STRINGS } = useLocalization();\n const inputRef = useRef<RNTextInput>(null);\n const toast = useToast();\n\n useEffect(() => {\n if (editMessage.isUserMessage()) {\n setText(editMessage.message ?? '');\n\n if (!AUTO_FOCUS) setTimeout(() => inputRef.current?.focus(), 500);\n }\n }, [editMessage]);\n\n const onPressCancel = () => {\n setEditMessage();\n setText('');\n };\n\n const onPressSave = () => {\n if (editMessage.isUserMessage()) {\n onUpdateUserMessage(text, editMessage).catch(() => toast.show(STRINGS.TOAST.UPDATE_MSG_ERROR, 'error'));\n }\n setEditMessage();\n setText('');\n };\n\n return (\n <View style={styles.editInputContainer}>\n <View style={styles.inputWrapper}>\n <TextInput\n editable={!disabled}\n autoFocus={AUTO_FOCUS}\n ref={inputRef}\n multiline\n value={text}\n onChangeText={setText}\n style={styles.input}\n placeholder={STRINGS.GROUP_CHANNEL.INPUT_PLACEHOLDER_ACTIVE}\n />\n </View>\n <View style={{ marginTop: 8, flexDirection: 'row' }}>\n <Button variant={'text'} onPress={onPressCancel}>\n {STRINGS.GROUP_CHANNEL.INPUT_EDIT_CANCEL}\n </Button>\n <View style={styles.space} />\n <Button variant={'contained'} onPress={onPressSave}>\n {STRINGS.GROUP_CHANNEL.INPUT_EDIT_OK}\n </Button>\n </View>\n </View>\n );\n};\n\nconst styles = createStyleSheet({\n editInputContainer: {\n paddingVertical: 10,\n paddingHorizontal: 16,\n flexDirection: 'column',\n alignItems: 'center',\n },\n input: {\n flex: 1,\n marginRight: 4,\n minHeight: 36,\n maxHeight: 36 * Platform.select({ ios: 2.5, default: 2 }),\n borderRadius: 20,\n },\n inputWrapper: {\n flexDirection: 'row',\n },\n space: {\n flex: 1,\n },\n});\n\nexport default EditInput;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,MAA3B,QAAyC,OAAzC;AACA,SAASC,QAAT,EAA6CC,IAA7C,QAAyD,cAAzD;AAEA,SAASC,MAAT,EAAiBC,SAAjB,EAA4BC,gBAA5B,EAA8CC,QAA9C,QAA8D,yCAA9D;AAGA,SAASC,eAAT,QAAgC,8BAAhC;AAWA,MAAMC,UAAU,GAAGP,QAAQ,CAACQ,MAAT,CAAgB;EAAEC,GAAG,EAAE,KAAP;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@ const SendInput = _ref => {
|
|
|
12
12
|
onSendFileMessage,
|
|
13
13
|
text,
|
|
14
14
|
setText,
|
|
15
|
-
disabled
|
|
15
|
+
disabled,
|
|
16
|
+
frozen,
|
|
17
|
+
muted
|
|
16
18
|
} = _ref;
|
|
17
19
|
const {
|
|
18
20
|
STRINGS
|
|
@@ -123,7 +125,7 @@ const SendInput = _ref => {
|
|
|
123
125
|
value: text,
|
|
124
126
|
onChangeText: setText,
|
|
125
127
|
style: styles.input,
|
|
126
|
-
placeholder: conditionChaining([
|
|
128
|
+
placeholder: conditionChaining([frozen, muted], [STRINGS.GROUP_CHANNEL.INPUT_PLACEHOLDER_DISABLED, STRINGS.GROUP_CHANNEL.INPUT_PLACEHOLDER_MUTED, STRINGS.GROUP_CHANNEL.INPUT_PLACEHOLDER_ACTIVE])
|
|
127
129
|
}), Boolean(text.trim()) && /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
128
130
|
onPress: onPressSend,
|
|
129
131
|
disabled: disabled
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Platform","TouchableOpacity","View","Icon","TextInput","createStyleSheet","useAlert","useBottomSheet","useToast","useUIKitTheme","conditionChaining","useLocalization","usePlatformService","SBUError","SBUUtils","SendInput","onSendUserMessage","onSendFileMessage","text","setText","disabled","STRINGS","fileService","colors","openSheet","alert","toast","onPressSend","catch","show","TOAST","SEND_MSG_ERROR","onPressAttachment","sheetItems","title","GROUP_CHANNEL","DIALOG_ATTACHMENT_CAMERA","icon","onPress","photo","openCamera","mediaType","onOpenFailure","error","code","CODE","ERR_PERMISSIONS_DENIED","DIALOG","ALERT_PERMISSIONS_TITLE","message","ALERT_PERMISSIONS_MESSAGE","buttons","ALERT_PERMISSIONS_OK","openSettings","OPEN_CAMERA_ERROR","DIALOG_ATTACHMENT_PHOTO_LIBRARY","openMediaLibrary","selectionLimit","OPEN_PHOTO_LIBRARY_ERROR","DIALOG_ATTACHMENT_FILES","file","openDocument","OPEN_FILES_ERROR","styles","sendInputContainer","ui","input","default","highlight","active","iconAttach","INPUT_PLACEHOLDER_DISABLED","INPUT_PLACEHOLDER_ACTIVE","Boolean","trim","iconSend","paddingVertical","paddingHorizontal","alignItems","flexDirection","flex","marginRight","minHeight","maxHeight","select","ios","borderRadius","padding","marginLeft"],"sources":["SendInput.tsx"],"sourcesContent":["import React from 'react';\nimport { Platform, TouchableOpacity, View } from 'react-native';\n\nimport {\n Icon,\n TextInput,\n createStyleSheet,\n useAlert,\n useBottomSheet,\n useToast,\n useUIKitTheme,\n} from '@sendbird/uikit-react-native-foundation';\nimport { conditionChaining } from '@sendbird/uikit-utils';\n\nimport { useLocalization, usePlatformService } from '../../../../hooks/useContext';\nimport SBUError from '../../../../libs/SBUError';\nimport SBUUtils from '../../../../libs/SBUUtils';\nimport type { GroupChannelProps } from '../../types';\n\ntype SendInputProps = GroupChannelProps['Input'] & {\n text: string;\n setText: (val: string) => void;\n disabled: boolean;\n};\nconst SendInput = ({ onSendUserMessage, onSendFileMessage, text, setText, disabled }: SendInputProps) => {\n const { STRINGS } = useLocalization();\n const { fileService } = usePlatformService();\n const { colors } = useUIKitTheme();\n const { openSheet } = useBottomSheet();\n const { alert } = useAlert();\n const toast = useToast();\n\n const onPressSend = () => {\n onSendUserMessage(text).catch(() => toast.show(STRINGS.TOAST.SEND_MSG_ERROR, 'error'));\n setText('');\n };\n const onPressAttachment = () => {\n openSheet({\n sheetItems: [\n {\n title: STRINGS.GROUP_CHANNEL.DIALOG_ATTACHMENT_CAMERA,\n icon: 'camera',\n onPress: async () => {\n const photo = await fileService.openCamera({\n mediaType: 'all',\n onOpenFailure: (error) => {\n if (error.code === SBUError.CODE.ERR_PERMISSIONS_DENIED) {\n alert({\n title: STRINGS.DIALOG.ALERT_PERMISSIONS_TITLE,\n message: STRINGS.DIALOG.ALERT_PERMISSIONS_MESSAGE('camera', 'UIKitSample'),\n buttons: [{ text: STRINGS.DIALOG.ALERT_PERMISSIONS_OK, onPress: () => SBUUtils.openSettings() }],\n });\n } else {\n toast.show(STRINGS.TOAST.OPEN_CAMERA_ERROR, 'error');\n }\n },\n });\n\n if (photo) {\n onSendFileMessage(photo).catch(() => toast.show(STRINGS.TOAST.SEND_MSG_ERROR, 'error'));\n }\n },\n },\n {\n title: STRINGS.GROUP_CHANNEL.DIALOG_ATTACHMENT_PHOTO_LIBRARY,\n icon: 'photo',\n onPress: async () => {\n const photo = await fileService.openMediaLibrary({\n selectionLimit: 1,\n mediaType: 'all',\n onOpenFailure: (error) => {\n if (error.code === SBUError.CODE.ERR_PERMISSIONS_DENIED) {\n alert({\n title: STRINGS.DIALOG.ALERT_PERMISSIONS_TITLE,\n message: STRINGS.DIALOG.ALERT_PERMISSIONS_MESSAGE('device storage', 'UIKitSample'),\n buttons: [{ text: STRINGS.DIALOG.ALERT_PERMISSIONS_OK, onPress: () => SBUUtils.openSettings() }],\n });\n } else {\n toast.show(STRINGS.TOAST.OPEN_PHOTO_LIBRARY_ERROR, 'error');\n }\n },\n });\n\n if (photo && photo[0]) {\n onSendFileMessage(photo[0]).catch(() => toast.show(STRINGS.TOAST.SEND_MSG_ERROR, 'error'));\n }\n },\n },\n {\n title: STRINGS.GROUP_CHANNEL.DIALOG_ATTACHMENT_FILES,\n icon: 'document',\n onPress: async () => {\n const file = await fileService.openDocument({\n onOpenFailure: () => toast.show(STRINGS.TOAST.OPEN_FILES_ERROR, 'error'),\n });\n\n if (file) {\n onSendFileMessage(file).catch(() => toast.show(STRINGS.TOAST.SEND_MSG_ERROR, 'error'));\n }\n },\n },\n ],\n });\n };\n\n return (\n <View style={styles.sendInputContainer}>\n <TouchableOpacity onPress={onPressAttachment} disabled={disabled}>\n <Icon\n color={disabled ? colors.ui.input.default.disabled.highlight : colors.ui.input.default.active.highlight}\n icon={'add'}\n size={24}\n containerStyle={styles.iconAttach}\n />\n </TouchableOpacity>\n <TextInput\n multiline\n editable={!disabled}\n value={text}\n onChangeText={setText}\n style={styles.input}\n placeholder={conditionChaining(\n [disabled],\n [STRINGS.GROUP_CHANNEL.INPUT_PLACEHOLDER_DISABLED, STRINGS.GROUP_CHANNEL.INPUT_PLACEHOLDER_ACTIVE],\n )}\n />\n {Boolean(text.trim()) && (\n <TouchableOpacity onPress={onPressSend} disabled={disabled}>\n <Icon\n color={disabled ? colors.ui.input.default.disabled.highlight : colors.ui.input.default.active.highlight}\n icon={'send'}\n size={24}\n containerStyle={styles.iconSend}\n />\n </TouchableOpacity>\n )}\n </View>\n );\n};\n\nconst styles = createStyleSheet({\n sendInputContainer: {\n paddingVertical: 10,\n paddingHorizontal: 12,\n alignItems: 'center',\n flexDirection: 'row',\n },\n input: {\n flex: 1,\n marginRight: 4,\n minHeight: 36,\n maxHeight: 36 * Platform.select({ ios: 2.5, default: 2 }),\n borderRadius: 20,\n },\n iconAttach: {\n marginRight: 8,\n padding: 4,\n },\n iconSend: {\n marginLeft: 4,\n padding: 4,\n },\n});\n\nexport default SendInput;\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,QAAT,EAAmBC,gBAAnB,EAAqCC,IAArC,QAAiD,cAAjD;AAEA,SACEC,IADF,EAEEC,SAFF,EAGEC,gBAHF,EAIEC,QAJF,EAKEC,cALF,EAMEC,QANF,EAOEC,aAPF,QAQO,yCARP;AASA,SAASC,iBAAT,QAAkC,uBAAlC;AAEA,SAASC,eAAT,EAA0BC,kBAA1B,QAAoD,8BAApD;AACA,OAAOC,QAAP,MAAqB,2BAArB;AACA,OAAOC,QAAP,MAAqB,2BAArB;;AAQA,MAAMC,SAAS,GAAG,QAAuF;EAAA,IAAtF;IAAEC,iBAAF;IAAqBC,iBAArB;IAAwCC,IAAxC;IAA8CC,OAA9C;IAAuDC;EAAvD,CAAsF;EACvG,MAAM;IAAEC;EAAF,IAAcV,eAAe,EAAnC;EACA,MAAM;IAAEW;EAAF,IAAkBV,kBAAkB,EAA1C;EACA,MAAM;IAAEW;EAAF,IAAad,aAAa,EAAhC;EACA,MAAM;IAAEe;EA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","useAlert","useBottomSheet","useToast","useUIKitTheme","conditionChaining","useLocalization","usePlatformService","SBUError","SBUUtils","SendInput","onSendUserMessage","onSendFileMessage","text","setText","disabled","frozen","muted","STRINGS","fileService","colors","openSheet","alert","toast","onPressSend","catch","show","TOAST","SEND_MSG_ERROR","onPressAttachment","sheetItems","title","GROUP_CHANNEL","DIALOG_ATTACHMENT_CAMERA","icon","onPress","photo","openCamera","mediaType","onOpenFailure","error","code","CODE","ERR_PERMISSIONS_DENIED","DIALOG","ALERT_PERMISSIONS_TITLE","message","ALERT_PERMISSIONS_MESSAGE","buttons","ALERT_PERMISSIONS_OK","openSettings","OPEN_CAMERA_ERROR","DIALOG_ATTACHMENT_PHOTO_LIBRARY","openMediaLibrary","selectionLimit","OPEN_PHOTO_LIBRARY_ERROR","DIALOG_ATTACHMENT_FILES","file","openDocument","OPEN_FILES_ERROR","styles","sendInputContainer","ui","input","default","highlight","active","iconAttach","INPUT_PLACEHOLDER_DISABLED","INPUT_PLACEHOLDER_MUTED","INPUT_PLACEHOLDER_ACTIVE","Boolean","trim","iconSend","paddingVertical","paddingHorizontal","alignItems","flexDirection","flex","marginRight","minHeight","maxHeight","select","ios","borderRadius","padding","marginLeft"],"sources":["SendInput.tsx"],"sourcesContent":["import React from 'react';\nimport { Platform, TouchableOpacity, View } from 'react-native';\n\nimport {\n Icon,\n TextInput,\n createStyleSheet,\n useAlert,\n useBottomSheet,\n useToast,\n useUIKitTheme,\n} from '@sendbird/uikit-react-native-foundation';\nimport { conditionChaining } from '@sendbird/uikit-utils';\n\nimport { useLocalization, usePlatformService } from '../../../../hooks/useContext';\nimport SBUError from '../../../../libs/SBUError';\nimport SBUUtils from '../../../../libs/SBUUtils';\nimport type { GroupChannelProps } from '../../types';\n\ntype SendInputProps = GroupChannelProps['Input'] & {\n text: string;\n setText: (val: string) => void;\n frozen: boolean;\n muted: boolean;\n disabled: boolean;\n};\nconst SendInput = ({\n onSendUserMessage,\n onSendFileMessage,\n text,\n setText,\n disabled,\n frozen,\n muted,\n}: SendInputProps) => {\n const { STRINGS } = useLocalization();\n const { fileService } = usePlatformService();\n const { colors } = useUIKitTheme();\n const { openSheet } = useBottomSheet();\n const { alert } = useAlert();\n const toast = useToast();\n\n const onPressSend = () => {\n onSendUserMessage(text).catch(() => toast.show(STRINGS.TOAST.SEND_MSG_ERROR, 'error'));\n setText('');\n };\n const onPressAttachment = () => {\n openSheet({\n sheetItems: [\n {\n title: STRINGS.GROUP_CHANNEL.DIALOG_ATTACHMENT_CAMERA,\n icon: 'camera',\n onPress: async () => {\n const photo = await fileService.openCamera({\n mediaType: 'all',\n onOpenFailure: (error) => {\n if (error.code === SBUError.CODE.ERR_PERMISSIONS_DENIED) {\n alert({\n title: STRINGS.DIALOG.ALERT_PERMISSIONS_TITLE,\n message: STRINGS.DIALOG.ALERT_PERMISSIONS_MESSAGE('camera', 'UIKitSample'),\n buttons: [{ text: STRINGS.DIALOG.ALERT_PERMISSIONS_OK, onPress: () => SBUUtils.openSettings() }],\n });\n } else {\n toast.show(STRINGS.TOAST.OPEN_CAMERA_ERROR, 'error');\n }\n },\n });\n\n if (photo) {\n onSendFileMessage(photo).catch(() => toast.show(STRINGS.TOAST.SEND_MSG_ERROR, 'error'));\n }\n },\n },\n {\n title: STRINGS.GROUP_CHANNEL.DIALOG_ATTACHMENT_PHOTO_LIBRARY,\n icon: 'photo',\n onPress: async () => {\n const photo = await fileService.openMediaLibrary({\n selectionLimit: 1,\n mediaType: 'all',\n onOpenFailure: (error) => {\n if (error.code === SBUError.CODE.ERR_PERMISSIONS_DENIED) {\n alert({\n title: STRINGS.DIALOG.ALERT_PERMISSIONS_TITLE,\n message: STRINGS.DIALOG.ALERT_PERMISSIONS_MESSAGE('device storage', 'UIKitSample'),\n buttons: [{ text: STRINGS.DIALOG.ALERT_PERMISSIONS_OK, onPress: () => SBUUtils.openSettings() }],\n });\n } else {\n toast.show(STRINGS.TOAST.OPEN_PHOTO_LIBRARY_ERROR, 'error');\n }\n },\n });\n\n if (photo && photo[0]) {\n onSendFileMessage(photo[0]).catch(() => toast.show(STRINGS.TOAST.SEND_MSG_ERROR, 'error'));\n }\n },\n },\n {\n title: STRINGS.GROUP_CHANNEL.DIALOG_ATTACHMENT_FILES,\n icon: 'document',\n onPress: async () => {\n const file = await fileService.openDocument({\n onOpenFailure: () => toast.show(STRINGS.TOAST.OPEN_FILES_ERROR, 'error'),\n });\n\n if (file) {\n onSendFileMessage(file).catch(() => toast.show(STRINGS.TOAST.SEND_MSG_ERROR, 'error'));\n }\n },\n },\n ],\n });\n };\n\n return (\n <View style={styles.sendInputContainer}>\n <TouchableOpacity onPress={onPressAttachment} disabled={disabled}>\n <Icon\n color={disabled ? colors.ui.input.default.disabled.highlight : colors.ui.input.default.active.highlight}\n icon={'add'}\n size={24}\n containerStyle={styles.iconAttach}\n />\n </TouchableOpacity>\n <TextInput\n multiline\n editable={!disabled}\n value={text}\n onChangeText={setText}\n style={styles.input}\n placeholder={conditionChaining(\n [frozen, muted],\n [\n STRINGS.GROUP_CHANNEL.INPUT_PLACEHOLDER_DISABLED,\n STRINGS.GROUP_CHANNEL.INPUT_PLACEHOLDER_MUTED,\n STRINGS.GROUP_CHANNEL.INPUT_PLACEHOLDER_ACTIVE,\n ],\n )}\n />\n {Boolean(text.trim()) && (\n <TouchableOpacity onPress={onPressSend} disabled={disabled}>\n <Icon\n color={disabled ? colors.ui.input.default.disabled.highlight : colors.ui.input.default.active.highlight}\n icon={'send'}\n size={24}\n containerStyle={styles.iconSend}\n />\n </TouchableOpacity>\n )}\n </View>\n );\n};\n\nconst styles = createStyleSheet({\n sendInputContainer: {\n paddingVertical: 10,\n paddingHorizontal: 12,\n alignItems: 'center',\n flexDirection: 'row',\n },\n input: {\n flex: 1,\n marginRight: 4,\n minHeight: 36,\n maxHeight: 36 * Platform.select({ ios: 2.5, default: 2 }),\n borderRadius: 20,\n },\n iconAttach: {\n marginRight: 8,\n padding: 4,\n },\n iconSend: {\n marginLeft: 4,\n padding: 4,\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;IAIE,cAAc,EAAEL,MAAM,CAACa;EAJzB,EADF,CAzBJ,CADF;AAqCD,CA9HD;;AAgIA,MAAMb,MAAM,GAAG5D,gBAAgB,CAAC;EAC9B6D,kBAAkB,EAAE;IAClBa,eAAe,EAAE,EADC;IAElBC,iBAAiB,EAAE,EAFD;IAGlBC,UAAU,EAAE,QAHM;IAIlBC,aAAa,EAAE;EAJG,CADU;EAO9Bd,KAAK,EAAE;IACLe,IAAI,EAAE,CADD;IAELC,WAAW,EAAE,CAFR;IAGLC,SAAS,EAAE,EAHN;IAILC,SAAS,EAAE,KAAKtF,QAAQ,CAACuF,MAAT,CAAgB;MAAEC,GAAG,EAAE,GAAP;MAAYnB,OAAO,EAAE;IAArB,CAAhB,CAJX;IAKLoB,YAAY,EAAE;EALT,CAPuB;EAc9BjB,UAAU,EAAE;IACVY,WAAW,EAAE,CADH;IAEVM,OAAO,EAAE;EAFC,CAdkB;EAkB9BZ,QAAQ,EAAE;IACRa,UAAU,EAAE,CADJ;IAERD,OAAO,EAAE;EAFD;AAlBoB,CAAD,CAA/B;AAwBA,eAAe3E,SAAf"}
|
|
@@ -4,7 +4,7 @@ import React, { useContext, useEffect, useRef, useState } from 'react';
|
|
|
4
4
|
import { KeyboardAvoidingView, Platform, View } from 'react-native';
|
|
5
5
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
6
6
|
import { useUIKitTheme } from '@sendbird/uikit-react-native-foundation';
|
|
7
|
-
import {
|
|
7
|
+
import { getGroupChannelChatAvailableState, useIIFE } from '@sendbird/uikit-utils';
|
|
8
8
|
import { GroupChannelContexts } from '../../module/moduleContext';
|
|
9
9
|
import EditInput from './EditInput';
|
|
10
10
|
import SendInput from './SendInput';
|
|
@@ -14,9 +14,6 @@ const KEYBOARD_AVOID_VIEW_BEHAVIOR = Platform.select({
|
|
|
14
14
|
});
|
|
15
15
|
|
|
16
16
|
const GroupChannelInput = props => {
|
|
17
|
-
const {
|
|
18
|
-
channel
|
|
19
|
-
} = props;
|
|
20
17
|
const {
|
|
21
18
|
left,
|
|
22
19
|
right,
|
|
@@ -26,29 +23,37 @@ const GroupChannelInput = props => {
|
|
|
26
23
|
colors
|
|
27
24
|
} = useUIKitTheme();
|
|
28
25
|
const {
|
|
26
|
+
channel,
|
|
29
27
|
editMessage,
|
|
30
28
|
setEditMessage,
|
|
31
29
|
keyboardAvoidOffset = 0
|
|
32
30
|
} = useContext(GroupChannelContexts.Fragment);
|
|
33
31
|
const [text, setText] = useState('');
|
|
34
32
|
const textTmpRef = useRef('');
|
|
35
|
-
const
|
|
33
|
+
const chatAvailableState = getGroupChannelChatAvailableState(channel);
|
|
36
34
|
useEffect(() => {
|
|
37
35
|
if (text.length === 0) channel.endTyping();else channel.startTyping();
|
|
38
36
|
}, [text]);
|
|
39
37
|
useEffect(() => {
|
|
40
|
-
if (
|
|
38
|
+
if (chatAvailableState.disabled) {
|
|
41
39
|
textTmpRef.current = text;
|
|
42
40
|
setText('');
|
|
43
41
|
} else {
|
|
44
42
|
setText(textTmpRef.current);
|
|
45
43
|
}
|
|
46
|
-
}, [
|
|
44
|
+
}, [chatAvailableState.disabled]);
|
|
47
45
|
const inputMode = useIIFE(() => {
|
|
48
46
|
if (!editMessage) return 'send';
|
|
49
47
|
if (editMessage.isFileMessage()) return 'send';
|
|
50
48
|
return 'edit';
|
|
51
49
|
});
|
|
50
|
+
|
|
51
|
+
if (!props.shouldRenderInput) {
|
|
52
|
+
return /*#__PURE__*/React.createElement(SafeAreaBottom, {
|
|
53
|
+
height: bottom
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
52
57
|
return /*#__PURE__*/React.createElement(KeyboardAvoidingView, {
|
|
53
58
|
keyboardVerticalOffset: -bottom + keyboardAvoidOffset,
|
|
54
59
|
behavior: KEYBOARD_AVOID_VIEW_BEHAVIOR
|
|
@@ -65,13 +70,13 @@ const GroupChannelInput = props => {
|
|
|
65
70
|
}
|
|
66
71
|
}, inputMode === 'send' && /*#__PURE__*/React.createElement(SendInput, _extends({}, props, {
|
|
67
72
|
text: text,
|
|
68
|
-
setText: setText
|
|
69
|
-
|
|
70
|
-
})), inputMode === 'edit' && editMessage && /*#__PURE__*/React.createElement(EditInput, _extends({}, props, {
|
|
73
|
+
setText: setText
|
|
74
|
+
}, chatAvailableState)), inputMode === 'edit' && editMessage && /*#__PURE__*/React.createElement(EditInput, _extends({}, props, {
|
|
71
75
|
text: text,
|
|
72
76
|
setText: setText,
|
|
73
77
|
editMessage: editMessage,
|
|
74
|
-
setEditMessage: setEditMessage
|
|
78
|
+
setEditMessage: setEditMessage,
|
|
79
|
+
disabled: chatAvailableState.disabled
|
|
75
80
|
}))), /*#__PURE__*/React.createElement(SafeAreaBottom, {
|
|
76
81
|
height: bottom
|
|
77
82
|
})));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useContext","useEffect","useRef","useState","KeyboardAvoidingView","Platform","View","useSafeAreaInsets","useUIKitTheme","
|
|
1
|
+
{"version":3,"names":["React","useContext","useEffect","useRef","useState","KeyboardAvoidingView","Platform","View","useSafeAreaInsets","useUIKitTheme","getGroupChannelChatAvailableState","useIIFE","GroupChannelContexts","EditInput","SendInput","KEYBOARD_AVOID_VIEW_BEHAVIOR","select","ios","default","undefined","GroupChannelInput","props","left","right","bottom","colors","channel","editMessage","setEditMessage","keyboardAvoidOffset","Fragment","text","setText","textTmpRef","chatAvailableState","length","endTyping","startTyping","disabled","current","inputMode","isFileMessage","shouldRenderInput","paddingLeft","paddingRight","backgroundColor","background","justifyContent","width","SafeAreaBottom","height","memo"],"sources":["index.tsx"],"sourcesContent":["import React, { useContext, useEffect, useRef, useState } from 'react';\nimport { KeyboardAvoidingView, Platform, View } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\nimport { useUIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport { getGroupChannelChatAvailableState, useIIFE } from '@sendbird/uikit-utils';\n\nimport { GroupChannelContexts } from '../../module/moduleContext';\nimport type { GroupChannelProps } from '../../types';\nimport EditInput from './EditInput';\nimport SendInput from './SendInput';\n\nconst KEYBOARD_AVOID_VIEW_BEHAVIOR = Platform.select({ ios: 'padding' as const, default: undefined });\nconst GroupChannelInput = (props: GroupChannelProps['Input']) => {\n const { left, right, bottom } = useSafeAreaInsets();\n const { colors } = useUIKitTheme();\n const { channel, editMessage, setEditMessage, keyboardAvoidOffset = 0 } = useContext(GroupChannelContexts.Fragment);\n\n const [text, setText] = useState('');\n const textTmpRef = useRef('');\n const chatAvailableState = getGroupChannelChatAvailableState(channel);\n\n useEffect(() => {\n if (text.length === 0) channel.endTyping();\n else channel.startTyping();\n }, [text]);\n\n useEffect(() => {\n if (chatAvailableState.disabled) {\n textTmpRef.current = text;\n setText('');\n } else {\n setText(textTmpRef.current);\n }\n }, [chatAvailableState.disabled]);\n\n const inputMode = useIIFE(() => {\n if (!editMessage) return 'send';\n if (editMessage.isFileMessage()) return 'send';\n return 'edit';\n });\n\n if (!props.shouldRenderInput) {\n return <SafeAreaBottom height={bottom} />;\n }\n\n return (\n <KeyboardAvoidingView\n keyboardVerticalOffset={-bottom + keyboardAvoidOffset}\n behavior={KEYBOARD_AVOID_VIEW_BEHAVIOR}\n >\n <View style={{ paddingLeft: left, paddingRight: right, backgroundColor: colors.background }}>\n <View style={{ justifyContent: 'center', width: '100%' }}>\n {inputMode === 'send' && <SendInput {...props} text={text} setText={setText} {...chatAvailableState} />}\n {inputMode === 'edit' && editMessage && (\n <EditInput\n {...props}\n text={text}\n setText={setText}\n editMessage={editMessage}\n setEditMessage={setEditMessage}\n disabled={chatAvailableState.disabled}\n />\n )}\n </View>\n <SafeAreaBottom height={bottom} />\n </View>\n </KeyboardAvoidingView>\n );\n};\nconst SafeAreaBottom = ({ height }: { height: number }) => {\n return <View style={{ height }} />;\n};\n\nexport default React.memo(GroupChannelInput);\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,UAAhB,EAA4BC,SAA5B,EAAuCC,MAAvC,EAA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;EAAA,IAAnC;IAAEC;EAAF,CAAmC;EACzD,oBAAO,oBAAC,IAAD;IAAM,KAAK,EAAE;MAAEA;IAAF;EAAb,EAAP;AACD,CAFD;;AAIA,4BAAelD,KAAK,CAACmD,IAAN,CAAW/B,iBAAX,CAAf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type React from 'react';\nimport type { FlatListProps } from 'react-native';\n\nimport type { UseGroupChannelMessagesOptions } from '@sendbird/uikit-chat-hooks';\nimport type {\n SendbirdFileMessage,\n SendbirdFileMessageCreateParams,\n SendbirdGroupChannel,\n SendbirdMessage,\n SendbirdUser,\n SendbirdUserMessage,\n SendbirdUserMessageCreateParams,\n} from '@sendbird/uikit-utils';\n\nimport type { FileType } from '../../platform/types';\nimport type { CommonComponent } from '../../types';\n\nexport interface GroupChannelProps {\n Fragment: {\n channel: SendbirdGroupChannel;\n onChannelDeleted: () => void;\n onPressHeaderLeft: GroupChannelProps['Header']['onPressHeaderLeft'];\n onPressHeaderRight: GroupChannelProps['Header']['onPressHeaderRight'];\n\n onBeforeSendFileMessage?: (\n params: SendbirdFileMessageCreateParams,\n ) => SendbirdFileMessageCreateParams | Promise<SendbirdFileMessageCreateParams>;\n onBeforeSendUserMessage?: (\n params: SendbirdUserMessageCreateParams,\n ) => SendbirdUserMessageCreateParams | Promise<SendbirdUserMessageCreateParams>;\n onPressMediaMessage?: GroupChannelProps['MessageList']['onPressMediaMessage'];\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 queryCreator?: UseGroupChannelMessagesOptions['queryCreator'];\n\n /** @deprecated `onPressImageMessage` is deprecated, please use `onPressMediaMessage` instead **/\n onPressImageMessage?: GroupChannelProps['MessageList']['onPressImageMessage'];\n };\n Header: {\n onPressHeaderLeft: () => void;\n onPressHeaderRight: () => void;\n };\n MessageList: {\n enableMessageGrouping: boolean;\n currentUserId?: string;\n channel: SendbirdGroupChannel;\n messages: SendbirdMessage[];\n nextMessages: SendbirdMessage[];\n newMessagesFromMembers: SendbirdMessage[];\n onTopReached: () => void;\n onBottomReached: () => void;\n\n onResendFailedMessage: (failedMessage: SendbirdUserMessage | SendbirdFileMessage) => Promise<void>;\n onDeleteMessage: (message: SendbirdUserMessage | SendbirdFileMessage) => Promise<void>;\n onPressMediaMessage?: (message: SendbirdFileMessage, deleteMessage: () => Promise<void>, uri: string) => void;\n\n renderMessage: (props: {\n message: SendbirdMessage;\n prevMessage?: SendbirdMessage;\n nextMessage?: SendbirdMessage;\n onPress?: () => void;\n onLongPress?: () => void;\n channel: GroupChannelProps['MessageList']['channel'];\n currentUserId?: GroupChannelProps['MessageList']['currentUserId'];\n enableMessageGrouping: GroupChannelProps['MessageList']['enableMessageGrouping'];\n }) => React.ReactElement | null;\n renderNewMessagesButton: null | CommonComponent<{\n visible: boolean;\n onPress: () => void;\n newMessages: SendbirdMessage[];\n }>;\n renderScrollToBottomButton: null | CommonComponent<{\n visible: boolean;\n onPress: () => void;\n }>;\n flatListProps?: Omit<FlatListProps<SendbirdMessage>, 'data' | 'renderItem'>;\n\n /** @deprecated `onPressImageMessage` is deprecated, please use `onPressMediaMessage` instead **/\n onPressImageMessage?: (message: SendbirdFileMessage, uri: string) => void;\n };\n Input: {\n
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type React from 'react';\nimport type { FlatListProps } from 'react-native';\n\nimport type { UseGroupChannelMessagesOptions } from '@sendbird/uikit-chat-hooks';\nimport type {\n SendbirdFileMessage,\n SendbirdFileMessageCreateParams,\n SendbirdGroupChannel,\n SendbirdMessage,\n SendbirdUser,\n SendbirdUserMessage,\n SendbirdUserMessageCreateParams,\n} from '@sendbird/uikit-utils';\n\nimport type { FileType } from '../../platform/types';\nimport type { CommonComponent } from '../../types';\n\nexport interface GroupChannelProps {\n Fragment: {\n channel: SendbirdGroupChannel;\n onChannelDeleted: () => void;\n onPressHeaderLeft: GroupChannelProps['Header']['onPressHeaderLeft'];\n onPressHeaderRight: GroupChannelProps['Header']['onPressHeaderRight'];\n\n onBeforeSendFileMessage?: (\n params: SendbirdFileMessageCreateParams,\n ) => SendbirdFileMessageCreateParams | Promise<SendbirdFileMessageCreateParams>;\n onBeforeSendUserMessage?: (\n params: SendbirdUserMessageCreateParams,\n ) => SendbirdUserMessageCreateParams | Promise<SendbirdUserMessageCreateParams>;\n onPressMediaMessage?: GroupChannelProps['MessageList']['onPressMediaMessage'];\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 queryCreator?: UseGroupChannelMessagesOptions['queryCreator'];\n\n /** @deprecated `onPressImageMessage` is deprecated, please use `onPressMediaMessage` instead **/\n onPressImageMessage?: GroupChannelProps['MessageList']['onPressImageMessage'];\n };\n Header: {\n onPressHeaderLeft: () => void;\n onPressHeaderRight: () => void;\n };\n MessageList: {\n enableMessageGrouping: boolean;\n currentUserId?: string;\n channel: SendbirdGroupChannel;\n messages: SendbirdMessage[];\n nextMessages: SendbirdMessage[];\n newMessagesFromMembers: SendbirdMessage[];\n onTopReached: () => void;\n onBottomReached: () => void;\n\n onResendFailedMessage: (failedMessage: SendbirdUserMessage | SendbirdFileMessage) => Promise<void>;\n onDeleteMessage: (message: SendbirdUserMessage | SendbirdFileMessage) => Promise<void>;\n onPressMediaMessage?: (message: SendbirdFileMessage, deleteMessage: () => Promise<void>, uri: string) => void;\n\n renderMessage: (props: {\n message: SendbirdMessage;\n prevMessage?: SendbirdMessage;\n nextMessage?: SendbirdMessage;\n onPress?: () => void;\n onLongPress?: () => void;\n channel: GroupChannelProps['MessageList']['channel'];\n currentUserId?: GroupChannelProps['MessageList']['currentUserId'];\n enableMessageGrouping: GroupChannelProps['MessageList']['enableMessageGrouping'];\n }) => React.ReactElement | null;\n renderNewMessagesButton: null | CommonComponent<{\n visible: boolean;\n onPress: () => void;\n newMessages: SendbirdMessage[];\n }>;\n renderScrollToBottomButton: null | CommonComponent<{\n visible: boolean;\n onPress: () => void;\n }>;\n flatListProps?: Omit<FlatListProps<SendbirdMessage>, 'data' | 'renderItem'>;\n\n /** @deprecated `onPressImageMessage` is deprecated, please use `onPressMediaMessage` instead **/\n onPressImageMessage?: (message: SendbirdFileMessage, uri: string) => void;\n };\n Input: {\n shouldRenderInput: boolean;\n onSendFileMessage: (file: FileType) => Promise<void>;\n onSendUserMessage: (text: string) => Promise<void>;\n onUpdateFileMessage: (editedFile: FileType, message: SendbirdFileMessage) => Promise<void>;\n onUpdateUserMessage: (editedText: string, message: SendbirdUserMessage) => Promise<void>;\n };\n Provider: {\n channel: SendbirdGroupChannel;\n enableTypingIndicator: boolean;\n keyboardAvoidOffset?: number;\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 editMessage?: SendbirdUserMessage | SendbirdFileMessage;\n setEditMessage: (msg?: SendbirdUserMessage | SendbirdFileMessage) => void;\n keyboardAvoidOffset?: number;\n }>;\n TypingIndicator: React.Context<{\n typingUsers: SendbirdUser[];\n }>;\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 StatusEmpty: CommonComponent;\n StatusLoading: CommonComponent;\n}\n\nexport type GroupChannelFragment = CommonComponent<GroupChannelProps['Fragment']>;\n"],"mappings":""}
|