agora-appbuilder-core 4.0.0-beta.42 → 4.0.0-beta.44

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.42",
3
+ "version": "4.0.0-beta.44",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -44,7 +44,7 @@ const PinnedVideo = ({renderData}) => {
44
44
  const activeSpeaker = useActiveSpeaker();
45
45
  const {dispatch} = useContext(DispatchContext);
46
46
  const {videoTileInViewPortState} = useVideoCall();
47
- const {getWhiteboardUid} = useWhiteboard();
47
+ const {getWhiteboardUid = () => 0} = useWhiteboard();
48
48
  useEffect(() => {
49
49
  if (activeSpeaker && !videoTileInViewPortState[activeSpeaker] && isOnTop) {
50
50
  dispatch({
@@ -82,7 +82,7 @@ export default function UserActionMenuOptionsOptions(
82
82
  useState(false);
83
83
  const {enablePinForMe} = useVideoCall();
84
84
  const {setDisableChatUids, disableChatUids} = useDisableChat();
85
- const {getWhiteboardUid} = useWhiteboard();
85
+ const {getWhiteboardUid = () => 0} = useWhiteboard();
86
86
 
87
87
  useEffect(() => {
88
88
  customEvents.on('DisableChat', data => {
@@ -135,7 +135,7 @@ const VBPanel = (props?: {isOnPrecall?: boolean}) => {
135
135
  <></>
136
136
  )}
137
137
 
138
- <VideoPreview />
138
+ <VideoPreview isLocalVideoON={isLocalVideoON} />
139
139
  </View>
140
140
  ) : (
141
141
  <></>
@@ -3,7 +3,11 @@ import {MaxVideoView} from '../../../agora-rn-uikit';
3
3
  import {useContent, usePreCall, useRtc} from 'customization-api';
4
4
  import InlineNotification from '../../atoms/InlineNotification';
5
5
 
6
- const VideoPreview = () => {
6
+ interface VideoPreviewProps {
7
+ isLocalVideoON?: boolean;
8
+ }
9
+
10
+ const VideoPreview = ({isLocalVideoON = false}: VideoPreviewProps) => {
7
11
  const {defaultContent, activeUids} = useContent();
8
12
  const [maxUid] = activeUids;
9
13
  const {isCameraAvailable} = usePreCall();
@@ -15,6 +19,10 @@ as your camera turns on.`
15
19
  : `Your camera is switched off. Save a background to apply once it’s turned on.`;
16
20
  rtc?.RtcEngineUnsafe?.startPreview();
17
21
 
22
+ if (!isLocalVideoON) {
23
+ return <InlineNotification text={fallbackText} />;
24
+ }
25
+
18
26
  return (
19
27
  <MaxVideoView
20
28
  user={defaultContent[maxUid]}
@@ -8,15 +8,17 @@ import {useVB} from './useVB';
8
8
  import ThemeConfig from '../../../src/theme';
9
9
  import {isMobileUA} from '../../utils/common';
10
10
  import InlineNotification from '../../atoms/InlineNotification';
11
+ interface VideoPreviewProps {
12
+ isLocalVideoON?: boolean;
13
+ }
11
14
 
12
- const VideoPreview = () => {
15
+ const VideoPreview = ({isLocalVideoON}: VideoPreviewProps) => {
13
16
  const {setPreviewVideoTrack, setSaveVB, previewVideoTrack} = useVB();
14
17
  const rtc = useContext(RtcContext);
15
18
  const vContainerRef = React.useRef(null);
16
19
  const {video: localVideoStatus} = useLocalUserInfo();
17
20
  const {isCameraAvailable} = usePreCall();
18
21
 
19
- const isLocalVideoON = localVideoStatus === ToggleState.enabled;
20
22
  const isMobileWeb = isMobileUA();
21
23
  const {defaultContent, activeUids} = useContent();
22
24
  const [maxUid] = activeUids;
@@ -1,12 +1,68 @@
1
- import {UidType, useRoomInfo} from 'customization-api';
1
+ import {UidType, useContent, useLayout, useRoomInfo} from 'customization-api';
2
2
  import {createHook} from 'customization-implementation';
3
3
  import React, {useState, useRef, useEffect} from 'react';
4
4
  import {createContext} from 'react';
5
+ import {isWeb, randomIntFromInterval, randomString} from '../../utils/common';
6
+
7
+ export const whiteboardPaper = isWeb() ? document.createElement('div') : null;
8
+ if (whiteboardPaper) {
9
+ whiteboardPaper.className = 'whiteboardPaper';
10
+ whiteboardPaper.setAttribute('style', 'height:100%');
11
+ }
12
+
13
+ const dummyHeight = 409;
14
+ const dummyWidth = 317;
15
+
16
+ export const CursorColor = [
17
+ {
18
+ cursorColor: '#EAC443',
19
+ textColor: '#000000',
20
+ },
21
+ {
22
+ cursorColor: '#EB42B9',
23
+ textColor: '#000000',
24
+ },
25
+ {
26
+ cursorColor: '#FF5733',
27
+ textColor: '#000000',
28
+ },
29
+ {
30
+ cursorColor: '#C70039',
31
+ textColor: '#FFFFFF',
32
+ },
33
+ {
34
+ cursorColor: '#196F3D',
35
+ textColor: '#FFFFFF',
36
+ },
37
+ {
38
+ cursorColor: '#2E86C1',
39
+ textColor: '#000000',
40
+ },
41
+ {
42
+ cursorColor: '#A569BD',
43
+ textColor: '#000000',
44
+ },
45
+ {
46
+ cursorColor: '#AED6F1',
47
+ textColor: '#000000',
48
+ },
49
+ {
50
+ cursorColor: '#581845',
51
+ textColor: '#FFFFFF',
52
+ },
53
+ {
54
+ cursorColor: '#1B4F72',
55
+ textColor: '#FFFFFF',
56
+ },
57
+ ];
5
58
 
6
59
  export const whiteboardContext = createContext(
7
60
  {} as whiteboardContextInterface,
8
61
  );
9
-
62
+ export enum BoardColor {
63
+ Black = 1,
64
+ White = 2,
65
+ }
10
66
  export interface whiteboardContextInterface {
11
67
  whiteboardUid: UidType;
12
68
  whiteboardActive: boolean;
@@ -14,6 +70,12 @@ export interface whiteboardContextInterface {
14
70
  joinWhiteboardRoom: () => void;
15
71
  leaveWhiteboardRoom: () => void;
16
72
  whiteboardRoom: React.Ref<any>;
73
+ boardColor: BoardColor;
74
+ setBoardColor: React.Dispatch<React.SetStateAction<BoardColor>>;
75
+ setUploadRef: () => void;
76
+ insertImageIntoWhiteboard: (url: string) => void;
77
+ getWhiteboardUid: () => number;
78
+ whiteboardStartedFirst?: boolean;
17
79
  }
18
80
 
19
81
  export interface WhiteboardPropsInterface {
@@ -23,21 +85,44 @@ export interface WhiteboardPropsInterface {
23
85
  const WhiteboardConfigure: React.FC<WhiteboardPropsInterface> = props => {
24
86
  // Defines intent, whether whiteboard should be active or not
25
87
  const [whiteboardActive, setWhiteboardActive] = useState(false);
88
+ const [whiteboardStartedFirst, setWhiteboardStartedFirst] = useState(false);
89
+ const [boardColor, setBoardColor] = useState<BoardColor>(BoardColor.White);
26
90
  // Defines whiteboard room state, whether disconnected, Connected, Connecting etc.
27
91
  const [whiteboardRoomState, setWhiteboardRoomState] = useState();
28
92
  const whiteboardUidRef = useRef(Date.now());
29
-
93
+ const whiteWebSdkClient = useRef({});
30
94
  const whiteboardRoom = useRef({});
95
+ const {pinnedUid, activeUids} = useContent();
96
+ const prevImageUploadHeightRef = useRef(0);
97
+
98
+ const uploadPendingRef = useRef(false);
31
99
 
32
100
  const {
33
101
  data: {isHost, whiteboard: {room_token, room_uuid} = {}},
102
+ boardColor: boardColorRemote,
103
+ whiteboardLastImageUploadPosition: whiteboardLastImageUploadPositionRemote,
34
104
  } = useRoomInfo();
105
+ const {currentLayout} = useLayout();
106
+
107
+ const setUploadRef = () => {
108
+ uploadPendingRef.current = true;
109
+ };
110
+
111
+ const insertImageIntoWhiteboard = url => {};
112
+
113
+ const sendLastImageUploadPositionToRemoteUsers = (height: number) => {};
114
+
115
+ const join = () => {};
116
+
117
+ const leave = () => {};
35
118
 
36
119
  const joinWhiteboardRoom = () => {};
37
120
 
38
121
  const leaveWhiteboardRoom = () => {};
39
122
 
40
- useEffect(() => {}, []);
123
+ const getWhiteboardUid = () => {
124
+ return whiteboardUidRef?.current;
125
+ };
41
126
 
42
127
  return (
43
128
  <whiteboardContext.Provider
@@ -48,6 +133,12 @@ const WhiteboardConfigure: React.FC<WhiteboardPropsInterface> = props => {
48
133
  leaveWhiteboardRoom,
49
134
  whiteboardRoom,
50
135
  whiteboardUid: whiteboardUidRef.current,
136
+ getWhiteboardUid,
137
+ boardColor,
138
+ setBoardColor,
139
+ setUploadRef,
140
+ insertImageIntoWhiteboard,
141
+ whiteboardStartedFirst,
51
142
  }}>
52
143
  {props.children}
53
144
  </whiteboardContext.Provider>
@@ -971,6 +971,13 @@ const WhiteboardToolBox = ({whiteboardRoom}) => {
971
971
  />
972
972
  <IconButton
973
973
  onPress={() => {
974
+ try {
975
+ //to clear prev selected file
976
+ //@ts-ignore
977
+ document.getElementById('docpicker').value = null;
978
+ } catch (error) {
979
+ console.log('debugging error on setting null');
980
+ }
974
981
  document.getElementById('docpicker').click();
975
982
  }}
976
983
  toolTipMessage="Upload Document or Image"
@@ -63,7 +63,7 @@ const VideoRenderer: React.FC<VideoRendererProps> = ({
63
63
  const videoMoreMenuRef = useRef(null);
64
64
  const [actionMenuVisible, setActionMenuVisible] = React.useState(false);
65
65
  const {setVideoTileInViewPortState} = useVideoCall();
66
- const {getWhiteboardUid} = useWhiteboard();
66
+ const {getWhiteboardUid = () => 0} = useWhiteboard();
67
67
  const [landscapeMode, setLandscapeMode] = useState(
68
68
  isAndroid() || isIOS() ? true : false,
69
69
  );