agora-appbuilder-core 4.0.32-1 → 4.0.32-3
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/defaultConfig.js +2 -2
- package/template/src/auth/openIDPURL.tsx +2 -1
- package/template/src/auth/useIDPAuth.tsx +2 -1
- package/template/src/components/chat/chatConfigure.native.tsx +26 -24
- package/template/src/components/chat/chatConfigure.tsx +2 -0
- package/template/src/components/chat-ui/useChatUIControls.tsx +7 -0
- package/template/src/components/meeting-info-invite/MeetingInfo.tsx +0 -5
- package/template/src/components/meeting-info-invite/MeetingInfoCardHeader.tsx +0 -16
- package/template/src/language/default-labels/commonLabels.ts +3 -0
- package/template/src/subComponents/ChatContainer.tsx +19 -27
- package/template/src/subComponents/ChatInput.tsx +6 -5
- package/template/src/subComponents/chat/ChatSendButton.tsx +2 -5
package/package.json
CHANGED
|
@@ -76,8 +76,8 @@ const DefaultConfig = {
|
|
|
76
76
|
CHAT_ORG_NAME: '',
|
|
77
77
|
CHAT_APP_NAME: '',
|
|
78
78
|
CHAT_URL: '',
|
|
79
|
-
CLI_VERSION: '3.0.32-
|
|
80
|
-
CORE_VERSION: '4.0.32-
|
|
79
|
+
CLI_VERSION: '3.0.32-3',
|
|
80
|
+
CORE_VERSION: '4.0.32-3',
|
|
81
81
|
DISABLE_LANDSCAPE_MODE: false,
|
|
82
82
|
STT_AUTO_START: false,
|
|
83
83
|
CLOUD_RECORDING_AUTO_START: false,
|
|
@@ -14,7 +14,8 @@ export const getIDPAuthLoginURL = (returnTo?: any) => {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
export const enableIDPAuth = async (returnTo?: any, heading?: string) => {
|
|
17
|
-
|
|
17
|
+
//react-native-web support 2nd argument
|
|
18
|
+
Linking.openURL(getIDPAuthLoginURL(returnTo), '_self');
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
export const exitApp = () => {};
|
|
@@ -66,7 +66,8 @@ export const useIDPAuth = () => {
|
|
|
66
66
|
tokenLogout(false)
|
|
67
67
|
.then(() => {
|
|
68
68
|
//open idp logout url
|
|
69
|
-
|
|
69
|
+
//react-native-web support 2nd argument
|
|
70
|
+
Linking.openURL(IDPAuthLogoutURL, '_self');
|
|
70
71
|
resolve(true);
|
|
71
72
|
})
|
|
72
73
|
.catch(() => {
|
|
@@ -89,7 +89,8 @@ const ChatConfigure = ({children}) => {
|
|
|
89
89
|
addReactionToPrivateStore,
|
|
90
90
|
addReactionToStore,
|
|
91
91
|
} = useChatMessages();
|
|
92
|
-
const {setPinMsgId, setPinnedByUser, privateChatUser} =
|
|
92
|
+
const {setPinMsgId, setPinnedByUser, privateChatUser, setIsChatInitialized} =
|
|
93
|
+
useChatUIControls();
|
|
93
94
|
const privateChatUserRef = React.useRef(privateChatUser);
|
|
94
95
|
|
|
95
96
|
React.useEffect(() => {
|
|
@@ -333,6 +334,30 @@ const ChatConfigure = ({children}) => {
|
|
|
333
334
|
// initialize native client
|
|
334
335
|
await chatClient.init(chatOptions);
|
|
335
336
|
console.warn('chat sdk: init success');
|
|
337
|
+
// adding chat connection event listeners
|
|
338
|
+
let listener: ChatConnectEventListener = {
|
|
339
|
+
onTokenWillExpire() {
|
|
340
|
+
console.warn('token expire.');
|
|
341
|
+
},
|
|
342
|
+
onTokenDidExpire() {
|
|
343
|
+
console.warn('token did expire');
|
|
344
|
+
},
|
|
345
|
+
onConnected() {
|
|
346
|
+
// once sdk connects to chat server successfully , need to add message listeners
|
|
347
|
+
console.warn('chat onConnected');
|
|
348
|
+
setIsChatInitialized(true);
|
|
349
|
+
setupMessageListener();
|
|
350
|
+
logger.log(
|
|
351
|
+
LogSource.Internals,
|
|
352
|
+
'CHAT',
|
|
353
|
+
`Native User ${localUid} to connected to Agora Chat Server`,
|
|
354
|
+
);
|
|
355
|
+
},
|
|
356
|
+
onDisconnected() {
|
|
357
|
+
console.warn('onDisconnected:');
|
|
358
|
+
},
|
|
359
|
+
};
|
|
360
|
+
chatClient.addConnectionListener(listener);
|
|
336
361
|
|
|
337
362
|
// log in user to agoar chat
|
|
338
363
|
try {
|
|
@@ -343,29 +368,6 @@ const ChatConfigure = ({children}) => {
|
|
|
343
368
|
'CHAT',
|
|
344
369
|
`Logged in Native User ${localUid} to Agora Chat Server`,
|
|
345
370
|
);
|
|
346
|
-
setupMessageListener();
|
|
347
|
-
// adding chat connection event listeners
|
|
348
|
-
let listener: ChatConnectEventListener = {
|
|
349
|
-
onTokenWillExpire() {
|
|
350
|
-
console.warn('token expire.');
|
|
351
|
-
},
|
|
352
|
-
onTokenDidExpire() {
|
|
353
|
-
console.warn('token did expire');
|
|
354
|
-
},
|
|
355
|
-
onConnected() {
|
|
356
|
-
console.warn('onConnected');
|
|
357
|
-
// once sdk connects to chat server successfully , need to add message listeners
|
|
358
|
-
logger.log(
|
|
359
|
-
LogSource.Internals,
|
|
360
|
-
'CHAT',
|
|
361
|
-
`Native User ${localUid} to connected to Agora Chat Server`,
|
|
362
|
-
);
|
|
363
|
-
},
|
|
364
|
-
onDisconnected() {
|
|
365
|
-
console.warn('onDisconnected:');
|
|
366
|
-
},
|
|
367
|
-
};
|
|
368
|
-
chatClient.addConnectionListener(listener);
|
|
369
371
|
} catch (error) {
|
|
370
372
|
console.warn(
|
|
371
373
|
'chat sdk: login failed ',
|
|
@@ -72,6 +72,7 @@ const ChatConfigure = ({children}) => {
|
|
|
72
72
|
uploadedFiles,
|
|
73
73
|
setPinMsgId,
|
|
74
74
|
setPinnedByUser,
|
|
75
|
+
setIsChatInitialized,
|
|
75
76
|
} = useChatUIControls();
|
|
76
77
|
const localUid = useLocalUid();
|
|
77
78
|
const defaultContentRef = React.useRef(defaultContent);
|
|
@@ -118,6 +119,7 @@ const ChatConfigure = ({children}) => {
|
|
|
118
119
|
newConn.addEventHandler('connection&message', {
|
|
119
120
|
// app is connected to chat server
|
|
120
121
|
onConnected: () => {
|
|
122
|
+
setIsChatInitialized(true);
|
|
121
123
|
logger.log(
|
|
122
124
|
LogSource.Internals,
|
|
123
125
|
'CHAT',
|
|
@@ -64,6 +64,8 @@ export interface ChatUIControlsInterface {
|
|
|
64
64
|
setPinMsgId: React.Dispatch<SetStateAction<string>>;
|
|
65
65
|
pinnedByUser: UidType;
|
|
66
66
|
setPinnedByUser: React.Dispatch<SetStateAction<UidType>>;
|
|
67
|
+
isChatInitialized: boolean;
|
|
68
|
+
setIsChatInitialized: React.Dispatch<SetStateAction<boolean>>;
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
const ChatUIControlsContext = React.createContext<ChatUIControlsInterface>({
|
|
@@ -92,6 +94,8 @@ const ChatUIControlsContext = React.createContext<ChatUIControlsInterface>({
|
|
|
92
94
|
setPinMsgId: () => {},
|
|
93
95
|
pinnedByUser: 0,
|
|
94
96
|
setPinnedByUser: () => {},
|
|
97
|
+
isChatInitialized: false,
|
|
98
|
+
setIsChatInitialized: () => {},
|
|
95
99
|
});
|
|
96
100
|
|
|
97
101
|
interface ChatUIControlsProviderProps {
|
|
@@ -125,6 +129,7 @@ const ChatUIControlsProvider = (props: ChatUIControlsProviderProps) => {
|
|
|
125
129
|
const [replyToMsgId, setReplyToMsgId] = useState('');
|
|
126
130
|
const [pinMsgId, setPinMsgId] = useState('');
|
|
127
131
|
const [pinnedByUser, setPinnedByUser] = useState<UidType>(0);
|
|
132
|
+
const [isChatInitialized, setIsChatInitialized] = useState(false);
|
|
128
133
|
|
|
129
134
|
const _resetTextareaHeight = () => {
|
|
130
135
|
if (chatInputRef?.current) {
|
|
@@ -183,6 +188,8 @@ const ChatUIControlsProvider = (props: ChatUIControlsProviderProps) => {
|
|
|
183
188
|
setPinMsgId,
|
|
184
189
|
pinnedByUser,
|
|
185
190
|
setPinnedByUser,
|
|
191
|
+
isChatInitialized,
|
|
192
|
+
setIsChatInitialized,
|
|
186
193
|
}}>
|
|
187
194
|
{props.children}
|
|
188
195
|
</ChatUIControlsContext.Provider>
|
|
@@ -49,11 +49,6 @@ const MeetingInfo = (props: MeetingInfoProps) => {
|
|
|
49
49
|
<FpeShareComponent />
|
|
50
50
|
) : (
|
|
51
51
|
<View style={style.root}>
|
|
52
|
-
{!isMobileUA() ? (
|
|
53
|
-
<IDPLogoutComponent containerStyle={{marginBottom: -100}} />
|
|
54
|
-
) : (
|
|
55
|
-
<></>
|
|
56
|
-
)}
|
|
57
52
|
<ScrollView contentContainerStyle={style.scrollMain}>
|
|
58
53
|
<Card
|
|
59
54
|
margin={margin}
|
|
@@ -25,22 +25,6 @@ export const MeetingInfoCardHeader = (props: MeetingInfoCardHeaderProps) => {
|
|
|
25
25
|
const {avatar, children} = props;
|
|
26
26
|
return (
|
|
27
27
|
<View>
|
|
28
|
-
<View
|
|
29
|
-
style={{
|
|
30
|
-
flexDirection: 'row',
|
|
31
|
-
justifyContent: 'space-between',
|
|
32
|
-
alignItems: 'center',
|
|
33
|
-
}}>
|
|
34
|
-
{isMobileUA() ? (
|
|
35
|
-
<>
|
|
36
|
-
<IDPLogoutComponent
|
|
37
|
-
containerStyle={{marginTop: 0, marginRight: 0}}
|
|
38
|
-
/>
|
|
39
|
-
</>
|
|
40
|
-
) : (
|
|
41
|
-
<></>
|
|
42
|
-
)}
|
|
43
|
-
</View>
|
|
44
28
|
<View style={style.flexRow}>
|
|
45
29
|
{React.isValidElement(avatar) && (
|
|
46
30
|
<View style={style.avatar}>{avatar}</View>
|
|
@@ -2,6 +2,7 @@ import {I18nBaseType} from '../i18nTypes';
|
|
|
2
2
|
|
|
3
3
|
export const cancelText = 'cancelText';
|
|
4
4
|
export const loadingText = 'loadingText';
|
|
5
|
+
export const initializingChatText = 'initializingChatText';
|
|
5
6
|
export const logoutText = 'logoutText';
|
|
6
7
|
export const authLogoutPopupHeading = 'authLogoutPopupHeading';
|
|
7
8
|
export const authLogoutPopupSubHeading = 'authLogoutPopupSubHeading';
|
|
@@ -23,6 +24,7 @@ export const copiedToClipboardText = 'copiedToClipboardText';
|
|
|
23
24
|
export interface I18nCommonLabelsInterface {
|
|
24
25
|
[cancelText]?: I18nBaseType;
|
|
25
26
|
[loadingText]?: I18nBaseType;
|
|
27
|
+
[initializingChatText]?: I18nBaseType;
|
|
26
28
|
[logoutText]?: I18nBaseType;
|
|
27
29
|
[authLogoutPopupHeading]?: I18nBaseType;
|
|
28
30
|
[authLogoutPopupSubHeading]?: I18nBaseType;
|
|
@@ -44,6 +46,7 @@ export interface I18nCommonLabelsInterface {
|
|
|
44
46
|
export const CommonLabels: I18nCommonLabelsInterface = {
|
|
45
47
|
[cancelText]: 'CANCEL',
|
|
46
48
|
[loadingText]: 'Loading...',
|
|
49
|
+
[initializingChatText]: 'Initializing Chat ...',
|
|
47
50
|
[logoutText]: 'Logout',
|
|
48
51
|
[authLogoutPopupHeading]: 'Logout?',
|
|
49
52
|
[authLogoutPopupSubHeading]: 'Are you sure you wanna log out?',
|
|
@@ -59,6 +59,8 @@ import {
|
|
|
59
59
|
} from '../language/default-labels/videoCallScreenLabels';
|
|
60
60
|
import CommonStyles from '../components/CommonStyles';
|
|
61
61
|
import PinnedMessage from './chat/PinnedMessage';
|
|
62
|
+
import {initializingChatText} from '../language/default-labels/commonLabels';
|
|
63
|
+
import Loading from './Loading';
|
|
62
64
|
|
|
63
65
|
/**
|
|
64
66
|
* Chat container is the component which renders all the chat messages
|
|
@@ -85,6 +87,7 @@ const ChatContainer = (props?: {
|
|
|
85
87
|
showEmojiPicker,
|
|
86
88
|
pinMsgId,
|
|
87
89
|
pinnedByUser,
|
|
90
|
+
isChatInitialized,
|
|
88
91
|
} = useChatUIControls();
|
|
89
92
|
const privateMessageStoreRef = useRef(
|
|
90
93
|
privateMessageStore[privateChatUser]?.length,
|
|
@@ -99,6 +102,7 @@ const ChatContainer = (props?: {
|
|
|
99
102
|
} = useChatNotification();
|
|
100
103
|
const localUid = useLocalUid();
|
|
101
104
|
const scrollViewRef = useRef<ScrollView>(null);
|
|
105
|
+
const loadingLabel = useString(initializingChatText)();
|
|
102
106
|
|
|
103
107
|
useEffect(() => {
|
|
104
108
|
if (chatType === ChatType.Group) {
|
|
@@ -196,9 +200,11 @@ const ChatContainer = (props?: {
|
|
|
196
200
|
}
|
|
197
201
|
};
|
|
198
202
|
|
|
199
|
-
return (
|
|
203
|
+
return isChatInitialized === false ? (
|
|
204
|
+
<Loading text={loadingLabel} />
|
|
205
|
+
) : (
|
|
200
206
|
<View style={style.containerView}>
|
|
201
|
-
{showEmojiPicker
|
|
207
|
+
{showEmojiPicker ? <View style={CommonStyles.tintedOverlay} /> : null}
|
|
202
208
|
{chatType === ChatType.Private && privateChatUser ? (
|
|
203
209
|
<>
|
|
204
210
|
<View style={style.participantContainer}>
|
|
@@ -217,12 +223,10 @@ const ChatContainer = (props?: {
|
|
|
217
223
|
</View>
|
|
218
224
|
<Spacer size={10} />
|
|
219
225
|
</>
|
|
220
|
-
) :
|
|
221
|
-
|
|
222
|
-
)}
|
|
223
|
-
{pinMsgId && chatType === ChatType.Group && (
|
|
226
|
+
) : null}
|
|
227
|
+
{pinMsgId && chatType === ChatType.Group ? (
|
|
224
228
|
<PinnedMessage pinMsgId={pinMsgId} pinnedByUser={pinnedByUser} />
|
|
225
|
-
)}
|
|
229
|
+
) : null}
|
|
226
230
|
<ScrollView
|
|
227
231
|
ref={scrollViewRef}
|
|
228
232
|
onContentSizeChange={onContentSizeChange}
|
|
@@ -236,7 +240,7 @@ const ChatContainer = (props?: {
|
|
|
236
240
|
</View>
|
|
237
241
|
|
|
238
242
|
{messageStore.map((message: messageStoreInterface, index) => (
|
|
239
|
-
|
|
243
|
+
<React.Fragment key={`message-group-${message.msgId}`}>
|
|
240
244
|
{messageStoreLengthRef.current === messageStore.length &&
|
|
241
245
|
grpUnreadCount &&
|
|
242
246
|
messageStore.length - grpUnreadCount === index ? (
|
|
@@ -250,9 +254,7 @@ const ChatContainer = (props?: {
|
|
|
250
254
|
{grpUnreadCount} {unreadMessageLabel}
|
|
251
255
|
</Text>
|
|
252
256
|
</View>
|
|
253
|
-
) :
|
|
254
|
-
<></>
|
|
255
|
-
)}
|
|
257
|
+
) : null}
|
|
256
258
|
{!message?.hide ? (
|
|
257
259
|
<ChatBubbleComponent
|
|
258
260
|
isLocal={localUid === message.uid}
|
|
@@ -287,15 +289,11 @@ const ChatContainer = (props?: {
|
|
|
287
289
|
) : null}
|
|
288
290
|
{messageStore?.length - 1 === index ? (
|
|
289
291
|
<Spacer size={10} />
|
|
290
|
-
) :
|
|
291
|
-
|
|
292
|
-
)}
|
|
293
|
-
</>
|
|
292
|
+
) : null}
|
|
293
|
+
</React.Fragment>
|
|
294
294
|
))}
|
|
295
295
|
</>
|
|
296
|
-
) :
|
|
297
|
-
<></>
|
|
298
|
-
)}
|
|
296
|
+
) : null}
|
|
299
297
|
{chatType === ChatType.Private &&
|
|
300
298
|
privateChatUser &&
|
|
301
299
|
privateMessageStore[privateChatUser] ? (
|
|
@@ -319,9 +317,7 @@ const ChatContainer = (props?: {
|
|
|
319
317
|
{privateUnreadCount} {unreadMessageLabel}
|
|
320
318
|
</Text>
|
|
321
319
|
</View>
|
|
322
|
-
) :
|
|
323
|
-
<></>
|
|
324
|
-
)}
|
|
320
|
+
) : null}
|
|
325
321
|
{!message?.hide ? (
|
|
326
322
|
<ChatBubbleComponent
|
|
327
323
|
isLocal={localUid === message.uid}
|
|
@@ -356,16 +352,12 @@ const ChatContainer = (props?: {
|
|
|
356
352
|
{privateMessageStore[privateChatUser]?.length - 1 ===
|
|
357
353
|
index ? (
|
|
358
354
|
<Spacer size={10} />
|
|
359
|
-
) :
|
|
360
|
-
<></>
|
|
361
|
-
)}
|
|
355
|
+
) : null}
|
|
362
356
|
</>
|
|
363
357
|
),
|
|
364
358
|
)}
|
|
365
359
|
</>
|
|
366
|
-
) :
|
|
367
|
-
<></>
|
|
368
|
-
)}
|
|
360
|
+
) : null}
|
|
369
361
|
{defaultContent[privateChatUser]?.offline && (
|
|
370
362
|
<View style={style.infoTextView}>
|
|
371
363
|
<Text style={style.infoText}>{userOfflineLabel}</Text>
|
|
@@ -314,10 +314,11 @@ export const ChatTextInput = (props: ChatTextInputProps) => {
|
|
|
314
314
|
{!replyToMsgId && uploadedFiles.map(renderAttachmentBubble)}
|
|
315
315
|
{/* {replyToMsgId && renderTextInput({borderWidth: 0, padddingLeft: 0})} */}
|
|
316
316
|
<View>
|
|
317
|
-
{replyToMsgId
|
|
318
|
-
{replyToMsgId
|
|
319
|
-
{!replyToMsgId
|
|
320
|
-
renderTextInput({borderWidth: 0, padddingLeft: 0})
|
|
317
|
+
{replyToMsgId ? <View>{renderReplyMsg()}</View> : null}
|
|
318
|
+
{replyToMsgId ? uploadedFiles.map(renderAttachmentBubble) : null}
|
|
319
|
+
{!replyToMsgId
|
|
320
|
+
? renderTextInput({borderWidth: 0, padddingLeft: 0})
|
|
321
|
+
: null}
|
|
321
322
|
</View>
|
|
322
323
|
</ScrollView>
|
|
323
324
|
</View>
|
|
@@ -328,7 +329,7 @@ export const ChatTextInput = (props: ChatTextInputProps) => {
|
|
|
328
329
|
? [style.inputWrapper, {borderRadius: 8, borderTopWidth: 1}]
|
|
329
330
|
: {}
|
|
330
331
|
}>
|
|
331
|
-
{replyToMsgId
|
|
332
|
+
{replyToMsgId ? <View>{renderReplyMsg()}</View> : null}
|
|
332
333
|
{renderTextInput({borderWidth: 0, padddingLeft: 0})}
|
|
333
334
|
</View>
|
|
334
335
|
)}
|
|
@@ -186,6 +186,7 @@ const ChatSendButton = (props: ChatSendButtonProps) => {
|
|
|
186
186
|
const toastHeadingSize = useString(chatSendErrorTextSizeToastHeading)();
|
|
187
187
|
const errorSubHeadingSize = useString(chatSendErrorTextSizeToastSubHeading);
|
|
188
188
|
const groupID = data.chat.group_id;
|
|
189
|
+
const sendMessageBtnText = useString(chatSendMessageBtnText)();
|
|
189
190
|
|
|
190
191
|
const onPress = () =>
|
|
191
192
|
handleChatSend({
|
|
@@ -224,11 +225,7 @@ const ChatSendButton = (props: ChatSendButtonProps) => {
|
|
|
224
225
|
: {}
|
|
225
226
|
}
|
|
226
227
|
disabled={!isValidMsg}
|
|
227
|
-
toolTipMessage={
|
|
228
|
-
isMobileUA() || !isValidMsg
|
|
229
|
-
? null
|
|
230
|
-
: useString(chatSendMessageBtnText)()
|
|
231
|
-
}
|
|
228
|
+
toolTipMessage={isMobileUA() || !isValidMsg ? null : sendMessageBtnText}
|
|
232
229
|
iconProps={{
|
|
233
230
|
iconType: 'plain',
|
|
234
231
|
iconContainerStyle: {
|