agora-appbuilder-core 4.0.0-beta.46 → 4.0.0-beta.48

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.46",
3
+ "version": "4.0.0-beta.48",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -33,7 +33,8 @@ export {default as NetworkQualityPill} from '../src/subComponents/NetworkQuality
33
33
  //videocall screen
34
34
  export {default as VideocallScreen} from '../src/pages/video-call/VideoCallScreen';
35
35
  export {default as PrecallScreen} from '../src/components/Precall';
36
- //export {default as VBPanel} from '../src/components/virtual-background/VBPanel';
36
+ export {default as VBPanel} from '../src/components/virtual-background/VBPanel';
37
+ export {WhiteboardListener} from '../src/components/Controls';
37
38
 
38
39
  // commented for v1 release
39
40
  //Settings screen
@@ -19,6 +19,7 @@ import useMuteToggleLocal, {
19
19
  import {RoomPhase} from 'white-web-sdk';
20
20
  import {useScreenContext} from '../src/components/contexts/ScreenShareContext';
21
21
  import {filterObject} from '../src/utils/index';
22
+ import {useToggleWhiteboard} from '../src/components/Controls';
22
23
  export {
23
24
  VideoRenderer,
24
25
  DispatchContext,
@@ -36,4 +37,5 @@ export {
36
37
  RoomPhase,
37
38
  useScreenContext,
38
39
  filterObject,
40
+ useToggleWhiteboard,
39
41
  };
@@ -82,7 +82,46 @@ import LocalEventEmitter, {
82
82
  } from '../rtm-events-api/LocalEvents';
83
83
  import {useSetRoomInfo} from './room-info/useSetRoomInfo';
84
84
 
85
- const WhiteboardListener = () => {
85
+ export const useToggleWhiteboard = () => {
86
+ const {
87
+ whiteboardActive,
88
+ joinWhiteboardRoom,
89
+ leaveWhiteboardRoom,
90
+ getWhiteboardUid,
91
+ } = useContext(whiteboardContext);
92
+ const {setCustomContent} = useContent();
93
+ const {setLayout} = useLayout();
94
+ const {dispatch} = useContext(DispatchContext);
95
+ return () => {
96
+ if ($config.ENABLE_WHITEBOARD) {
97
+ if (whiteboardActive) {
98
+ leaveWhiteboardRoom();
99
+ setCustomContent(getWhiteboardUid(), false);
100
+ setLayout('grid');
101
+ events.send(
102
+ EventNames.WHITEBOARD_ACTIVE,
103
+ JSON.stringify({status: false}),
104
+ PersistanceLevel.Session,
105
+ );
106
+ } else {
107
+ joinWhiteboardRoom();
108
+ setCustomContent(getWhiteboardUid(), WhiteboardWrapper, {}, true);
109
+ dispatch({
110
+ type: 'UserPin',
111
+ value: [getWhiteboardUid()],
112
+ });
113
+ setLayout('pinned');
114
+ events.send(
115
+ EventNames.WHITEBOARD_ACTIVE,
116
+ JSON.stringify({status: true}),
117
+ PersistanceLevel.Session,
118
+ );
119
+ }
120
+ }
121
+ };
122
+ };
123
+
124
+ export const WhiteboardListener = () => {
86
125
  const {dispatch} = useContext(DispatchContext);
87
126
  const {setCustomContent} = useContent();
88
127
  const {currentLayout, setLayout} = useLayout();
@@ -812,10 +851,16 @@ export const MoreButtonToolbarItem = () => {
812
851
  <WhiteboardListener />
813
852
  );
814
853
  };
815
- export const LocalEndcallToolbarItem = () => {
854
+ export interface LocalEndcallToolbarItemProps {
855
+ customExit?: () => void;
856
+ }
857
+ export const LocalEndcallToolbarItem = (
858
+ props?: LocalEndcallToolbarItemProps,
859
+ ) => {
816
860
  return (
817
- <ToolbarItem testID="endCall-btn">
818
- <LocalEndcall />
861
+ <ToolbarItem
862
+ testID={props?.customExit ? 'endCall-btn-custom' : 'endCall-btn'}>
863
+ <LocalEndcall {...props} />
819
864
  </ToolbarItem>
820
865
  );
821
866
  };
@@ -303,22 +303,20 @@ const EventsConfigure: React.FC<Props> = props => {
303
303
 
304
304
  events.on(EventNames.WHITEBOARD_LAST_IMAGE_UPLOAD_POSITION, ({payload}) => {
305
305
  const data = JSON.parse(payload);
306
- if (data?.height) {
307
- if ($config.ENABLE_WAITING_ROOM && !isHostRef.current) {
308
- setRoomInfo(prev => {
309
- return {
310
- ...prev,
311
- whiteboardLastImageUploadPosition: {height: data?.height},
312
- };
313
- });
314
- } else {
315
- LocalEventEmitter.emit(
316
- LocalEventsEnum.WHITEBOARD_LAST_IMAGE_UPLOAD_POSITION_LOCAL,
317
- {
318
- height: data?.height,
319
- },
320
- );
321
- }
306
+ if ($config.ENABLE_WAITING_ROOM && !isHostRef.current) {
307
+ setRoomInfo(prev => {
308
+ return {
309
+ ...prev,
310
+ whiteboardLastImageUploadPosition: {height: data?.height || 0},
311
+ };
312
+ });
313
+ } else {
314
+ LocalEventEmitter.emit(
315
+ LocalEventsEnum.WHITEBOARD_LAST_IMAGE_UPLOAD_POSITION_LOCAL,
316
+ {
317
+ height: data?.height || 0,
318
+ },
319
+ );
322
320
  }
323
321
  });
324
322
 
@@ -76,6 +76,7 @@ export interface whiteboardContextInterface {
76
76
  insertImageIntoWhiteboard: (url: string) => void;
77
77
  getWhiteboardUid: () => number;
78
78
  whiteboardStartedFirst?: boolean;
79
+ clearAllCallback: () => void;
79
80
  }
80
81
 
81
82
  export interface WhiteboardPropsInterface {
@@ -124,6 +125,7 @@ const WhiteboardConfigure: React.FC<WhiteboardPropsInterface> = props => {
124
125
  return whiteboardUidRef?.current;
125
126
  };
126
127
 
128
+ const clearAllCallback = () => {};
127
129
  return (
128
130
  <whiteboardContext.Provider
129
131
  value={{
@@ -139,6 +141,7 @@ const WhiteboardConfigure: React.FC<WhiteboardPropsInterface> = props => {
139
141
  setUploadRef,
140
142
  insertImageIntoWhiteboard,
141
143
  whiteboardStartedFirst,
144
+ clearAllCallback,
142
145
  }}>
143
146
  {props.children}
144
147
  </whiteboardContext.Provider>
@@ -85,6 +85,7 @@ export interface whiteboardContextInterface {
85
85
  insertImageIntoWhiteboard: (url: string) => void;
86
86
  getWhiteboardUid: () => number;
87
87
  whiteboardStartedFirst?: boolean;
88
+ clearAllCallback?: () => void;
88
89
  }
89
90
 
90
91
  export interface WhiteboardPropsInterface {
@@ -166,7 +167,7 @@ const WhiteboardConfigure: React.FC<WhiteboardPropsInterface> = props => {
166
167
  React.useEffect(() => {
167
168
  if ($config.ENABLE_WAITING_ROOM && !isHost) {
168
169
  SetLastImageUploadHeightCallBack({
169
- height: whiteboardLastImageUploadPositionRemote?.height,
170
+ height: whiteboardLastImageUploadPositionRemote?.height || 0,
170
171
  });
171
172
  }
172
173
  }, [whiteboardLastImageUploadPositionRemote, isHost]);
@@ -288,7 +289,7 @@ const WhiteboardConfigure: React.FC<WhiteboardPropsInterface> = props => {
288
289
  */
289
290
  events.send(
290
291
  EventNames.WHITEBOARD_LAST_IMAGE_UPLOAD_POSITION,
291
- JSON.stringify({height: height}),
292
+ JSON.stringify({height: height || 0}),
292
293
  PersistanceLevel.Session,
293
294
  );
294
295
  };
@@ -397,6 +398,11 @@ const WhiteboardConfigure: React.FC<WhiteboardPropsInterface> = props => {
397
398
  return whiteboardUidRef?.current;
398
399
  };
399
400
 
401
+ const clearAllCallback = () => {
402
+ prevImageUploadHeightRef.current = 0;
403
+ sendLastImageUploadPositionToRemoteUsers(0);
404
+ };
405
+
400
406
  return (
401
407
  <whiteboardContext.Provider
402
408
  value={{
@@ -412,6 +418,7 @@ const WhiteboardConfigure: React.FC<WhiteboardPropsInterface> = props => {
412
418
  setUploadRef,
413
419
  insertImageIntoWhiteboard,
414
420
  whiteboardStartedFirst,
421
+ clearAllCallback,
415
422
  }}>
416
423
  {props.children}
417
424
  </whiteboardContext.Provider>
@@ -212,6 +212,7 @@ const WhiteboardToolBox = ({whiteboardRoom}) => {
212
212
  insertImageIntoWhiteboard,
213
213
  boardColor,
214
214
  getWhiteboardUid,
215
+ clearAllCallback,
215
216
  } = useContext(whiteboardContext);
216
217
  const [isShapeBtnHovered, setShapeBtnHovered] = useState(false);
217
218
  const [isShapeContainerHovered, setShapeContainerHovered] = useState(false);
@@ -239,6 +240,7 @@ const WhiteboardToolBox = ({whiteboardRoom}) => {
239
240
  LocalEventEmitter.on(LocalEventsEnum.CLEAR_WHITEBOARD, () => {
240
241
  whiteboardRoom.current?.cleanCurrentScene();
241
242
  setShowWhiteboardClearAllPopup(false);
243
+ clearAllCallback();
242
244
  });
243
245
  }, []);
244
246
 
@@ -18,7 +18,9 @@ import WhiteboardToolBox from './WhiteboardToolBox';
18
18
  import WhiteboardCanvas from './WhiteboardCanvas';
19
19
  import {useContent, useLayout} from 'customization-api';
20
20
 
21
- interface WhiteboardViewInterface {}
21
+ interface WhiteboardViewInterface {
22
+ showToolbox: boolean;
23
+ }
22
24
 
23
25
  const WhiteboardView: React.FC<WhiteboardViewInterface> = () => {
24
26
  const wbSurfaceRef = useRef();
@@ -74,6 +74,8 @@ const WhiteboardWidget = ({whiteboardRoom}) => {
74
74
  type: 'error',
75
75
  text1: 'Failed to export the whiteboard',
76
76
  visibilityTime: 3000,
77
+ primaryBtn: null,
78
+ secondaryBtn: null,
77
79
  });
78
80
  };
79
81
 
@@ -86,6 +88,8 @@ const WhiteboardWidget = ({whiteboardRoom}) => {
86
88
  text1:
87
89
  'Please wait few seconds to get the screenshot link of the whiteboard',
88
90
  visibilityTime: 3000,
91
+ primaryBtn: null,
92
+ secondaryBtn: null,
89
93
  });
90
94
  const myHeaders2 = new Headers();
91
95
  myHeaders2.append('Content-Type', 'application/json');
@@ -111,10 +115,13 @@ const WhiteboardWidget = ({whiteboardRoom}) => {
111
115
  text1:
112
116
  'Whiteboard exported as an image. Link copied to your clipboard.',
113
117
  visibilityTime: 3000,
118
+ primaryBtn: null,
119
+ secondaryBtn: null,
114
120
  });
115
121
  Clipboard.setString(parsedUrl);
116
- window.open(parsedUrl, '_blank');
117
- window.focus();
122
+ setTimeout(() => {
123
+ window.open(parsedUrl, '_blank');
124
+ });
118
125
  setIsInProgress(false);
119
126
  } else {
120
127
  showWhiteboardError();
@@ -225,7 +232,8 @@ const WhiteboardWidget = ({whiteboardRoom}) => {
225
232
  <></>
226
233
  )}
227
234
  <ScaleController room={whiteboardRoom.current} />
228
- {whiteboardRoom.current?.isWritable ? (
235
+ {whiteboardRoom.current?.isWritable &&
236
+ $config.ENABLE_WHITEBOARD_FILE_UPLOAD ? (
229
237
  <>
230
238
  <Seperator />
231
239
  <TouchableOpacity
@@ -18,6 +18,7 @@ import {ENABLE_AUTH} from '../../src/auth/config';
18
18
 
19
19
  export interface LocalEndcallProps {
20
20
  render?: (onPress: () => void) => JSX.Element;
21
+ customExit?: () => void;
21
22
  }
22
23
 
23
24
  /* For android only, bg audio */
@@ -76,11 +77,15 @@ const LocalEndcall = (props: LocalEndcallProps) => {
76
77
  }, [isScreenshareActive, endCallState]);
77
78
 
78
79
  const endCall = async () => {
79
- if ((isAndroid() || isIOS()) && isScreenshareActive) {
80
- stopUserScreenShare();
81
- setEndCallState(true);
80
+ if (props?.customExit) {
81
+ props.customExit();
82
82
  } else {
83
- executeEndCall();
83
+ if ((isAndroid() || isIOS()) && isScreenshareActive) {
84
+ stopUserScreenShare();
85
+ setEndCallState(true);
86
+ } else {
87
+ executeEndCall();
88
+ }
84
89
  }
85
90
  };
86
91
 
@@ -32,6 +32,7 @@ import {
32
32
  useRtc,
33
33
  } from 'customization-api';
34
34
  import {filterObject} from '../../utils';
35
+ import Toast from '../../../react-native-toast-message';
35
36
 
36
37
  export const ScreenshareContextConsumer = ScreenshareContext.Consumer;
37
38
 
@@ -339,6 +340,13 @@ export const ScreenshareConfigure = (props: {children: React.ReactNode}) => {
339
340
  } catch (e) {
340
341
  console.error("can't start the screen share", e);
341
342
  executeNormalQuery();
343
+ Toast.show({
344
+ leadingIconName: 'alert',
345
+ type: 'error',
346
+ text1: 'Failed to start the screen sharing',
347
+ text2: 'Please allow the permission to start the screen sharing',
348
+ visibilityTime: 1000 * 10,
349
+ });
342
350
  }
343
351
  };
344
352