@ethora/chat-component-rn 26.7.5 → 26.7.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/CHANGELOG.md +59 -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/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 +23 -38
- 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/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/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 +6 -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/xmppClient.js +7 -107
- 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/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/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 +23 -38
- 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/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/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 +1 -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/xmppClient.js +7 -107
- 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/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/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/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/useSendMessage.d.ts.map +1 -1
- package/lib/typescript/i18n/strings.d.ts.map +1 -1
- package/lib/typescript/main.d.ts +1 -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/xmppClient.d.ts +1 -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/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 +30 -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/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 +27 -46
- package/src/helpers/getChatBackground.ts +18 -0
- package/src/helpers/mediaLibraryRuntime.ts +25 -0
- package/src/helpers/pickImageAsset.ts +68 -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/useSendMessage.tsx +24 -60
- package/src/i18n/strings.ts +121 -1
- package/src/main.ts +1 -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/xmppClient.ts +7 -118
- package/src/roomStore/chatSettingsSlice.ts +3 -1
- package/src/roomStore/roomsSlice.ts +2 -20
- package/src/types/models/room.model.ts +0 -15
- package/src/types/types.ts +32 -20
|
@@ -1,19 +1,99 @@
|
|
|
1
|
-
import React, { FC, useMemo } from 'react';
|
|
1
|
+
import React, { FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
2
|
import {
|
|
3
|
+
Alert,
|
|
3
4
|
Animated,
|
|
4
5
|
Text,
|
|
5
6
|
TouchableOpacity,
|
|
6
7
|
TouchableWithoutFeedback,
|
|
7
8
|
StyleSheet,
|
|
8
9
|
Dimensions,
|
|
10
|
+
Modal,
|
|
11
|
+
PanResponder,
|
|
12
|
+
Platform,
|
|
9
13
|
View,
|
|
10
14
|
} from 'react-native';
|
|
11
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
AddNewIcon,
|
|
17
|
+
LogoutIcon,
|
|
18
|
+
ProfileIcon,
|
|
19
|
+
SettingIcon,
|
|
20
|
+
} from '../../assets/icons';
|
|
12
21
|
import { useDispatch } from 'react-redux';
|
|
22
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
13
23
|
import { setActiveModal } from '../../roomStore/chatSettingsSlice';
|
|
14
24
|
import { MODAL_TYPES } from '../../helpers/constants/MODAL_TYPES';
|
|
25
|
+
import { useChatSettingState } from '../../hooks/useChatSettingState';
|
|
26
|
+
import { useLogout } from '../../hooks/useLogout';
|
|
27
|
+
import {
|
|
28
|
+
shouldClaimVerticalDrag,
|
|
29
|
+
shouldDismissOnDrag,
|
|
30
|
+
} from '../../helpers/sheetGestures';
|
|
31
|
+
import type { IConfig } from '../../types/types';
|
|
32
|
+
|
|
33
|
+
type LogoutConfig = NonNullable<IConfig['logout']>;
|
|
34
|
+
|
|
35
|
+
const DEFAULT_LOGOUT_LABEL = 'Sign out';
|
|
36
|
+
|
|
37
|
+
const confirmLogout = (
|
|
38
|
+
confirm: LogoutConfig['confirm'],
|
|
39
|
+
label: string
|
|
40
|
+
): Promise<boolean> => {
|
|
41
|
+
if (confirm === false) {
|
|
42
|
+
return Promise.resolve(true);
|
|
43
|
+
}
|
|
44
|
+
const copy = typeof confirm === 'object' && confirm ? confirm : {};
|
|
45
|
+
return new Promise<boolean>((resolve) => {
|
|
46
|
+
Alert.alert(
|
|
47
|
+
copy.title ?? label,
|
|
48
|
+
copy.message ?? 'Are you sure you want to sign out?',
|
|
49
|
+
[
|
|
50
|
+
{
|
|
51
|
+
text: copy.cancelText ?? 'Cancel',
|
|
52
|
+
style: 'cancel',
|
|
53
|
+
onPress: () => resolve(false),
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
text: copy.confirmText ?? label,
|
|
57
|
+
style: 'destructive',
|
|
58
|
+
onPress: () => resolve(true),
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
{ cancelable: true, onDismiss: () => resolve(false) }
|
|
62
|
+
);
|
|
63
|
+
});
|
|
64
|
+
};
|
|
15
65
|
|
|
16
|
-
const
|
|
66
|
+
export const runLogoutFlow = async (
|
|
67
|
+
logoutConfig: LogoutConfig,
|
|
68
|
+
performLogout: () => Promise<void>
|
|
69
|
+
): Promise<void> => {
|
|
70
|
+
const label = logoutConfig.label ?? DEFAULT_LOGOUT_LABEL;
|
|
71
|
+
const confirmed = await confirmLogout(logoutConfig.confirm ?? true, label);
|
|
72
|
+
if (!confirmed) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (logoutConfig.onBeforeLogout) {
|
|
76
|
+
try {
|
|
77
|
+
const proceed = await logoutConfig.onBeforeLogout();
|
|
78
|
+
if (proceed === false) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
} catch (e) {
|
|
82
|
+
console.warn('HeaderRoomListMenu: onBeforeLogout threw, logout cancelled', e);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
await performLogout(); // never rejects (see useLogout)
|
|
87
|
+
if (logoutConfig.onAfterLogout) {
|
|
88
|
+
try {
|
|
89
|
+
await logoutConfig.onAfterLogout();
|
|
90
|
+
} catch (e) {
|
|
91
|
+
console.warn('HeaderRoomListMenu: onAfterLogout threw', e);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const { height: windowHeight } = Dimensions.get('window');
|
|
17
97
|
|
|
18
98
|
interface HeaderRoomListMenuProps {
|
|
19
99
|
isDrawerOpen: boolean;
|
|
@@ -29,86 +109,245 @@ export const HeaderRoomListMenu: FC<HeaderRoomListMenuProps> = ({
|
|
|
29
109
|
closeDrawer,
|
|
30
110
|
}) => {
|
|
31
111
|
const dispatch = useDispatch();
|
|
112
|
+
const { config } = useChatSettingState();
|
|
113
|
+
const performLogout = useLogout();
|
|
114
|
+
const logoutConfig = config?.logout?.enabled ? config.logout : undefined;
|
|
115
|
+
const primaryColor = config?.colors?.primary ?? '#0052CD';
|
|
116
|
+
|
|
117
|
+
const insets = useSafeAreaInsets();
|
|
118
|
+
// Measured, so the sheet is exactly as tall as its rows and starts
|
|
119
|
+
// fully off-screen no matter how many options the host enables.
|
|
120
|
+
const [sheetHeight, setSheetHeight] = useState(windowHeight * 0.4);
|
|
121
|
+
// Finger offset, layered on top of the open/close animation the parent
|
|
122
|
+
// drives. Reset once the sheet is unmounted, so a swipe-dismissed sheet
|
|
123
|
+
// never snaps back into view on its way out.
|
|
124
|
+
const dragY = useRef(new Animated.Value(0)).current;
|
|
125
|
+
const sheetHeightRef = useRef(sheetHeight);
|
|
126
|
+
sheetHeightRef.current = sheetHeight;
|
|
127
|
+
|
|
128
|
+
// closeDrawer is a fresh function each render; the responder is built
|
|
129
|
+
// once, so it reads the current one through a ref rather than the one it
|
|
130
|
+
// closed over on mount.
|
|
131
|
+
const closeDrawerRef = useRef(closeDrawer);
|
|
132
|
+
closeDrawerRef.current = closeDrawer;
|
|
133
|
+
|
|
134
|
+
const pendingActionRef = useRef<(() => void) | null>(null);
|
|
135
|
+
|
|
136
|
+
const runPendingAction = useCallback(() => {
|
|
137
|
+
const action = pendingActionRef.current;
|
|
138
|
+
pendingActionRef.current = null;
|
|
139
|
+
action?.();
|
|
140
|
+
}, []);
|
|
141
|
+
|
|
142
|
+
useEffect(() => {
|
|
143
|
+
if (Platform.OS === 'ios' || isDrawerOpen) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const id = setTimeout(runPendingAction, 0);
|
|
147
|
+
return () => clearTimeout(id);
|
|
148
|
+
}, [isDrawerOpen, runPendingAction]);
|
|
149
|
+
|
|
150
|
+
const handleOptionPress = useCallback(
|
|
151
|
+
(action: () => void) => {
|
|
152
|
+
pendingActionRef.current = action;
|
|
153
|
+
closeDrawer();
|
|
154
|
+
},
|
|
155
|
+
[closeDrawer]
|
|
156
|
+
);
|
|
32
157
|
|
|
33
|
-
|
|
158
|
+
useEffect(() => {
|
|
159
|
+
if (!isDrawerOpen) {
|
|
160
|
+
dragY.setValue(0);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
// Hand `dragY` to the native driver up front. The open/close value is
|
|
164
|
+
// already native (the parent animates it that way), and a transform
|
|
165
|
+
// that mixes a native node with a JS-only one drops the JS updates on
|
|
166
|
+
// the floor — which is exactly a drag that moves nothing.
|
|
167
|
+
Animated.timing(dragY, {
|
|
168
|
+
toValue: 0,
|
|
169
|
+
duration: 0,
|
|
170
|
+
useNativeDriver: true,
|
|
171
|
+
}).start();
|
|
172
|
+
}, [isDrawerOpen, dragY]);
|
|
173
|
+
|
|
174
|
+
const openTranslateY = drawerAnimation.interpolate({
|
|
34
175
|
inputRange: [0, 1],
|
|
35
|
-
outputRange: [
|
|
176
|
+
outputRange: [sheetHeight, 0],
|
|
36
177
|
});
|
|
37
178
|
|
|
38
|
-
const
|
|
39
|
-
(
|
|
179
|
+
const dismissByDrag = () => {
|
|
180
|
+
Animated.timing(dragY, {
|
|
181
|
+
toValue: sheetHeightRef.current,
|
|
182
|
+
duration: 180,
|
|
183
|
+
useNativeDriver: true,
|
|
184
|
+
}).start();
|
|
185
|
+
closeDrawerRef.current();
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
const makeDragResponder = (claimOnStart: boolean) =>
|
|
189
|
+
PanResponder.create({
|
|
190
|
+
// The grab area claims on touch-DOWN: nothing to negotiate against,
|
|
191
|
+
// so a pull on the handle always drags.
|
|
192
|
+
onStartShouldSetPanResponder: () => claimOnStart,
|
|
193
|
+
// CAPTURE matters on the body: a drag that starts on a row makes
|
|
194
|
+
// that row's Touchable the responder on touch-down, and a plain
|
|
195
|
+
// `onMoveShouldSetPanResponder` is never consulted afterwards.
|
|
196
|
+
// Capturing on the first clearly-vertical movement takes the gesture
|
|
197
|
+
// back, while a tap (dy ≈ 0) still reaches the row.
|
|
198
|
+
onMoveShouldSetPanResponderCapture: (_evt, g) =>
|
|
199
|
+
claimOnStart || shouldClaimVerticalDrag(g.dy, g.dx),
|
|
200
|
+
onMoveShouldSetPanResponder: (_evt, g) =>
|
|
201
|
+
claimOnStart || shouldClaimVerticalDrag(g.dy, g.dx),
|
|
202
|
+
onPanResponderTerminationRequest: () => false,
|
|
203
|
+
onPanResponderMove: (_evt, g) => {
|
|
204
|
+
dragY.setValue(Math.max(0, g.dy));
|
|
205
|
+
},
|
|
206
|
+
onPanResponderRelease: (_evt, g) => {
|
|
207
|
+
if (shouldDismissOnDrag(g.dy, g.vy)) {
|
|
208
|
+
dismissByDrag();
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
Animated.spring(dragY, {
|
|
212
|
+
toValue: 0,
|
|
213
|
+
tension: 90,
|
|
214
|
+
friction: 14,
|
|
215
|
+
useNativeDriver: true,
|
|
216
|
+
}).start();
|
|
217
|
+
},
|
|
218
|
+
onPanResponderTerminate: () => {
|
|
219
|
+
Animated.spring(dragY, {
|
|
220
|
+
toValue: 0,
|
|
221
|
+
tension: 90,
|
|
222
|
+
friction: 14,
|
|
223
|
+
useNativeDriver: true,
|
|
224
|
+
}).start();
|
|
225
|
+
},
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
// Built once — `useRef(expr)` would re-run PanResponder.create every
|
|
229
|
+
// render and throw the result away.
|
|
230
|
+
const bodyPanRef = useRef<ReturnType<typeof makeDragResponder> | null>(null);
|
|
231
|
+
const handlePanRef = useRef<ReturnType<typeof makeDragResponder> | null>(null);
|
|
232
|
+
if (!bodyPanRef.current) {bodyPanRef.current = makeDragResponder(false);}
|
|
233
|
+
if (!handlePanRef.current) {handlePanRef.current = makeDragResponder(true);}
|
|
234
|
+
const pan = bodyPanRef.current;
|
|
235
|
+
const handlePan = handlePanRef.current;
|
|
236
|
+
|
|
237
|
+
const menuOptions = useMemo(() => {
|
|
238
|
+
const options: {
|
|
239
|
+
label: string;
|
|
240
|
+
icon: React.ReactElement;
|
|
241
|
+
onClick: () => void;
|
|
242
|
+
styles?: { color: string };
|
|
243
|
+
}[] = [
|
|
40
244
|
{
|
|
41
245
|
label: 'New Chat',
|
|
42
|
-
icon: <AddNewIcon color=
|
|
246
|
+
icon: <AddNewIcon color={primaryColor} />,
|
|
43
247
|
onClick: () => {
|
|
44
248
|
dispatch(setActiveModal(MODAL_TYPES.NEW_CHAT));
|
|
45
|
-
console.log('New chat clicked');
|
|
46
249
|
},
|
|
47
250
|
styles: { color: '#141414' },
|
|
48
251
|
},
|
|
49
252
|
{
|
|
50
253
|
label: 'Profile',
|
|
51
|
-
icon: <ProfileIcon color=
|
|
254
|
+
icon: <ProfileIcon color={primaryColor} />,
|
|
52
255
|
onClick: () => {
|
|
53
256
|
dispatch(setActiveModal(MODAL_TYPES.PROFILE));
|
|
54
|
-
console.log('Profile clicked');
|
|
55
257
|
},
|
|
56
258
|
},
|
|
57
259
|
{
|
|
58
260
|
label: 'Settings',
|
|
59
|
-
icon: <SettingIcon color=
|
|
261
|
+
icon: <SettingIcon color={primaryColor} />,
|
|
60
262
|
onClick: () => {
|
|
61
263
|
dispatch(setActiveModal(MODAL_TYPES.SETTINGS));
|
|
62
|
-
console.log('Settings clicked');
|
|
63
264
|
},
|
|
64
265
|
},
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
266
|
+
];
|
|
267
|
+
if (logoutConfig) {
|
|
268
|
+
options.push({
|
|
269
|
+
label: logoutConfig.label ?? DEFAULT_LOGOUT_LABEL,
|
|
270
|
+
icon: <LogoutIcon color={primaryColor} />,
|
|
271
|
+
styles: { color: primaryColor },
|
|
272
|
+
onClick: () => {
|
|
273
|
+
runLogoutFlow(logoutConfig, performLogout).catch(() => {});
|
|
274
|
+
},
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
return options;
|
|
278
|
+
}, [dispatch, logoutConfig, performLogout, primaryColor]);
|
|
72
279
|
|
|
73
280
|
return (
|
|
74
|
-
|
|
281
|
+
// Presented through a real <Modal>: as an in-tree overlay the sheet was
|
|
282
|
+
// bounded by the room list's own container, so it stopped short of the
|
|
283
|
+
// screen's bottom edge (that pale strip under it) and the dim never
|
|
284
|
+
// reached the host's chrome.
|
|
285
|
+
<Modal
|
|
286
|
+
transparent
|
|
287
|
+
visible={isDrawerOpen}
|
|
288
|
+
animationType="none"
|
|
289
|
+
statusBarTranslucent
|
|
290
|
+
onRequestClose={closeDrawer}
|
|
291
|
+
onDismiss={runPendingAction}
|
|
292
|
+
>
|
|
293
|
+
<TouchableWithoutFeedback onPress={closeDrawer}>
|
|
294
|
+
<Animated.View
|
|
295
|
+
style={[styles.overlay, { opacity: overlayAnimation }]}
|
|
296
|
+
/>
|
|
297
|
+
</TouchableWithoutFeedback>
|
|
298
|
+
{/* A bottom sheet rather than the old full-height right-hand drawer:
|
|
299
|
+
* three rows never needed the whole screen, and coming up from the
|
|
300
|
+
* bottom keeps them within thumb reach. Inset by 2pt all round so a
|
|
301
|
+
* sliver of the dimmed screen shows around it. */}
|
|
75
302
|
<Animated.View
|
|
303
|
+
testID="header-menu-sheet"
|
|
304
|
+
onLayout={(e) => {
|
|
305
|
+
const measured = e.nativeEvent.layout.height;
|
|
306
|
+
if (measured > 0) {setSheetHeight(measured);}
|
|
307
|
+
}}
|
|
76
308
|
style={[
|
|
77
|
-
styles.
|
|
78
|
-
{
|
|
309
|
+
styles.sheet,
|
|
310
|
+
{
|
|
311
|
+
paddingBottom: insets.bottom + 20,
|
|
312
|
+
// Two entries rather than Animated.add: the parent's value is
|
|
313
|
+
// driven natively, and stacking the transforms keeps each node
|
|
314
|
+
// on its own driver instead of mixing them in one expression.
|
|
315
|
+
transform: [{ translateY: openTranslateY }, { translateY: dragY }],
|
|
316
|
+
},
|
|
79
317
|
]}
|
|
318
|
+
{...pan.panHandlers}
|
|
80
319
|
>
|
|
81
|
-
{
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
320
|
+
{/* Full-width grab area, not just the 40pt pill: it claims the
|
|
321
|
+
* gesture the moment it is touched. */}
|
|
322
|
+
<View
|
|
323
|
+
testID="header-menu-grabber"
|
|
324
|
+
style={styles.grabArea}
|
|
325
|
+
{...handlePan.panHandlers}
|
|
326
|
+
>
|
|
327
|
+
<View style={styles.grabber} />
|
|
328
|
+
</View>
|
|
329
|
+
<View style={styles.card}>
|
|
330
|
+
{menuOptions.map((option, index) => (
|
|
331
|
+
<View key={index} style={styles.menuItemWrapper}>
|
|
332
|
+
<TouchableOpacity
|
|
333
|
+
style={styles.menuItem}
|
|
334
|
+
testID={`header-menu-${option.label}`}
|
|
335
|
+
activeOpacity={0.6}
|
|
336
|
+
onPress={() => handleOptionPress(option.onClick)}
|
|
95
337
|
>
|
|
96
|
-
{option.icon}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
338
|
+
<View style={styles.iconSlot}>{option.icon}</View>
|
|
339
|
+
<Text style={[styles.label, option?.styles]}>
|
|
340
|
+
{option.label}
|
|
341
|
+
</Text>
|
|
342
|
+
</TouchableOpacity>
|
|
343
|
+
{index < menuOptions.length - 1 && (
|
|
344
|
+
<View style={styles.divider} />
|
|
345
|
+
)}
|
|
346
|
+
</View>
|
|
347
|
+
))}
|
|
348
|
+
</View>
|
|
103
349
|
</Animated.View>
|
|
104
|
-
|
|
105
|
-
<TouchableWithoutFeedback onPress={closeDrawer}>
|
|
106
|
-
<Animated.View
|
|
107
|
-
style={[styles.overlay, { opacity: overlayAnimation }]}
|
|
108
|
-
/>
|
|
109
|
-
</TouchableWithoutFeedback>
|
|
110
|
-
)}
|
|
111
|
-
</>
|
|
350
|
+
</Modal>
|
|
112
351
|
);
|
|
113
352
|
};
|
|
114
353
|
|
|
@@ -120,40 +359,54 @@ const styles = StyleSheet.create({
|
|
|
120
359
|
menuItem: {
|
|
121
360
|
flexDirection: 'row',
|
|
122
361
|
alignItems: 'center',
|
|
123
|
-
|
|
362
|
+
paddingVertical: 18,
|
|
363
|
+
paddingHorizontal: 16,
|
|
364
|
+
},
|
|
365
|
+
iconSlot: {
|
|
366
|
+
width: 26,
|
|
367
|
+
alignItems: 'center',
|
|
124
368
|
},
|
|
125
369
|
label: {
|
|
126
370
|
fontSize: 16,
|
|
127
|
-
|
|
371
|
+
fontWeight: '500',
|
|
372
|
+
color: '#141414',
|
|
373
|
+
marginLeft: 12,
|
|
128
374
|
},
|
|
129
375
|
divider: {
|
|
130
|
-
height:
|
|
131
|
-
|
|
132
|
-
backgroundColor: '#
|
|
376
|
+
height: StyleSheet.hairlineWidth,
|
|
377
|
+
marginLeft: 54,
|
|
378
|
+
backgroundColor: '#E4E4E9',
|
|
133
379
|
},
|
|
134
|
-
|
|
380
|
+
sheet: {
|
|
135
381
|
position: 'absolute',
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
382
|
+
// Inset rather than flush: the dimmed screen stays visible as a thin
|
|
383
|
+
// line around the sheet.
|
|
384
|
+
left: 3,
|
|
385
|
+
right: 3,
|
|
386
|
+
bottom: 3,
|
|
387
|
+
paddingTop: 8,
|
|
388
|
+
backgroundColor: '#FFFFFF',
|
|
389
|
+
borderRadius: 20,
|
|
142
390
|
shadowColor: '#000',
|
|
143
|
-
shadowOpacity: 0.
|
|
144
|
-
shadowOffset: { width:
|
|
145
|
-
shadowRadius:
|
|
146
|
-
elevation:
|
|
391
|
+
shadowOpacity: 0.12,
|
|
392
|
+
shadowOffset: { width: 0, height: -3 },
|
|
393
|
+
shadowRadius: 12,
|
|
394
|
+
elevation: 12,
|
|
147
395
|
zIndex: 999,
|
|
148
396
|
},
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
397
|
+
grabArea: {
|
|
398
|
+
alignItems: 'center',
|
|
399
|
+
paddingTop: 6,
|
|
400
|
+
paddingBottom: 12,
|
|
401
|
+
},
|
|
402
|
+
grabber: {
|
|
403
|
+
width: 40,
|
|
404
|
+
height: 4,
|
|
405
|
+
borderRadius: 2,
|
|
406
|
+
backgroundColor: '#C9CBD1',
|
|
153
407
|
},
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
marginBottom: 10,
|
|
408
|
+
card: {
|
|
409
|
+
overflow: 'hidden',
|
|
157
410
|
},
|
|
158
411
|
overlay: {
|
|
159
412
|
position: 'absolute',
|