@ethora/chat-component-rn 26.8.4 → 26.8.6
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 +55 -0
- package/lib/commonjs/assets/emojiData.js +40 -0
- package/lib/commonjs/assets/emojiData.js.map +1 -0
- package/lib/commonjs/assets/icons.js +1 -1
- package/lib/commonjs/assets/icons.js.map +1 -1
- package/lib/commonjs/components/Header/HeaderRoomList.js +12 -7
- package/lib/commonjs/components/Header/HeaderRoomList.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatHeader.js +7 -9
- package/lib/commonjs/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatRoom.js +47 -26
- package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatWrapper.js +58 -21
- package/lib/commonjs/components/MainComponents/ChatWrapper.js.map +1 -1
- package/lib/commonjs/components/MainComponents/KeyboardInputDock.js +40 -0
- package/lib/commonjs/components/MainComponents/KeyboardInputDock.js.map +1 -0
- package/lib/commonjs/components/MainComponents/MessageContainer.js +4 -12
- package/lib/commonjs/components/MainComponents/MessageContainer.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MessageList.js +110 -35
- package/lib/commonjs/components/MainComponents/MessageList.js.map +1 -1
- package/lib/commonjs/components/MainComponents/RoomList.js +32 -29
- package/lib/commonjs/components/MainComponents/RoomList.js.map +1 -1
- package/lib/commonjs/components/MainComponents/RoomStack.js +270 -0
- package/lib/commonjs/components/MainComponents/RoomStack.js.map +1 -0
- package/lib/commonjs/components/MainComponents/SystemMessage.js +6 -2
- package/lib/commonjs/components/MainComponents/SystemMessage.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/Avatar.js +5 -1
- package/lib/commonjs/components/MessageBubble/Avatar.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/BottomReplyContainer.js +17 -21
- package/lib/commonjs/components/MessageBubble/BottomReplyContainer.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/EmojiPickerSheet.js +447 -0
- package/lib/commonjs/components/MessageBubble/EmojiPickerSheet.js.map +1 -0
- package/lib/commonjs/components/MessageBubble/Message.js +200 -132
- package/lib/commonjs/components/MessageBubble/Message.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/MessageInteractions.js +213 -12
- package/lib/commonjs/components/MessageBubble/MessageInteractions.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/MessageReaction.js +113 -94
- package/lib/commonjs/components/MessageBubble/MessageReaction.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/MessageReply.js +66 -24
- package/lib/commonjs/components/MessageBubble/MessageReply.js.map +1 -1
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +6 -1
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/commonjs/components/Modals/Modal/Modal.js +24 -0
- package/lib/commonjs/components/Modals/Modal/Modal.js.map +1 -1
- package/lib/commonjs/components/Modals/Modal/SwipeBackLayer.js +178 -0
- package/lib/commonjs/components/Modals/Modal/SwipeBackLayer.js.map +1 -0
- package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js +28 -10
- package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js.map +1 -1
- package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js +9 -3
- package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/ChatRoomItem.js +5 -4
- package/lib/commonjs/components/RoomComponents/ChatRoomItem.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/styled/LastMessageEmoji.js +8 -9
- package/lib/commonjs/components/RoomComponents/styled/LastMessageEmoji.js.map +1 -1
- package/lib/commonjs/components/Thread/ThreadWrapper.js +265 -152
- package/lib/commonjs/components/Thread/ThreadWrapper.js.map +1 -1
- package/lib/commonjs/components/styled/DateLabel.js +6 -3
- package/lib/commonjs/components/styled/DateLabel.js.map +1 -1
- package/lib/commonjs/context/MessageNotificationContext.js +188 -9
- package/lib/commonjs/context/MessageNotificationContext.js.map +1 -1
- package/lib/commonjs/context/xmppProvider.js +22 -7
- package/lib/commonjs/context/xmppProvider.js.map +1 -1
- package/lib/commonjs/helpers/createRoomFromApi.js +36 -2
- package/lib/commonjs/helpers/createRoomFromApi.js.map +1 -1
- package/lib/commonjs/helpers/emoji.js +51 -0
- package/lib/commonjs/helpers/emoji.js.map +1 -0
- package/lib/commonjs/helpers/haptics.js +29 -0
- package/lib/commonjs/helpers/haptics.js.map +1 -0
- package/lib/commonjs/helpers/historyPreloadScheduler.js +32 -66
- package/lib/commonjs/helpers/historyPreloadScheduler.js.map +1 -1
- package/lib/commonjs/helpers/insertMessageWithDelimiter.js +21 -12
- package/lib/commonjs/helpers/insertMessageWithDelimiter.js.map +1 -1
- package/lib/commonjs/helpers/keyboardLayout.js +23 -1
- package/lib/commonjs/helpers/keyboardLayout.js.map +1 -1
- package/lib/commonjs/helpers/mamReactions.js +57 -0
- package/lib/commonjs/helpers/mamReactions.js.map +1 -0
- package/lib/commonjs/helpers/parseMessageReference.js +42 -0
- package/lib/commonjs/helpers/parseMessageReference.js.map +1 -0
- package/lib/commonjs/helpers/reactionsConfig.js +17 -0
- package/lib/commonjs/helpers/reactionsConfig.js.map +1 -0
- package/lib/commonjs/helpers/updateMessagesTillLast.js +17 -2
- package/lib/commonjs/helpers/updateMessagesTillLast.js.map +1 -1
- package/lib/commonjs/hooks/useHeapSender.js +3 -1
- package/lib/commonjs/hooks/useHeapSender.js.map +1 -1
- package/lib/commonjs/hooks/useMessageHeapState.js +3 -2
- package/lib/commonjs/hooks/useMessageHeapState.js.map +1 -1
- package/lib/commonjs/hooks/useRoomInitialization.js +16 -7
- package/lib/commonjs/hooks/useRoomInitialization.js.map +1 -1
- package/lib/commonjs/hooks/useSendMessage.js +14 -8
- package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
- package/lib/commonjs/hooks/useUnreadMessagesCounter.js +1 -1
- package/lib/commonjs/hooks/useUnreadMessagesCounter.js.map +1 -1
- package/lib/commonjs/networking/stanzaHandlers.js +106 -50
- package/lib/commonjs/networking/stanzaHandlers.js.map +1 -1
- package/lib/commonjs/networking/xmpp/getHistory.xmpp.js +29 -74
- package/lib/commonjs/networking/xmpp/getHistory.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/handleStanzas.xmpp.js +4 -0
- package/lib/commonjs/networking/xmpp/handleStanzas.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/mamRouter.js +186 -0
- package/lib/commonjs/networking/xmpp/mamRouter.js.map +1 -0
- package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js +41 -4
- package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmppClient.js +98 -23
- package/lib/commonjs/networking/xmppClient.js.map +1 -1
- package/lib/commonjs/roomStore/Middleware/newMessageMidlleware.js +29 -34
- package/lib/commonjs/roomStore/Middleware/newMessageMidlleware.js.map +1 -1
- package/lib/commonjs/roomStore/Middleware/perfMiddleware.js +51 -0
- package/lib/commonjs/roomStore/Middleware/perfMiddleware.js.map +1 -0
- package/lib/commonjs/roomStore/Middleware/reactionsMiddleware.js +66 -43
- package/lib/commonjs/roomStore/Middleware/reactionsMiddleware.js.map +1 -1
- package/lib/commonjs/roomStore/Middleware/unreadMidlleware.js +88 -68
- package/lib/commonjs/roomStore/Middleware/unreadMidlleware.js.map +1 -1
- package/lib/commonjs/roomStore/index.js +18 -14
- package/lib/commonjs/roomStore/index.js.map +1 -1
- package/lib/commonjs/roomStore/persistBackend.js +96 -0
- package/lib/commonjs/roomStore/persistBackend.js.map +1 -0
- package/lib/commonjs/roomStore/persistence.js +245 -50
- package/lib/commonjs/roomStore/persistence.js.map +1 -1
- package/lib/commonjs/roomStore/roomsSlice.js +282 -136
- package/lib/commonjs/roomStore/roomsSlice.js.map +1 -1
- package/lib/commonjs/theme/theme.js +3 -0
- package/lib/commonjs/theme/theme.js.map +1 -1
- package/lib/commonjs/utils/devLogger.js +14 -0
- package/lib/commonjs/utils/devLogger.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/assets/emojiData.js +36 -0
- package/lib/module/assets/emojiData.js.map +1 -0
- package/lib/module/assets/icons.js +1 -1
- package/lib/module/assets/icons.js.map +1 -1
- package/lib/module/components/Header/HeaderRoomList.js +12 -7
- package/lib/module/components/Header/HeaderRoomList.js.map +1 -1
- package/lib/module/components/MainComponents/ChatHeader.js +8 -10
- package/lib/module/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/module/components/MainComponents/ChatRoom.js +49 -28
- package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/module/components/MainComponents/ChatWrapper.js +60 -23
- package/lib/module/components/MainComponents/ChatWrapper.js.map +1 -1
- package/lib/module/components/MainComponents/KeyboardInputDock.js +33 -0
- package/lib/module/components/MainComponents/KeyboardInputDock.js.map +1 -0
- package/lib/module/components/MainComponents/MessageContainer.js +7 -14
- package/lib/module/components/MainComponents/MessageContainer.js.map +1 -1
- package/lib/module/components/MainComponents/MessageList.js +110 -35
- package/lib/module/components/MainComponents/MessageList.js.map +1 -1
- package/lib/module/components/MainComponents/RoomList.js +32 -29
- package/lib/module/components/MainComponents/RoomList.js.map +1 -1
- package/lib/module/components/MainComponents/RoomStack.js +266 -0
- package/lib/module/components/MainComponents/RoomStack.js.map +1 -0
- package/lib/module/components/MainComponents/SystemMessage.js +6 -2
- package/lib/module/components/MainComponents/SystemMessage.js.map +1 -1
- package/lib/module/components/MessageBubble/Avatar.js +5 -1
- package/lib/module/components/MessageBubble/Avatar.js.map +1 -1
- package/lib/module/components/MessageBubble/BottomReplyContainer.js +18 -22
- package/lib/module/components/MessageBubble/BottomReplyContainer.js.map +1 -1
- package/lib/module/components/MessageBubble/EmojiPickerSheet.js +438 -0
- package/lib/module/components/MessageBubble/EmojiPickerSheet.js.map +1 -0
- package/lib/module/components/MessageBubble/Message.js +203 -134
- package/lib/module/components/MessageBubble/Message.js.map +1 -1
- package/lib/module/components/MessageBubble/MessageInteractions.js +215 -14
- package/lib/module/components/MessageBubble/MessageInteractions.js.map +1 -1
- package/lib/module/components/MessageBubble/MessageReaction.js +115 -94
- package/lib/module/components/MessageBubble/MessageReaction.js.map +1 -1
- package/lib/module/components/MessageBubble/MessageReply.js +65 -24
- package/lib/module/components/MessageBubble/MessageReply.js.map +1 -1
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +6 -1
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/module/components/Modals/Modal/Modal.js +25 -1
- package/lib/module/components/Modals/Modal/Modal.js.map +1 -1
- package/lib/module/components/Modals/Modal/SwipeBackLayer.js +172 -0
- package/lib/module/components/Modals/Modal/SwipeBackLayer.js.map +1 -0
- package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js +29 -11
- package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js.map +1 -1
- package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js +10 -4
- package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
- package/lib/module/components/RoomComponents/ChatRoomItem.js +5 -4
- package/lib/module/components/RoomComponents/ChatRoomItem.js.map +1 -1
- package/lib/module/components/RoomComponents/styled/LastMessageEmoji.js +8 -9
- package/lib/module/components/RoomComponents/styled/LastMessageEmoji.js.map +1 -1
- package/lib/module/components/Thread/ThreadWrapper.js +264 -152
- package/lib/module/components/Thread/ThreadWrapper.js.map +1 -1
- package/lib/module/components/styled/DateLabel.js +6 -3
- package/lib/module/components/styled/DateLabel.js.map +1 -1
- package/lib/module/context/MessageNotificationContext.js +190 -11
- package/lib/module/context/MessageNotificationContext.js.map +1 -1
- package/lib/module/context/xmppProvider.js +22 -7
- package/lib/module/context/xmppProvider.js.map +1 -1
- package/lib/module/helpers/createRoomFromApi.js +36 -2
- package/lib/module/helpers/createRoomFromApi.js.map +1 -1
- package/lib/module/helpers/emoji.js +44 -0
- package/lib/module/helpers/emoji.js.map +1 -0
- package/lib/module/helpers/haptics.js +24 -0
- package/lib/module/helpers/haptics.js.map +1 -0
- package/lib/module/helpers/historyPreloadScheduler.js +32 -66
- package/lib/module/helpers/historyPreloadScheduler.js.map +1 -1
- package/lib/module/helpers/insertMessageWithDelimiter.js +21 -12
- package/lib/module/helpers/insertMessageWithDelimiter.js.map +1 -1
- package/lib/module/helpers/keyboardLayout.js +20 -0
- package/lib/module/helpers/keyboardLayout.js.map +1 -1
- package/lib/module/helpers/mamReactions.js +51 -0
- package/lib/module/helpers/mamReactions.js.map +1 -0
- package/lib/module/helpers/parseMessageReference.js +37 -0
- package/lib/module/helpers/parseMessageReference.js.map +1 -0
- package/lib/module/helpers/reactionsConfig.js +10 -0
- package/lib/module/helpers/reactionsConfig.js.map +1 -0
- package/lib/module/helpers/updateMessagesTillLast.js +17 -2
- package/lib/module/helpers/updateMessagesTillLast.js.map +1 -1
- package/lib/module/hooks/useHeapSender.js +3 -1
- package/lib/module/hooks/useHeapSender.js.map +1 -1
- package/lib/module/hooks/useMessageHeapState.js +3 -2
- package/lib/module/hooks/useMessageHeapState.js.map +1 -1
- package/lib/module/hooks/useRoomInitialization.js +17 -8
- package/lib/module/hooks/useRoomInitialization.js.map +1 -1
- package/lib/module/hooks/useSendMessage.js +14 -8
- package/lib/module/hooks/useSendMessage.js.map +1 -1
- package/lib/module/hooks/useUnreadMessagesCounter.js +1 -1
- package/lib/module/hooks/useUnreadMessagesCounter.js.map +1 -1
- package/lib/module/networking/stanzaHandlers.js +107 -51
- package/lib/module/networking/stanzaHandlers.js.map +1 -1
- package/lib/module/networking/xmpp/getHistory.xmpp.js +29 -74
- package/lib/module/networking/xmpp/getHistory.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/handleStanzas.xmpp.js +4 -0
- package/lib/module/networking/xmpp/handleStanzas.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/mamRouter.js +175 -0
- package/lib/module/networking/xmpp/mamRouter.js.map +1 -0
- package/lib/module/networking/xmpp/presenceInRoom.xmpp.js +38 -2
- package/lib/module/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
- package/lib/module/networking/xmppClient.js +99 -24
- package/lib/module/networking/xmppClient.js.map +1 -1
- package/lib/module/roomStore/Middleware/newMessageMidlleware.js +29 -34
- package/lib/module/roomStore/Middleware/newMessageMidlleware.js.map +1 -1
- package/lib/module/roomStore/Middleware/perfMiddleware.js +45 -0
- package/lib/module/roomStore/Middleware/perfMiddleware.js.map +1 -0
- package/lib/module/roomStore/Middleware/reactionsMiddleware.js +66 -43
- package/lib/module/roomStore/Middleware/reactionsMiddleware.js.map +1 -1
- package/lib/module/roomStore/Middleware/unreadMidlleware.js +89 -69
- package/lib/module/roomStore/Middleware/unreadMidlleware.js.map +1 -1
- package/lib/module/roomStore/index.js +19 -15
- package/lib/module/roomStore/index.js.map +1 -1
- package/lib/module/roomStore/persistBackend.js +89 -0
- package/lib/module/roomStore/persistBackend.js.map +1 -0
- package/lib/module/roomStore/persistence.js +245 -48
- package/lib/module/roomStore/persistence.js.map +1 -1
- package/lib/module/roomStore/roomsSlice.js +275 -134
- package/lib/module/roomStore/roomsSlice.js.map +1 -1
- package/lib/module/theme/theme.js +3 -0
- package/lib/module/theme/theme.js.map +1 -1
- package/lib/module/utils/devLogger.js +13 -0
- package/lib/module/utils/devLogger.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/assets/emojiData.d.ts +8 -0
- package/lib/typescript/assets/emojiData.d.ts.map +1 -0
- package/lib/typescript/components/Header/HeaderRoomList.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ChatHeader.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ChatRoom.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ChatWrapper.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/KeyboardInputDock.d.ts +16 -0
- package/lib/typescript/components/MainComponents/KeyboardInputDock.d.ts.map +1 -0
- package/lib/typescript/components/MainComponents/MessageContainer.d.ts +2 -2
- package/lib/typescript/components/MainComponents/MessageContainer.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/MessageList.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/RoomList.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/RoomStack.d.ts +42 -0
- package/lib/typescript/components/MainComponents/RoomStack.d.ts.map +1 -0
- package/lib/typescript/components/MainComponents/SystemMessage.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/Avatar.d.ts +2 -0
- package/lib/typescript/components/MessageBubble/Avatar.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/BottomReplyContainer.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/EmojiPickerSheet.d.ts +11 -0
- package/lib/typescript/components/MessageBubble/EmojiPickerSheet.d.ts.map +1 -0
- package/lib/typescript/components/MessageBubble/Message.d.ts +2 -2
- package/lib/typescript/components/MessageBubble/Message.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/MessageInteractions.d.ts +2 -0
- package/lib/typescript/components/MessageBubble/MessageInteractions.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/MessageReaction.d.ts +1 -0
- package/lib/typescript/components/MessageBubble/MessageReaction.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/MessageReply.d.ts +7 -7
- package/lib/typescript/components/MessageBubble/MessageReply.d.ts.map +1 -1
- package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/Modal/Modal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/Modal/SwipeBackLayer.d.ts +16 -0
- package/lib/typescript/components/Modals/Modal/SwipeBackLayer.d.ts.map +1 -0
- package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts.map +1 -1
- package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/ChatRoomItem.d.ts +2 -2
- package/lib/typescript/components/RoomComponents/ChatRoomItem.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/styled/LastMessageEmoji.d.ts +3 -6
- package/lib/typescript/components/RoomComponents/styled/LastMessageEmoji.d.ts.map +1 -1
- package/lib/typescript/components/Thread/ThreadWrapper.d.ts +7 -1
- package/lib/typescript/components/Thread/ThreadWrapper.d.ts.map +1 -1
- package/lib/typescript/components/styled/DateLabel.d.ts +1 -0
- package/lib/typescript/components/styled/DateLabel.d.ts.map +1 -1
- package/lib/typescript/context/MessageNotificationContext.d.ts.map +1 -1
- package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
- package/lib/typescript/helpers/createRoomFromApi.d.ts.map +1 -1
- package/lib/typescript/helpers/emoji.d.ts +6 -0
- package/lib/typescript/helpers/emoji.d.ts.map +1 -0
- package/lib/typescript/helpers/haptics.d.ts +3 -0
- package/lib/typescript/helpers/haptics.d.ts.map +1 -0
- package/lib/typescript/helpers/historyPreloadScheduler.d.ts +1 -0
- package/lib/typescript/helpers/historyPreloadScheduler.d.ts.map +1 -1
- package/lib/typescript/helpers/insertMessageWithDelimiter.d.ts.map +1 -1
- package/lib/typescript/helpers/keyboardLayout.d.ts +6 -0
- package/lib/typescript/helpers/keyboardLayout.d.ts.map +1 -1
- package/lib/typescript/helpers/mamReactions.d.ts +13 -0
- package/lib/typescript/helpers/mamReactions.d.ts.map +1 -0
- package/lib/typescript/helpers/parseMessageReference.d.ts +16 -0
- package/lib/typescript/helpers/parseMessageReference.d.ts.map +1 -0
- package/lib/typescript/helpers/reactionsConfig.d.ts +5 -0
- package/lib/typescript/helpers/reactionsConfig.d.ts.map +1 -0
- package/lib/typescript/helpers/updateMessagesTillLast.d.ts.map +1 -1
- package/lib/typescript/hooks/useHeapSender.d.ts.map +1 -1
- package/lib/typescript/hooks/useMessageHeapState.d.ts.map +1 -1
- package/lib/typescript/hooks/useRoomInitialization.d.ts +2 -2
- package/lib/typescript/hooks/useRoomInitialization.d.ts.map +1 -1
- package/lib/typescript/hooks/useSendMessage.d.ts.map +1 -1
- package/lib/typescript/networking/stanzaHandlers.d.ts +4 -2
- package/lib/typescript/networking/stanzaHandlers.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/getHistory.xmpp.d.ts +3 -1
- package/lib/typescript/networking/xmpp/getHistory.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/handleStanzas.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/mamRouter.d.ts +23 -0
- package/lib/typescript/networking/xmpp/mamRouter.d.ts.map +1 -0
- package/lib/typescript/networking/xmpp/presenceInRoom.xmpp.d.ts +1 -0
- package/lib/typescript/networking/xmpp/presenceInRoom.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmppClient.d.ts +22 -1
- package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
- package/lib/typescript/roomStore/Middleware/newMessageMidlleware.d.ts.map +1 -1
- package/lib/typescript/roomStore/Middleware/perfMiddleware.d.ts +4 -0
- package/lib/typescript/roomStore/Middleware/perfMiddleware.d.ts.map +1 -0
- package/lib/typescript/roomStore/Middleware/reactionsMiddleware.d.ts +9 -0
- package/lib/typescript/roomStore/Middleware/reactionsMiddleware.d.ts.map +1 -1
- package/lib/typescript/roomStore/Middleware/unreadMidlleware.d.ts.map +1 -1
- package/lib/typescript/roomStore/index.d.ts.map +1 -1
- package/lib/typescript/roomStore/persistBackend.d.ts +11 -0
- package/lib/typescript/roomStore/persistBackend.d.ts.map +1 -0
- package/lib/typescript/roomStore/persistence.d.ts +5 -6
- package/lib/typescript/roomStore/persistence.d.ts.map +1 -1
- package/lib/typescript/roomStore/roomsSlice.d.ts +41 -1
- package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
- package/lib/typescript/theme/theme.d.ts +4 -1
- package/lib/typescript/theme/theme.d.ts.map +1 -1
- package/lib/typescript/types/models/message.model.d.ts +4 -0
- package/lib/typescript/types/models/message.model.d.ts.map +1 -1
- package/lib/typescript/types/models/room.model.d.ts +16 -0
- package/lib/typescript/types/models/room.model.d.ts.map +1 -1
- package/lib/typescript/types/models/xmpp.model.d.ts +6 -1
- package/lib/typescript/types/models/xmpp.model.d.ts.map +1 -1
- package/lib/typescript/types/types.d.ts +15 -3
- package/lib/typescript/types/types.d.ts.map +1 -1
- package/lib/typescript/utils/devLogger.d.ts +8 -0
- package/lib/typescript/utils/devLogger.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +10 -1
- package/src/assets/emojiData.ts +2146 -0
- package/src/assets/icons.tsx +5 -5
- package/src/components/Header/HeaderRoomList.tsx +7 -5
- package/src/components/MainComponents/ChatHeader.tsx +16 -7
- package/src/components/MainComponents/ChatRoom.tsx +64 -32
- package/src/components/MainComponents/ChatWrapper.tsx +73 -21
- package/src/components/MainComponents/KeyboardInputDock.tsx +47 -0
- package/src/components/MainComponents/MessageContainer.tsx +7 -15
- package/src/components/MainComponents/MessageList.tsx +96 -43
- package/src/components/MainComponents/RoomList.tsx +28 -29
- package/src/components/MainComponents/RoomStack.tsx +309 -0
- package/src/components/MainComponents/SystemMessage.tsx +6 -2
- package/src/components/MessageBubble/Avatar.tsx +7 -1
- package/src/components/MessageBubble/BottomReplyContainer.tsx +19 -21
- package/src/components/MessageBubble/EmojiPickerSheet.tsx +468 -0
- package/src/components/MessageBubble/Message.tsx +146 -87
- package/src/components/MessageBubble/MessageInteractions.tsx +213 -12
- package/src/components/MessageBubble/MessageReaction.tsx +120 -96
- package/src/components/MessageBubble/MessageReply.tsx +65 -32
- package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +4 -0
- package/src/components/Modals/Modal/Modal.tsx +32 -1
- package/src/components/Modals/Modal/SwipeBackLayer.tsx +221 -0
- package/src/components/Modals/ProfileHeader/ProfileHeader.tsx +29 -8
- package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +6 -3
- package/src/components/RoomComponents/ChatRoomItem.tsx +11 -4
- package/src/components/RoomComponents/styled/LastMessageEmoji.tsx +7 -8
- package/src/components/Thread/ThreadWrapper.tsx +274 -198
- package/src/components/styled/DateLabel.tsx +7 -3
- package/src/context/MessageNotificationContext.tsx +205 -7
- package/src/context/xmppProvider.tsx +29 -9
- package/src/helpers/createRoomFromApi.tsx +37 -1
- package/src/helpers/emoji.ts +39 -0
- package/src/helpers/haptics.ts +19 -0
- package/src/helpers/historyPreloadScheduler.ts +37 -69
- package/src/helpers/insertMessageWithDelimiter.ts +23 -16
- package/src/helpers/keyboardLayout.ts +26 -0
- package/src/helpers/mamReactions.ts +59 -0
- package/src/helpers/parseMessageReference.ts +38 -0
- package/src/helpers/reactionsConfig.ts +13 -0
- package/src/helpers/updateMessagesTillLast.tsx +14 -2
- package/src/hooks/useHeapSender.tsx +3 -2
- package/src/hooks/useMessageHeapState.tsx +6 -2
- package/src/hooks/useRoomInitialization.tsx +32 -15
- package/src/hooks/useSendMessage.tsx +18 -11
- package/src/hooks/useUnreadMessagesCounter.ts +1 -1
- package/src/networking/stanzaHandlers.ts +116 -60
- package/src/networking/xmpp/getHistory.xmpp.ts +44 -106
- package/src/networking/xmpp/handleStanzas.xmpp.ts +2 -0
- package/src/networking/xmpp/mamRouter.ts +176 -0
- package/src/networking/xmpp/presenceInRoom.xmpp.ts +46 -3
- package/src/networking/xmppClient.ts +105 -20
- package/src/roomStore/Middleware/newMessageMidlleware.tsx +35 -38
- package/src/roomStore/Middleware/perfMiddleware.ts +50 -0
- package/src/roomStore/Middleware/reactionsMiddleware.tsx +53 -52
- package/src/roomStore/Middleware/unreadMidlleware.tsx +92 -80
- package/src/roomStore/index.ts +28 -27
- package/src/roomStore/persistBackend.ts +96 -0
- package/src/roomStore/persistence.ts +280 -73
- package/src/roomStore/roomsSlice.ts +304 -155
- package/src/theme/theme.ts +10 -1
- package/src/types/models/message.model.ts +4 -0
- package/src/types/models/room.model.ts +17 -0
- package/src/types/models/xmpp.model.ts +4 -2
- package/src/types/types.ts +15 -3
- package/src/utils/devLogger.ts +16 -0
- package/src/version.ts +1 -1
|
@@ -1,52 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import { View, Text, TouchableOpacity, Animated } from 'react-native';
|
|
4
|
-
import styled from 'styled-components/native';
|
|
1
|
+
import React, { FC, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { View, Text, TouchableOpacity, Animated, StyleSheet } from 'react-native';
|
|
5
3
|
import { ReactionMessage } from '../../types/types';
|
|
6
4
|
import { useTheme } from '../../hooks/useTheme';
|
|
7
|
-
|
|
8
|
-
const ReactionContainer = styled.View`
|
|
9
|
-
flex-direction: row;
|
|
10
|
-
align-items: center;
|
|
11
|
-
gap: 8px;
|
|
12
|
-
`;
|
|
13
|
-
|
|
14
|
-
const ReactionBox = styled(TouchableOpacity)<{ active: boolean; color: string }>`
|
|
15
|
-
padding: 4px 8px;
|
|
16
|
-
border-radius: 20px;
|
|
17
|
-
background-color: ${({ active, color, theme }) =>
|
|
18
|
-
active ? color : theme.surface};
|
|
19
|
-
flex-direction: row;
|
|
20
|
-
align-items: center;
|
|
21
|
-
justify-content: center;
|
|
22
|
-
elevation: 3;
|
|
23
|
-
`;
|
|
5
|
+
import { getEmojiNativeById } from '../../helpers/emoji';
|
|
24
6
|
|
|
25
7
|
interface MessageReactionProps {
|
|
26
8
|
color: string;
|
|
27
9
|
reaction: Record<string, ReactionMessage>;
|
|
28
10
|
changeReaction: (reaction: string) => void;
|
|
29
11
|
userName?: string;
|
|
30
|
-
}
|
|
31
12
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
heart: '❤️',
|
|
35
|
-
fire: '🔥',
|
|
36
|
-
'+1': '👍',
|
|
37
|
-
smile: '😄',
|
|
38
|
-
scream: '😱',
|
|
39
|
-
};
|
|
13
|
+
interactive?: boolean;
|
|
14
|
+
}
|
|
40
15
|
|
|
41
16
|
export const MessageReaction: FC<MessageReactionProps> = ({
|
|
42
17
|
reaction,
|
|
43
18
|
color,
|
|
44
19
|
changeReaction,
|
|
45
20
|
userName,
|
|
21
|
+
interactive = true,
|
|
46
22
|
}) => {
|
|
47
23
|
const theme = useTheme();
|
|
48
24
|
const [tooltipEmoji, setTooltipEmoji] = useState<string | null>(null);
|
|
49
|
-
const fadeAnim = new Animated.Value(0);
|
|
25
|
+
const fadeAnim = useRef(new Animated.Value(0)).current;
|
|
26
|
+
|
|
27
|
+
const reactionDetails = useMemo(() => {
|
|
28
|
+
const result: Record<string, { count: number; users: string[] }> = {};
|
|
29
|
+
Object.values(reaction || {}).forEach(({ emoji, data }) => {
|
|
30
|
+
(emoji || []).forEach((em) => {
|
|
31
|
+
if (!result[em]) {result[em] = { count: 0, users: [] };}
|
|
32
|
+
result[em].count += 1;
|
|
33
|
+
result[em].users.push(
|
|
34
|
+
`${data?.senderFirstName || ''} ${data?.senderLastName || ''}`.trim()
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
return result;
|
|
39
|
+
}, [reaction]);
|
|
40
|
+
|
|
41
|
+
if (!reaction || Object.keys(reactionDetails).length === 0) {return null;}
|
|
50
42
|
|
|
51
43
|
const showTooltip = (emoji: string) => {
|
|
52
44
|
setTooltipEmoji(emoji);
|
|
@@ -65,90 +57,122 @@ export const MessageReaction: FC<MessageReactionProps> = ({
|
|
|
65
57
|
}).start(() => setTooltipEmoji(null));
|
|
66
58
|
};
|
|
67
59
|
|
|
68
|
-
if (!reaction) {return null;}
|
|
69
|
-
|
|
70
|
-
const reactionDetails = useMemo(() => {
|
|
71
|
-
const result: Record<string, { count: number; users: string[] }> = {};
|
|
72
|
-
|
|
73
|
-
Object.values(reaction).forEach(({ emoji, data }) => {
|
|
74
|
-
if (emoji && emoji.length > 0)
|
|
75
|
-
{emoji.forEach((em) => {
|
|
76
|
-
if (!result[em]) {
|
|
77
|
-
result[em] = { count: 0, users: [] };
|
|
78
|
-
}
|
|
79
|
-
result[em].count += 1;
|
|
80
|
-
result[em].users.push(`${data?.senderFirstName} ${data?.senderLastName}`);
|
|
81
|
-
});}
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
return result;
|
|
85
|
-
}, [reaction]);
|
|
86
|
-
|
|
87
60
|
return (
|
|
88
|
-
<
|
|
61
|
+
<View style={styles.row}>
|
|
89
62
|
{Object.entries(reactionDetails).map(([emoji, details]) => {
|
|
90
|
-
const isUserReacted = userName
|
|
91
|
-
? details.users.includes(userName)
|
|
92
|
-
: false;
|
|
93
|
-
|
|
63
|
+
const isUserReacted = !!userName && details.users.includes(userName);
|
|
94
64
|
return (
|
|
95
|
-
<View key={emoji} style={
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
|
|
65
|
+
<View key={emoji} style={styles.chipWrap}>
|
|
66
|
+
<TouchableOpacity
|
|
67
|
+
testID={`reaction-chip-${emoji}`}
|
|
68
|
+
activeOpacity={0.7}
|
|
69
|
+
disabled={!interactive}
|
|
99
70
|
onPress={() => changeReaction(emoji)}
|
|
100
71
|
onLongPress={() => showTooltip(emoji)}
|
|
101
72
|
onPressOut={hideTooltip}
|
|
73
|
+
style={[
|
|
74
|
+
styles.chip,
|
|
75
|
+
{
|
|
76
|
+
backgroundColor: theme.surface,
|
|
77
|
+
borderColor: isUserReacted ? color : theme.border,
|
|
78
|
+
shadowColor: theme.shadow,
|
|
79
|
+
},
|
|
80
|
+
]}
|
|
102
81
|
>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
82
|
+
{isUserReacted && (
|
|
83
|
+
<View
|
|
84
|
+
pointerEvents="none"
|
|
85
|
+
style={[styles.tint, { backgroundColor: `${color}26` }]}
|
|
86
|
+
/>
|
|
87
|
+
)}
|
|
88
|
+
<Text style={styles.glyph}>{getEmojiNativeById(emoji)}</Text>
|
|
106
89
|
<Text
|
|
107
|
-
style={
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}}
|
|
90
|
+
style={[
|
|
91
|
+
styles.count,
|
|
92
|
+
{ color: isUserReacted ? color : theme.textSecondary },
|
|
93
|
+
]}
|
|
112
94
|
>
|
|
113
95
|
{details.count}
|
|
114
96
|
</Text>
|
|
115
|
-
</
|
|
97
|
+
</TouchableOpacity>
|
|
116
98
|
|
|
117
|
-
{/* Tooltip */}
|
|
118
99
|
{tooltipEmoji === emoji && (
|
|
119
100
|
<Animated.View
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
paddingHorizontal: 10,
|
|
139
|
-
paddingVertical: 6,
|
|
140
|
-
maxWidth: 220,
|
|
141
|
-
zIndex: 999,
|
|
142
|
-
}}
|
|
101
|
+
pointerEvents="none"
|
|
102
|
+
style={[
|
|
103
|
+
styles.tooltip,
|
|
104
|
+
{
|
|
105
|
+
opacity: fadeAnim,
|
|
106
|
+
transform: [
|
|
107
|
+
{
|
|
108
|
+
translateY: fadeAnim.interpolate({
|
|
109
|
+
inputRange: [0, 1],
|
|
110
|
+
outputRange: [4, 0],
|
|
111
|
+
}),
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
// Inverted pill: text colour as ground, surface as ink,
|
|
115
|
+
// so it stays high-contrast on both palettes.
|
|
116
|
+
backgroundColor: theme.text,
|
|
117
|
+
},
|
|
118
|
+
]}
|
|
143
119
|
>
|
|
144
|
-
<Text style={{ color: theme.surface
|
|
145
|
-
{details.users.join(', ')}
|
|
120
|
+
<Text style={[styles.tooltipText, { color: theme.surface }]}>
|
|
121
|
+
{details.users.filter(Boolean).join(', ')}
|
|
146
122
|
</Text>
|
|
147
123
|
</Animated.View>
|
|
148
124
|
)}
|
|
149
125
|
</View>
|
|
150
126
|
);
|
|
151
127
|
})}
|
|
152
|
-
</
|
|
128
|
+
</View>
|
|
153
129
|
);
|
|
154
|
-
};
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const styles = StyleSheet.create({
|
|
133
|
+
row: {
|
|
134
|
+
flexDirection: 'row',
|
|
135
|
+
flexWrap: 'wrap',
|
|
136
|
+
alignItems: 'center',
|
|
137
|
+
gap: 6,
|
|
138
|
+
},
|
|
139
|
+
chipWrap: {
|
|
140
|
+
position: 'relative',
|
|
141
|
+
},
|
|
142
|
+
chip: {
|
|
143
|
+
flexDirection: 'row',
|
|
144
|
+
alignItems: 'center',
|
|
145
|
+
paddingVertical: 3,
|
|
146
|
+
paddingHorizontal: 8,
|
|
147
|
+
borderRadius: 14,
|
|
148
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
149
|
+
shadowOpacity: 0.08,
|
|
150
|
+
shadowOffset: { width: 0, height: 1 },
|
|
151
|
+
shadowRadius: 2,
|
|
152
|
+
elevation: 1,
|
|
153
|
+
},
|
|
154
|
+
tint: {
|
|
155
|
+
position: "absolute", top: 0, right: 0, bottom: 0, left: 0,
|
|
156
|
+
borderRadius: 14,
|
|
157
|
+
},
|
|
158
|
+
glyph: {
|
|
159
|
+
fontSize: 16,
|
|
160
|
+
marginRight: 4,
|
|
161
|
+
},
|
|
162
|
+
count: {
|
|
163
|
+
fontSize: 13,
|
|
164
|
+
fontWeight: '600',
|
|
165
|
+
},
|
|
166
|
+
tooltip: {
|
|
167
|
+
position: 'absolute',
|
|
168
|
+
bottom: 34,
|
|
169
|
+
left: 0,
|
|
170
|
+
borderRadius: 6,
|
|
171
|
+
paddingHorizontal: 10,
|
|
172
|
+
paddingVertical: 6,
|
|
173
|
+
maxWidth: 220,
|
|
174
|
+
},
|
|
175
|
+
tooltipText: {
|
|
176
|
+
fontSize: 12,
|
|
177
|
+
},
|
|
178
|
+
});
|
|
@@ -1,50 +1,83 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Text } from 'react-native';
|
|
5
|
-
|
|
6
|
-
export const StyledMessageReply = styled.TouchableOpacity<{
|
|
7
|
-
isUser: boolean;
|
|
8
|
-
configColor: string;
|
|
9
|
-
}>`
|
|
10
|
-
background-color: ${(props) => (props.isUser ? '#ffffff' : '#E7EDF9')};
|
|
11
|
-
padding: 8px 16px;
|
|
12
|
-
margin-bottom: 8px;
|
|
13
|
-
border-radius: 4px;
|
|
14
|
-
border-style: solid;
|
|
15
|
-
border-start-width: ${(props) => (props.isUser ? 4 : 0)}px;
|
|
16
|
-
border-start-color: ${(props) =>
|
|
17
|
-
props.isUser ? props.configColor : 'transparent'};
|
|
18
|
-
border-end-width: ${(props) => (!props.isUser ? 4 : 0)}px;
|
|
19
|
-
border-end-color: ${(props) =>
|
|
20
|
-
!props.isUser ? props.configColor : 'transparent'};
|
|
21
|
-
`;
|
|
22
|
-
|
|
23
|
-
const StyledText = styled.Text`
|
|
24
|
-
font-size: 14px;
|
|
25
|
-
overflow: hidden;
|
|
26
|
-
`;
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
|
3
|
+
import { useTheme } from '../../hooks/useTheme';
|
|
27
4
|
|
|
28
5
|
interface MessageReplyProps {
|
|
29
6
|
isUser: boolean;
|
|
30
7
|
text: string;
|
|
8
|
+
/** The parent's author, when the reply carries it. */
|
|
9
|
+
userName?: string;
|
|
31
10
|
color?: string;
|
|
32
11
|
handleReplyMessage: () => void;
|
|
33
12
|
}
|
|
34
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Quote of the parent at the top of a reply that was also sent to the
|
|
16
|
+
* channel (WhatsApp-style): accent bar, author, up to two lines of text.
|
|
17
|
+
* Tapping opens the parent's thread.
|
|
18
|
+
*/
|
|
35
19
|
export const MessageReply: FC<MessageReplyProps> = ({
|
|
36
20
|
isUser,
|
|
37
21
|
text,
|
|
38
|
-
|
|
22
|
+
userName,
|
|
23
|
+
color,
|
|
39
24
|
handleReplyMessage,
|
|
40
25
|
}) => {
|
|
26
|
+
const theme = useTheme();
|
|
27
|
+
const accent = color || theme.primary;
|
|
41
28
|
return (
|
|
42
|
-
<
|
|
29
|
+
<TouchableOpacity
|
|
30
|
+
testID="message-reply-quote"
|
|
31
|
+
activeOpacity={0.7}
|
|
43
32
|
onPress={handleReplyMessage}
|
|
44
|
-
|
|
45
|
-
|
|
33
|
+
style={[
|
|
34
|
+
styles.quote,
|
|
35
|
+
{
|
|
36
|
+
// A tint of the bubble's own ground, so it reads on both sides
|
|
37
|
+
// and in both themes.
|
|
38
|
+
backgroundColor: isUser ? 'rgba(0,0,0,0.12)' : theme.surfaceSecondary,
|
|
39
|
+
},
|
|
40
|
+
]}
|
|
46
41
|
>
|
|
47
|
-
<
|
|
48
|
-
|
|
42
|
+
<View style={[styles.bar, { backgroundColor: accent }]} />
|
|
43
|
+
<View style={styles.body}>
|
|
44
|
+
{!!userName && (
|
|
45
|
+
<Text numberOfLines={1} style={[styles.author, { color: accent }]}>
|
|
46
|
+
{userName}
|
|
47
|
+
</Text>
|
|
48
|
+
)}
|
|
49
|
+
<Text
|
|
50
|
+
numberOfLines={2}
|
|
51
|
+
style={[styles.text, { color: isUser ? theme.messageTextUser : theme.text }]}
|
|
52
|
+
>
|
|
53
|
+
{text}
|
|
54
|
+
</Text>
|
|
55
|
+
</View>
|
|
56
|
+
</TouchableOpacity>
|
|
49
57
|
);
|
|
50
58
|
};
|
|
59
|
+
|
|
60
|
+
const styles = StyleSheet.create({
|
|
61
|
+
quote: {
|
|
62
|
+
flexDirection: 'row',
|
|
63
|
+
borderRadius: 8,
|
|
64
|
+
overflow: 'hidden',
|
|
65
|
+
marginBottom: 8,
|
|
66
|
+
},
|
|
67
|
+
bar: {
|
|
68
|
+
width: 4,
|
|
69
|
+
},
|
|
70
|
+
body: {
|
|
71
|
+
flexShrink: 1,
|
|
72
|
+
paddingVertical: 6,
|
|
73
|
+
paddingHorizontal: 10,
|
|
74
|
+
},
|
|
75
|
+
author: {
|
|
76
|
+
fontSize: 13,
|
|
77
|
+
fontWeight: '600',
|
|
78
|
+
marginBottom: 2,
|
|
79
|
+
},
|
|
80
|
+
text: {
|
|
81
|
+
fontSize: 14,
|
|
82
|
+
},
|
|
83
|
+
});
|
|
@@ -510,6 +510,10 @@ const ChatProfileModal: React.FC<ChatProfileModalProps> = ({
|
|
|
510
510
|
]}
|
|
511
511
|
onLayout={(e) => setViewportHeight(e.nativeEvent.layout.height)}
|
|
512
512
|
showsVerticalScrollIndicator={false}
|
|
513
|
+
// Magnet: a header released part-way settles fully open or fully
|
|
514
|
+
// collapsed; past the collapsed point the content scrolls freely.
|
|
515
|
+
snapToOffsets={[0, collapseDistance]}
|
|
516
|
+
snapToEnd={false}
|
|
513
517
|
keyboardShouldPersistTaps="handled"
|
|
514
518
|
scrollEventThrottle={16}
|
|
515
519
|
onScroll={Animated.event(
|
|
@@ -2,9 +2,13 @@ import React from 'react';
|
|
|
2
2
|
import { ModalBackground } from '../styledModalComponents';
|
|
3
3
|
import { ModalType } from '../../../types/types';
|
|
4
4
|
import { useDispatch } from 'react-redux';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
setActiveModal,
|
|
7
|
+
setSelectedUser,
|
|
8
|
+
} from '../../../roomStore/chatSettingsSlice';
|
|
6
9
|
import { MODAL_TYPES } from '../../../helpers/constants/MODAL_TYPES';
|
|
7
10
|
import { MODAL_COMPONENTS } from '../../../helpers/constants/MODAL_COMPONENTS';
|
|
11
|
+
import { SwipeBackLayer } from './SwipeBackLayer';
|
|
8
12
|
|
|
9
13
|
interface ModalProps {
|
|
10
14
|
children?: React.ReactNode;
|
|
@@ -44,6 +48,33 @@ const Modal: React.FC<ModalProps> = ({ children, modal, setOpenModal }) => {
|
|
|
44
48
|
return <>{renderModalContent()}{children}</>;
|
|
45
49
|
}
|
|
46
50
|
|
|
51
|
+
// The profile screens are full-screen pages rather than dialogs: they
|
|
52
|
+
// slide in and can be swiped back from the left edge, like a room. One
|
|
53
|
+
// layer serves both, so going chat profile → member profile swaps the
|
|
54
|
+
// page in place instead of replaying the entrance.
|
|
55
|
+
if (modal === MODAL_TYPES.PROFILE || modal === MODAL_TYPES.CHAT_PROFILE) {
|
|
56
|
+
const ProfileComponent = MODAL_COMPONENTS[modal];
|
|
57
|
+
if (ProfileComponent) {
|
|
58
|
+
return (
|
|
59
|
+
<SwipeBackLayer
|
|
60
|
+
onClose={() => {
|
|
61
|
+
// The viewed member is cleared only once the page is gone, so
|
|
62
|
+
// it doesn't flip to the user's own profile mid-slide.
|
|
63
|
+
dispatch(setSelectedUser(undefined));
|
|
64
|
+
setOpenModal();
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
67
|
+
{(close) => (
|
|
68
|
+
<>
|
|
69
|
+
<ProfileComponent handleCloseModal={close} />
|
|
70
|
+
{children}
|
|
71
|
+
</>
|
|
72
|
+
)}
|
|
73
|
+
</SwipeBackLayer>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
47
78
|
return (
|
|
48
79
|
modal && (
|
|
49
80
|
<ModalBackground
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
ReactNode,
|
|
3
|
+
useCallback,
|
|
4
|
+
useEffect,
|
|
5
|
+
useMemo,
|
|
6
|
+
useRef,
|
|
7
|
+
useState,
|
|
8
|
+
} from 'react';
|
|
9
|
+
import {
|
|
10
|
+
Animated,
|
|
11
|
+
BackHandler,
|
|
12
|
+
Keyboard,
|
|
13
|
+
StyleSheet,
|
|
14
|
+
useWindowDimensions,
|
|
15
|
+
View,
|
|
16
|
+
} from 'react-native';
|
|
17
|
+
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
|
|
18
|
+
import {
|
|
19
|
+
COMPLETE_DISTANCE,
|
|
20
|
+
COMPLETE_VELOCITY,
|
|
21
|
+
EDGE_WIDTH,
|
|
22
|
+
LIST_DIM,
|
|
23
|
+
POP,
|
|
24
|
+
PUSH,
|
|
25
|
+
} from '../../MainComponents/RoomStack';
|
|
26
|
+
|
|
27
|
+
interface SwipeBackLayerProps {
|
|
28
|
+
/** Called once the screen has left (swipe, back button, hardware back). */
|
|
29
|
+
onClose: () => void;
|
|
30
|
+
/** Receives the animated close, to hand to the screen's own back button. */
|
|
31
|
+
children: (close: () => void) => ReactNode;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Full-screen modal layer with the same navigation feel as RoomStack: it
|
|
36
|
+
* slides in from the right, and a swipe from the left edge drags it back
|
|
37
|
+
* out over whatever is underneath (the room or the list). Like RoomStack it
|
|
38
|
+
* runs on RN's own `Animated`, one value driving every layer.
|
|
39
|
+
*/
|
|
40
|
+
export const SwipeBackLayer: React.FC<SwipeBackLayerProps> = ({
|
|
41
|
+
onClose,
|
|
42
|
+
children,
|
|
43
|
+
}) => {
|
|
44
|
+
const { width: windowWidth } = useWindowDimensions();
|
|
45
|
+
const [width, setWidth] = useState(windowWidth);
|
|
46
|
+
const widthRef = useRef(width);
|
|
47
|
+
widthRef.current = width;
|
|
48
|
+
const x = useRef(new Animated.Value(windowWidth)).current;
|
|
49
|
+
const closing = useRef(false);
|
|
50
|
+
|
|
51
|
+
const slideTo = useCallback(
|
|
52
|
+
(
|
|
53
|
+
toValue: number,
|
|
54
|
+
config: typeof PUSH,
|
|
55
|
+
done?: (finished: boolean) => void
|
|
56
|
+
) => {
|
|
57
|
+
Animated.timing(x, {
|
|
58
|
+
toValue,
|
|
59
|
+
...config,
|
|
60
|
+
useNativeDriver: true,
|
|
61
|
+
}).start(({ finished }) => done?.(finished));
|
|
62
|
+
},
|
|
63
|
+
[x]
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
slideTo(0, PUSH);
|
|
68
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
69
|
+
|
|
70
|
+
const onCloseRef = useRef(onClose);
|
|
71
|
+
onCloseRef.current = onClose;
|
|
72
|
+
const [closeCount, setCloseCount] = useState(0);
|
|
73
|
+
const finish = useCallback(() => {
|
|
74
|
+
onCloseRef.current();
|
|
75
|
+
setCloseCount(count => count + 1);
|
|
76
|
+
}, []);
|
|
77
|
+
|
|
78
|
+
// `onClose` normally unmounts this layer. If it is still here afterwards
|
|
79
|
+
// (the modal did not close), slide the screen back rather than leave it
|
|
80
|
+
// parked off-screen.
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
if (closeCount === 0) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
closing.current = false;
|
|
86
|
+
slideTo(0, POP);
|
|
87
|
+
}, [closeCount]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
88
|
+
|
|
89
|
+
const slideOut = useCallback(() => {
|
|
90
|
+
closing.current = true;
|
|
91
|
+
slideTo(widthRef.current, POP, finished => {
|
|
92
|
+
if (finished) {
|
|
93
|
+
finish();
|
|
94
|
+
} else {
|
|
95
|
+
closing.current = false;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}, [finish, slideTo]);
|
|
99
|
+
|
|
100
|
+
const close = useCallback(() => {
|
|
101
|
+
if (closing.current) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
Keyboard.dismiss();
|
|
105
|
+
slideOut();
|
|
106
|
+
}, [slideOut]);
|
|
107
|
+
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
const sub = BackHandler.addEventListener('hardwareBackPress', () => {
|
|
110
|
+
close();
|
|
111
|
+
return true;
|
|
112
|
+
});
|
|
113
|
+
return () => sub.remove();
|
|
114
|
+
}, [close]);
|
|
115
|
+
|
|
116
|
+
const swipeBack = useMemo(
|
|
117
|
+
() =>
|
|
118
|
+
Gesture.Pan()
|
|
119
|
+
.runOnJS(true)
|
|
120
|
+
.hitSlop({ left: 0, width: EDGE_WIDTH })
|
|
121
|
+
.activeOffsetX(12)
|
|
122
|
+
.failOffsetY([-16, 16])
|
|
123
|
+
.onStart(() => {
|
|
124
|
+
if (closing.current) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
Keyboard.dismiss();
|
|
128
|
+
x.stopAnimation();
|
|
129
|
+
})
|
|
130
|
+
.onUpdate(e => {
|
|
131
|
+
if (closing.current) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
x.setValue(Math.min(Math.max(e.translationX, 0), widthRef.current));
|
|
135
|
+
})
|
|
136
|
+
.onEnd(e => {
|
|
137
|
+
if (closing.current) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const complete =
|
|
141
|
+
e.translationX > widthRef.current * COMPLETE_DISTANCE ||
|
|
142
|
+
e.velocityX > COMPLETE_VELOCITY;
|
|
143
|
+
if (complete) {
|
|
144
|
+
slideOut();
|
|
145
|
+
} else {
|
|
146
|
+
slideTo(0, POP);
|
|
147
|
+
}
|
|
148
|
+
}),
|
|
149
|
+
[slideOut, slideTo, x]
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
const dimOpacity = useMemo(
|
|
153
|
+
() =>
|
|
154
|
+
x.interpolate({
|
|
155
|
+
inputRange: [0, width],
|
|
156
|
+
outputRange: [LIST_DIM, 0],
|
|
157
|
+
extrapolate: 'clamp',
|
|
158
|
+
}),
|
|
159
|
+
[x, width]
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
return (
|
|
163
|
+
<View
|
|
164
|
+
pointerEvents="box-none"
|
|
165
|
+
style={styles.host}
|
|
166
|
+
onLayout={e => {
|
|
167
|
+
const next = e.nativeEvent.layout.width;
|
|
168
|
+
if (next > 0 && next !== widthRef.current) {
|
|
169
|
+
setWidth(next);
|
|
170
|
+
}
|
|
171
|
+
}}
|
|
172
|
+
>
|
|
173
|
+
<Animated.View
|
|
174
|
+
pointerEvents="none"
|
|
175
|
+
style={[styles.fill, styles.dim, { opacity: dimOpacity }]}
|
|
176
|
+
/>
|
|
177
|
+
<GestureDetector gesture={swipeBack}>
|
|
178
|
+
<Animated.View
|
|
179
|
+
style={[
|
|
180
|
+
styles.fill,
|
|
181
|
+
styles.screen,
|
|
182
|
+
{ transform: [{ translateX: x }] },
|
|
183
|
+
]}
|
|
184
|
+
>
|
|
185
|
+
{children(close)}
|
|
186
|
+
</Animated.View>
|
|
187
|
+
</GestureDetector>
|
|
188
|
+
</View>
|
|
189
|
+
);
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const styles = StyleSheet.create({
|
|
193
|
+
host: {
|
|
194
|
+
position: 'absolute',
|
|
195
|
+
top: 0,
|
|
196
|
+
right: 0,
|
|
197
|
+
bottom: 0,
|
|
198
|
+
left: 0,
|
|
199
|
+
zIndex: 1000,
|
|
200
|
+
overflow: 'hidden',
|
|
201
|
+
},
|
|
202
|
+
fill: {
|
|
203
|
+
position: 'absolute',
|
|
204
|
+
top: 0,
|
|
205
|
+
right: 0,
|
|
206
|
+
bottom: 0,
|
|
207
|
+
left: 0,
|
|
208
|
+
},
|
|
209
|
+
dim: {
|
|
210
|
+
backgroundColor: '#000',
|
|
211
|
+
},
|
|
212
|
+
// Same box the shared ModalBackground gives its content.
|
|
213
|
+
screen: {
|
|
214
|
+
justifyContent: 'center',
|
|
215
|
+
alignItems: 'center',
|
|
216
|
+
shadowColor: '#000',
|
|
217
|
+
shadowOffset: { width: -4, height: 0 },
|
|
218
|
+
shadowOpacity: 0.18,
|
|
219
|
+
shadowRadius: 12,
|
|
220
|
+
},
|
|
221
|
+
});
|