agora-appbuilder-core 4.0.0-beta.61 → 4.0.0-beta.63

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agora-appbuilder-core",
3
- "version": "4.0.0-beta.61",
3
+ "version": "4.0.0-beta.63",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -16,4 +16,11 @@ export type {
16
16
  NetworkQualities,
17
17
  I18nRequestConfirmation,
18
18
  I18nMuteConfirmation,
19
+ deviceDetectionToastSubHeadingDataInterface,
20
+ sttSpokenLanguageToastHeadingDataType,
21
+ whiteboardFileUploadToastDataType,
22
+ publicChatToastSubHeadingDataInterface,
23
+ privateChatToastHeadingDataInterface,
24
+ publicAndPrivateChatToastSubHeadingDataInterface,
19
25
  } from '../src/language/default-labels/videoCallScreenLabels';
26
+ export type {TextDataInterface} from '../src/language/default-labels';
@@ -35,7 +35,7 @@ import LocalEventEmitter, {
35
35
  } from '../rtm-events-api/LocalEvents';
36
36
  import {useString} from '../utils/useString';
37
37
  import {
38
- deviceDetectionCancelBtnText,
38
+ deviceDetectionSecondaryBtnText,
39
39
  deviceDetectionCheckboxText,
40
40
  deviceDetectionPrimaryBtnText,
41
41
  deviceDetectionToastHeading,
@@ -67,7 +67,7 @@ const DeviceConfigure: React.FC<Props> = (props: any) => {
67
67
  deviceDetectionToastSubHeading,
68
68
  );
69
69
  const toastPrimaryBtnText = useString(deviceDetectionPrimaryBtnText)();
70
- const toastCancelBtnText = useString(deviceDetectionCancelBtnText)();
70
+ const toastCancelBtnText = useString(deviceDetectionSecondaryBtnText)();
71
71
  const toastCheckboxBtnText = useString(deviceDetectionCheckboxText)();
72
72
 
73
73
  const micSelectInProgress = useRef(false);
@@ -9,7 +9,7 @@
9
9
  information visit https://appbuilder.agora.io.
10
10
  *********************************************
11
11
  */
12
- import React, {useState, useContext, useEffect} from 'react';
12
+ import React, {useState, useContext, useEffect, useRef} from 'react';
13
13
  import {
14
14
  DispatchContext,
15
15
  ContentInterface,
@@ -22,13 +22,15 @@ import {EventNames} from '../rtm-events';
22
22
  import useLocalScreenShareUid from '../utils/useLocalShareScreenUid';
23
23
  import {createHook} from 'customization-implementation';
24
24
  import ChatContext from './ChatContext';
25
- import {useRtc} from 'customization-api';
25
+ import {filterObject, useContent, useRtc} from 'customization-api';
26
26
  import {gql, useMutation} from '@apollo/client';
27
27
  import {
28
28
  PSTNUserLabel,
29
29
  videoRoomScreenshareText,
30
30
  videoRoomUserFallbackText,
31
31
  } from '../language/default-labels/videoCallScreenLabels';
32
+ import {useLanguage} from '../language/useLanguage';
33
+ import {useScreenContext} from '../components/contexts/ScreenShareContext';
32
34
 
33
35
  interface UserPreferenceContextInterface {
34
36
  displayName: string;
@@ -64,6 +66,36 @@ const UserPreferenceProvider = (props: {children: React.ReactNode}) => {
64
66
  const [displayName, setDisplayName] = useState(getInitialUsername());
65
67
  const [updateUserName] = useMutation(UPDATE_USER_NAME_MUTATION);
66
68
 
69
+ const {languageCode} = useLanguage();
70
+ const {screenShareData} = useScreenContext();
71
+ const {defaultContent} = useContent();
72
+ const screenShareDataRef = useRef({screenShareData});
73
+ useEffect(() => {
74
+ screenShareDataRef.current.screenShareData = screenShareData;
75
+ }, [screenShareData]);
76
+
77
+ useEffect(() => {
78
+ try {
79
+ if (languageCode) {
80
+ Object.keys(screenShareDataRef.current.screenShareData).map(i => {
81
+ let screenShareUidToUpdate = parseInt(i);
82
+ const users = filterObject(
83
+ defaultContent,
84
+ ([k, v]) => v?.screenUid === screenShareUidToUpdate,
85
+ );
86
+ const keys = Object.keys(users);
87
+ if (users && keys && keys?.length) {
88
+ updateRenderListState(screenShareUidToUpdate, {
89
+ name: getScreenShareName(
90
+ users[parseInt(keys[0])]?.name || userText,
91
+ ),
92
+ });
93
+ }
94
+ });
95
+ }
96
+ } catch (error) {}
97
+ }, [languageCode, screenShareData]);
98
+
67
99
  const saveName = (name: string) => {
68
100
  if (name && name?.trim() !== '') {
69
101
  try {
@@ -1,5 +1,33 @@
1
1
  import {I18nBaseType, I18nConditionalType, I18nDynamicType} from '../i18nTypes';
2
2
  import {room} from './createScreenLabels';
3
+
4
+ export interface deviceDetectionToastSubHeadingDataInterface {
5
+ name: string;
6
+ label: string;
7
+ }
8
+
9
+ export type sttSpokenLanguageToastHeadingDataType = 'Set' | 'Changed';
10
+ export interface sttSpokenLanguageToastSubHeadingDataInterface {
11
+ action: sttSpokenLanguageToastHeadingDataType;
12
+ newLanguage: string;
13
+ oldLanguage: string;
14
+ username: string;
15
+ }
16
+
17
+ export type whiteboardFileUploadToastDataType = 'File' | 'Image';
18
+ export interface publicChatToastSubHeadingDataInterface {
19
+ count: number;
20
+ from: string;
21
+ }
22
+ export interface privateChatToastHeadingDataInterface {
23
+ count: number;
24
+ }
25
+
26
+ export interface publicAndPrivateChatToastSubHeadingDataInterface {
27
+ publicChatCount: number;
28
+ privateChatCount: number;
29
+ from: string;
30
+ }
3
31
  interface NetworkQualityStatusInterface {
4
32
  unknown?: 'Unknown';
5
33
  excellent?: 'Excellent';
@@ -128,9 +156,9 @@ export const leavePopupHeading = `leave${room}PopupHeading`;
128
156
  export const leavePopupSubHeading = `leave${room}PopupSubHeading`;
129
157
  export const leavePopupPrimaryBtnText = `leave${room}PopupPrimaryBtnText`;
130
158
 
131
- export const removeFromRoomPopupHeading = `removeFrom${room}PopupHeading`;
132
- export const removeFromRoomPopupSubHeading = `removeFrom${room}PopupSubHeading`;
133
- export const removeFromRoomPopupPrimaryBtnText = `removeFrom${room}PopupPrimaryBtnText`;
159
+ export const removeUserFromRoomPopupHeading = `removeUserFrom${room}PopupHeading`;
160
+ export const removeUserFromRoomPopupSubHeading = `removeUserFrom${room}PopupSubHeading`;
161
+ export const removeUserFromRoomPopupPrimaryBtnText = `removeUserFrom${room}PopupPrimaryBtnText`;
134
162
 
135
163
  export const removeScreenshareFromRoomPopupHeading = `removeScreenshareFrom${room}PopupHeading`;
136
164
  export const removeScreenshareFromRoomPopupSubHeading = `removeScreenshareFrom${room}PopupSubHeading`;
@@ -358,7 +386,8 @@ export const sttSpokenLanguageToastSubHeading = `${stt}SpokenLanguageToastSubHea
358
386
  export const deviceDetectionToastHeading = 'deviceDetectionToastHeading';
359
387
  export const deviceDetectionToastSubHeading = 'deviceDetectionToastSubHeading';
360
388
  export const deviceDetectionPrimaryBtnText = 'deviceDetectionPrimaryBtnText';
361
- export const deviceDetectionCancelBtnText = 'deviceDetectionCancelBtnText';
389
+ export const deviceDetectionSecondaryBtnText =
390
+ 'deviceDetectionSecondaryBtnText';
362
391
  export const deviceDetectionCheckboxText = 'deviceDetectionCheckboxText';
363
392
 
364
393
  export const hostMutedUserToastHeading = 'hostMutedUserToastHeading';
@@ -494,9 +523,9 @@ export interface I18nVideoCallScreenLabelsInterface {
494
523
  [leavePopupSubHeading]?: I18nConditionalType;
495
524
  [leavePopupPrimaryBtnText]?: I18nBaseType;
496
525
 
497
- [removeFromRoomPopupHeading]?: I18nDynamicType;
498
- [removeFromRoomPopupSubHeading]?: I18nDynamicType;
499
- [removeFromRoomPopupPrimaryBtnText]?: I18nBaseType;
526
+ [removeUserFromRoomPopupHeading]?: I18nDynamicType;
527
+ [removeUserFromRoomPopupSubHeading]?: I18nDynamicType;
528
+ [removeUserFromRoomPopupPrimaryBtnText]?: I18nBaseType;
500
529
 
501
530
  [removeScreenshareFromRoomPopupHeading]?: I18nBaseType;
502
531
  [removeScreenshareFromRoomPopupSubHeading]?: I18nDynamicType;
@@ -577,20 +606,13 @@ export interface I18nVideoCallScreenLabelsInterface {
577
606
 
578
607
  [publicChatToastHeading]?: I18nBaseType;
579
608
  [multiplePublicChatToastHeading]?: I18nBaseType;
580
- [multiplePublicChatToastSubHeading]?: I18nBaseType<{
581
- count: number;
582
- from: string;
583
- }>;
609
+ [multiplePublicChatToastSubHeading]?: I18nBaseType<publicChatToastSubHeadingDataInterface>;
584
610
 
585
611
  [privateChatToastHeading]?: I18nBaseType;
586
- [multiplePrivateChatToastHeading]?: I18nBaseType<{count: number}>;
612
+ [multiplePrivateChatToastHeading]?: I18nBaseType<privateChatToastHeadingDataInterface>;
587
613
 
588
614
  [multiplePublicAndPrivateChatToastHeading]?: I18nBaseType;
589
- [multiplePublicAndPrivateChatToastSubHeading]?: I18nBaseType<{
590
- publicChatCount: number;
591
- privateChatCount: number;
592
- from: string;
593
- }>;
615
+ [multiplePublicAndPrivateChatToastSubHeading]?: I18nBaseType<publicAndPrivateChatToastSubHeadingDataInterface>;
594
616
 
595
617
  [livestreamToastApprovalBtnText]?: I18nBaseType;
596
618
  [livestreamToastDenyBtnText]?: I18nBaseType;
@@ -653,28 +675,18 @@ export interface I18nVideoCallScreenLabelsInterface {
653
675
  [whiteboardToolboxUploadText]?: I18nBaseType;
654
676
  [whiteboardToolboxClearAllText]?: I18nBaseType;
655
677
 
656
- [whiteboardFileUploadErrorToastHeading]?: I18nBaseType<'File' | 'Image'>;
657
- [whiteboardFileUploadInfoToastHeading]?: I18nBaseType<'File' | 'Image'>;
658
- [whiteboardFileUploadTypeErrorToastHeading]?: I18nBaseType<'File' | 'Image'>;
659
- [whiteboardFileUploadTypeErrorToastSubHeading]?: I18nBaseType<
660
- 'File' | 'Image'
661
- >;
662
-
663
- [sttSpokenLanguageToastHeading]?: I18nBaseType<'Set' | 'Changed'>;
664
- [sttSpokenLanguageToastSubHeading]?: I18nBaseType<{
665
- action: 'Set' | 'Changed';
666
- newLanguage: string;
667
- oldLanguage: string;
668
- username: string;
669
- }>;
678
+ [whiteboardFileUploadErrorToastHeading]?: I18nBaseType<whiteboardFileUploadToastDataType>;
679
+ [whiteboardFileUploadInfoToastHeading]?: I18nBaseType<whiteboardFileUploadToastDataType>;
680
+ [whiteboardFileUploadTypeErrorToastHeading]?: I18nBaseType<whiteboardFileUploadToastDataType>;
681
+ [whiteboardFileUploadTypeErrorToastSubHeading]?: I18nBaseType<whiteboardFileUploadToastDataType>;
682
+
683
+ [sttSpokenLanguageToastHeading]?: I18nBaseType<sttSpokenLanguageToastHeadingDataType>;
684
+ [sttSpokenLanguageToastSubHeading]?: I18nBaseType<sttSpokenLanguageToastSubHeadingDataInterface>;
670
685
 
671
686
  [deviceDetectionToastHeading]?: I18nDynamicType;
672
- [deviceDetectionToastSubHeading]?: I18nBaseType<{
673
- name: string;
674
- label: string;
675
- }>;
687
+ [deviceDetectionToastSubHeading]?: I18nBaseType<deviceDetectionToastSubHeadingDataInterface>;
676
688
  [deviceDetectionPrimaryBtnText]?: I18nBaseType;
677
- [deviceDetectionCancelBtnText]?: I18nBaseType;
689
+ [deviceDetectionSecondaryBtnText]?: I18nBaseType;
678
690
  [deviceDetectionCheckboxText]?: I18nBaseType;
679
691
 
680
692
  [hostMutedUserToastHeading]?: I18nBaseType<I18nMuteType>;
@@ -863,10 +875,10 @@ export const VideoCallScreenLabels: I18nVideoCallScreenLabelsInterface = {
863
875
  : 'Are you sure you want to leave this meeting?',
864
876
  [leavePopupPrimaryBtnText]: 'LEAVE',
865
877
 
866
- [removeFromRoomPopupHeading]: name => `Remove ${name}?`,
867
- [removeFromRoomPopupSubHeading]: name =>
878
+ [removeUserFromRoomPopupHeading]: name => `Remove ${name}?`,
879
+ [removeUserFromRoomPopupSubHeading]: name =>
868
880
  `Once removed, ${name} will still be able to rejoin the room later.`,
869
- [removeFromRoomPopupPrimaryBtnText]: 'REMOVE',
881
+ [removeUserFromRoomPopupPrimaryBtnText]: 'REMOVE',
870
882
 
871
883
  [removeScreenshareFromRoomPopupHeading]: 'Remove Screenshare?',
872
884
  [removeScreenshareFromRoomPopupSubHeading]: name =>
@@ -1084,7 +1096,7 @@ export const VideoCallScreenLabels: I18nVideoCallScreenLabelsInterface = {
1084
1096
  [deviceDetectionToastSubHeading]: ({name, label}) =>
1085
1097
  `New ${name} named ${label} detected. Do you want to switch?`,
1086
1098
  [deviceDetectionPrimaryBtnText]: 'SWITCH DEVICE',
1087
- [deviceDetectionCancelBtnText]: 'IGNORE',
1099
+ [deviceDetectionSecondaryBtnText]: 'IGNORE',
1088
1100
  [deviceDetectionCheckboxText]: 'Remember my choice',
1089
1101
 
1090
1102
  [hostMutedUserToastHeading]: type =>
@@ -8,9 +8,9 @@ import ThemeConfig from '../theme';
8
8
  import {useIsDesktop} from '../utils/common';
9
9
  import {useString} from '../utils/useString';
10
10
  import {
11
- removeFromRoomPopupHeading,
12
- removeFromRoomPopupPrimaryBtnText,
13
- removeFromRoomPopupSubHeading,
11
+ removeUserFromRoomPopupHeading,
12
+ removeUserFromRoomPopupPrimaryBtnText,
13
+ removeUserFromRoomPopupSubHeading,
14
14
  } from '../language/default-labels/videoCallScreenLabels';
15
15
  import {cancelText} from '../language/default-labels/commonLabels';
16
16
 
@@ -22,11 +22,13 @@ interface RemoveMeetingPopupProps {
22
22
  }
23
23
  const RemoveMeetingPopup = (props: RemoveMeetingPopupProps) => {
24
24
  const isDesktop = useIsDesktop()('popup');
25
- const removeMeetingLabelHeading = useString(removeFromRoomPopupHeading);
26
- const removeMeetingLabelSubHeading = useString(removeFromRoomPopupSubHeading);
25
+ const removeMeetingLabelHeading = useString(removeUserFromRoomPopupHeading);
26
+ const removeMeetingLabelSubHeading = useString(
27
+ removeUserFromRoomPopupSubHeading,
28
+ );
27
29
 
28
30
  const cancelBtnLabel = useString(cancelText)();
29
- const removeBtnLabel = useString(removeFromRoomPopupPrimaryBtnText)();
31
+ const removeBtnLabel = useString(removeUserFromRoomPopupPrimaryBtnText)();
30
32
  return (
31
33
  <Popup
32
34
  modalVisible={props.modalVisible}