@amityco/ts-sdk-react-native 6.36.1-938a6a9.0 → 7.0.1-91b5585.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/dist/@types/core/events.d.ts +6 -6
- package/dist/@types/core/events.d.ts.map +1 -1
- package/dist/@types/domains/analytics.d.ts +0 -3
- package/dist/@types/domains/analytics.d.ts.map +1 -1
- package/dist/@types/domains/channel.d.ts +9 -33
- package/dist/@types/domains/channel.d.ts.map +1 -1
- package/dist/@types/domains/client.d.ts +0 -4
- package/dist/@types/domains/client.d.ts.map +1 -1
- package/dist/@types/domains/community.d.ts +2 -10
- package/dist/@types/domains/community.d.ts.map +1 -1
- package/dist/@types/domains/feed.d.ts +0 -11
- package/dist/@types/domains/feed.d.ts.map +1 -1
- package/dist/@types/domains/message.d.ts +0 -12
- package/dist/@types/domains/message.d.ts.map +1 -1
- package/dist/@types/domains/subChannel.d.ts +0 -4
- package/dist/@types/domains/subChannel.d.ts.map +1 -1
- package/dist/@types/domains/user.d.ts +1 -5
- package/dist/@types/domains/user.d.ts.map +1 -1
- package/dist/channelRepository/api/deleteChannel.d.ts.map +1 -1
- package/dist/channelRepository/api/index.d.ts +0 -1
- package/dist/channelRepository/api/index.d.ts.map +1 -1
- package/dist/channelRepository/channelMembership/observers/getMembers/ChannelMemberLiveCollectionController.d.ts.map +1 -1
- package/dist/channelRepository/channelMembership/observers/getMembers/getMembers.d.ts.map +1 -1
- package/dist/channelRepository/channelMembership/observers/searchMembers/SearchChannelMemberLiveCollectionController.d.ts.map +1 -1
- package/dist/channelRepository/channelMembership/observers/searchMembers/searchMembers.d.ts.map +1 -1
- package/dist/channelRepository/{api → internalApi}/getChannel.d.ts +2 -2
- package/dist/channelRepository/internalApi/getChannel.d.ts.map +1 -0
- package/dist/channelRepository/internalApi/getChannelByIds.d.ts +32 -0
- package/dist/channelRepository/internalApi/getChannelByIds.d.ts.map +1 -0
- package/dist/channelRepository/{api → internalApi}/markAsRead.d.ts +0 -3
- package/dist/channelRepository/internalApi/markAsRead.d.ts.map +1 -0
- package/dist/channelRepository/observers/getChannel.d.ts.map +1 -1
- package/dist/channelRepository/observers/getChannels/ChannelLiveCollectionController.d.ts.map +1 -1
- package/dist/channelRepository/observers/index.d.ts +0 -2
- package/dist/channelRepository/observers/index.d.ts.map +1 -1
- package/dist/channelRepository/utils/constructChannelDynamicValue.d.ts.map +1 -1
- package/dist/channelRepository/utils/constructChannelObject.d.ts +2 -0
- package/dist/channelRepository/utils/constructChannelObject.d.ts.map +1 -0
- package/dist/channelRepository/utils/getChannelIsMentioned.d.ts +1 -1
- package/dist/channelRepository/utils/getChannelIsMentioned.d.ts.map +1 -1
- package/dist/channelRepository/utils/getSubChannelsUnreadCount.d.ts +1 -1
- package/dist/channelRepository/utils/getSubChannelsUnreadCount.d.ts.map +1 -1
- package/dist/channelRepository/utils/resolveChannels.d.ts.map +1 -1
- package/dist/channelRepository/utils/updateChannelCache.d.ts +1 -1
- package/dist/channelRepository/utils/updateChannelCache.d.ts.map +1 -1
- package/dist/client/observers/index.d.ts +0 -1
- package/dist/client/observers/index.d.ts.map +1 -1
- package/dist/client/utils/endpoints.d.ts +1 -1
- package/dist/client/utils/markerSyncEngine.d.ts +0 -4
- package/dist/client/utils/markerSyncEngine.d.ts.map +1 -1
- package/dist/client/utils/subscribeGlobalTopic.d.ts.map +1 -1
- package/dist/commentRepository/observers/index.d.ts +0 -2
- package/dist/commentRepository/observers/index.d.ts.map +1 -1
- package/dist/communityRepository/api/index.d.ts +0 -1
- package/dist/communityRepository/api/index.d.ts.map +1 -1
- package/dist/communityRepository/api/queryCommunities.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersLiveCollectionController.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/getMembers.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersPaginationController.d.ts +1 -1
- package/dist/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersPaginationController.d.ts.map +1 -1
- package/dist/communityRepository/observers/getCommunities/CommunitiesLiveCollectionController.d.ts.map +1 -1
- package/dist/communityRepository/observers/getCommunities/CommunitiesPaginationController.d.ts.map +1 -1
- package/dist/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.d.ts.map +1 -1
- package/dist/communityRepository/observers/index.d.ts +0 -1
- package/dist/communityRepository/observers/index.d.ts.map +1 -1
- package/dist/communityRepository/observers/searchCommunities.d.ts +1 -1
- package/dist/communityRepository/observers/searchCommunities.d.ts.map +1 -1
- package/dist/communityRepository/utils/communityQueryFilter.d.ts.map +1 -1
- package/dist/core/events.d.ts +3 -3
- package/dist/core/events.d.ts.map +1 -1
- package/dist/core/subscription.d.ts +1 -0
- package/dist/core/subscription.d.ts.map +1 -1
- package/dist/feedRepository/api/getCustomRankingGlobalFeed.d.ts +2 -35
- package/dist/feedRepository/api/getCustomRankingGlobalFeed.d.ts.map +1 -1
- package/dist/feedRepository/api/queryGlobalFeed.d.ts +2 -24
- package/dist/feedRepository/api/queryGlobalFeed.d.ts.map +1 -1
- package/dist/fileRepository/api/index.d.ts +0 -3
- package/dist/fileRepository/api/index.d.ts.map +1 -1
- package/dist/fileRepository/index.d.ts +0 -1
- package/dist/fileRepository/index.d.ts.map +1 -1
- package/dist/index.cjs.js +1261 -2688
- package/dist/index.esm.js +1225 -2653
- package/dist/index.umd.js +3 -3
- package/dist/messagePreview/utils/getChannelMessagePreviewWithUser.d.ts +1 -5
- package/dist/messagePreview/utils/getChannelMessagePreviewWithUser.d.ts.map +1 -1
- package/dist/messagePreview/utils/getSubChannelMessagePreviewWithUser.d.ts +0 -1
- package/dist/messagePreview/utils/getSubChannelMessagePreviewWithUser.d.ts.map +1 -1
- package/dist/messageRepository/api/createMessage.d.ts.map +1 -1
- package/dist/messageRepository/api/index.d.ts +0 -1
- package/dist/messageRepository/api/index.d.ts.map +1 -1
- package/dist/messageRepository/internalApi/getMessage.d.ts.map +1 -1
- package/dist/messageRepository/observers/getMessages/MessageLiveCollectionController.d.ts.map +1 -1
- package/dist/messageRepository/observers/getMessages/MessageQueryStreamController.d.ts.map +1 -1
- package/dist/messageRepository/observers/getMessages/getMessages.d.ts +0 -1
- package/dist/messageRepository/observers/getMessages/getMessages.d.ts.map +1 -1
- package/dist/messageRepository/observers/index.d.ts +0 -2
- package/dist/messageRepository/observers/index.d.ts.map +1 -1
- package/dist/messageRepository/utils/prepareMessagePayload.d.ts +1 -1
- package/dist/messageRepository/utils/prepareMessagePayload.d.ts.map +1 -1
- package/dist/pollRepository/observers/index.d.ts +0 -1
- package/dist/pollRepository/observers/index.d.ts.map +1 -1
- package/dist/postRepository/api/index.d.ts +0 -1
- package/dist/postRepository/api/index.d.ts.map +1 -1
- package/dist/postRepository/observers/index.d.ts +0 -2
- package/dist/postRepository/observers/index.d.ts.map +1 -1
- package/dist/role/api/queryRoles.d.ts +0 -7
- package/dist/role/api/queryRoles.d.ts.map +1 -1
- package/dist/streamRepository/api/index.d.ts +0 -2
- package/dist/streamRepository/api/index.d.ts.map +1 -1
- package/dist/streamRepository/events/onStreamFlagged.d.ts.map +1 -1
- package/dist/streamRepository/internalApi/getStream.d.ts.map +1 -0
- package/dist/subChannelRepository/utils/markReadEngine.d.ts +0 -34
- package/dist/subChannelRepository/utils/markReadEngine.d.ts.map +1 -1
- package/dist/userRepository/internalApi/queryUsers.d.ts.map +1 -1
- package/dist/userRepository/observers/getUsers/UserLiveCollectionController.d.ts.map +1 -1
- package/dist/userRepository/observers/getUsers/UserPaginationController.d.ts.map +1 -1
- package/dist/userRepository/observers/index.d.ts +0 -2
- package/dist/userRepository/observers/index.d.ts.map +1 -1
- package/dist/userRepository/relationship/block/index.d.ts +0 -1
- package/dist/userRepository/relationship/block/index.d.ts.map +1 -1
- package/dist/userRepository/relationship/follow/api/index.d.ts +0 -2
- package/dist/userRepository/relationship/follow/api/index.d.ts.map +1 -1
- package/dist/userRepository/relationship/follow/observers/index.d.ts +0 -3
- package/dist/userRepository/relationship/follow/observers/index.d.ts.map +1 -1
- package/dist/utils/liveObject.d.ts +1 -1
- package/package.json +1 -1
- package/src/@types/core/events.ts +8 -9
- package/src/@types/domains/analytics.ts +0 -7
- package/src/@types/domains/channel.ts +15 -46
- package/src/@types/domains/client.ts +0 -4
- package/src/@types/domains/community.ts +0 -8
- package/src/@types/domains/feed.ts +0 -11
- package/src/@types/domains/message.ts +0 -12
- package/src/@types/domains/subChannel.ts +0 -4
- package/src/@types/domains/user.ts +0 -4
- package/src/channelRepository/api/deleteChannel.ts +3 -2
- package/src/channelRepository/api/getChannelByIds.ts +5 -5
- package/src/channelRepository/api/index.ts +0 -2
- package/src/channelRepository/channelMembership/observers/getMembers/ChannelMemberLiveCollectionController.ts +0 -8
- package/src/channelRepository/channelMembership/observers/getMembers/getMembers.ts +0 -8
- package/src/channelRepository/channelMembership/observers/searchMembers/SearchChannelMemberLiveCollectionController.ts +0 -8
- package/src/channelRepository/channelMembership/observers/searchMembers/searchMembers.ts +0 -8
- package/src/channelRepository/{api → internalApi}/getChannel.ts +4 -4
- package/src/channelRepository/internalApi/getChannelByIds.ts +105 -0
- package/src/channelRepository/{api → internalApi}/markAsRead.ts +0 -3
- package/src/channelRepository/observers/getChannel.ts +36 -15
- package/src/channelRepository/observers/getChannels/ChannelLiveCollectionController.ts +11 -12
- package/src/channelRepository/observers/index.ts +0 -2
- package/src/channelRepository/utils/constructChannelDynamicValue.ts +4 -9
- package/src/channelRepository/utils/constructChannelObject.ts +16 -0
- package/src/channelRepository/utils/getChannelIsMentioned.ts +4 -1
- package/src/channelRepository/utils/getSubChannelsUnreadCount.ts +1 -1
- package/src/channelRepository/utils/resolveChannels.ts +7 -2
- package/src/channelRepository/utils/updateChannelCache.ts +4 -1
- package/src/client/observers/getUserUnread.ts +1 -1
- package/src/client/observers/index.ts +0 -1
- package/src/client/utils/endpoints.ts +1 -1
- package/src/client/utils/markerSyncEngine.ts +0 -9
- package/src/client/utils/subscribeGlobalTopic.ts +3 -0
- package/src/commentRepository/observers/index.ts +0 -2
- package/src/communityRepository/api/index.ts +0 -3
- package/src/communityRepository/api/queryCommunities.ts +1 -2
- package/src/communityRepository/communityMembership/observers/getMembers/CommunityMembersLiveCollectionController.ts +0 -12
- package/src/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.ts +0 -7
- package/src/communityRepository/communityMembership/observers/getMembers.ts +0 -4
- package/src/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersPaginationController.ts +1 -1
- package/src/communityRepository/communityMembership/observers/tests/getMembers.test.ts +0 -1
- package/src/communityRepository/observers/getCommunities/CommunitiesLiveCollectionController.ts +12 -16
- package/src/communityRepository/observers/getCommunities/CommunitiesPaginationController.ts +0 -1
- package/src/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.ts +0 -4
- package/src/communityRepository/observers/index.ts +0 -2
- package/src/communityRepository/observers/searchCommunities.ts +1 -1
- package/src/communityRepository/observers/tests/getCommunities.test.ts +0 -1
- package/src/communityRepository/utils/communityQueryFilter.ts +1 -8
- package/src/core/events.ts +7 -5
- package/src/core/subscription.ts +6 -0
- package/src/feedRepository/api/getCustomRankingGlobalFeed.ts +8 -55
- package/src/feedRepository/api/queryGlobalFeed.ts +6 -58
- package/src/feedRepository/api/test/getCustomRankingGlobalFeed.test.ts +1 -1
- package/src/feedRepository/api/test/queryGlobalFeed.test.ts +1 -1
- package/src/fileRepository/api/index.ts +0 -5
- package/src/fileRepository/index.ts +0 -1
- package/src/liveStreamPlayer/api/getPlayer.ts +1 -1
- package/src/messagePreview/utils/getChannelMessagePreviewWithUser.ts +2 -2
- package/src/messageRepository/api/createMessage.ts +5 -1
- package/src/messageRepository/api/index.ts +0 -2
- package/src/messageRepository/api/tests/createMessage.test.ts +6 -1
- package/src/messageRepository/api/tests/deleteMessage.test.ts +5 -1
- package/src/messageRepository/internalApi/getMessage.ts +0 -6
- package/src/messageRepository/observers/getMessages/MessageLiveCollectionController.ts +0 -20
- package/src/messageRepository/observers/getMessages/MessageQueryStreamController.ts +0 -10
- package/src/messageRepository/observers/getMessages/getMessages.ts +0 -54
- package/src/messageRepository/observers/index.ts +0 -3
- package/src/messageRepository/utils/prepareMessagePayload.ts +1 -7
- package/src/pollRepository/observers/index.ts +0 -1
- package/src/postRepository/api/index.ts +0 -1
- package/src/postRepository/observers/index.ts +0 -2
- package/src/role/api/queryRoles.ts +1 -13
- package/src/streamRepository/api/deleteStream.ts +1 -1
- package/src/streamRepository/api/index.ts +0 -4
- package/src/streamRepository/api/tests/getStream.test.ts +1 -1
- package/src/streamRepository/events/onStreamFlagged.ts +1 -6
- package/src/streamRepository/events/onStreamRecorded.ts +1 -1
- package/src/streamRepository/events/onStreamStarted.ts +1 -1
- package/src/streamRepository/events/onStreamStopped.ts +1 -1
- package/src/streamRepository/events/onStreamTerminated.ts +1 -1
- package/src/streamRepository/observers/getStreamById.ts +1 -1
- package/src/subChannelRepository/utils/markReadEngine.ts +0 -106
- package/src/userRepository/internalApi/queryUsers.ts +1 -9
- package/src/userRepository/observers/getUsers/UserLiveCollectionController.ts +12 -16
- package/src/userRepository/observers/getUsers/UserPaginationController.ts +1 -2
- package/src/userRepository/observers/index.ts +0 -2
- package/src/userRepository/observers/tests/getUsers.test.ts +1 -43
- package/src/userRepository/relationship/block/index.ts +0 -1
- package/src/userRepository/relationship/follow/api/index.ts +0 -4
- package/src/userRepository/relationship/follow/observers/index.ts +0 -4
- package/src/utils/linkedObject/channelLinkedObject.ts +1 -1
- package/src/utils/liveObject.ts +2 -2
- package/dist/channelRepository/api/getChannel.d.ts.map +0 -1
- package/dist/channelRepository/api/markAsRead.d.ts.map +0 -1
- package/dist/channelRepository/observers/observeChannel.d.ts +0 -18
- package/dist/channelRepository/observers/observeChannel.d.ts.map +0 -1
- package/dist/channelRepository/observers/observeChannels.d.ts +0 -17
- package/dist/channelRepository/observers/observeChannels.d.ts.map +0 -1
- package/dist/client/observers/getTotalUnreadCount.d.ts +0 -20
- package/dist/client/observers/getTotalUnreadCount.d.ts.map +0 -1
- package/dist/client/observers/tests/getTotalUnreadCount.test.d.ts +0 -2
- package/dist/client/observers/tests/getTotalUnreadCount.test.d.ts.map +0 -1
- package/dist/commentRepository/observers/observeComment.d.ts +0 -18
- package/dist/commentRepository/observers/observeComment.d.ts.map +0 -1
- package/dist/commentRepository/observers/observeComments.d.ts +0 -26
- package/dist/commentRepository/observers/observeComments.d.ts.map +0 -1
- package/dist/communityRepository/api/getTopTrendingCommunities.d.ts +0 -35
- package/dist/communityRepository/api/getTopTrendingCommunities.d.ts.map +0 -1
- package/dist/communityRepository/api/test/getTopTrendingCommunities.test.d.ts +0 -2
- package/dist/communityRepository/api/test/getTopTrendingCommunities.test.d.ts.map +0 -1
- package/dist/communityRepository/observers/observeCommunity.d.ts +0 -18
- package/dist/communityRepository/observers/observeCommunity.d.ts.map +0 -1
- package/dist/feedRepository/internalApi/getCustomRankingGlobalFeed.d.ts +0 -8
- package/dist/feedRepository/internalApi/getCustomRankingGlobalFeed.d.ts.map +0 -1
- package/dist/feedRepository/internalApi/index.d.ts +0 -3
- package/dist/feedRepository/internalApi/index.d.ts.map +0 -1
- package/dist/feedRepository/internalApi/queryGlobalFeed.d.ts +0 -9
- package/dist/feedRepository/internalApi/queryGlobalFeed.d.ts.map +0 -1
- package/dist/feedRepository/internalApi/test/getCustomRankingGlobalFeed.test.d.ts +0 -2
- package/dist/feedRepository/internalApi/test/getCustomRankingGlobalFeed.test.d.ts.map +0 -1
- package/dist/feedRepository/internalApi/test/queryGlobalFeed.test.d.ts +0 -2
- package/dist/feedRepository/internalApi/test/queryGlobalFeed.test.d.ts.map +0 -1
- package/dist/fileRepository/api/createFile.d.ts +0 -17
- package/dist/fileRepository/api/createFile.d.ts.map +0 -1
- package/dist/fileRepository/api/createImage.d.ts +0 -17
- package/dist/fileRepository/api/createImage.d.ts.map +0 -1
- package/dist/fileRepository/api/createVideo.d.ts +0 -18
- package/dist/fileRepository/api/createVideo.d.ts.map +0 -1
- package/dist/fileRepository/observers/index.d.ts +0 -2
- package/dist/fileRepository/observers/index.d.ts.map +0 -1
- package/dist/fileRepository/observers/observeFile.d.ts +0 -18
- package/dist/fileRepository/observers/observeFile.d.ts.map +0 -1
- package/dist/messageRepository/api/getMessage.d.ts +0 -32
- package/dist/messageRepository/api/getMessage.d.ts.map +0 -1
- package/dist/messageRepository/api/getMessages.d.ts +0 -32
- package/dist/messageRepository/api/getMessages.d.ts.map +0 -1
- package/dist/messageRepository/observers/observeMessage.d.ts +0 -21
- package/dist/messageRepository/observers/observeMessage.d.ts.map +0 -1
- package/dist/messageRepository/observers/observeMessages.d.ts +0 -23
- package/dist/messageRepository/observers/observeMessages.d.ts.map +0 -1
- package/dist/pollRepository/observers/observePoll.d.ts +0 -18
- package/dist/pollRepository/observers/observePoll.d.ts.map +0 -1
- package/dist/postRepository/api/updatePost.d.ts +0 -24
- package/dist/postRepository/api/updatePost.d.ts.map +0 -1
- package/dist/postRepository/observers/observePost.d.ts +0 -18
- package/dist/postRepository/observers/observePost.d.ts.map +0 -1
- package/dist/postRepository/observers/observePosts.d.ts +0 -34
- package/dist/postRepository/observers/observePosts.d.ts.map +0 -1
- package/dist/streamRepository/api/getStream.d.ts.map +0 -1
- package/dist/streamRepository/api/queryStreams.d.ts +0 -25
- package/dist/streamRepository/api/queryStreams.d.ts.map +0 -1
- package/dist/userRepository/observers/getViewedUsers.d.ts +0 -7
- package/dist/userRepository/observers/getViewedUsers.d.ts.map +0 -1
- package/dist/userRepository/observers/observeUser.d.ts +0 -17
- package/dist/userRepository/observers/observeUser.d.ts.map +0 -1
- package/dist/userRepository/observers/tests/getViewedUsers.test.d.ts +0 -2
- package/dist/userRepository/observers/tests/getViewedUsers.test.d.ts.map +0 -1
- package/dist/userRepository/relationship/block/observers/getBlockedUsers.d.ts +0 -2
- package/dist/userRepository/relationship/block/observers/getBlockedUsers.d.ts.map +0 -1
- package/dist/userRepository/relationship/block/observers/index.d.ts +0 -2
- package/dist/userRepository/relationship/block/observers/index.d.ts.map +0 -1
- package/dist/userRepository/relationship/follow/api/acceptFollower.d.ts +0 -19
- package/dist/userRepository/relationship/follow/api/acceptFollower.d.ts.map +0 -1
- package/dist/userRepository/relationship/follow/api/declineFollower.d.ts +0 -19
- package/dist/userRepository/relationship/follow/api/declineFollower.d.ts.map +0 -1
- package/dist/userRepository/relationship/follow/observers/observeFollowInfo.d.ts +0 -18
- package/dist/userRepository/relationship/follow/observers/observeFollowInfo.d.ts.map +0 -1
- package/dist/userRepository/relationship/follow/observers/observeFollowers.d.ts +0 -18
- package/dist/userRepository/relationship/follow/observers/observeFollowers.d.ts.map +0 -1
- package/dist/userRepository/relationship/follow/observers/observeFollowings.d.ts +0 -18
- package/dist/userRepository/relationship/follow/observers/observeFollowings.d.ts.map +0 -1
- package/src/channelRepository/observers/observeChannel.ts +0 -109
- package/src/channelRepository/observers/observeChannels.ts +0 -74
- package/src/client/observers/getTotalUnreadCount.ts +0 -53
- package/src/client/observers/tests/getTotalUnreadCount.test.ts +0 -101
- package/src/commentRepository/observers/observeComment.ts +0 -102
- package/src/commentRepository/observers/observeComments.ts +0 -77
- package/src/communityRepository/api/getTopTrendingCommunities.ts +0 -97
- package/src/communityRepository/api/test/getTopTrendingCommunities.test.ts +0 -102
- package/src/communityRepository/observers/observeCommunity.ts +0 -103
- package/src/feedRepository/internalApi/getCustomRankingGlobalFeed.ts +0 -87
- package/src/feedRepository/internalApi/index.ts +0 -2
- package/src/feedRepository/internalApi/queryGlobalFeed.ts +0 -95
- package/src/feedRepository/internalApi/test/getCustomRankingGlobalFeed.test.ts +0 -138
- package/src/feedRepository/internalApi/test/queryGlobalFeed.test.ts +0 -130
- package/src/fileRepository/api/createFile.ts +0 -59
- package/src/fileRepository/api/createImage.ts +0 -59
- package/src/fileRepository/api/createVideo.ts +0 -69
- package/src/fileRepository/observers/index.ts +0 -1
- package/src/fileRepository/observers/observeFile.ts +0 -49
- package/src/messageRepository/api/getMessage.ts +0 -102
- package/src/messageRepository/api/getMessages.ts +0 -83
- package/src/messageRepository/observers/observeMessage.ts +0 -94
- package/src/messageRepository/observers/observeMessages.ts +0 -89
- package/src/pollRepository/observers/observePoll.ts +0 -67
- package/src/postRepository/api/updatePost.ts +0 -63
- package/src/postRepository/observers/observePost.ts +0 -115
- package/src/postRepository/observers/observePosts.ts +0 -86
- package/src/streamRepository/api/queryStreams.ts +0 -63
- package/src/userRepository/observers/getViewedUsers.ts +0 -99
- package/src/userRepository/observers/observeUser.ts +0 -71
- package/src/userRepository/observers/tests/getViewedUsers.test.ts +0 -39
- package/src/userRepository/relationship/block/observers/getBlockedUsers.ts +0 -13
- package/src/userRepository/relationship/block/observers/index.ts +0 -1
- package/src/userRepository/relationship/follow/api/acceptFollower.ts +0 -40
- package/src/userRepository/relationship/follow/api/declineFollower.ts +0 -40
- package/src/userRepository/relationship/follow/observers/observeFollowInfo.ts +0 -64
- package/src/userRepository/relationship/follow/observers/observeFollowers.ts +0 -74
- package/src/userRepository/relationship/follow/observers/observeFollowings.ts +0 -74
- /package/dist/streamRepository/{api → internalApi}/getStream.d.ts +0 -0
- /package/src/streamRepository/{api → internalApi}/getStream.ts +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getActiveClient } from '~/client/api';
|
|
2
2
|
|
|
3
|
-
import { getChannel } from '
|
|
3
|
+
import { getChannel } from '../internalApi/getChannel';
|
|
4
|
+
import { constructChannelDynamicValue } from '../utils/constructChannelDynamicValue';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* ```js
|
|
@@ -29,5 +30,5 @@ export const deleteChannel = async (
|
|
|
29
30
|
const deleted = await getChannel(channelId);
|
|
30
31
|
// no need for event, fired by server
|
|
31
32
|
|
|
32
|
-
return deleted.data;
|
|
33
|
+
return constructChannelDynamicValue(deleted.data);
|
|
33
34
|
};
|
|
@@ -8,8 +8,8 @@ import { pushToTombstone } from '~/cache/api/pushToTombstone';
|
|
|
8
8
|
import { prepareChannelPayload } from '../utils';
|
|
9
9
|
import { fireEvent } from '~/core/events';
|
|
10
10
|
import { prepareUnreadCountInfo } from '../utils/prepareUnreadCountInfo';
|
|
11
|
-
|
|
12
|
-
import {
|
|
11
|
+
|
|
12
|
+
import { constructChannelObject } from '../utils/constructChannelObject';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* ```js
|
|
@@ -65,7 +65,7 @@ export const getChannelByIds = async (
|
|
|
65
65
|
fireEvent('local.channel.fetched', data.channels);
|
|
66
66
|
|
|
67
67
|
return {
|
|
68
|
-
data: data.channels.map(channel =>
|
|
68
|
+
data: data.channels.map(channel => constructChannelObject(channel)),
|
|
69
69
|
cachedAt,
|
|
70
70
|
};
|
|
71
71
|
};
|
|
@@ -91,7 +91,7 @@ getChannelByIds.locally = (
|
|
|
91
91
|
|
|
92
92
|
if (!client.cache) return;
|
|
93
93
|
|
|
94
|
-
const cached = queryCache<Amity.
|
|
94
|
+
const cached = queryCache<Amity.StaticInternalChannel>(['channel', 'get'])?.filter(({ data }) => {
|
|
95
95
|
return channelIds.includes(data.channelPublicId);
|
|
96
96
|
});
|
|
97
97
|
|
|
@@ -101,7 +101,7 @@ getChannelByIds.locally = (
|
|
|
101
101
|
const oldest = cached.sort((a, b) => (a.cachedAt! < b.cachedAt! ? -1 : 1))?.[0];
|
|
102
102
|
|
|
103
103
|
return {
|
|
104
|
-
data: channels.map(channel =>
|
|
104
|
+
data: channels.map(channel => constructChannelObject(channel)),
|
|
105
105
|
cachedAt: oldest.cachedAt,
|
|
106
106
|
};
|
|
107
107
|
};
|
|
@@ -137,14 +137,6 @@ export class ChannelMemberLiveCollectionController extends LiveCollectionControl
|
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
if (this.query.search) {
|
|
141
|
-
// eslint-disable-next-line no-console
|
|
142
|
-
console.warn(
|
|
143
|
-
'`search` param will be deprecated in the next major release. If you want to search channel members by displayName, Please use `searchMembers()` instead.',
|
|
144
|
-
);
|
|
145
|
-
channelMembers = filterBySearchTerm(channelMembers, this.query.search);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
140
|
if (this.query.includeDeleted === false) {
|
|
149
141
|
channelMembers = channelMembers.filter(member => member.user?.isDeleted !== true);
|
|
150
142
|
}
|
|
@@ -38,14 +38,6 @@ export const applyFilter = <T extends Amity.Membership<'channel'>>(
|
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
if (params.search) {
|
|
42
|
-
// eslint-disable-next-line no-console
|
|
43
|
-
console.warn(
|
|
44
|
-
'`search` param will be deprecated in the next major release. If you want to search channel members by displayName, Please use `searchMembers()` instead.',
|
|
45
|
-
);
|
|
46
|
-
channelMembers = filterBySearchTerm(channelMembers, params.search);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
41
|
// sort, 'lastCreated' is the default sort order
|
|
50
42
|
const sortBy = params.sortBy ? params.sortBy : 'lastCreated';
|
|
51
43
|
channelMembers = channelMembers.sort(
|
|
@@ -135,14 +135,6 @@ export class SearchChannelMemberLiveCollectionController extends LiveCollectionC
|
|
|
135
135
|
channelMembers = channelMembers.filter(member => member.user?.isDeleted !== true);
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
if (this.query.search) {
|
|
139
|
-
// eslint-disable-next-line no-console
|
|
140
|
-
console.warn(
|
|
141
|
-
'`search` param will be deprecated in the next major release. If you want to search channel members by displayName, Please use `searchMembers()` instead.',
|
|
142
|
-
);
|
|
143
|
-
channelMembers = filterBySearchTerm(channelMembers, this.query.search);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
138
|
return channelMembers;
|
|
147
139
|
}
|
|
148
140
|
}
|
|
@@ -38,14 +38,6 @@ export const applyFilter = <T extends Amity.Membership<'channel'>>(
|
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
if (params.search) {
|
|
42
|
-
// eslint-disable-next-line no-console
|
|
43
|
-
console.warn(
|
|
44
|
-
'`search` param will be deprecated in the next major release. If you want to search channel members by displayName, Please use `searchMembers()` instead.',
|
|
45
|
-
);
|
|
46
|
-
channelMembers = filterBySearchTerm(channelMembers, params.search);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
41
|
// sort, 'lastCreated' is the default sort order
|
|
50
42
|
const sortBy = params.sortBy ? params.sortBy : 'lastCreated';
|
|
51
43
|
channelMembers = channelMembers.sort(
|
|
@@ -27,7 +27,7 @@ import { constructChannelDynamicValue } from '../utils/constructChannelDynamicVa
|
|
|
27
27
|
*/
|
|
28
28
|
export const getChannel = async (
|
|
29
29
|
channelId: Amity.Channel['channelPublicId'],
|
|
30
|
-
): Promise<Amity.Cached<Amity.
|
|
30
|
+
): Promise<Amity.Cached<Amity.StaticInternalChannel>> => {
|
|
31
31
|
const client = getActiveClient();
|
|
32
32
|
client.log('channel/getChannel', channelId);
|
|
33
33
|
|
|
@@ -60,7 +60,7 @@ export const getChannel = async (
|
|
|
60
60
|
const { channels } = data;
|
|
61
61
|
|
|
62
62
|
return {
|
|
63
|
-
data:
|
|
63
|
+
data: channels.find(channel => channel.channelId === channelId)!,
|
|
64
64
|
cachedAt,
|
|
65
65
|
};
|
|
66
66
|
};
|
|
@@ -80,7 +80,7 @@ export const getChannel = async (
|
|
|
80
80
|
*/
|
|
81
81
|
getChannel.locally = (
|
|
82
82
|
channelId: Amity.Channel['channelPublicId'],
|
|
83
|
-
): Amity.Cached<Amity.
|
|
83
|
+
): Amity.Cached<Amity.StaticInternalChannel> | undefined => {
|
|
84
84
|
const client = getActiveClient();
|
|
85
85
|
client.log('channel/getChannel.locally', channelId);
|
|
86
86
|
|
|
@@ -94,7 +94,7 @@ getChannel.locally = (
|
|
|
94
94
|
if (!cached || cached?.length === 0) return;
|
|
95
95
|
|
|
96
96
|
return {
|
|
97
|
-
data:
|
|
97
|
+
data: cached[0].data,
|
|
98
98
|
cachedAt: cached[0].cachedAt,
|
|
99
99
|
};
|
|
100
100
|
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api/activeClient';
|
|
2
|
+
|
|
3
|
+
import { queryCache } from '~/cache/api';
|
|
4
|
+
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
5
|
+
|
|
6
|
+
import { checkIfShouldGoesToTombstone } from '~/cache/utils';
|
|
7
|
+
import { pushToTombstone } from '~/cache/api/pushToTombstone';
|
|
8
|
+
import { prepareChannelPayload } from '../utils';
|
|
9
|
+
import { fireEvent } from '~/core/events';
|
|
10
|
+
import { prepareUnreadCountInfo } from '../utils/prepareUnreadCountInfo';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* ```js
|
|
14
|
+
* import { getChannelByIds } from '@amityco/ts-sdk'
|
|
15
|
+
* const channels = await getChannelByIds(['foo', 'bar'])
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* Fetches a collection of {@link Amity.Channel} objects
|
|
19
|
+
*
|
|
20
|
+
* @param channelIds the IDs of the {@link Amity.Channel} to fetch
|
|
21
|
+
* @returns the associated collection of {@link Amity.Channel} objects
|
|
22
|
+
*
|
|
23
|
+
* @category Channel API
|
|
24
|
+
* @async
|
|
25
|
+
*/
|
|
26
|
+
export const getChannelByIds = async (
|
|
27
|
+
channelIds: Amity.Channel['channelPublicId'][],
|
|
28
|
+
): Promise<Amity.Cached<Amity.StaticInternalChannel[]>> => {
|
|
29
|
+
const client = getActiveClient();
|
|
30
|
+
client.log('channel/getChannelByIds', channelIds);
|
|
31
|
+
|
|
32
|
+
const encodedChannelIds = channelIds.map(channelId => encodeURIComponent(channelId));
|
|
33
|
+
|
|
34
|
+
let payload: Amity.ChannelPayload;
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
// API-FIX: endpoint should not be /list, parameters should be querystring.
|
|
38
|
+
const response = await client.http.get<Amity.ChannelPayload>(`/api/v3/channels/list`, {
|
|
39
|
+
params: { channelIds: encodedChannelIds },
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
payload = response.data;
|
|
43
|
+
} catch (error) {
|
|
44
|
+
channelIds.forEach(channelId => {
|
|
45
|
+
if (checkIfShouldGoesToTombstone((error as Amity.ErrorResponse)?.code)) {
|
|
46
|
+
// NOTE: use channelPublicId as tombstone cache key since we cannot get the channelPrivateId that come along with channel data from server
|
|
47
|
+
pushToTombstone('channel', channelId);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const data = await prepareChannelPayload(payload);
|
|
55
|
+
|
|
56
|
+
if (client.isUnreadCountEnabled && client.getMarkerSyncConsistentMode()) {
|
|
57
|
+
await prepareUnreadCountInfo(payload);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const cachedAt = client.cache && Date.now();
|
|
61
|
+
if (client.cache) ingestInCache(data, { cachedAt });
|
|
62
|
+
|
|
63
|
+
fireEvent('local.channel.fetched', data.channels);
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
data: data.channels,
|
|
67
|
+
cachedAt,
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* ```js
|
|
73
|
+
* import { getChannelByIds } from '@amityco/ts-sdk'
|
|
74
|
+
* const channels = getChannelByIds.locally(['foo', 'bar']) ?? []
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* Fetches a collection of {@link Amity.Channel} objects from cache
|
|
78
|
+
*
|
|
79
|
+
* @param channelIds the IDs of the {@link Amity.Channel} to fetch
|
|
80
|
+
* @returns the associated collection of {@link Amity.Channel} objects
|
|
81
|
+
*
|
|
82
|
+
* @category Channel API
|
|
83
|
+
*/
|
|
84
|
+
getChannelByIds.locally = (
|
|
85
|
+
channelIds: Amity.Channel['channelPublicId'][],
|
|
86
|
+
): Amity.Cached<Amity.StaticInternalChannel[]> | undefined => {
|
|
87
|
+
const client = getActiveClient();
|
|
88
|
+
client.log('channel/getChannelByIds.locally', channelIds);
|
|
89
|
+
|
|
90
|
+
if (!client.cache) return;
|
|
91
|
+
|
|
92
|
+
const cached = queryCache<Amity.StaticInternalChannel>(['channel', 'get'])?.filter(({ data }) => {
|
|
93
|
+
return channelIds.includes(data.channelPublicId);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
if (!cached || cached?.length < channelIds.length) return;
|
|
97
|
+
|
|
98
|
+
const channels = cached.map(({ data }) => data);
|
|
99
|
+
const oldest = cached.sort((a, b) => (a.cachedAt! < b.cachedAt! ? -1 : 1))?.[0];
|
|
100
|
+
|
|
101
|
+
return {
|
|
102
|
+
data: channels,
|
|
103
|
+
cachedAt: oldest.cachedAt,
|
|
104
|
+
};
|
|
105
|
+
};
|
|
@@ -8,9 +8,6 @@ import { fireEvent } from '~/core/events';
|
|
|
8
8
|
* import { ChannelRepository } from '@amityco/ts-sdk-react-native'
|
|
9
9
|
* const success = await ChannelRepository.markAsRead('channelId')
|
|
10
10
|
* ```
|
|
11
|
-
*
|
|
12
|
-
* @deprecated Please use the {@link Amity.Channel.markAsRead} method instead
|
|
13
|
-
*
|
|
14
11
|
* Updating all {@link Amity.SubChannel} in specify {@link Amity.Channel} as read
|
|
15
12
|
*
|
|
16
13
|
* @param channelId the ID of to specify {@link Amity.Channel}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { convertEventPayload } from '~/utils/event';
|
|
2
2
|
import { onChannelMarkerFetched } from '~/marker/events';
|
|
3
3
|
import { liveObject } from '~/utils/liveObject';
|
|
4
|
-
import { getChannel as _getChannel } from '../
|
|
4
|
+
import { getChannel as _getChannel } from '../internalApi/getChannel';
|
|
5
5
|
import {
|
|
6
6
|
onChannelDeleted,
|
|
7
7
|
onChannelJoined,
|
|
@@ -28,14 +28,12 @@ import {
|
|
|
28
28
|
handleSubChannelUpdated,
|
|
29
29
|
} from '~/messagePreview/utils/updateMessagePreviewFromMessage';
|
|
30
30
|
import { getActiveClient } from '~/client/api/activeClient';
|
|
31
|
-
import { getChannelMessagePreviewWithUser } from '~/messagePreview/utils';
|
|
32
31
|
import { isEqual } from '~/utils/isEqual';
|
|
33
32
|
import { updateChannelCache } from '../utils/updateChannelCache';
|
|
34
33
|
import { onChannelMarkerUpdated } from '~/marker/events/onChannelMarkerUpdated';
|
|
35
34
|
import { onSubChannelCreated } from '~/subChannelRepository';
|
|
36
|
-
import { LinkedObject } from '~/utils/linkedObject';
|
|
37
35
|
import { onChannelUnreadUpdatedLocal } from '~/marker/events/onChannelUnreadUpdatedLocal';
|
|
38
|
-
import {
|
|
36
|
+
import { constructChannelObject } from '../utils/constructChannelObject';
|
|
39
37
|
|
|
40
38
|
/* begin_public_function
|
|
41
39
|
id: channel.get
|
|
@@ -68,15 +66,14 @@ export const getChannel = (
|
|
|
68
66
|
let snapshot: Omit<Amity.LiveObjectCallback<Amity.Channel>, 'origin'>;
|
|
69
67
|
|
|
70
68
|
const reactor = async (
|
|
71
|
-
response: Amity.LiveObject<Amity.
|
|
69
|
+
response: Amity.LiveObject<Amity.StaticInternalChannel<any>>,
|
|
72
70
|
): Promise<Amity.LiveObjectCallback<Amity.Channel> | undefined> => {
|
|
73
|
-
if (!response.data) return callback(response as Amity.LiveObject<Amity.Channel>);
|
|
71
|
+
if (!response.data) return callback(response as unknown as Amity.LiveObject<Amity.Channel>);
|
|
74
72
|
|
|
75
73
|
const data = {
|
|
76
74
|
...response,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
),
|
|
75
|
+
|
|
76
|
+
data: constructChannelObject(response.data),
|
|
80
77
|
};
|
|
81
78
|
|
|
82
79
|
const { origin, ...newSnapshot } = data;
|
|
@@ -120,7 +117,11 @@ export const getChannel = (
|
|
|
120
117
|
if (message.channelId !== channelId) return;
|
|
121
118
|
|
|
122
119
|
// channelId from message is channelInternalId
|
|
123
|
-
const channel = pullFromCache<Amity.
|
|
120
|
+
const channel = pullFromCache<Amity.StaticInternalChannel>([
|
|
121
|
+
'channel',
|
|
122
|
+
'get',
|
|
123
|
+
channelId,
|
|
124
|
+
])?.data;
|
|
124
125
|
if (!channel) return;
|
|
125
126
|
|
|
126
127
|
updateChannelCache(channel, {
|
|
@@ -149,7 +150,11 @@ export const getChannel = (
|
|
|
149
150
|
if (message.channelId !== channelId) return;
|
|
150
151
|
|
|
151
152
|
// channelId from message is channelInternalId
|
|
152
|
-
const channel = pullFromCache<Amity.
|
|
153
|
+
const channel = pullFromCache<Amity.StaticInternalChannel>([
|
|
154
|
+
'channel',
|
|
155
|
+
'get',
|
|
156
|
+
channelId,
|
|
157
|
+
])?.data;
|
|
153
158
|
if (!channel) return;
|
|
154
159
|
|
|
155
160
|
updateChannelCache(channel, {
|
|
@@ -167,7 +172,11 @@ export const getChannel = (
|
|
|
167
172
|
convertEventPayload(
|
|
168
173
|
(callback: Amity.Listener<Amity.InternalMessage>) => {
|
|
169
174
|
const updateMessagePreview = async (message: Amity.InternalMessage) => {
|
|
170
|
-
const channel = pullFromCache<Amity.
|
|
175
|
+
const channel = pullFromCache<Amity.StaticInternalChannel>([
|
|
176
|
+
'channel',
|
|
177
|
+
'get',
|
|
178
|
+
channelId,
|
|
179
|
+
])?.data;
|
|
171
180
|
if (!channel || channel.messagePreviewId !== message.messageId) return;
|
|
172
181
|
|
|
173
182
|
const messagePreviewSetting = await client.getMessagePreviewSetting(false);
|
|
@@ -187,7 +196,11 @@ export const getChannel = (
|
|
|
187
196
|
convertEventPayload(
|
|
188
197
|
(callback: Amity.Listener<Amity.InternalMessage>) => {
|
|
189
198
|
const updateMessagePreview = async (message: Amity.InternalMessage) => {
|
|
190
|
-
const channel = pullFromCache<Amity.
|
|
199
|
+
const channel = pullFromCache<Amity.StaticInternalChannel>([
|
|
200
|
+
'channel',
|
|
201
|
+
'get',
|
|
202
|
+
channelId,
|
|
203
|
+
])?.data;
|
|
191
204
|
if (!channel || channel.messagePreviewId !== message.messageId) return;
|
|
192
205
|
|
|
193
206
|
const messagePreviewSetting = await client.getMessagePreviewSetting(false);
|
|
@@ -230,7 +243,11 @@ export const getChannel = (
|
|
|
230
243
|
|
|
231
244
|
await _getChannel(channelId);
|
|
232
245
|
|
|
233
|
-
const channel = pullFromCache<Amity.
|
|
246
|
+
const channel = pullFromCache<Amity.StaticInternalChannel>([
|
|
247
|
+
'channel',
|
|
248
|
+
'get',
|
|
249
|
+
channelId,
|
|
250
|
+
])?.data;
|
|
234
251
|
if (!channel) return;
|
|
235
252
|
|
|
236
253
|
callback(subChannel);
|
|
@@ -262,7 +279,11 @@ export const getChannel = (
|
|
|
262
279
|
)
|
|
263
280
|
return;
|
|
264
281
|
|
|
265
|
-
const channel = pullFromCache<Amity.
|
|
282
|
+
const channel = pullFromCache<Amity.StaticInternalChannel>([
|
|
283
|
+
'channel',
|
|
284
|
+
'get',
|
|
285
|
+
channelId,
|
|
286
|
+
])?.data;
|
|
266
287
|
if (!channel) return;
|
|
267
288
|
|
|
268
289
|
callback(subChannel);
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
handleMessageUpdated,
|
|
44
44
|
handleSubChannelUpdated,
|
|
45
45
|
} from '~/messagePreview/utils';
|
|
46
|
-
import { getChannel } from '~/channelRepository/
|
|
46
|
+
import { getChannel } from '~/channelRepository/internalApi/getChannel';
|
|
47
47
|
import { getActiveClient } from '~/client';
|
|
48
48
|
import { prepareChannelPayload } from '~/channelRepository/utils';
|
|
49
49
|
import { ChannelPaginationNoPageController } from './ChannelPagnationNoPageController';
|
|
@@ -55,9 +55,8 @@ import { prepareUnreadCountInfo } from '~/channelRepository/utils/prepareUnreadC
|
|
|
55
55
|
import { resolveUnreadInfoOnChannelEvent } from '~/channelRepository/utils/resolveUnreadInfoOnChannelEvent';
|
|
56
56
|
import { onChannelResolved } from '~/channelRepository/events/onChannelResolved';
|
|
57
57
|
import { onUserMessageFeedMarkerResolved } from '~/marker/events/onUserMessageFeedMarkerResolved';
|
|
58
|
-
import { LinkedObject } from '~/utils/linkedObject';
|
|
59
58
|
import { onChannelUnreadUpdatedLocal } from '~/marker/events/onChannelUnreadUpdatedLocal';
|
|
60
|
-
import {
|
|
59
|
+
import { constructChannelObject } from '~/channelRepository/utils/constructChannelObject';
|
|
61
60
|
|
|
62
61
|
export class ChannelLiveCollectionController extends LiveCollectionController<
|
|
63
62
|
'channel',
|
|
@@ -133,14 +132,14 @@ export class ChannelLiveCollectionController extends LiveCollectionController<
|
|
|
133
132
|
const collection = pullFromCache<Amity.ChannelLiveCollectionCache>(this.cacheKey)?.data;
|
|
134
133
|
if (!collection) return;
|
|
135
134
|
|
|
136
|
-
let data =
|
|
135
|
+
let data: Amity.Channel[] =
|
|
137
136
|
collection.data
|
|
138
|
-
.map(
|
|
137
|
+
.map(
|
|
138
|
+
channelId => pullFromCache<Amity.StaticInternalChannel>(['channel', 'get', channelId])!,
|
|
139
|
+
)
|
|
139
140
|
.filter(Boolean)
|
|
140
141
|
.map(({ data }) => data)
|
|
141
|
-
.map(
|
|
142
|
-
.map(constructChannelDynamicValue)
|
|
143
|
-
.map(LinkedObject.channel) ?? [];
|
|
142
|
+
.map(constructChannelObject) ?? [];
|
|
144
143
|
|
|
145
144
|
if (this.paginationController instanceof ChannelPaginationController) {
|
|
146
145
|
data = this.applyFilter(data);
|
|
@@ -264,7 +263,7 @@ export class ChannelLiveCollectionController extends LiveCollectionController<
|
|
|
264
263
|
Amity.ReferenceType.USER_MESSAGE_FEED_MARKER,
|
|
265
264
|
);
|
|
266
265
|
|
|
267
|
-
const channelCache = pullFromCache<Amity.
|
|
266
|
+
const channelCache = pullFromCache<Amity.StaticInternalChannel>([
|
|
268
267
|
'channel',
|
|
269
268
|
'get',
|
|
270
269
|
message.channelId,
|
|
@@ -291,7 +290,7 @@ export class ChannelLiveCollectionController extends LiveCollectionController<
|
|
|
291
290
|
fn: convertEventPayload(
|
|
292
291
|
(callback: Amity.Listener<Amity.InternalMessage>) => {
|
|
293
292
|
return onMessageCreatedLocal(message => {
|
|
294
|
-
const cacheData = pullFromCache<Amity.
|
|
293
|
+
const cacheData = pullFromCache<Amity.StaticInternalChannel>([
|
|
295
294
|
'channel',
|
|
296
295
|
'get',
|
|
297
296
|
message.channelId,
|
|
@@ -370,7 +369,7 @@ export class ChannelLiveCollectionController extends LiveCollectionController<
|
|
|
370
369
|
|
|
371
370
|
if (this.shouldAbort(message.channelId)) return;
|
|
372
371
|
|
|
373
|
-
const channel = pullFromCache<Amity.
|
|
372
|
+
const channel = pullFromCache<Amity.StaticInternalChannel>([
|
|
374
373
|
'channel',
|
|
375
374
|
'get',
|
|
376
375
|
message.channelId,
|
|
@@ -404,7 +403,7 @@ export class ChannelLiveCollectionController extends LiveCollectionController<
|
|
|
404
403
|
|
|
405
404
|
if (this.shouldAbort(message.channelId)) return;
|
|
406
405
|
|
|
407
|
-
const channel = pullFromCache<Amity.
|
|
406
|
+
const channel = pullFromCache<Amity.StaticInternalChannel>([
|
|
408
407
|
'channel',
|
|
409
408
|
'get',
|
|
410
409
|
message.channelId,
|
|
@@ -5,18 +5,13 @@ import { getSubChannelsUnreadCount } from './getSubChannelsUnreadCount';
|
|
|
5
5
|
export const constructChannelDynamicValue = (
|
|
6
6
|
channel: Amity.StaticInternalChannel,
|
|
7
7
|
): Amity.InternalChannel => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return getSubChannelsUnreadCount(channel);
|
|
11
|
-
},
|
|
12
|
-
get hasMentioned() {
|
|
13
|
-
return getChannelIsMentioned(channel);
|
|
14
|
-
},
|
|
8
|
+
const { messageCount, ...rest } = channel;
|
|
9
|
+
return shallowClone(rest, {
|
|
15
10
|
get isMentioned() {
|
|
16
|
-
return getChannelIsMentioned(
|
|
11
|
+
return getChannelIsMentioned(rest);
|
|
17
12
|
},
|
|
18
13
|
get subChannelsUnreadCount() {
|
|
19
|
-
return getSubChannelsUnreadCount(
|
|
14
|
+
return getSubChannelsUnreadCount(rest);
|
|
20
15
|
},
|
|
21
16
|
});
|
|
22
17
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { getChannelMessagePreviewWithUser } from '~/messagePreview/utils';
|
|
2
|
+
import { constructChannelDynamicValue } from './constructChannelDynamicValue';
|
|
3
|
+
import { LinkedObject } from '~/utils/linkedObject';
|
|
4
|
+
|
|
5
|
+
export const constructChannelObject = (channel: Amity.StaticInternalChannel): Amity.Channel => {
|
|
6
|
+
/**
|
|
7
|
+
* convert internal cache data to be public channel data
|
|
8
|
+
* 1. [getChannelMessagePreviewWithUser] add messagePreview >> Amity.InternalChannel -> Amity.InternalChannel
|
|
9
|
+
* 2. [constructChannelDynamicValue] construct getter value >> Amity.StaticInternalChannel -> Amity.Channel
|
|
10
|
+
* 3. [LinkedObject.channel] add markAsRead >> Amity.InternalChannel -> Amity.Channel
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
return LinkedObject.channel(
|
|
14
|
+
constructChannelDynamicValue(getChannelMessagePreviewWithUser(channel)),
|
|
15
|
+
);
|
|
16
|
+
};
|
|
@@ -29,7 +29,10 @@ const getUnreadInfoCached = (channelId: Amity.RawChannel['channelId']) => {
|
|
|
29
29
|
* If not found in the both cache, use `false` as defaul value.
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
|
-
export const getChannelIsMentioned = (
|
|
32
|
+
export const getChannelIsMentioned = (
|
|
33
|
+
channel: Omit<Amity.RawChannel, 'messageCount'>,
|
|
34
|
+
marker?: Amity.ChannelMarker,
|
|
35
|
+
) => {
|
|
33
36
|
const client = getActiveClient();
|
|
34
37
|
|
|
35
38
|
if (client.isUnreadCountEnabled && client.getMarkerSyncConsistentMode()) {
|
|
@@ -30,7 +30,7 @@ const getUnreadInfoCached = (channelId: Amity.RawChannel['channelId']) => {
|
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
32
|
export const getSubChannelsUnreadCount = (
|
|
33
|
-
channel: Amity.RawChannel,
|
|
33
|
+
channel: Omit<Amity.RawChannel, 'messageCount'>,
|
|
34
34
|
marker?: Amity.ChannelMarker,
|
|
35
35
|
) => {
|
|
36
36
|
const client = getActiveClient();
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { queryCache } from '~/cache/api';
|
|
2
|
+
import { getChannelByIds } from '../internalApi/getChannelByIds';
|
|
2
3
|
import { fireEvent } from '~/core/events';
|
|
3
4
|
|
|
4
5
|
export const resolveChannels = async (channelIds: Amity.InternalChannel['channelPublicId'][]) => {
|
|
5
|
-
|
|
6
|
+
await getChannelByIds(channelIds);
|
|
7
|
+
const channels =
|
|
8
|
+
queryCache<Amity.StaticInternalChannel>(['channel', 'get'])
|
|
9
|
+
?.filter(({ data }) => data.channelPublicId && channelIds.includes(data.channelPublicId))
|
|
10
|
+
?.map(({ data }) => data) ?? [];
|
|
6
11
|
|
|
7
12
|
fireEvent('local.channel.resolved', channels);
|
|
8
13
|
};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { pushToCache } from '~/cache/api';
|
|
2
2
|
import { shallowClone } from '~/utils/shallowClone';
|
|
3
3
|
|
|
4
|
-
export function updateChannelCache(
|
|
4
|
+
export function updateChannelCache(
|
|
5
|
+
channel: Amity.StaticInternalChannel,
|
|
6
|
+
params: Partial<Amity.StaticInternalChannel>,
|
|
7
|
+
) {
|
|
5
8
|
pushToCache(
|
|
6
9
|
['channel', 'get', channel.channelId],
|
|
7
10
|
// eslint-disable-next-line prefer-object-spread
|
|
@@ -229,15 +229,6 @@ export const stopUnreadSync = () => {
|
|
|
229
229
|
unRegisterEventListeners();
|
|
230
230
|
};
|
|
231
231
|
|
|
232
|
-
/**
|
|
233
|
-
* @deprecated Please use `startUnreadSync` instead
|
|
234
|
-
*/
|
|
235
|
-
export const stopUnreadSyncing = () => {
|
|
236
|
-
console.warn('`stopUnreadSyncing` has been deprecated, please use `stopUnreadSync` instead');
|
|
237
|
-
|
|
238
|
-
return stopUnreadSync();
|
|
239
|
-
};
|
|
240
|
-
|
|
241
232
|
setIntervalTask(async () => {
|
|
242
233
|
if (!isSyncRunning) return;
|
|
243
234
|
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
getSmartFeedSubChannelTopic,
|
|
8
8
|
getUserTopic,
|
|
9
9
|
subscribeTopic,
|
|
10
|
+
getLiveStreamTopic,
|
|
10
11
|
} from '~/core/subscription';
|
|
11
12
|
|
|
12
13
|
export const subscribeGlobalTopic = () => {
|
|
@@ -19,6 +20,8 @@ export const subscribeGlobalTopic = () => {
|
|
|
19
20
|
// subscribing to user topic is necessary to handle ban event
|
|
20
21
|
subscribeTopic(getUserTopic(getActiveUser())),
|
|
21
22
|
subscribeTopic(getMarkerUserFeedTopic()),
|
|
23
|
+
|
|
24
|
+
subscribeTopic(getLiveStreamTopic()),
|
|
22
25
|
];
|
|
23
26
|
|
|
24
27
|
return () => disposers.forEach(fn => fn());
|