agora-appbuilder-core 4.0.0-beta.59 → 4.0.0-beta.60

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.59",
3
+ "version": "4.0.0-beta.60",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -85,42 +85,42 @@ const AppWrapper = (props: AppWrapperProps) => {
85
85
  // @ts-ignore textAlign not supported by TS definitions but is applied to web regardless
86
86
  style={[{flex: 1}, Platform.select({web: {textAlign: 'left'}})]}>
87
87
  <StatusBar hidden={true} />
88
- <ToastProvider>
89
- <ToastContext.Consumer>
90
- {({isActionSheetVisible}) => {
91
- return !isActionSheetVisible ? <ToastComponent /> : null;
92
- }}
93
- </ToastContext.Consumer>
94
- <StorageProvider>
95
- <GraphQLProvider>
96
- <Router
97
- /*@ts-ignore Router will be memory Router in sdk*/
98
- initialEntries={[
99
- //@ts-ignore
100
- isSDK && SdkJoinState.phrase
101
- ? //@ts-ignore
102
- `/${SdkJoinState.phrase}`
103
- : '',
104
- ]}>
105
- <AuthProvider>
106
- <SessionProvider>
107
- <ColorConfigure>
108
- <DimensionProvider>
109
- <LanguageProvider>
88
+ <StorageProvider>
89
+ <LanguageProvider>
90
+ <ToastProvider>
91
+ <ToastContext.Consumer>
92
+ {({isActionSheetVisible}) => {
93
+ return !isActionSheetVisible ? <ToastComponent /> : null;
94
+ }}
95
+ </ToastContext.Consumer>
96
+ <GraphQLProvider>
97
+ <Router
98
+ /*@ts-ignore Router will be memory Router in sdk*/
99
+ initialEntries={[
100
+ //@ts-ignore
101
+ isSDK && SdkJoinState.phrase
102
+ ? //@ts-ignore
103
+ `/${SdkJoinState.phrase}`
104
+ : '',
105
+ ]}>
106
+ <AuthProvider>
107
+ <SessionProvider>
108
+ <ColorConfigure>
109
+ <DimensionProvider>
110
110
  <ErrorProvider>
111
111
  <Error />
112
112
  <Navigation />
113
113
  {props.children}
114
114
  </ErrorProvider>
115
- </LanguageProvider>
116
- </DimensionProvider>
117
- </ColorConfigure>
118
- </SessionProvider>
119
- </AuthProvider>
120
- </Router>
121
- </GraphQLProvider>
122
- </StorageProvider>
123
- </ToastProvider>
115
+ </DimensionProvider>
116
+ </ColorConfigure>
117
+ </SessionProvider>
118
+ </AuthProvider>
119
+ </Router>
120
+ </GraphQLProvider>
121
+ </ToastProvider>
122
+ </LanguageProvider>
123
+ </StorageProvider>
124
124
  </SafeAreaView>
125
125
  </ImageBackgroundComp>
126
126
  </AppRoot>
@@ -58,35 +58,167 @@ interface Props {
58
58
  }
59
59
 
60
60
  const EventsConfigure: React.FC<Props> = props => {
61
- const hostMutedUserToastHeadingTT = useString<I18nMuteType>(
61
+ // mute user audio
62
+ const hostMutedUserAudioToastHeadingTT = useString<I18nMuteType>(
62
63
  hostMutedUserToastHeading,
63
- );
64
- const hostRequestedUserToastHeadingTT = useString<I18nMuteType>(
64
+ )(I18nMuteType.audio);
65
+
66
+ const audioMuteToastRef = useRef(hostMutedUserAudioToastHeadingTT);
67
+ useEffect(() => {
68
+ audioMuteToastRef.current = hostMutedUserAudioToastHeadingTT;
69
+ }, [hostMutedUserAudioToastHeadingTT]);
70
+
71
+ // mute user video
72
+ const hostMutedUserVideoToastHeadingTT = useString<I18nMuteType>(
73
+ hostMutedUserToastHeading,
74
+ )(I18nMuteType.video);
75
+
76
+ const videoMuteToastRef = useRef(hostMutedUserVideoToastHeadingTT);
77
+ useEffect(() => {
78
+ videoMuteToastRef.current = hostMutedUserVideoToastHeadingTT;
79
+ }, [hostMutedUserVideoToastHeadingTT]);
80
+
81
+ //request user video
82
+ const hostRequestedUserVideoToastHeadingTT = useString<I18nMuteType>(
65
83
  hostRequestedUserToastHeading,
84
+ )(I18nMuteType.video);
85
+
86
+ const videoRequestToastRef = useRef(hostRequestedUserVideoToastHeadingTT);
87
+ useEffect(() => {
88
+ videoRequestToastRef.current = hostRequestedUserVideoToastHeadingTT;
89
+ }, [hostRequestedUserVideoToastHeadingTT]);
90
+
91
+ //request user audio
92
+ const hostRequestedUserAudioToastHeadingTT = useString<I18nMuteType>(
93
+ hostRequestedUserToastHeading,
94
+ )(I18nMuteType.audio);
95
+
96
+ const audioRequestToastRef = useRef(hostRequestedUserAudioToastHeadingTT);
97
+ useEffect(() => {
98
+ audioRequestToastRef.current = hostRequestedUserAudioToastHeadingTT;
99
+ }, [hostRequestedUserAudioToastHeadingTT]);
100
+
101
+ //request user video primary btn
102
+ const hostRequestedUserVideoToastPrimaryBtnTextTT = useString<I18nMuteType>(
103
+ hostRequestedUserToastPrimaryBtnText,
104
+ )(I18nMuteType.video);
105
+
106
+ const requestUserVideoPrimaryBtnRef = useRef(
107
+ hostRequestedUserVideoToastPrimaryBtnTextTT,
66
108
  );
67
- const hostRequestedUserToastPrimaryBtnTextTT = useString<I18nMuteType>(
109
+
110
+ useEffect(() => {
111
+ requestUserVideoPrimaryBtnRef.current =
112
+ hostRequestedUserVideoToastPrimaryBtnTextTT;
113
+ }, [hostRequestedUserVideoToastPrimaryBtnTextTT]);
114
+
115
+ //request user audio primary btn
116
+ const hostRequestedUserAudioToastPrimaryBtnTextTT = useString<I18nMuteType>(
68
117
  hostRequestedUserToastPrimaryBtnText,
118
+ )(I18nMuteType.audio);
119
+
120
+ const requestUserAudioPrimaryBtnRef = useRef(
121
+ hostRequestedUserAudioToastPrimaryBtnTextTT,
69
122
  );
70
- const hostRequestedUserToastSecondaryBtnTextTT = useString<I18nMuteType>(
123
+
124
+ useEffect(() => {
125
+ requestUserAudioPrimaryBtnRef.current =
126
+ hostRequestedUserAudioToastPrimaryBtnTextTT;
127
+ }, [hostRequestedUserAudioToastPrimaryBtnTextTT]);
128
+
129
+ //request user video secondary btn
130
+ const hostRequestedUserVideoToastSecondaryBtnTextTT = useString<I18nMuteType>(
131
+ hostRequestedUserToastSecondaryBtnText,
132
+ )(I18nMuteType.video);
133
+
134
+ const requestUserVideoSecondaryBtnRef = useRef(
135
+ hostRequestedUserVideoToastSecondaryBtnTextTT,
136
+ );
137
+ useEffect(() => {
138
+ requestUserVideoSecondaryBtnRef.current =
139
+ hostRequestedUserVideoToastSecondaryBtnTextTT;
140
+ }, [hostRequestedUserVideoToastSecondaryBtnTextTT]);
141
+
142
+ //request user audio secondary btn
143
+ const hostRequestedUserAudioToastSecondaryBtnTextTT = useString<I18nMuteType>(
71
144
  hostRequestedUserToastSecondaryBtnText,
145
+ )(I18nMuteType.audio);
146
+
147
+ const requestUserAudioSecondaryBtnRef = useRef(
148
+ hostRequestedUserAudioToastSecondaryBtnTextTT,
72
149
  );
150
+ useEffect(() => {
151
+ requestUserAudioSecondaryBtnRef.current =
152
+ hostRequestedUserAudioToastSecondaryBtnTextTT;
153
+ }, [hostRequestedUserAudioToastSecondaryBtnTextTT]);
73
154
 
155
+ //host removed
74
156
  const hostRemovedUserToastHeadingTT = useString(
75
157
  hostRemovedUserToastHeading,
76
158
  )();
77
159
 
160
+ const removedUserToastRef = useRef(hostRemovedUserToastHeadingTT);
161
+
162
+ useEffect(() => {
163
+ removedUserToastRef.current = hostRemovedUserToastHeadingTT;
164
+ }, [hostRemovedUserToastHeadingTT]);
165
+
166
+ //waiting room heading
78
167
  const waitingRoomApprovalRequiredToastHeadingTT = useString(
79
168
  waitingRoomApprovalRequiredToastHeading,
80
169
  )();
170
+
171
+ const waitingRoomAppovalHeadingRef = useRef(
172
+ waitingRoomApprovalRequiredToastHeadingTT,
173
+ );
174
+
175
+ useEffect(() => {
176
+ waitingRoomAppovalHeadingRef.current =
177
+ waitingRoomApprovalRequiredToastHeadingTT;
178
+ }, [waitingRoomApprovalRequiredToastHeadingTT]);
179
+
180
+ //waiting room subheading
81
181
  const waitingRoomApprovalRequiredToastSubHeadingTT = useString(
82
182
  waitingRoomApprovalRequiredToastSubHeading,
83
183
  );
184
+
185
+ const waitingRoomApprovalSubHeadingRef = useRef(
186
+ waitingRoomApprovalRequiredToastSubHeadingTT,
187
+ );
188
+
189
+ useEffect(() => {
190
+ waitingRoomApprovalSubHeadingRef.current =
191
+ waitingRoomApprovalRequiredToastSubHeadingTT;
192
+ }, [waitingRoomApprovalRequiredToastSubHeadingTT]);
193
+
194
+ //waiting room primary btn
84
195
  const waitingRoomApprovalRequiredPrimaryBtnTextTT = useString(
85
196
  waitingRoomApprovalRequiredPrimaryBtnText,
86
197
  )();
198
+
199
+ const waitingRoomApprovalPrimaryBtnRef = useRef(
200
+ waitingRoomApprovalRequiredPrimaryBtnTextTT,
201
+ );
202
+
203
+ useEffect(() => {
204
+ waitingRoomApprovalPrimaryBtnRef.current =
205
+ waitingRoomApprovalRequiredPrimaryBtnTextTT;
206
+ }, [waitingRoomApprovalRequiredPrimaryBtnTextTT]);
207
+
208
+ //waiting room secondary btn
87
209
  const waitingRoomApprovalRequiredSecondaryBtnTextTT = useString(
88
210
  waitingRoomApprovalRequiredSecondaryBtnText,
89
211
  )();
212
+
213
+ const waitingRoomApprovalSecondaryBtnRef = useRef(
214
+ waitingRoomApprovalRequiredSecondaryBtnTextTT,
215
+ );
216
+
217
+ useEffect(() => {
218
+ waitingRoomApprovalSecondaryBtnRef.current =
219
+ waitingRoomApprovalRequiredSecondaryBtnTextTT;
220
+ }, [waitingRoomApprovalRequiredSecondaryBtnTextTT]);
221
+
90
222
  //@ts-ignore
91
223
  const {isScreenshareActive, ScreenshareStoppedCallback, stopUserScreenShare} =
92
224
  useScreenshare();
@@ -148,7 +280,7 @@ const EventsConfigure: React.FC<Props> = props => {
148
280
  // text1: `${
149
281
  // defaultContentRef.current.defaultContent[sender].name || 'The host'
150
282
  // } muted you.`,
151
- text1: hostMutedUserToastHeadingTT(I18nMuteType.video),
283
+ text1: videoMuteToastRef.current,
152
284
  visibilityTime: 3000,
153
285
  primaryBtn: null,
154
286
  secondaryBtn: null,
@@ -179,7 +311,7 @@ const EventsConfigure: React.FC<Props> = props => {
179
311
  // text1: `${
180
312
  // defaultContentRef.current.defaultContent[sender].name || 'The host'
181
313
  // } muted you.`,
182
- text1: hostMutedUserToastHeadingTT(I18nMuteType.audio),
314
+ text1: audioMuteToastRef.current,
183
315
  visibilityTime: 3000,
184
316
  primaryBtn: null,
185
317
  secondaryBtn: null,
@@ -209,7 +341,7 @@ const EventsConfigure: React.FC<Props> = props => {
209
341
  Toast.show({
210
342
  leadingIconName: 'info',
211
343
  type: 'info',
212
- text1: hostRemovedUserToastHeadingTT,
344
+ text1: removedUserToastRef.current,
213
345
  visibilityTime: 5000,
214
346
  primaryBtn: null,
215
347
  secondaryBtn: null,
@@ -225,7 +357,7 @@ const EventsConfigure: React.FC<Props> = props => {
225
357
  Toast.show({
226
358
  leadingIconName: 'mic-on',
227
359
  type: 'info',
228
- text1: hostRequestedUserToastHeadingTT(I18nMuteType.audio),
360
+ text1: audioRequestToastRef.current,
229
361
  visibilityTime: 3000,
230
362
  leadingIcon: null,
231
363
  primaryBtn:
@@ -236,7 +368,7 @@ const EventsConfigure: React.FC<Props> = props => {
236
368
  <PrimaryButton
237
369
  containerStyle={style.primaryBtn}
238
370
  textStyle={style.textStyle}
239
- text={hostRequestedUserToastPrimaryBtnTextTT(I18nMuteType.audio)}
371
+ text={requestUserAudioPrimaryBtnRef.current}
240
372
  onPress={() => {
241
373
  RtcEngineUnsafe.muteLocalAudioStream(false);
242
374
  dispatch({
@@ -252,11 +384,7 @@ const EventsConfigure: React.FC<Props> = props => {
252
384
  PermissionState.GRANTED_FOR_CAM_AND_MIC ||
253
385
  permissionStatusRef.current ===
254
386
  PermissionState.GRANTED_FOR_MIC_ONLY ? (
255
- <SecondaryBtn
256
- text={hostRequestedUserToastSecondaryBtnTextTT(
257
- I18nMuteType.audio,
258
- )}
259
- />
387
+ <SecondaryBtn text={requestUserAudioSecondaryBtnRef.current} />
260
388
  ) : null,
261
389
  });
262
390
  });
@@ -264,7 +392,7 @@ const EventsConfigure: React.FC<Props> = props => {
264
392
  Toast.show({
265
393
  leadingIconName: 'video-on',
266
394
  type: 'info',
267
- text1: hostRequestedUserToastHeadingTT(I18nMuteType.video),
395
+ text1: videoRequestToastRef.current,
268
396
  visibilityTime: 3000,
269
397
  leadingIcon: null,
270
398
  primaryBtn:
@@ -275,7 +403,7 @@ const EventsConfigure: React.FC<Props> = props => {
275
403
  <PrimaryButton
276
404
  containerStyle={style.primaryBtn}
277
405
  textStyle={style.textStyle}
278
- text={hostRequestedUserToastPrimaryBtnTextTT(I18nMuteType.video)}
406
+ text={requestUserVideoPrimaryBtnRef.current}
279
407
  onPress={async () => {
280
408
  isWebInternal()
281
409
  ? await RtcEngineUnsafe.muteLocalVideoStream(false)
@@ -295,11 +423,7 @@ const EventsConfigure: React.FC<Props> = props => {
295
423
  PermissionState.GRANTED_FOR_CAM_AND_MIC ||
296
424
  permissionStatusRef.current ===
297
425
  PermissionState.GRANTED_FOR_CAM_ONLY ? (
298
- <SecondaryBtn
299
- text={hostRequestedUserToastSecondaryBtnTextTT(
300
- I18nMuteType.video,
301
- )}
302
- />
426
+ <SecondaryBtn text={requestUserVideoSecondaryBtnRef.current} />
303
427
  ) : null,
304
428
  });
305
429
  });
@@ -471,7 +595,7 @@ const EventsConfigure: React.FC<Props> = props => {
471
595
  <PrimaryButton
472
596
  containerStyle={style.primaryBtn}
473
597
  textStyle={style.textStyle}
474
- text={waitingRoomApprovalRequiredPrimaryBtnTextTT}
598
+ text={waitingRoomApprovalPrimaryBtnRef.current}
475
599
  onPress={() => {
476
600
  // user approving waiting room request
477
601
  const res = approval({
@@ -503,7 +627,7 @@ const EventsConfigure: React.FC<Props> = props => {
503
627
  <TertiaryButton
504
628
  containerStyle={style.secondaryBtn}
505
629
  textStyle={style.textStyle}
506
- text={waitingRoomApprovalRequiredSecondaryBtnTextTT}
630
+ text={waitingRoomApprovalSecondaryBtnRef.current}
507
631
  onPress={() => {
508
632
  // user rejecting waiting room request
509
633
  const res = approval({
@@ -537,8 +661,8 @@ const EventsConfigure: React.FC<Props> = props => {
537
661
  leadingIconName: 'info',
538
662
  leadingIcon: null,
539
663
  type: 'info',
540
- text1: waitingRoomApprovalRequiredToastHeadingTT,
541
- text2: waitingRoomApprovalRequiredToastSubHeadingTT(userName),
664
+ text1: waitingRoomAppovalHeadingRef.current,
665
+ text2: waitingRoomApprovalSubHeadingRef.current(userName),
542
666
  visibilityTime: 30000,
543
667
  ...btns,
544
668
  });
@@ -38,7 +38,10 @@ import {filterObject} from '../utils';
38
38
  import SDKEvents from '../utils/SdkEvents';
39
39
  import isSDK from '../utils/isSDK';
40
40
  import {useAsyncEffect} from '../utils/useAsyncEffect';
41
- import {useRoomInfo} from '../components/room-info/useRoomInfo';
41
+ import {
42
+ WaitingRoomStatus,
43
+ useRoomInfo,
44
+ } from '../components/room-info/useRoomInfo';
42
45
  import LocalEventEmitter, {
43
46
  LocalEventsEnum,
44
47
  } from '../rtm-events-api/LocalEvents';
@@ -56,10 +59,22 @@ const RtmConfigure = (props: any) => {
56
59
  const {defaultContent, activeUids} = useContent();
57
60
  const defaultContentRef = useRef({defaultContent: defaultContent});
58
61
  const activeUidsRef = useRef({activeUids: activeUids});
62
+
59
63
  const {
60
- isInWaitingRoom,
64
+ waitingRoomStatus,
61
65
  data: {isHost},
62
66
  } = useRoomInfo();
67
+ const waitingRoomStatusRef = useRef({waitingRoomStatus: waitingRoomStatus});
68
+
69
+ const isHostRef = useRef({isHost: isHost});
70
+
71
+ useEffect(() => {
72
+ isHostRef.current.isHost = isHost;
73
+ }, [isHost]);
74
+
75
+ useEffect(() => {
76
+ waitingRoomStatusRef.current.waitingRoomStatus = waitingRoomStatus;
77
+ }, [waitingRoomStatus]);
63
78
 
64
79
  /**
65
80
  * inside event callback state won't have latest value.
@@ -474,8 +489,17 @@ const RtmConfigure = (props: any) => {
474
489
  value = formattedData;
475
490
  }
476
491
  } else {
477
- evt = data.evt;
478
- value = data.value;
492
+ if (
493
+ $config.ENABLE_WAITING_ROOM &&
494
+ !isHostRef.current?.isHost &&
495
+ waitingRoomStatusRef.current?.waitingRoomStatus !==
496
+ WaitingRoomStatus.APPROVED
497
+ ) {
498
+ return;
499
+ } else {
500
+ evt = data.evt;
501
+ value = data.value;
502
+ }
479
503
  }
480
504
 
481
505
  try {
@@ -21,7 +21,6 @@ export interface I18nShareLinkScreenLabelsInterface {
21
21
  [shareRoomHostLinkSubText]?: I18nBaseType;
22
22
  [shareRoomPSTNLabel]?: I18nBaseType;
23
23
  [shareRoomPSTNNumberLabel]?: I18nBaseType;
24
- [shareRoomPSTNNumberLabel]?: I18nBaseType;
25
24
  [shareRoomPSTNPinLabel]?: I18nBaseType;
26
25
  [shareRoomPSTNSubText]?: I18nBaseType;
27
26
  [shareRoomCopyBtnText]?: I18nBaseType; // need to discuss