@ethora/chat-component-rn 26.7.5 → 26.7.7
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/CHANGELOG.md +62 -0
- package/README.md +31 -8
- package/lib/commonjs/assets/icons.js +7 -2
- package/lib/commonjs/assets/icons.js.map +1 -1
- package/lib/commonjs/components/Header/HeaderRoomList.js +26 -7
- package/lib/commonjs/components/Header/HeaderRoomList.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatHeader.js +5 -2
- package/lib/commonjs/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatRoom.js +36 -14
- package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatWrapper.js +2 -0
- package/lib/commonjs/components/MainComponents/ChatWrapper.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MessageList.js +7 -23
- package/lib/commonjs/components/MainComponents/MessageList.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js +14 -13
- package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
- package/lib/commonjs/components/MainComponents/RoomList.js +208 -35
- package/lib/commonjs/components/MainComponents/RoomList.js.map +1 -1
- package/lib/commonjs/components/Menu/HeaderRoomListMenu.js +317 -98
- package/lib/commonjs/components/Menu/HeaderRoomListMenu.js.map +1 -1
- package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js +320 -110
- package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +552 -213
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js +226 -0
- package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js.map +1 -0
- package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js +6 -2
- package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
- package/lib/commonjs/components/Modals/Modal/Modal.js +8 -0
- package/lib/commonjs/components/Modals/Modal/Modal.js.map +1 -1
- package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js +2 -1
- package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js.map +1 -1
- package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js +202 -104
- package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
- package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js +8 -0
- package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
- package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js +556 -0
- package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js.map +1 -0
- package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js +210 -0
- package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js.map +1 -0
- package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js +4 -2
- package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
- package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js +7 -21
- package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
- package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js +507 -244
- package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
- package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js +74 -46
- package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
- package/lib/commonjs/components/Modals/styledModalComponents.js +9 -2
- package/lib/commonjs/components/Modals/styledModalComponents.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/ChatRoomItem.js +17 -7
- package/lib/commonjs/components/RoomComponents/ChatRoomItem.js.map +1 -1
- package/lib/commonjs/components/styled/SendInput.js +80 -11
- package/lib/commonjs/components/styled/SendInput.js.map +1 -1
- package/lib/commonjs/components/styled/StyledComponents.js +9 -3
- package/lib/commonjs/components/styled/StyledComponents.js.map +1 -1
- package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js +11 -4
- package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
- package/lib/commonjs/context/xmppProvider.js +32 -39
- package/lib/commonjs/context/xmppProvider.js.map +1 -1
- package/lib/commonjs/helpers/getChatBackground.js +23 -0
- package/lib/commonjs/helpers/getChatBackground.js.map +1 -0
- package/lib/commonjs/helpers/mediaLibraryRuntime.js +31 -0
- package/lib/commonjs/helpers/mediaLibraryRuntime.js.map +1 -0
- package/lib/commonjs/helpers/pickImageAsset.js +68 -0
- package/lib/commonjs/helpers/pickImageAsset.js.map +1 -0
- package/lib/commonjs/helpers/pushPayload.js +71 -0
- package/lib/commonjs/helpers/pushPayload.js.map +1 -0
- package/lib/commonjs/helpers/sheetGestures.js +32 -0
- package/lib/commonjs/helpers/sheetGestures.js.map +1 -0
- package/lib/commonjs/helpers/updateMessagesTillLast.js +12 -40
- package/lib/commonjs/helpers/updateMessagesTillLast.js.map +1 -1
- package/lib/commonjs/hooks/useChatRoomFocus.js +3 -9
- package/lib/commonjs/hooks/useChatRoomFocus.js.map +1 -1
- package/lib/commonjs/hooks/useLogout.js +0 -5
- package/lib/commonjs/hooks/useLogout.js.map +1 -1
- package/lib/commonjs/hooks/usePendingNotification.js +8 -11
- package/lib/commonjs/hooks/usePendingNotification.js.map +1 -1
- package/lib/commonjs/hooks/useSendMessage.js +23 -50
- package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
- package/lib/commonjs/i18n/strings.js +121 -1
- package/lib/commonjs/i18n/strings.js.map +1 -1
- package/lib/commonjs/main.js +19 -0
- package/lib/commonjs/main.js.map +1 -1
- package/lib/commonjs/networking/api-requests/user.api.js +59 -0
- package/lib/commonjs/networking/api-requests/user.api.js.map +1 -1
- package/lib/commonjs/networking/authRefresh.js +12 -2
- package/lib/commonjs/networking/authRefresh.js.map +1 -1
- package/lib/commonjs/networking/outboundQueue.js +0 -18
- package/lib/commonjs/networking/outboundQueue.js.map +1 -1
- package/lib/commonjs/networking/stanzaHandlers.js +1 -10
- package/lib/commonjs/networking/stanzaHandlers.js.map +1 -1
- package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js +8 -1
- package/lib/commonjs/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/subscribeToRoomMessages.xmpp.js +5 -1
- package/lib/commonjs/networking/xmpp/subscribeToRoomMessages.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmppClient.js +62 -108
- package/lib/commonjs/networking/xmppClient.js.map +1 -1
- package/lib/commonjs/roomStore/chatSettingsSlice.js +3 -1
- package/lib/commonjs/roomStore/chatSettingsSlice.js.map +1 -1
- package/lib/commonjs/roomStore/roomsSlice.js +3 -22
- package/lib/commonjs/roomStore/roomsSlice.js.map +1 -1
- package/lib/commonjs/services/pushSubscriptionService.js +15 -13
- package/lib/commonjs/services/pushSubscriptionService.js.map +1 -1
- package/lib/module/assets/icons.js +6 -1
- package/lib/module/assets/icons.js.map +1 -1
- package/lib/module/components/Header/HeaderRoomList.js +26 -7
- package/lib/module/components/Header/HeaderRoomList.js.map +1 -1
- package/lib/module/components/MainComponents/ChatHeader.js +5 -2
- package/lib/module/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/module/components/MainComponents/ChatRoom.js +36 -14
- package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/module/components/MainComponents/ChatWrapper.js +2 -0
- package/lib/module/components/MainComponents/ChatWrapper.js.map +1 -1
- package/lib/module/components/MainComponents/MessageList.js +8 -24
- package/lib/module/components/MainComponents/MessageList.js.map +1 -1
- package/lib/module/components/MainComponents/ProfileImagePlaceholder.js +14 -13
- package/lib/module/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
- package/lib/module/components/MainComponents/RoomList.js +207 -35
- package/lib/module/components/MainComponents/RoomList.js.map +1 -1
- package/lib/module/components/Menu/HeaderRoomListMenu.js +319 -101
- package/lib/module/components/Menu/HeaderRoomListMenu.js.map +1 -1
- package/lib/module/components/Modals/AttachSheet/AttachSheet.js +311 -113
- package/lib/module/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +555 -217
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js +223 -0
- package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js.map +1 -0
- package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js +6 -2
- package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
- package/lib/module/components/Modals/Modal/Modal.js +9 -1
- package/lib/module/components/Modals/Modal/Modal.js.map +1 -1
- package/lib/module/components/Modals/NewChatModal/ModalContent.js +2 -1
- package/lib/module/components/Modals/NewChatModal/ModalContent.js.map +1 -1
- package/lib/module/components/Modals/NewChatModal/NewChatModal.js +205 -106
- package/lib/module/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
- package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js +8 -0
- package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
- package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js +548 -0
- package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js.map +1 -0
- package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js +205 -0
- package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js.map +1 -0
- package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js +4 -2
- package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
- package/lib/module/components/Modals/UserProfileModal/EditUserModal.js +9 -23
- package/lib/module/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
- package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js +509 -248
- package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
- package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js +76 -48
- package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
- package/lib/module/components/Modals/styledModalComponents.js +9 -2
- package/lib/module/components/Modals/styledModalComponents.js.map +1 -1
- package/lib/module/components/RoomComponents/ChatRoomItem.js +17 -7
- package/lib/module/components/RoomComponents/ChatRoomItem.js.map +1 -1
- package/lib/module/components/styled/SendInput.js +81 -12
- package/lib/module/components/styled/SendInput.js.map +1 -1
- package/lib/module/components/styled/StyledComponents.js +9 -3
- package/lib/module/components/styled/StyledComponents.js.map +1 -1
- package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js +11 -4
- package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
- package/lib/module/context/xmppProvider.js +32 -39
- package/lib/module/context/xmppProvider.js.map +1 -1
- package/lib/module/helpers/getChatBackground.js +18 -0
- package/lib/module/helpers/getChatBackground.js.map +1 -0
- package/lib/module/helpers/mediaLibraryRuntime.js +25 -0
- package/lib/module/helpers/mediaLibraryRuntime.js.map +1 -0
- package/lib/module/helpers/pickImageAsset.js +63 -0
- package/lib/module/helpers/pickImageAsset.js.map +1 -0
- package/lib/module/helpers/pushPayload.js +63 -0
- package/lib/module/helpers/pushPayload.js.map +1 -0
- package/lib/module/helpers/sheetGestures.js +26 -0
- package/lib/module/helpers/sheetGestures.js.map +1 -0
- package/lib/module/helpers/updateMessagesTillLast.js +13 -41
- package/lib/module/helpers/updateMessagesTillLast.js.map +1 -1
- package/lib/module/hooks/useChatRoomFocus.js +3 -9
- package/lib/module/hooks/useChatRoomFocus.js.map +1 -1
- package/lib/module/hooks/useLogout.js +0 -5
- package/lib/module/hooks/useLogout.js.map +1 -1
- package/lib/module/hooks/usePendingNotification.js +8 -11
- package/lib/module/hooks/usePendingNotification.js.map +1 -1
- package/lib/module/hooks/useSendMessage.js +24 -51
- package/lib/module/hooks/useSendMessage.js.map +1 -1
- package/lib/module/i18n/strings.js +121 -1
- package/lib/module/i18n/strings.js.map +1 -1
- package/lib/module/main.js +2 -1
- package/lib/module/main.js.map +1 -1
- package/lib/module/networking/api-requests/user.api.js +56 -0
- package/lib/module/networking/api-requests/user.api.js.map +1 -1
- package/lib/module/networking/authRefresh.js +12 -2
- package/lib/module/networking/authRefresh.js.map +1 -1
- package/lib/module/networking/outboundQueue.js +0 -17
- package/lib/module/networking/outboundQueue.js.map +1 -1
- package/lib/module/networking/stanzaHandlers.js +1 -10
- package/lib/module/networking/stanzaHandlers.js.map +1 -1
- package/lib/module/networking/xmpp/presenceInRoom.xmpp.js +8 -1
- package/lib/module/networking/xmpp/presenceInRoom.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/subscribeToRoomMessages.xmpp.js +5 -1
- package/lib/module/networking/xmpp/subscribeToRoomMessages.xmpp.js.map +1 -1
- package/lib/module/networking/xmppClient.js +62 -108
- package/lib/module/networking/xmppClient.js.map +1 -1
- package/lib/module/roomStore/chatSettingsSlice.js +3 -1
- package/lib/module/roomStore/chatSettingsSlice.js.map +1 -1
- package/lib/module/roomStore/roomsSlice.js +2 -20
- package/lib/module/roomStore/roomsSlice.js.map +1 -1
- package/lib/module/services/pushSubscriptionService.js +15 -13
- package/lib/module/services/pushSubscriptionService.js.map +1 -1
- package/lib/typescript/assets/icons.d.ts +16 -0
- package/lib/typescript/assets/icons.d.ts.map +1 -1
- 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/MessageList.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ProfileImagePlaceholder.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/RoomList.d.ts +7 -0
- package/lib/typescript/components/MainComponents/RoomList.d.ts.map +1 -1
- package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts +3 -0
- package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts.map +1 -1
- package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts +9 -0
- package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts.map +1 -1
- package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts +10 -0
- package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts +9 -0
- package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts.map +1 -0
- package/lib/typescript/components/Modals/FilePreviewModal/FilePreviewModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/Modal/Modal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts +4 -2
- package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts.map +1 -1
- package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts +1 -1
- package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/NewChatModal/UpdNewChatModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts +75 -0
- package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts.map +1 -0
- package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts +25 -0
- package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts.map +1 -0
- package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts +6 -1
- package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/UserProfileModal/EditUserModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts +16 -0
- package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts +1 -0
- package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/styledModalComponents.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/ChatRoomItem.d.ts.map +1 -1
- package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
- package/lib/typescript/components/styled/StyledComponents.d.ts.map +1 -1
- package/lib/typescript/components/styled/StyledInputComponents/StyledInputComponents.d.ts.map +1 -1
- package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
- package/lib/typescript/helpers/getChatBackground.d.ts +15 -0
- package/lib/typescript/helpers/getChatBackground.d.ts.map +1 -0
- package/lib/typescript/helpers/mediaLibraryRuntime.d.ts +3 -0
- package/lib/typescript/helpers/mediaLibraryRuntime.d.ts.map +1 -0
- package/lib/typescript/helpers/pickImageAsset.d.ts +27 -0
- package/lib/typescript/helpers/pickImageAsset.d.ts.map +1 -0
- package/lib/typescript/helpers/pushPayload.d.ts +7 -0
- package/lib/typescript/helpers/pushPayload.d.ts.map +1 -0
- package/lib/typescript/helpers/sheetGestures.d.ts +20 -0
- package/lib/typescript/helpers/sheetGestures.d.ts.map +1 -0
- package/lib/typescript/helpers/updateMessagesTillLast.d.ts.map +1 -1
- package/lib/typescript/hooks/useChatRoomFocus.d.ts.map +1 -1
- package/lib/typescript/hooks/useLogout.d.ts.map +1 -1
- package/lib/typescript/hooks/usePendingNotification.d.ts.map +1 -1
- package/lib/typescript/hooks/useSendMessage.d.ts.map +1 -1
- package/lib/typescript/i18n/strings.d.ts.map +1 -1
- package/lib/typescript/main.d.ts +3 -1
- package/lib/typescript/main.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/user.api.d.ts +27 -0
- package/lib/typescript/networking/api-requests/user.api.d.ts.map +1 -1
- package/lib/typescript/networking/authRefresh.d.ts +4 -1
- package/lib/typescript/networking/authRefresh.d.ts.map +1 -1
- package/lib/typescript/networking/outboundQueue.d.ts +0 -16
- package/lib/typescript/networking/outboundQueue.d.ts.map +1 -1
- package/lib/typescript/networking/stanzaHandlers.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/presenceInRoom.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/subscribeToRoomMessages.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmppClient.d.ts +8 -33
- package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
- package/lib/typescript/roomStore/chatSettingsSlice.d.ts.map +1 -1
- package/lib/typescript/roomStore/roomsSlice.d.ts +1 -18
- package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
- package/lib/typescript/services/pushSubscriptionService.d.ts +1 -1
- package/lib/typescript/services/pushSubscriptionService.d.ts.map +1 -1
- package/lib/typescript/types/models/room.model.d.ts +0 -15
- package/lib/typescript/types/models/room.model.d.ts.map +1 -1
- package/lib/typescript/types/types.d.ts +31 -20
- package/lib/typescript/types/types.d.ts.map +1 -1
- package/package.json +6 -1
- package/src/assets/icons.tsx +48 -9
- package/src/components/Header/HeaderRoomList.tsx +24 -6
- package/src/components/MainComponents/ChatHeader.tsx +5 -2
- package/src/components/MainComponents/ChatRoom.tsx +38 -20
- package/src/components/MainComponents/ChatWrapper.tsx +3 -0
- package/src/components/MainComponents/MessageList.tsx +8 -24
- package/src/components/MainComponents/ProfileImagePlaceholder.tsx +21 -14
- package/src/components/MainComponents/RoomList.tsx +236 -39
- package/src/components/Menu/HeaderRoomListMenu.tsx +328 -75
- package/src/components/Modals/AttachSheet/AttachSheet.tsx +331 -97
- package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +598 -279
- package/src/components/Modals/ChatProfileModal/ReportChatModal.tsx +244 -0
- package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +4 -2
- package/src/components/Modals/Modal/Modal.tsx +7 -0
- package/src/components/Modals/NewChatModal/ModalContent.tsx +6 -3
- package/src/components/Modals/NewChatModal/NewChatModal.tsx +219 -117
- package/src/components/Modals/NewChatModal/UpdNewChatModal.tsx +12 -1
- package/src/components/Modals/ProfileHeader/ProfileHeader.tsx +615 -0
- package/src/components/Modals/ProfileHeader/ProfileMenu.tsx +217 -0
- package/src/components/Modals/SelectUsersModal/SelectUsersModal.tsx +14 -4
- package/src/components/Modals/UserProfileModal/EditUserModal.tsx +9 -25
- package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +617 -307
- package/src/components/Modals/UserSettingsModal/UserSettingsModal.tsx +75 -58
- package/src/components/Modals/styledModalComponents.tsx +9 -2
- package/src/components/RoomComponents/ChatRoomItem.tsx +14 -7
- package/src/components/styled/SendInput.tsx +83 -12
- package/src/components/styled/StyledComponents.ts +9 -3
- package/src/components/styled/StyledInputComponents/StyledInputComponents.tsx +11 -4
- package/src/context/xmppProvider.tsx +36 -47
- package/src/helpers/getChatBackground.ts +18 -0
- package/src/helpers/mediaLibraryRuntime.ts +25 -0
- package/src/helpers/pickImageAsset.ts +68 -0
- package/src/helpers/pushPayload.ts +62 -0
- package/src/helpers/sheetGestures.ts +25 -0
- package/src/helpers/updateMessagesTillLast.tsx +17 -42
- package/src/hooks/useChatRoomFocus.ts +3 -11
- package/src/hooks/useLogout.tsx +0 -7
- package/src/hooks/usePendingNotification.ts +5 -11
- package/src/hooks/useSendMessage.tsx +24 -60
- package/src/i18n/strings.ts +121 -1
- package/src/main.ts +4 -1
- package/src/networking/api-requests/user.api.ts +71 -0
- package/src/networking/authRefresh.ts +25 -4
- package/src/networking/outboundQueue.ts +0 -29
- package/src/networking/stanzaHandlers.ts +1 -9
- package/src/networking/xmpp/presenceInRoom.xmpp.ts +6 -1
- package/src/networking/xmpp/subscribeToRoomMessages.xmpp.ts +12 -1
- package/src/networking/xmppClient.ts +65 -119
- package/src/roomStore/chatSettingsSlice.ts +3 -1
- package/src/roomStore/roomsSlice.ts +2 -20
- package/src/services/pushSubscriptionService.ts +18 -13
- package/src/types/models/room.model.ts +0 -15
- package/src/types/types.ts +33 -20
|
@@ -3,34 +3,75 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
6
|
+
exports.userInitials = exports.profileTabs = exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
8
9
|
var _styledModalComponents = require("../styledModalComponents");
|
|
9
10
|
var _icons = require("../../../assets/icons");
|
|
10
|
-
var _ModalHeaderComponent = _interopRequireDefault(require("../ModalHeaderComponent"));
|
|
11
|
-
var _ProfileImagePlaceholder = require("../../MainComponents/ProfileImagePlaceholder");
|
|
12
|
-
var _Button = _interopRequireDefault(require("../../styled/Button"));
|
|
13
|
-
var _DropdownMenu = _interopRequireDefault(require("../../DropdownMenu/DropdownMenu"));
|
|
14
|
-
var _chatSettingsSlice = require("../../../roomStore/chatSettingsSlice");
|
|
15
|
-
var _roomsSlice = require("../../../roomStore/roomsSlice");
|
|
16
|
-
var _EditUserModal = _interopRequireDefault(require("./EditUserModal"));
|
|
17
|
-
var _walletUsername = require("../../../helpers/walletUsername");
|
|
18
|
-
var _xmppProvider = require("../../../context/xmppProvider");
|
|
19
|
-
var _Select = _interopRequireDefault(require("../../MainComponents/Select"));
|
|
20
11
|
var _hooks = require("../../../hooks/hooks");
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
var _createRoomFromApi = require("../../../helpers/createRoomFromApi");
|
|
12
|
+
var _useChatSettingState = require("../../../hooks/useChatSettingState");
|
|
13
|
+
var _xmppProvider = require("../../../context/xmppProvider");
|
|
24
14
|
var _ToastContext = require("../../../context/ToastContext");
|
|
15
|
+
var _useT = require("../../../i18n/useT");
|
|
16
|
+
var _useFileToken = require("../../../hooks/useFileToken");
|
|
17
|
+
var _secureFileUrl = require("../../../helpers/secureFileUrl");
|
|
18
|
+
var _getIconColor = require("../../../helpers/getIconColor");
|
|
19
|
+
var _typography = require("../../../helpers/typography");
|
|
20
|
+
var _getElementFont = require("../../../helpers/getElementFont");
|
|
25
21
|
var _LANGUAGE_OPTIONS = require("../../../helpers/constants/LANGUAGE_OPTIONS");
|
|
22
|
+
var _MODAL_TYPES = require("../../../helpers/constants/MODAL_TYPES");
|
|
23
|
+
var _chatSettingsSlice = require("../../../roomStore/chatSettingsSlice");
|
|
24
|
+
var _roomsSlice = require("../../../roomStore/roomsSlice");
|
|
25
|
+
var _HeaderRoomListMenu = require("../../Menu/HeaderRoomListMenu");
|
|
26
|
+
var _useLogout = require("../../../hooks/useLogout");
|
|
27
|
+
var _rooms = require("../../../networking/api-requests/rooms.api");
|
|
26
28
|
var _user = require("../../../networking/api-requests/user.api");
|
|
27
|
-
var
|
|
29
|
+
var _createRoomFromApi = require("../../../helpers/createRoomFromApi");
|
|
30
|
+
var _walletUsername = require("../../../helpers/walletUsername");
|
|
31
|
+
var _ProfileHeader = require("../ProfileHeader/ProfileHeader");
|
|
32
|
+
var _ProfileMenu = _interopRequireDefault(require("../ProfileHeader/ProfileMenu"));
|
|
33
|
+
var _EditUserModal = _interopRequireDefault(require("./EditUserModal"));
|
|
28
34
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
35
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
30
36
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
37
|
+
/** @format */
|
|
38
|
+
|
|
39
|
+
const PREFIX = 'user-profile';
|
|
40
|
+
/** Two uppercase letters for a person without a picture. */
|
|
41
|
+
const userInitials = name => {
|
|
42
|
+
const words = (name || '').trim().split(/\s+/).filter(Boolean);
|
|
43
|
+
const letters = (words.length >= 2 ? [words[0][0], words[1][0]] : [words[0]?.[0], words[0]?.[1]]).filter(c => !!c && /[\p{L}\p{N}]/u.test(c));
|
|
44
|
+
return letters.join('').toUpperCase();
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Which tabs a profile shows. Only the signed-in user has tabs at all:
|
|
49
|
+
* `GET /v2/files/` returns the JWT owner's files, so there is nothing to
|
|
50
|
+
* put under Media/Documents for anybody else, and the language picker is
|
|
51
|
+
* a personal setting.
|
|
52
|
+
*/
|
|
53
|
+
exports.userInitials = userInitials;
|
|
54
|
+
const profileTabs = opts => {
|
|
55
|
+
if (!opts.isOwnProfile) {
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
const tabs = [];
|
|
59
|
+
if (opts.translatesEnabled) {
|
|
60
|
+
tabs.push('language');
|
|
61
|
+
}
|
|
62
|
+
if (opts.hasMedia) {
|
|
63
|
+
tabs.push('media');
|
|
64
|
+
}
|
|
65
|
+
if (opts.hasDocuments) {
|
|
66
|
+
tabs.push('documents');
|
|
67
|
+
}
|
|
68
|
+
return tabs;
|
|
69
|
+
};
|
|
70
|
+
exports.profileTabs = profileTabs;
|
|
31
71
|
const UserProfileModal = ({
|
|
32
72
|
handleCloseModal
|
|
33
73
|
}) => {
|
|
74
|
+
const t = (0, _useT.useT)();
|
|
34
75
|
const dispatch = (0, _hooks.useAppDispatch)();
|
|
35
76
|
const {
|
|
36
77
|
client
|
|
@@ -44,75 +85,99 @@ const UserProfileModal = ({
|
|
|
44
85
|
selectedUser,
|
|
45
86
|
langSource
|
|
46
87
|
} = (0, _useChatSettingState.useChatSettingState)();
|
|
88
|
+
const fileToken = (0, _useFileToken.useFileToken)();
|
|
47
89
|
const [isEditing, setIsEditing] = (0, _react.useState)(false);
|
|
48
|
-
const [
|
|
49
|
-
const [
|
|
50
|
-
const [
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
data
|
|
78
|
-
} = await (0, _user.getDocuments)(user?.defaultWallet?.walletAddress);
|
|
79
|
-
const items = data.results.filter(el => el.locations[0]);
|
|
80
|
-
setDocuments(items);
|
|
81
|
-
} catch (error) {
|
|
82
|
-
console.error('Error getting docs', error);
|
|
90
|
+
const [files, setFiles] = (0, _react.useState)([]);
|
|
91
|
+
const [loadingFiles, setLoadingFiles] = (0, _react.useState)(false);
|
|
92
|
+
const [activeTab, setActiveTab] = (0, _react.useState)(null);
|
|
93
|
+
const scrollY = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
|
|
94
|
+
const scrollRef = (0, _react.useRef)(null);
|
|
95
|
+
const {
|
|
96
|
+
collapseDistance
|
|
97
|
+
} = (0, _ProfileHeader.useHeaderMetrics)();
|
|
98
|
+
const [viewportHeight, setViewportHeight] = (0, _react.useState)(0);
|
|
99
|
+
// `scrollY` is driven natively, so its value can't be read back with
|
|
100
|
+
// addListener; the Animated.event's JS `listener` still fires, which is
|
|
101
|
+
// enough to know which state the header is in.
|
|
102
|
+
const [isCollapsed, setIsCollapsed] = (0, _react.useState)(false);
|
|
103
|
+
const isOwnProfile = !selectedUser;
|
|
104
|
+
const profileUser = selectedUser ?? user;
|
|
105
|
+
const media = (0, _react.useMemo)(() => files.filter(_user.isMediaFile), [files]);
|
|
106
|
+
const documents = (0, _react.useMemo)(() => files.filter(file => !(0, _user.isMediaFile)(file)), [files]);
|
|
107
|
+
const tabs = (0, _react.useMemo)(() => profileTabs({
|
|
108
|
+
isOwnProfile,
|
|
109
|
+
translatesEnabled: !!config?.translates?.enabled,
|
|
110
|
+
hasMedia: media.length > 0,
|
|
111
|
+
hasDocuments: documents.length > 0
|
|
112
|
+
}), [isOwnProfile, config?.translates?.enabled, media.length, documents.length]);
|
|
113
|
+
|
|
114
|
+
// Keep the selected tab valid as the lists load in.
|
|
115
|
+
(0, _react.useEffect)(() => {
|
|
116
|
+
if (tabs.length === 0) {
|
|
117
|
+
setActiveTab(null);
|
|
118
|
+
return;
|
|
83
119
|
}
|
|
84
|
-
|
|
120
|
+
setActiveTab(current => current && tabs.includes(current) ? current : tabs[0]);
|
|
121
|
+
}, [tabs]);
|
|
122
|
+
|
|
123
|
+
// One request per visit, and only for one's own profile — the endpoint
|
|
124
|
+
// is scoped to the JWT owner, so it would return *our* files while
|
|
125
|
+
// looking at somebody else's page.
|
|
85
126
|
(0, _react.useEffect)(() => {
|
|
86
|
-
|
|
87
|
-
|
|
127
|
+
if (!isOwnProfile) {
|
|
128
|
+
setFiles([]);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
let cancelled = false;
|
|
132
|
+
setLoadingFiles(true);
|
|
133
|
+
(0, _user.getUserFiles)().then(rows => {
|
|
134
|
+
if (!cancelled) {
|
|
135
|
+
setFiles(rows);
|
|
136
|
+
}
|
|
137
|
+
}).catch(error => {
|
|
138
|
+
console.warn('Could not load user files:', error);
|
|
139
|
+
if (!cancelled) {
|
|
140
|
+
setFiles([]);
|
|
141
|
+
}
|
|
142
|
+
}).finally(() => {
|
|
143
|
+
if (!cancelled) {
|
|
144
|
+
setLoadingFiles(false);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
return () => {
|
|
148
|
+
cancelled = true;
|
|
149
|
+
};
|
|
150
|
+
}, [isOwnProfile, user?.token]);
|
|
88
151
|
const handleBackClick = (0, _react.useCallback)(() => {
|
|
89
152
|
dispatch((0, _chatSettingsSlice.setSelectedUser)(undefined));
|
|
90
153
|
handleCloseModal();
|
|
91
|
-
}, []);
|
|
154
|
+
}, [dispatch, handleCloseModal]);
|
|
155
|
+
|
|
156
|
+
// Same teardown the room-list menu runs (XMPP, redux, persisted slices,
|
|
157
|
+
// AsyncStorage), including the host's confirm copy and callbacks.
|
|
158
|
+
const performLogout = (0, _useLogout.useLogout)();
|
|
92
159
|
const handleLogout = (0, _react.useCallback)(() => {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
160
|
+
(0, _HeaderRoomListMenu.runLogoutFlow)(config?.logout ?? {
|
|
161
|
+
enabled: true
|
|
162
|
+
}, performLogout).catch(() => {});
|
|
163
|
+
}, [config?.logout, performLogout]);
|
|
164
|
+
const handleShare = (0, _react.useCallback)(async () => {
|
|
165
|
+
const name = profileUser?.name || `${profileUser?.firstName ?? ''} ${profileUser?.lastName ?? ''}`.trim();
|
|
166
|
+
const id = profileUser?.userJID || profileUser?.defaultWallet?.walletAddress || profileUser?.id || '';
|
|
167
|
+
try {
|
|
168
|
+
await _reactNative.Share.share({
|
|
169
|
+
message: id ? `${name}\n${id}` : name
|
|
170
|
+
});
|
|
171
|
+
} catch (error) {
|
|
172
|
+
console.warn('Could not share the profile:', error);
|
|
104
173
|
}
|
|
105
|
-
}
|
|
106
|
-
const handleSelect = selected => {
|
|
107
|
-
dispatch((0, _chatSettingsSlice.setLangSource)(selected.id));
|
|
108
|
-
};
|
|
109
|
-
const EditClick = (0, _react.useCallback)(() => {
|
|
110
|
-
setIsEditing(true);
|
|
111
|
-
}, []);
|
|
174
|
+
}, [profileUser]);
|
|
112
175
|
const handleRoomCreation = async (newChat, usersArrayLength) => {
|
|
113
176
|
try {
|
|
114
177
|
const normalizedChat = (0, _createRoomFromApi.createRoomFromApi)(newChat, config?.xmppSettings?.conference, usersArrayLength);
|
|
115
|
-
if (!normalizedChat || !client)
|
|
178
|
+
if (!normalizedChat || !client) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
116
181
|
dispatch((0, _roomsSlice.addRoomViaApi)({
|
|
117
182
|
room: normalizedChat,
|
|
118
183
|
xmpp: client
|
|
@@ -139,202 +204,400 @@ const UserProfileModal = ({
|
|
|
139
204
|
type: 'info',
|
|
140
205
|
duration: 3000
|
|
141
206
|
});
|
|
142
|
-
let newRoomJid = '';
|
|
143
207
|
if (config?.newArch) {
|
|
144
208
|
const newRoom = await (0, _rooms.postPrivateRoom)(selectedUser?.userJID ?? (selectedUser?.id || ''));
|
|
145
209
|
handleRoomCreation(newRoom, 2);
|
|
146
|
-
newRoomJid = newRoom.name;
|
|
147
210
|
} else {
|
|
148
211
|
const selectedUserUsername = (0, _walletUsername.walletToUsername)(selectedUser?.id || '');
|
|
149
212
|
const myUsername = (0, _walletUsername.walletToUsername)(user.defaultWallet.walletAddress);
|
|
150
|
-
const
|
|
151
|
-
const roomJid = combinedWalletAddress.toLowerCase();
|
|
213
|
+
const roomJid = [myUsername, selectedUserUsername].sort().join('.').toLowerCase();
|
|
152
214
|
const combinedUsersName = [user.firstName, selectedUser?.name?.split(' ')?.[0] || ''].sort().join(' and ');
|
|
153
|
-
newRoomJid = (await client?.createPrivateRoomStanza(combinedUsersName, `Private chat ${combinedUsersName}`, roomJid)) || '';
|
|
215
|
+
const newRoomJid = (await client?.createPrivateRoomStanza(combinedUsersName, `Private chat ${combinedUsersName}`, roomJid)) || '';
|
|
154
216
|
if (newRoomJid) {
|
|
155
217
|
await client?.inviteRoomRequestStanza(selectedUserUsername, newRoomJid);
|
|
156
218
|
await client?.getRoomsStanza();
|
|
157
219
|
}
|
|
158
220
|
}
|
|
159
221
|
dispatch((0, _chatSettingsSlice.setActiveModal)(undefined));
|
|
160
|
-
}, [selectedUser]);
|
|
161
|
-
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
const showDeleteModal = docId => {
|
|
170
|
-
setDeleteDocumentId(docId);
|
|
171
|
-
setShowDelete(true);
|
|
222
|
+
}, [selectedUser]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
223
|
+
|
|
224
|
+
const openFile = file => {
|
|
225
|
+
dispatch((0, _chatSettingsSlice.setActiveFile)({
|
|
226
|
+
fileName: file.name,
|
|
227
|
+
fileURL: file.url,
|
|
228
|
+
mimetype: file.mimetype
|
|
229
|
+
}));
|
|
230
|
+
dispatch((0, _chatSettingsSlice.setActiveModal)(_MODAL_TYPES.MODAL_TYPES.FILE_PREVIEW));
|
|
172
231
|
};
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
232
|
+
const heroActions = (0, _react.useMemo)(() => isOwnProfile ? [{
|
|
233
|
+
key: 'account',
|
|
234
|
+
label: t('action.account'),
|
|
235
|
+
icon: color => /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ProfileIcon, {
|
|
236
|
+
color: color
|
|
237
|
+
}),
|
|
238
|
+
onPress: () => dispatch((0, _chatSettingsSlice.setActiveModal)(_MODAL_TYPES.MODAL_TYPES.SETTINGS))
|
|
239
|
+
}, {
|
|
240
|
+
key: 'share',
|
|
241
|
+
label: t('action.share'),
|
|
242
|
+
icon: color => /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ShareIcon, {
|
|
243
|
+
color: color
|
|
244
|
+
}),
|
|
245
|
+
onPress: handleShare
|
|
246
|
+
}, {
|
|
247
|
+
key: 'edit',
|
|
248
|
+
label: t('action.edit'),
|
|
249
|
+
icon: color => /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.EditIcon, {
|
|
250
|
+
color: color
|
|
251
|
+
}),
|
|
252
|
+
onPress: () => setIsEditing(true)
|
|
253
|
+
}, {
|
|
254
|
+
key: 'logout',
|
|
255
|
+
label: t('action.logOut'),
|
|
256
|
+
icon: color => /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.LogoutIcon, {
|
|
257
|
+
color: color
|
|
258
|
+
}),
|
|
259
|
+
onPress: handleLogout
|
|
260
|
+
}] : [...(config?.hideMemberSendMessageAction ? [] : [{
|
|
261
|
+
key: 'message',
|
|
262
|
+
label: t('action.message'),
|
|
263
|
+
icon: color => /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ChatIcon, {
|
|
264
|
+
color: color
|
|
265
|
+
}),
|
|
266
|
+
onPress: handlePrivateMessage
|
|
267
|
+
}]), {
|
|
268
|
+
key: 'share',
|
|
269
|
+
label: t('action.share'),
|
|
270
|
+
icon: color => /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ShareIcon, {
|
|
271
|
+
color: color
|
|
272
|
+
}),
|
|
273
|
+
onPress: handleShare
|
|
274
|
+
}], [isOwnProfile, t, handleShare, handlePrivateMessage, handleLogout] // eslint-disable-line react-hooks/exhaustive-deps
|
|
275
|
+
);
|
|
276
|
+
|
|
277
|
+
// Collapsed, the hero's round buttons are gone — the "…" menu carries
|
|
278
|
+
// exactly the same actions so nothing becomes unreachable.
|
|
279
|
+
const menuItems = (0, _react.useMemo)(() => isCollapsed ? heroActions.map(action => ({
|
|
280
|
+
key: action.key,
|
|
281
|
+
label: action.label,
|
|
282
|
+
icon: action.icon('#141414'),
|
|
283
|
+
destructive: action.key === 'logout',
|
|
284
|
+
onPress: action.onPress
|
|
285
|
+
})) : [], [isCollapsed, heroActions]);
|
|
286
|
+
if (isEditing) {
|
|
287
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledModalComponents.ModalContainerFullScreen, {
|
|
288
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_EditUserModal.default, {
|
|
289
|
+
setIsEditing: setIsEditing,
|
|
290
|
+
modalUser: profileUser,
|
|
291
|
+
config: config
|
|
188
292
|
})
|
|
189
|
-
})
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
const displayName = profileUser?.name || `${profileUser?.firstName ?? ''} ${profileUser?.lastName ?? ''}`.trim() || t('modal.profile.title');
|
|
296
|
+
const heroImage = (0, _secureFileUrl.appendFileToken)(profileUser?.profileImage, fileToken) || null;
|
|
297
|
+
const heroColor = config?.colors?.avatar || (0, _getIconColor.getIconColor)(config);
|
|
298
|
+
const description = profileUser?.description;
|
|
299
|
+
const renderTabBody = () => {
|
|
300
|
+
if (activeTab === 'language') {
|
|
301
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
302
|
+
children: _LANGUAGE_OPTIONS.LANGUAGE_OPTIONS.map(option => {
|
|
303
|
+
const selected = langSource === option.id;
|
|
304
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
|
|
305
|
+
testID: `${PREFIX}-language-${option.id}`,
|
|
306
|
+
activeOpacity: 0.7,
|
|
307
|
+
style: styles.languageRow,
|
|
308
|
+
onPress: () => dispatch((0, _chatSettingsSlice.setLangSource)(option.id)),
|
|
309
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
310
|
+
style: styles.languageLabel,
|
|
311
|
+
children: option.name
|
|
312
|
+
}), selected && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
313
|
+
style: [styles.check, {
|
|
314
|
+
color: (0, _getIconColor.getIconColor)(config)
|
|
315
|
+
}],
|
|
316
|
+
children: "\u2713"
|
|
317
|
+
})]
|
|
318
|
+
}, option.id);
|
|
205
319
|
})
|
|
206
|
-
})
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
onPress:
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
color: '#ffffff'
|
|
220
|
-
},
|
|
221
|
-
children: "Message"
|
|
222
|
-
})
|
|
223
|
-
}), !config?.hideMemberCopyIdAction && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledModalComponents.ActionButton, {
|
|
224
|
-
onPress: () => {}
|
|
225
|
-
// onPress={() => handleCopyClick(selectedUser.id)}
|
|
226
|
-
,
|
|
227
|
-
variant: "filled",
|
|
228
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
229
|
-
style: {
|
|
230
|
-
color: '#ffffff'
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
if (activeTab === 'media') {
|
|
323
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
324
|
+
style: styles.mediaGrid,
|
|
325
|
+
children: media.map(file => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
326
|
+
testID: `${PREFIX}-media-${file.id}`,
|
|
327
|
+
activeOpacity: 0.8,
|
|
328
|
+
style: styles.mediaTile,
|
|
329
|
+
onPress: () => openFile(file),
|
|
330
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, {
|
|
331
|
+
source: {
|
|
332
|
+
uri: (0, _secureFileUrl.appendFileToken)(file.url, fileToken) || file.url
|
|
231
333
|
},
|
|
232
|
-
|
|
334
|
+
style: styles.mediaImage,
|
|
335
|
+
resizeMode: "cover"
|
|
233
336
|
})
|
|
337
|
+
}, file.id))
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
341
|
+
children: documents.map(file => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
|
|
342
|
+
testID: `${PREFIX}-document-${file.id}`,
|
|
343
|
+
activeOpacity: 0.7,
|
|
344
|
+
style: styles.documentRow,
|
|
345
|
+
onPress: () => openFile(file),
|
|
346
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.IconDoc, {}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
347
|
+
style: styles.documentText,
|
|
348
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
349
|
+
numberOfLines: 1,
|
|
350
|
+
style: styles.documentName,
|
|
351
|
+
children: file.name
|
|
352
|
+
}), !!file.createdAt && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
353
|
+
style: styles.documentDate,
|
|
354
|
+
children: new Date(file.createdAt).toLocaleDateString()
|
|
355
|
+
})]
|
|
234
356
|
})]
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
357
|
+
}, file.id))
|
|
358
|
+
});
|
|
359
|
+
};
|
|
360
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styledModalComponents.ModalContainerFullScreen, {
|
|
361
|
+
style: styles.screen,
|
|
362
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Animated.ScrollView, {
|
|
363
|
+
ref: scrollRef,
|
|
364
|
+
style: styles.scroll,
|
|
365
|
+
contentContainerStyle: [styles.scrollContent, viewportHeight > 0 && {
|
|
366
|
+
minHeight: viewportHeight + collapseDistance
|
|
367
|
+
}],
|
|
368
|
+
onLayout: e => setViewportHeight(e.nativeEvent.layout.height),
|
|
369
|
+
showsVerticalScrollIndicator: false,
|
|
370
|
+
scrollEventThrottle: 16,
|
|
371
|
+
onScroll: _reactNative.Animated.event([{
|
|
372
|
+
nativeEvent: {
|
|
373
|
+
contentOffset: {
|
|
374
|
+
y: scrollY
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}], {
|
|
378
|
+
useNativeDriver: true,
|
|
379
|
+
listener: e => {
|
|
380
|
+
const y = e?.nativeEvent?.contentOffset?.y ?? 0;
|
|
381
|
+
setIsCollapsed(y >= collapseDistance - 8);
|
|
382
|
+
}
|
|
383
|
+
}),
|
|
384
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ProfileHeader.ProfileHero, {
|
|
385
|
+
testIDPrefix: PREFIX,
|
|
386
|
+
title: displayName,
|
|
387
|
+
imageUri: heroImage,
|
|
388
|
+
fallbackColor: heroColor,
|
|
389
|
+
initials: userInitials(displayName),
|
|
390
|
+
scrollY: scrollY,
|
|
391
|
+
actions: heroActions,
|
|
392
|
+
titleStyle: (0, _typography.chatTextStyle)(config?.typography?.profile?.title),
|
|
393
|
+
titleAccessory: isOwnProfile ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
|
|
394
|
+
testID: `${PREFIX}-logout`,
|
|
395
|
+
activeOpacity: 0.7,
|
|
396
|
+
style: styles.leaveButton,
|
|
397
|
+
onPress: handleLogout,
|
|
398
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.LeaveIcon, {
|
|
399
|
+
color: "#FFFFFF",
|
|
400
|
+
width: 18,
|
|
401
|
+
height: 18
|
|
402
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
403
|
+
style: styles.leaveLabel,
|
|
404
|
+
children: t('action.leave')
|
|
405
|
+
})]
|
|
406
|
+
}) : undefined
|
|
407
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
408
|
+
style: styles.body,
|
|
409
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
410
|
+
style: styles.card,
|
|
411
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
412
|
+
style: [styles.cardLabel, (0, _getElementFont.getElementFont)(config, 'profileSectionLabel')],
|
|
413
|
+
children: t('modal.profile.about')
|
|
414
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
415
|
+
style: styles.cardValue,
|
|
416
|
+
children: description && description.length > 4 ? description : t('modal.profile.noDescription')
|
|
417
|
+
})]
|
|
418
|
+
}), tabs.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
419
|
+
style: styles.card,
|
|
420
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
421
|
+
style: styles.tabsRow,
|
|
422
|
+
children: tabs.map(tab => {
|
|
423
|
+
const active = tab === activeTab;
|
|
424
|
+
const count = tab === 'media' ? media.length : tab === 'documents' ? documents.length : 0;
|
|
425
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
|
|
426
|
+
testID: `${PREFIX}-tab-${tab}`,
|
|
427
|
+
activeOpacity: 0.7,
|
|
428
|
+
style: [styles.tab, active && {
|
|
429
|
+
borderBottomColor: (0, _getIconColor.getIconColor)(config)
|
|
430
|
+
}],
|
|
431
|
+
onPress: () => setActiveTab(tab),
|
|
432
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
433
|
+
style: [styles.tabLabel, active && {
|
|
434
|
+
color: (0, _getIconColor.getIconColor)(config)
|
|
435
|
+
}],
|
|
436
|
+
children: t(`modal.profile.${tab}`)
|
|
437
|
+
}), count > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
438
|
+
style: [styles.tabBadge, {
|
|
439
|
+
backgroundColor: (0, _getIconColor.getIconColor)(config)
|
|
440
|
+
}],
|
|
441
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
442
|
+
style: styles.tabBadgeText,
|
|
443
|
+
children: count
|
|
276
444
|
})
|
|
277
445
|
})]
|
|
278
|
-
})
|
|
279
|
-
})
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
}, doc._id))
|
|
284
|
-
})
|
|
285
|
-
})]
|
|
286
|
-
})]
|
|
287
|
-
}), [modalUser, documents]);
|
|
288
|
-
const EditingBody = (0, _react.useMemo)(() => /*#__PURE__*/(0, _jsxRuntime.jsx)(_EditUserModal.default, {
|
|
289
|
-
setIsEditing: setIsEditing,
|
|
290
|
-
modalUser: modalUser,
|
|
291
|
-
config: config
|
|
292
|
-
}), [modalUser]);
|
|
293
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
294
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styledModalComponents.ModalContainerFullScreen, {
|
|
295
|
-
children: !isEditing ? DefaultBody : EditingBody
|
|
296
|
-
}), showDelete && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledModalComponents.ModalBackground, {
|
|
297
|
-
style: {
|
|
298
|
-
position: 'absolute',
|
|
299
|
-
zIndex: 9999
|
|
300
|
-
},
|
|
301
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styledModalComponents.ModalContainer, {
|
|
302
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styledModalComponents.CloseButton, {
|
|
303
|
-
onPress: () => setShowDelete(false),
|
|
304
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
305
|
-
style: {
|
|
306
|
-
fontSize: 24
|
|
307
|
-
},
|
|
308
|
-
children: "\xD7"
|
|
309
|
-
})
|
|
310
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledModalComponents.ModalTitle, {
|
|
311
|
-
children: "Delete this document?"
|
|
312
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styledModalComponents.GroupContainer, {
|
|
313
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
314
|
-
onPress: () => setShowDelete(false),
|
|
315
|
-
text: 'Cancel',
|
|
316
|
-
style: {
|
|
317
|
-
width: '100%'
|
|
318
|
-
},
|
|
319
|
-
unstyled: true,
|
|
320
|
-
variant: "filled",
|
|
321
|
-
color: "white"
|
|
322
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
323
|
-
onPress: handleDeleteDocument,
|
|
324
|
-
text: 'Delete',
|
|
325
|
-
style: {
|
|
326
|
-
width: '100%',
|
|
327
|
-
borderWidth: 1,
|
|
328
|
-
borderColor: 'red'
|
|
329
|
-
},
|
|
330
|
-
color: "red",
|
|
331
|
-
unstyled: true,
|
|
332
|
-
variant: "outlined"
|
|
333
|
-
})]
|
|
446
|
+
}, tab);
|
|
447
|
+
})
|
|
448
|
+
}), renderTabBody()]
|
|
449
|
+
}), isOwnProfile && loadingFiles && files.length === 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
|
|
450
|
+
testID: `${PREFIX}-files-loading`
|
|
334
451
|
})]
|
|
452
|
+
})]
|
|
453
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProfileHeader.ProfileTopBar, {
|
|
454
|
+
testIDPrefix: PREFIX,
|
|
455
|
+
title: displayName,
|
|
456
|
+
imageUri: heroImage,
|
|
457
|
+
fallbackColor: heroColor,
|
|
458
|
+
initials: userInitials(displayName),
|
|
459
|
+
scrollY: scrollY,
|
|
460
|
+
onBack: handleBackClick,
|
|
461
|
+
titleStyle: (0, _typography.chatTextStyle)(config?.typography?.profile?.screenTitle),
|
|
462
|
+
menu: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProfileMenu.default, {
|
|
463
|
+
testIDPrefix: PREFIX,
|
|
464
|
+
items: menuItems
|
|
335
465
|
})
|
|
336
466
|
})]
|
|
337
467
|
});
|
|
338
468
|
};
|
|
469
|
+
const styles = _reactNative.StyleSheet.create({
|
|
470
|
+
screen: {
|
|
471
|
+
position: 'relative',
|
|
472
|
+
backgroundColor: '#F2F3F5'
|
|
473
|
+
},
|
|
474
|
+
scroll: {
|
|
475
|
+
width: '100%',
|
|
476
|
+
flex: 1
|
|
477
|
+
},
|
|
478
|
+
scrollContent: {
|
|
479
|
+
paddingBottom: 32
|
|
480
|
+
},
|
|
481
|
+
body: {
|
|
482
|
+
padding: 12,
|
|
483
|
+
gap: 12
|
|
484
|
+
},
|
|
485
|
+
card: {
|
|
486
|
+
backgroundColor: '#FFFFFF',
|
|
487
|
+
borderRadius: 14,
|
|
488
|
+
padding: 16,
|
|
489
|
+
shadowColor: '#000',
|
|
490
|
+
shadowOffset: {
|
|
491
|
+
width: 0,
|
|
492
|
+
height: 1
|
|
493
|
+
},
|
|
494
|
+
shadowOpacity: 0.05,
|
|
495
|
+
shadowRadius: 4,
|
|
496
|
+
elevation: 1
|
|
497
|
+
},
|
|
498
|
+
cardLabel: {
|
|
499
|
+
color: '#8C8C8C',
|
|
500
|
+
fontSize: 14
|
|
501
|
+
},
|
|
502
|
+
cardValue: {
|
|
503
|
+
color: '#141414',
|
|
504
|
+
fontSize: 16,
|
|
505
|
+
marginTop: 4
|
|
506
|
+
},
|
|
507
|
+
leaveButton: {
|
|
508
|
+
flexDirection: 'row',
|
|
509
|
+
alignItems: 'center',
|
|
510
|
+
gap: 6,
|
|
511
|
+
paddingHorizontal: 12,
|
|
512
|
+
paddingVertical: 7,
|
|
513
|
+
borderRadius: 18,
|
|
514
|
+
backgroundColor: 'rgba(0,0,0,0.35)'
|
|
515
|
+
},
|
|
516
|
+
leaveLabel: {
|
|
517
|
+
color: '#FFFFFF',
|
|
518
|
+
fontSize: 14,
|
|
519
|
+
fontWeight: '500'
|
|
520
|
+
},
|
|
521
|
+
tabsRow: {
|
|
522
|
+
flexDirection: 'row',
|
|
523
|
+
gap: 20,
|
|
524
|
+
borderBottomWidth: _reactNative.StyleSheet.hairlineWidth,
|
|
525
|
+
borderBottomColor: '#EFEFF2',
|
|
526
|
+
marginBottom: 12
|
|
527
|
+
},
|
|
528
|
+
tab: {
|
|
529
|
+
flexDirection: 'row',
|
|
530
|
+
alignItems: 'center',
|
|
531
|
+
gap: 6,
|
|
532
|
+
paddingBottom: 10,
|
|
533
|
+
borderBottomWidth: 2,
|
|
534
|
+
borderBottomColor: 'transparent'
|
|
535
|
+
},
|
|
536
|
+
tabLabel: {
|
|
537
|
+
fontSize: 15,
|
|
538
|
+
fontWeight: '500',
|
|
539
|
+
color: '#8C8C8C'
|
|
540
|
+
},
|
|
541
|
+
tabBadge: {
|
|
542
|
+
minWidth: 20,
|
|
543
|
+
paddingHorizontal: 5,
|
|
544
|
+
paddingVertical: 1,
|
|
545
|
+
borderRadius: 10,
|
|
546
|
+
alignItems: 'center'
|
|
547
|
+
},
|
|
548
|
+
tabBadgeText: {
|
|
549
|
+
color: '#FFFFFF',
|
|
550
|
+
fontSize: 11,
|
|
551
|
+
fontWeight: '600'
|
|
552
|
+
},
|
|
553
|
+
languageRow: {
|
|
554
|
+
flexDirection: 'row',
|
|
555
|
+
alignItems: 'center',
|
|
556
|
+
justifyContent: 'space-between',
|
|
557
|
+
paddingVertical: 12
|
|
558
|
+
},
|
|
559
|
+
languageLabel: {
|
|
560
|
+
fontSize: 16,
|
|
561
|
+
color: '#141414'
|
|
562
|
+
},
|
|
563
|
+
check: {
|
|
564
|
+
fontSize: 16,
|
|
565
|
+
fontWeight: '700'
|
|
566
|
+
},
|
|
567
|
+
mediaGrid: {
|
|
568
|
+
flexDirection: 'row',
|
|
569
|
+
flexWrap: 'wrap',
|
|
570
|
+
gap: 6
|
|
571
|
+
},
|
|
572
|
+
mediaTile: {
|
|
573
|
+
width: '31.8%',
|
|
574
|
+
aspectRatio: 1,
|
|
575
|
+
borderRadius: 10,
|
|
576
|
+
overflow: 'hidden',
|
|
577
|
+
backgroundColor: '#EFEFF2'
|
|
578
|
+
},
|
|
579
|
+
mediaImage: {
|
|
580
|
+
width: '100%',
|
|
581
|
+
height: '100%'
|
|
582
|
+
},
|
|
583
|
+
documentRow: {
|
|
584
|
+
flexDirection: 'row',
|
|
585
|
+
alignItems: 'center',
|
|
586
|
+
gap: 14,
|
|
587
|
+
paddingVertical: 12
|
|
588
|
+
},
|
|
589
|
+
documentText: {
|
|
590
|
+
flex: 1
|
|
591
|
+
},
|
|
592
|
+
documentName: {
|
|
593
|
+
fontSize: 16,
|
|
594
|
+
color: '#141414'
|
|
595
|
+
},
|
|
596
|
+
documentDate: {
|
|
597
|
+
fontSize: 13,
|
|
598
|
+
color: '#8C8C8C',
|
|
599
|
+
marginTop: 2
|
|
600
|
+
}
|
|
601
|
+
});
|
|
339
602
|
var _default = exports.default = UserProfileModal;
|
|
340
603
|
//# sourceMappingURL=UserProfileModal.js.map
|