agora-appbuilder-core 4.0.13 → 4.0.15
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/package.json +1 -1
- package/template/_package-lock.json +1364 -1576
- package/template/android/app/src/main/assets/fonts/icomoon.ttf +0 -0
- package/template/customization-api/sub-components.ts +6 -4
- package/template/customization-api/types.ts +0 -6
- package/template/defaultConfig.js +0 -3
- package/template/global.d.ts +0 -3
- package/template/ios/Podfile.lock +0 -10
- package/template/package-lock.json +1364 -1576
- package/template/package.json +0 -4
- package/template/src/SDKAppWrapper.tsx +8 -2
- package/template/src/app-state/useMessages.ts +9 -49
- package/template/src/assets/font-styles.css +125 -289
- package/template/src/assets/fonts/icomoon.ttf +0 -0
- package/template/src/assets/selection.json +1 -1
- package/template/src/atoms/ActionMenu.tsx +2 -5
- package/template/src/atoms/CustomIcon.tsx +1 -17
- package/template/src/atoms/ImageIcon.tsx +3 -19
- package/template/src/atoms/Popup.tsx +4 -13
- package/template/src/atoms/ToolbarPreset.tsx +57 -6
- package/template/src/auth/AuthProvider.tsx +0 -5
- package/template/src/auth/config.ts +3 -12
- package/template/src/components/Chat.tsx +1 -7
- package/template/src/components/ChatContext.ts +0 -12
- package/template/src/components/CommonStyles.ts +2 -2
- package/template/src/components/Controls.tsx +57 -29
- package/template/src/components/Leftbar.tsx +4 -4
- package/template/src/components/Navbar.tsx +54 -29
- package/template/src/components/NavbarMobile.tsx +23 -33
- package/template/src/components/PinnedVideo.tsx +1 -1
- package/template/src/components/RTMConfigure.tsx +0 -1
- package/template/src/components/SdkApiContext.tsx +4 -1
- package/template/src/components/chat-messages/useChatMessages.tsx +607 -411
- package/template/src/components/chat-ui/useChatUIControls.tsx +0 -53
- package/template/src/components/meeting-info-invite/MeetingInfoGridTile.tsx +1 -4
- package/template/src/components/participants/Participant.tsx +1 -0
- package/template/src/components/precall/joinWaitingRoomBtn.native.tsx +1 -6
- package/template/src/components/precall/joinWaitingRoomBtn.tsx +1 -6
- package/template/src/components/room-info/useRoomInfo.tsx +5 -5
- package/template/src/language/default-labels/videoCallScreenLabels.ts +6 -86
- package/template/src/pages/VideoCall.tsx +4 -3
- package/template/src/pages/video-call/ActionSheetContent.tsx +32 -3
- package/template/src/pages/video-call/VideoCallScreenWrapper.tsx +12 -22
- package/template/src/pages/video-call/VideoComponent.tsx +11 -5
- package/template/src/pages/video-call/index.ts +0 -8
- package/template/src/subComponents/ChatBubble.tsx +32 -252
- package/template/src/subComponents/ChatContainer.tsx +4 -14
- package/template/src/subComponents/ChatInput.ios.tsx +184 -0
- package/template/src/subComponents/ChatInput.tsx +100 -276
- package/template/src/subComponents/RemoteMutePopup.tsx +131 -12
- package/template/src/subComponents/caption/CaptionContainer.tsx +2 -6
- package/template/src/subComponents/recording/useRecording.tsx +1 -3
- package/template/src/utils/SdkMethodEvents.ts +1 -0
- package/template/src/utils/common.tsx +17 -0
- package/template/src/utils/index.tsx +0 -30
- package/template/src/utils/useEndCall.ts +0 -7
- package/template/src/utils/useJoinRoom.ts +7 -33
- package/template/android/link-assets-manifest.json +0 -13
- package/template/ios/link-assets-manifest.json +0 -13
- package/template/src/atoms/InlinePopup.tsx +0 -185
- package/template/src/components/chat/chatConfigure.native.tsx +0 -488
- package/template/src/components/chat/chatConfigure.tsx +0 -473
- package/template/src/subComponents/ChatInput.native.tsx +0 -269
- package/template/src/subComponents/chat/ChatActionMenu.tsx +0 -224
- package/template/src/subComponents/chat/ChatAttachment.native.tsx +0 -234
- package/template/src/subComponents/chat/ChatAttachment.tsx +0 -145
- package/template/src/subComponents/chat/ChatEmoji.native.tsx +0 -75
- package/template/src/subComponents/chat/ChatEmoji.tsx +0 -181
- package/template/src/subComponents/chat/ChatSendButton.tsx +0 -141
- package/template/src/subComponents/chat/ChatUploadStatus.tsx +0 -65
- package/template/src/subComponents/chat/ImagePopup.tsx +0 -400
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
********************************************
|
|
3
|
-
Copyright © 2021 Agora Lab, Inc., all rights reserved.
|
|
4
|
-
AppBuilder and all associated components, source code, APIs, services, and documentation
|
|
5
|
-
(the “Materials”) are owned by Agora Lab, Inc. and its licensors. The Materials may not be
|
|
6
|
-
accessed, used, modified, or distributed for any purpose without a license from Agora Lab, Inc.
|
|
7
|
-
Use without a license or in violation of any license terms and conditions (including use for
|
|
8
|
-
any purpose competitive to Agora Lab, Inc.’s business) is strictly prohibited. For more
|
|
9
|
-
information visit https://appbuilder.agora.io.
|
|
10
|
-
*********************************************
|
|
11
|
-
*/
|
|
12
|
-
import React, {useContext, useEffect, useRef} from 'react';
|
|
13
|
-
import {
|
|
14
|
-
View,
|
|
15
|
-
TouchableOpacity,
|
|
16
|
-
StyleSheet,
|
|
17
|
-
Image,
|
|
18
|
-
Text,
|
|
19
|
-
TextInput,
|
|
20
|
-
} from 'react-native';
|
|
21
|
-
import {useString} from '../utils/useString';
|
|
22
|
-
import {ChatEmojiPicker, ChatEmojiButton} from './chat/ChatEmoji';
|
|
23
|
-
|
|
24
|
-
import {
|
|
25
|
-
ChatType,
|
|
26
|
-
UploadStatus,
|
|
27
|
-
useChatUIControls,
|
|
28
|
-
MIN_HEIGHT,
|
|
29
|
-
MAX_HEIGHT,
|
|
30
|
-
LINE_HEIGHT,
|
|
31
|
-
MAX_TEXT_MESSAGE_SIZE,
|
|
32
|
-
} from '../components/chat-ui/useChatUIControls';
|
|
33
|
-
import {useContent, useRoomInfo, useUserName} from 'customization-api';
|
|
34
|
-
import ImageIcon from '../atoms/ImageIcon';
|
|
35
|
-
import ThemeConfig from '../theme';
|
|
36
|
-
import {BottomSheetTextInput} from '@gorhom/bottom-sheet';
|
|
37
|
-
import {
|
|
38
|
-
groupChatMeetingInputPlaceHolderText,
|
|
39
|
-
groupChatLiveInputPlaceHolderText,
|
|
40
|
-
privateChatInputPlaceHolderText,
|
|
41
|
-
chatSendErrorTextSizeToastHeading,
|
|
42
|
-
chatSendErrorTextSizeToastSubHeading,
|
|
43
|
-
} from '../language/default-labels/videoCallScreenLabels';
|
|
44
|
-
import ChatSendButton from './chat/ChatSendButton';
|
|
45
|
-
import {ChatAttachmentButton} from './chat/ChatAttachment';
|
|
46
|
-
import {useChatConfigure} from '../components/chat/chatConfigure';
|
|
47
|
-
import {
|
|
48
|
-
ChatMessageType,
|
|
49
|
-
SDKChatType,
|
|
50
|
-
} from '../components/chat-messages/useChatMessages';
|
|
51
|
-
import hexadecimalTransparency from '../utils/hexadecimalTransparency';
|
|
52
|
-
import ChatUploadStatus from './chat/ChatUploadStatus';
|
|
53
|
-
import {isAndroid} from '../utils/common';
|
|
54
|
-
import Toast from '../../react-native-toast-message';
|
|
55
|
-
|
|
56
|
-
export interface ChatSendButtonProps {
|
|
57
|
-
render?: (onPress: () => void) => JSX.Element;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const ChatPanel = () => {
|
|
61
|
-
return (
|
|
62
|
-
<View style={style.chatPanelContainer}>
|
|
63
|
-
<View style={style.chatPanel}>
|
|
64
|
-
<ChatAttachmentButton />
|
|
65
|
-
{/* <ChatEmojiButton /> */}
|
|
66
|
-
</View>
|
|
67
|
-
<ChatSendButton />
|
|
68
|
-
</View>
|
|
69
|
-
);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export interface ChatTextInputProps {
|
|
73
|
-
render?: (
|
|
74
|
-
message: string,
|
|
75
|
-
onChangeText: (text: string) => void,
|
|
76
|
-
onSubmitEditing: () => void,
|
|
77
|
-
chatMessageInputPlaceholder: string,
|
|
78
|
-
) => JSX.Element;
|
|
79
|
-
}
|
|
80
|
-
export const ChatTextInput = (props: ChatTextInputProps) => {
|
|
81
|
-
const {
|
|
82
|
-
privateChatUser,
|
|
83
|
-
message,
|
|
84
|
-
setMessage,
|
|
85
|
-
chatType,
|
|
86
|
-
inputActive,
|
|
87
|
-
uploadStatus,
|
|
88
|
-
inputHeight,
|
|
89
|
-
setInputHeight,
|
|
90
|
-
} = useChatUIControls();
|
|
91
|
-
|
|
92
|
-
const {defaultContent} = useContent();
|
|
93
|
-
const {sendChatSDKMessage} = useChatConfigure();
|
|
94
|
-
const {data} = useRoomInfo();
|
|
95
|
-
const [name] = useUserName();
|
|
96
|
-
const groupChatInputPlaceHolder = $config.EVENT_MODE
|
|
97
|
-
? useString(groupChatLiveInputPlaceHolderText)
|
|
98
|
-
: useString(groupChatMeetingInputPlaceHolderText);
|
|
99
|
-
const privateChatInputPlaceHolder = useString(
|
|
100
|
-
privateChatInputPlaceHolderText,
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
// React.useEffect(() => {
|
|
104
|
-
// if (message.length === 0) {
|
|
105
|
-
// setInputHeight(MIN_HEIGHT);
|
|
106
|
-
// }
|
|
107
|
-
// }, [message]);
|
|
108
|
-
|
|
109
|
-
const isUploadStatusShown =
|
|
110
|
-
uploadStatus === UploadStatus.IN_PROGRESS ||
|
|
111
|
-
uploadStatus === UploadStatus.FAILURE;
|
|
112
|
-
|
|
113
|
-
const toastHeadingSize = useString(chatSendErrorTextSizeToastHeading)();
|
|
114
|
-
const errorSubHeadingSize = useString(chatSendErrorTextSizeToastSubHeading);
|
|
115
|
-
|
|
116
|
-
const handleContentSizeChange = ({
|
|
117
|
-
nativeEvent: {
|
|
118
|
-
contentSize: {width, height},
|
|
119
|
-
},
|
|
120
|
-
}) => {
|
|
121
|
-
const lines = Math.floor(height / LINE_HEIGHT);
|
|
122
|
-
const newHeight = lines < 5 ? LINE_HEIGHT * lines + 24 + 2 : MAX_HEIGHT; // Assuming lineHeight is LINE_HEIGHT
|
|
123
|
-
message.length && setInputHeight(newHeight);
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
const chatMessageInputPlaceholder =
|
|
127
|
-
chatType === ChatType.Private
|
|
128
|
-
? privateChatInputPlaceHolder(defaultContent[privateChatUser]?.name)
|
|
129
|
-
: groupChatInputPlaceHolder(name);
|
|
130
|
-
const onChangeText = (text: string) => setMessage(text);
|
|
131
|
-
const onSubmitEditing = () => {
|
|
132
|
-
if (message.length === 0) return;
|
|
133
|
-
|
|
134
|
-
if (message.length >= MAX_TEXT_MESSAGE_SIZE * 1024) {
|
|
135
|
-
Toast.show({
|
|
136
|
-
leadingIconName: 'alert',
|
|
137
|
-
type: 'error',
|
|
138
|
-
text1: toastHeadingSize,
|
|
139
|
-
text2: errorSubHeadingSize(MAX_TEXT_MESSAGE_SIZE.toString()),
|
|
140
|
-
visibilityTime: 3000,
|
|
141
|
-
primaryBtn: null,
|
|
142
|
-
secondaryBtn: null,
|
|
143
|
-
});
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
const groupID = data.chat.group_id;
|
|
148
|
-
const option = {
|
|
149
|
-
chatType: privateChatUser
|
|
150
|
-
? SDKChatType.SINGLE_CHAT
|
|
151
|
-
: SDKChatType.GROUP_CHAT,
|
|
152
|
-
type: ChatMessageType.TXT,
|
|
153
|
-
from: data.uid.toString(),
|
|
154
|
-
to: privateChatUser ? privateChatUser.toString() : groupID,
|
|
155
|
-
msg: message,
|
|
156
|
-
};
|
|
157
|
-
sendChatSDKMessage(option);
|
|
158
|
-
setInputHeight(MIN_HEIGHT);
|
|
159
|
-
setMessage('');
|
|
160
|
-
};
|
|
161
|
-
const {setInputActive} = useChatUIControls();
|
|
162
|
-
|
|
163
|
-
const TextInputComponent = isAndroid() ? TextInput : BottomSheetTextInput;
|
|
164
|
-
|
|
165
|
-
return props?.render ? (
|
|
166
|
-
props.render(
|
|
167
|
-
message,
|
|
168
|
-
onChangeText,
|
|
169
|
-
onSubmitEditing,
|
|
170
|
-
chatMessageInputPlaceholder,
|
|
171
|
-
)
|
|
172
|
-
) : (
|
|
173
|
-
<TextInputComponent
|
|
174
|
-
onFocus={() => setInputActive(true)}
|
|
175
|
-
onBlur={() => setInputActive(false)}
|
|
176
|
-
value={message}
|
|
177
|
-
onChangeText={onChangeText}
|
|
178
|
-
multiline={true}
|
|
179
|
-
textAlignVertical="top"
|
|
180
|
-
style={{
|
|
181
|
-
color: $config.FONT_COLOR,
|
|
182
|
-
textAlign: 'left',
|
|
183
|
-
width: '100%',
|
|
184
|
-
alignSelf: 'center',
|
|
185
|
-
fontFamily: ThemeConfig.FontFamily.sansPro,
|
|
186
|
-
fontWeight: '400',
|
|
187
|
-
height: inputHeight,
|
|
188
|
-
paddingRight: 0,
|
|
189
|
-
paddingLeft: 12,
|
|
190
|
-
paddingTop: 12,
|
|
191
|
-
paddingBottom: 12,
|
|
192
|
-
fontSize: ThemeConfig.FontSize.small,
|
|
193
|
-
lineHeight: LINE_HEIGHT,
|
|
194
|
-
borderWidth: 1,
|
|
195
|
-
borderColor: $config.CARD_LAYER_5_COLOR + hexadecimalTransparency['8%'],
|
|
196
|
-
backgroundColor: $config.CARD_LAYER_2_COLOR,
|
|
197
|
-
borderRadius: 8,
|
|
198
|
-
borderTopRightRadius: isUploadStatusShown ? 0 : 8,
|
|
199
|
-
borderTopLeftRadius: isUploadStatusShown ? 0 : 8,
|
|
200
|
-
maxHeight: MAX_HEIGHT,
|
|
201
|
-
overflow: 'scroll',
|
|
202
|
-
}}
|
|
203
|
-
blurOnSubmit={false}
|
|
204
|
-
onSubmitEditing={onSubmitEditing}
|
|
205
|
-
placeholder={chatMessageInputPlaceholder}
|
|
206
|
-
placeholderTextColor={
|
|
207
|
-
$config.FONT_COLOR + ThemeConfig.EmphasisPlus.disabled
|
|
208
|
-
}
|
|
209
|
-
autoCorrect={false}
|
|
210
|
-
onContentSizeChange={handleContentSizeChange}
|
|
211
|
-
/>
|
|
212
|
-
);
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Input component for the Chat interface
|
|
217
|
-
*/
|
|
218
|
-
const ChatInput = () => {
|
|
219
|
-
const {inputActive, showEmojiPicker} = useChatUIControls();
|
|
220
|
-
return (
|
|
221
|
-
<View
|
|
222
|
-
style={[
|
|
223
|
-
style.inputContainer,
|
|
224
|
-
showEmojiPicker
|
|
225
|
-
? {backgroundColor: 'transparent'}
|
|
226
|
-
: {backgroundColor: $config.CARD_LAYER_1_COLOR},
|
|
227
|
-
// inputActive ? style.inputActiveView : {},
|
|
228
|
-
]}>
|
|
229
|
-
{showEmojiPicker && <ChatEmojiPicker />}
|
|
230
|
-
<View style={style.inputView}>
|
|
231
|
-
<ChatUploadStatus />
|
|
232
|
-
<ChatTextInput />
|
|
233
|
-
<ChatPanel />
|
|
234
|
-
</View>
|
|
235
|
-
</View>
|
|
236
|
-
);
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
const style = StyleSheet.create({
|
|
240
|
-
inputActiveView: {
|
|
241
|
-
borderTopWidth: 1,
|
|
242
|
-
borderTopColor: $config.PRIMARY_ACTION_BRAND_COLOR,
|
|
243
|
-
},
|
|
244
|
-
inputContainer: {
|
|
245
|
-
flex: 1,
|
|
246
|
-
flexDirection: 'column',
|
|
247
|
-
},
|
|
248
|
-
|
|
249
|
-
inputView: {
|
|
250
|
-
flexDirection: 'column',
|
|
251
|
-
borderTopWidth: 1,
|
|
252
|
-
borderTopColor: 'transparent',
|
|
253
|
-
paddingHorizontal: 12,
|
|
254
|
-
paddingBottom: 8,
|
|
255
|
-
},
|
|
256
|
-
|
|
257
|
-
chatPanelContainer: {
|
|
258
|
-
flexDirection: 'row',
|
|
259
|
-
justifyContent: 'space-between',
|
|
260
|
-
paddingHorizontal: 12,
|
|
261
|
-
backgroundColor: $config.CARD_LAYER_1_COLOR,
|
|
262
|
-
height: 36,
|
|
263
|
-
paddingTop: 4,
|
|
264
|
-
},
|
|
265
|
-
chatPanel: {
|
|
266
|
-
flexDirection: 'row',
|
|
267
|
-
},
|
|
268
|
-
});
|
|
269
|
-
export default ChatInput;
|
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
import {StyleSheet, Text, useWindowDimensions, View} from 'react-native';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import {calculatePosition, isMobileUA, trimText} from '../../utils/common';
|
|
4
|
-
import IconButton from '../../atoms/IconButton';
|
|
5
|
-
import hexadecimalTransparency from '../../utils/hexadecimalTransparency';
|
|
6
|
-
import ActionMenu, {ActionMenuItem} from '../../../src/atoms/ActionMenu';
|
|
7
|
-
import {useRoomInfo} from '../../components/room-info/useRoomInfo';
|
|
8
|
-
import {useChatConfigure} from '../../components/chat/chatConfigure';
|
|
9
|
-
import Clipboard from '../../subComponents/Clipboard';
|
|
10
|
-
import {useString} from '../../utils/useString';
|
|
11
|
-
import {
|
|
12
|
-
chatActionMenuCopyLinkText,
|
|
13
|
-
chatActionMenuDownloadText,
|
|
14
|
-
chatActionMenuDeleteText,
|
|
15
|
-
chatMessageDeleteConfirmBtnText,
|
|
16
|
-
chatPublicMessageDeletePopupText,
|
|
17
|
-
chatPrivateMessageDeletePopupText,
|
|
18
|
-
} from '../../language/default-labels/videoCallScreenLabels';
|
|
19
|
-
import {
|
|
20
|
-
SDKChatType,
|
|
21
|
-
useChatMessages,
|
|
22
|
-
} from '../../components/chat-messages/useChatMessages';
|
|
23
|
-
import InlinePopup from '../../../src/atoms/InlinePopup';
|
|
24
|
-
import {cancelText} from '../../language/default-labels/commonLabels';
|
|
25
|
-
import {useContent} from 'customization-api';
|
|
26
|
-
|
|
27
|
-
interface MoreMenuProps {
|
|
28
|
-
setActionMenuVisible: React.Dispatch<React.SetStateAction<boolean>>;
|
|
29
|
-
}
|
|
30
|
-
interface CaptionsActionMenuProps {
|
|
31
|
-
actionMenuVisible: boolean;
|
|
32
|
-
setActionMenuVisible: (actionMenuVisible: boolean) => void;
|
|
33
|
-
btnRef: React.RefObject<View>;
|
|
34
|
-
fileName: string;
|
|
35
|
-
fileUrl: string;
|
|
36
|
-
msgId: string;
|
|
37
|
-
privateChatUser: number;
|
|
38
|
-
isLocal: boolean;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export const ChatActionMenu = (props: CaptionsActionMenuProps) => {
|
|
42
|
-
const {
|
|
43
|
-
actionMenuVisible,
|
|
44
|
-
setActionMenuVisible,
|
|
45
|
-
btnRef,
|
|
46
|
-
fileName,
|
|
47
|
-
fileUrl,
|
|
48
|
-
msgId,
|
|
49
|
-
privateChatUser,
|
|
50
|
-
isLocal,
|
|
51
|
-
} = props;
|
|
52
|
-
|
|
53
|
-
const actionMenuitems: ActionMenuItem[] = [];
|
|
54
|
-
const [modalPosition, setModalPosition] = React.useState({});
|
|
55
|
-
const [isPosCalculated, setIsPosCalculated] = React.useState(false);
|
|
56
|
-
const [showDeleteMessageModal, setShowDeleteMessageModal] =
|
|
57
|
-
React.useState(false);
|
|
58
|
-
const {width: globalWidth, height: globalHeight} = useWindowDimensions();
|
|
59
|
-
const {downloadAttachment, deleteAttachment} = useChatConfigure();
|
|
60
|
-
const {removeMessageFromPrivateStore, removeMessageFromStore} =
|
|
61
|
-
useChatMessages();
|
|
62
|
-
const {defaultContent} = useContent();
|
|
63
|
-
|
|
64
|
-
const {
|
|
65
|
-
data: {isHost, chat},
|
|
66
|
-
} = useRoomInfo();
|
|
67
|
-
|
|
68
|
-
const groupID = chat.group_id;
|
|
69
|
-
const chatType = privateChatUser
|
|
70
|
-
? SDKChatType.SINGLE_CHAT
|
|
71
|
-
: SDKChatType.GROUP_CHAT;
|
|
72
|
-
const recallFromUser = privateChatUser ? privateChatUser : groupID;
|
|
73
|
-
const cancelTxt = useString(cancelText)();
|
|
74
|
-
const cancelLabel =
|
|
75
|
-
cancelTxt.charAt(0).toUpperCase() + cancelTxt.slice(1).toLowerCase();
|
|
76
|
-
const confirmLabel = useString(chatMessageDeleteConfirmBtnText)();
|
|
77
|
-
let message = '';
|
|
78
|
-
if (chatType === SDKChatType.GROUP_CHAT) {
|
|
79
|
-
message = useString(chatPublicMessageDeletePopupText)();
|
|
80
|
-
}
|
|
81
|
-
if (chatType === SDKChatType.SINGLE_CHAT) {
|
|
82
|
-
message = useString(chatPrivateMessageDeletePopupText)(
|
|
83
|
-
trimText(defaultContent[recallFromUser]?.name),
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
actionMenuitems.push({
|
|
88
|
-
icon: 'download',
|
|
89
|
-
iconColor: $config.SECONDARY_ACTION_COLOR,
|
|
90
|
-
textColor: $config.FONT_COLOR,
|
|
91
|
-
title: useString(chatActionMenuDownloadText)(),
|
|
92
|
-
callback: () => {
|
|
93
|
-
downloadAttachment(fileName, fileUrl);
|
|
94
|
-
setActionMenuVisible(false);
|
|
95
|
-
},
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
actionMenuitems.push({
|
|
99
|
-
icon: 'clipboard',
|
|
100
|
-
iconColor: $config.SECONDARY_ACTION_COLOR,
|
|
101
|
-
textColor: $config.FONT_COLOR,
|
|
102
|
-
title: useString(chatActionMenuCopyLinkText)(),
|
|
103
|
-
callback: () => {
|
|
104
|
-
Clipboard.setString(fileUrl);
|
|
105
|
-
setActionMenuVisible(false);
|
|
106
|
-
},
|
|
107
|
-
});
|
|
108
|
-
actionMenuitems.push({
|
|
109
|
-
icon: 'delete',
|
|
110
|
-
iconColor: $config.SEMANTIC_ERROR,
|
|
111
|
-
textColor: $config.SEMANTIC_ERROR,
|
|
112
|
-
iconSize: 24,
|
|
113
|
-
title: useString(chatActionMenuDeleteText)(),
|
|
114
|
-
callback: () => {
|
|
115
|
-
if (isLocal) {
|
|
116
|
-
// confirm dialog : user is deleting for all
|
|
117
|
-
setShowDeleteMessageModal(true);
|
|
118
|
-
//deleteAttachment(msgId, recallFromUser.toString(), chatType);
|
|
119
|
-
} else {
|
|
120
|
-
if (chatType === SDKChatType.SINGLE_CHAT) {
|
|
121
|
-
removeMessageFromPrivateStore(msgId, isLocal);
|
|
122
|
-
}
|
|
123
|
-
if (chatType === SDKChatType.GROUP_CHAT) {
|
|
124
|
-
removeMessageFromStore(msgId, isLocal);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
setActionMenuVisible(false);
|
|
128
|
-
},
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
React.useEffect(() => {
|
|
132
|
-
if (actionMenuVisible) {
|
|
133
|
-
//getting btnRef x,y
|
|
134
|
-
btnRef?.current?.measure(
|
|
135
|
-
(
|
|
136
|
-
_fx: number,
|
|
137
|
-
_fy: number,
|
|
138
|
-
localWidth: number,
|
|
139
|
-
localHeight: number,
|
|
140
|
-
px: number,
|
|
141
|
-
py: number,
|
|
142
|
-
) => {
|
|
143
|
-
const data = calculatePosition({
|
|
144
|
-
px,
|
|
145
|
-
py,
|
|
146
|
-
localWidth,
|
|
147
|
-
localHeight,
|
|
148
|
-
globalHeight,
|
|
149
|
-
globalWidth,
|
|
150
|
-
});
|
|
151
|
-
setModalPosition(data);
|
|
152
|
-
setIsPosCalculated(true);
|
|
153
|
-
},
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
}, [actionMenuVisible]);
|
|
157
|
-
return (
|
|
158
|
-
<>
|
|
159
|
-
{isLocal ? (
|
|
160
|
-
<InlinePopup
|
|
161
|
-
actionMenuVisible={showDeleteMessageModal}
|
|
162
|
-
setActionMenuVisible={setShowDeleteMessageModal}
|
|
163
|
-
modalPosition={modalPosition}
|
|
164
|
-
message={message}
|
|
165
|
-
cancelLabel={cancelLabel}
|
|
166
|
-
cancelLabelStyle={{color: $config.SECONDARY_ACTION_COLOR}}
|
|
167
|
-
confirmLabel={confirmLabel}
|
|
168
|
-
confirmLabelStyle={{color: $config.SEMANTIC_ERROR}}
|
|
169
|
-
onConfirmClick={() => {
|
|
170
|
-
deleteAttachment(msgId, recallFromUser.toString(), chatType);
|
|
171
|
-
if (chatType === SDKChatType.SINGLE_CHAT) {
|
|
172
|
-
removeMessageFromPrivateStore(msgId, isLocal);
|
|
173
|
-
}
|
|
174
|
-
if (chatType === SDKChatType.GROUP_CHAT) {
|
|
175
|
-
removeMessageFromStore(msgId, isLocal);
|
|
176
|
-
}
|
|
177
|
-
setShowDeleteMessageModal(false);
|
|
178
|
-
}}
|
|
179
|
-
/>
|
|
180
|
-
) : (
|
|
181
|
-
<></>
|
|
182
|
-
)}
|
|
183
|
-
<ActionMenu
|
|
184
|
-
from={'chat'}
|
|
185
|
-
actionMenuVisible={actionMenuVisible && isPosCalculated}
|
|
186
|
-
setActionMenuVisible={setActionMenuVisible}
|
|
187
|
-
modalPosition={modalPosition}
|
|
188
|
-
items={actionMenuitems}
|
|
189
|
-
/>
|
|
190
|
-
</>
|
|
191
|
-
);
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
export const MoreMenu = React.forwardRef<View, MoreMenuProps>((props, ref) => {
|
|
195
|
-
const {setActionMenuVisible} = props;
|
|
196
|
-
const isMobile = isMobileUA();
|
|
197
|
-
return (
|
|
198
|
-
<View ref={ref} collapsable={false}>
|
|
199
|
-
<IconButton
|
|
200
|
-
hoverEffect={true}
|
|
201
|
-
hoverEffectStyle={{
|
|
202
|
-
backgroundColor:
|
|
203
|
-
$config.CARD_LAYER_5_COLOR + hexadecimalTransparency['25%'],
|
|
204
|
-
borderRadius: 18,
|
|
205
|
-
}}
|
|
206
|
-
iconProps={{
|
|
207
|
-
iconType: 'plain',
|
|
208
|
-
name: 'more-menu',
|
|
209
|
-
iconSize: 18,
|
|
210
|
-
tintColor: $config.SECONDARY_ACTION_COLOR,
|
|
211
|
-
iconContainerStyle: {
|
|
212
|
-
padding: 4,
|
|
213
|
-
borderRadius: 18,
|
|
214
|
-
},
|
|
215
|
-
}}
|
|
216
|
-
onPress={() => {
|
|
217
|
-
setActionMenuVisible(true);
|
|
218
|
-
}}
|
|
219
|
-
/>
|
|
220
|
-
</View>
|
|
221
|
-
);
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
const styles = StyleSheet.create({});
|