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