agora-appbuilder-core 4.0.0-beta.50 → 4.0.0-beta.52
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 +2 -2
- package/template/agora-rn-uikit/src/Contexts/PropsContext.tsx +2 -0
- package/template/agora-rn-uikit/src/Rtc/Join.tsx +15 -7
- package/template/agora-rn-uikit/src/RtcConfigure.tsx +1 -0
- package/template/src/components/precall/joinWaitingRoomBtn.native.tsx +3 -1
- package/template/src/components/precall/joinWaitingRoomBtn.tsx +3 -1
- package/template/src/components/room-info/useRoomInfo.tsx +9 -0
- package/template/src/components/virtual-background/VideoPreview.native.tsx +5 -5
- package/template/src/components/virtual-background/VideoPreview.tsx +4 -3
- package/template/src/pages/VideoCall.tsx +39 -2
- package/template/src/subComponents/screenshare/ScreenshareConfigure.tsx +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agora-appbuilder-core",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.52",
|
|
4
4
|
"description": "React Native template for RTE app builder",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
],
|
|
10
10
|
"scripts": {
|
|
11
11
|
"vercel-build": "npm run dev-setup && cd template && npm run web:build && cd .. && npm run copy-vercel",
|
|
12
|
-
"uikit": "rm -rf template/agora-rn-uikit && git clone https://github.com/AgoraIO-Community/ReactNative-UIKit.git template/agora-rn-uikit && cd template/agora-rn-uikit && git checkout v3-release-
|
|
12
|
+
"uikit": "rm -rf template/agora-rn-uikit && git clone https://github.com/AgoraIO-Community/ReactNative-UIKit.git template/agora-rn-uikit && cd template/agora-rn-uikit && git checkout v3-release-fixes",
|
|
13
13
|
"deps": "cd template && npm i",
|
|
14
14
|
"dev-setup": "npm run uikit && npm run deps && node devSetup.js",
|
|
15
15
|
"web-build": "cd template && npm run web:build && cd .. && npm run copy-vercel",
|
|
@@ -133,6 +133,7 @@ export interface RtcPropsInterface {
|
|
|
133
133
|
geoFencing?: boolean;
|
|
134
134
|
audioRoom?: boolean;
|
|
135
135
|
activeSpeaker?: boolean;
|
|
136
|
+
preventJoin?: boolean;
|
|
136
137
|
|
|
137
138
|
//core only
|
|
138
139
|
screenShareUid?: number;
|
|
@@ -182,6 +183,7 @@ const initialValue: Partial<PropsInterface> = {
|
|
|
182
183
|
channel: '',
|
|
183
184
|
geoFencing: true,
|
|
184
185
|
audioRoom: false,
|
|
186
|
+
preventJoin: true,
|
|
185
187
|
},
|
|
186
188
|
};
|
|
187
189
|
|
|
@@ -12,6 +12,7 @@ const Join: React.FC<{
|
|
|
12
12
|
uidState: ContentStateInterface;
|
|
13
13
|
dispatch: DispatchType;
|
|
14
14
|
tracksReady: boolean;
|
|
15
|
+
preventJoin?: boolean;
|
|
15
16
|
}> = ({children, precall, engineRef, uidState, dispatch, tracksReady}) => {
|
|
16
17
|
let joinState = useRef(false);
|
|
17
18
|
const {rtcProps} = useContext(PropsContext);
|
|
@@ -29,6 +30,9 @@ const Join: React.FC<{
|
|
|
29
30
|
}, [tracksReady]);
|
|
30
31
|
|
|
31
32
|
useEffect(() => {
|
|
33
|
+
if (rtcProps?.preventJoin) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
32
36
|
const engine = engineRef.current;
|
|
33
37
|
async function leave() {
|
|
34
38
|
try {
|
|
@@ -77,13 +81,16 @@ const Join: React.FC<{
|
|
|
77
81
|
// } catch (error) {
|
|
78
82
|
// console.error('FPE:Error on executing useBeforeJoin', error);
|
|
79
83
|
// }
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
try {
|
|
85
|
+
await engine.joinChannel(
|
|
86
|
+
rtcProps.token || null,
|
|
87
|
+
rtcProps.channel,
|
|
88
|
+
null,
|
|
89
|
+
rtcProps.uid || 0,
|
|
90
|
+
);
|
|
91
|
+
} catch (error) {
|
|
92
|
+
console.error('RTC joinChannel error', error);
|
|
93
|
+
}
|
|
87
94
|
if (
|
|
88
95
|
!audioRoom &&
|
|
89
96
|
videoState === ToggleState.enabled &&
|
|
@@ -126,6 +133,7 @@ const Join: React.FC<{
|
|
|
126
133
|
rtcProps.token,
|
|
127
134
|
precall,
|
|
128
135
|
rtcProps.encryption,
|
|
136
|
+
rtcProps.preventJoin,
|
|
129
137
|
]);
|
|
130
138
|
|
|
131
139
|
return <>{children}</>;
|
|
@@ -414,6 +414,7 @@ const RtcConfigure = (props: {children: React.ReactNode}) => {
|
|
|
414
414
|
{(engineRef, tracksReady) => (
|
|
415
415
|
<Join
|
|
416
416
|
precall={!rtcProps.callActive}
|
|
417
|
+
preventJoin={rtcProps?.preventJoin}
|
|
417
418
|
engineRef={engineRef}
|
|
418
419
|
uidState={uidState}
|
|
419
420
|
dispatch={dispatch}
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
useLocalUid,
|
|
22
22
|
} from '../../../agora-rn-uikit';
|
|
23
23
|
import {JoinRoomButtonTextInterface} from '../../language/default-labels/precallScreenLabels';
|
|
24
|
-
import {useRoomInfo} from '../room-info/useRoomInfo';
|
|
24
|
+
import {WaitingRoomStatus, useRoomInfo} from '../room-info/useRoomInfo';
|
|
25
25
|
import useGetName from '../../utils/useGetName';
|
|
26
26
|
import {useUserPreference} from '../useUserPreference';
|
|
27
27
|
import {useSetRoomInfo} from '../room-info/useSetRoomInfo';
|
|
@@ -107,6 +107,7 @@ const JoinWaitingRoomBtn = (props: PreCallJoinWaitingRoomBtnProps) => {
|
|
|
107
107
|
return {
|
|
108
108
|
...prev,
|
|
109
109
|
isInWaitingRoom: false,
|
|
110
|
+
waitingRoomStatus: WaitingRoomStatus.APPROVED,
|
|
110
111
|
data: {
|
|
111
112
|
...prev.data,
|
|
112
113
|
token: mainUser.rtc,
|
|
@@ -121,6 +122,7 @@ const JoinWaitingRoomBtn = (props: PreCallJoinWaitingRoomBtnProps) => {
|
|
|
121
122
|
return {
|
|
122
123
|
...prev,
|
|
123
124
|
isInWaitingRoom: false,
|
|
125
|
+
waitingRoomStatus: WaitingRoomStatus.REJECTED,
|
|
124
126
|
};
|
|
125
127
|
});
|
|
126
128
|
// inform user that entry was denied by the host
|
|
@@ -30,7 +30,7 @@ import useSetName from '../../utils/useSetName';
|
|
|
30
30
|
import {useUserPreference} from '../useUserPreference';
|
|
31
31
|
import {useSetRoomInfo} from '../room-info/useSetRoomInfo';
|
|
32
32
|
import {EventNames} from '../../rtm-events';
|
|
33
|
-
import {useRoomInfo} from '../room-info/useRoomInfo';
|
|
33
|
+
import {WaitingRoomStatus, useRoomInfo} from '../room-info/useRoomInfo';
|
|
34
34
|
import Toast from '../../../react-native-toast-message';
|
|
35
35
|
|
|
36
36
|
import events from '../../rtm-events-api';
|
|
@@ -114,6 +114,7 @@ const JoinWaitingRoomBtn = (props: PreCallJoinWaitingRoomBtnProps) => {
|
|
|
114
114
|
return {
|
|
115
115
|
...prev,
|
|
116
116
|
isInWaitingRoom: false,
|
|
117
|
+
waitingRoomStatus: WaitingRoomStatus.APPROVED,
|
|
117
118
|
data: {
|
|
118
119
|
...prev.data,
|
|
119
120
|
token: mainUser.rtc,
|
|
@@ -128,6 +129,7 @@ const JoinWaitingRoomBtn = (props: PreCallJoinWaitingRoomBtnProps) => {
|
|
|
128
129
|
return {
|
|
129
130
|
...prev,
|
|
130
131
|
isInWaitingRoom: false,
|
|
132
|
+
waitingRoomStatus: WaitingRoomStatus.REJECTED,
|
|
131
133
|
};
|
|
132
134
|
});
|
|
133
135
|
// inform user that entry was denied by the host
|
|
@@ -14,6 +14,13 @@ import {createHook} from 'customization-implementation';
|
|
|
14
14
|
import {UidType} from '../../../agora-rn-uikit';
|
|
15
15
|
import {LanguageType} from '../../subComponents/caption/utils';
|
|
16
16
|
import {BoardColor} from '../whiteboard/WhiteboardConfigure';
|
|
17
|
+
|
|
18
|
+
export enum WaitingRoomStatus {
|
|
19
|
+
NOT_REQUESTED = 1,
|
|
20
|
+
REQUESTED = 2,
|
|
21
|
+
APPROVED = 3,
|
|
22
|
+
REJECTED = 4,
|
|
23
|
+
}
|
|
17
24
|
export interface RoomInfoContextInterface {
|
|
18
25
|
isJoinDataFetched?: boolean;
|
|
19
26
|
data?: {
|
|
@@ -41,6 +48,7 @@ export interface RoomInfoContextInterface {
|
|
|
41
48
|
screenShareToken?: string;
|
|
42
49
|
};
|
|
43
50
|
isInWaitingRoom?: boolean;
|
|
51
|
+
waitingRoomStatus?: WaitingRoomStatus;
|
|
44
52
|
isWhiteBoardOn?: boolean;
|
|
45
53
|
boardColor?: BoardColor;
|
|
46
54
|
whiteboardLastImageUploadPosition?: {
|
|
@@ -83,6 +91,7 @@ export const validateMeetingInfoData = (
|
|
|
83
91
|
export const RoomInfoDefaultValue: RoomInfoContextInterface = {
|
|
84
92
|
isJoinDataFetched: false,
|
|
85
93
|
isInWaitingRoom: false,
|
|
94
|
+
waitingRoomStatus: WaitingRoomStatus.NOT_REQUESTED,
|
|
86
95
|
isWhiteBoardOn: false,
|
|
87
96
|
sttLanguage: null,
|
|
88
97
|
isSTTActive: false,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {MaxVideoView} from '../../../agora-rn-uikit';
|
|
2
|
+
import {MaxVideoView, useLocalUid} from '../../../agora-rn-uikit';
|
|
3
3
|
import {useContent, usePreCall, useRtc} from 'customization-api';
|
|
4
4
|
import InlineNotification from '../../atoms/InlineNotification';
|
|
5
5
|
|
|
@@ -8,9 +8,9 @@ interface VideoPreviewProps {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
const VideoPreview = ({isLocalVideoON = false}: VideoPreviewProps) => {
|
|
11
|
-
const {defaultContent
|
|
12
|
-
const [maxUid] = activeUids;
|
|
11
|
+
const {defaultContent} = useContent();
|
|
13
12
|
const {isCameraAvailable} = usePreCall();
|
|
13
|
+
const localUid = useLocalUid();
|
|
14
14
|
|
|
15
15
|
const rtc = useRtc();
|
|
16
16
|
const fallbackText = isCameraAvailable
|
|
@@ -25,8 +25,8 @@ as your camera turns on.`
|
|
|
25
25
|
|
|
26
26
|
return (
|
|
27
27
|
<MaxVideoView
|
|
28
|
-
user={defaultContent[
|
|
29
|
-
key={
|
|
28
|
+
user={defaultContent[localUid]}
|
|
29
|
+
key={localUid}
|
|
30
30
|
fallback={() => <InlineNotification text={fallbackText} />}
|
|
31
31
|
isFullView={true}
|
|
32
32
|
containerStyle={{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {StyleSheet, View} from 'react-native';
|
|
2
2
|
import React, {useContext} from 'react';
|
|
3
3
|
import {useContent, useLocalUserInfo, usePreCall} from 'customization-api';
|
|
4
|
-
import {MaxVideoView, RtcContext} from '../../../agora-rn-uikit';
|
|
4
|
+
import {MaxVideoView, RtcContext, useLocalUid} from '../../../agora-rn-uikit';
|
|
5
5
|
import {ToggleState} from '../../../agora-rn-uikit/src/Contexts/PropsContext';
|
|
6
6
|
import AgoraRTC from 'agora-rtc-sdk-ng';
|
|
7
7
|
import {useVB} from './useVB';
|
|
@@ -18,6 +18,7 @@ const VideoPreview = ({isLocalVideoON}: VideoPreviewProps) => {
|
|
|
18
18
|
const vContainerRef = React.useRef(null);
|
|
19
19
|
const {video: localVideoStatus} = useLocalUserInfo();
|
|
20
20
|
const {isCameraAvailable} = usePreCall();
|
|
21
|
+
const localUid = useLocalUid();
|
|
21
22
|
|
|
22
23
|
const isMobileWeb = isMobileUA();
|
|
23
24
|
const {defaultContent, activeUids} = useContent();
|
|
@@ -66,8 +67,8 @@ const VideoPreview = ({isLocalVideoON}: VideoPreviewProps) => {
|
|
|
66
67
|
}>
|
|
67
68
|
{isMobileWeb ? (
|
|
68
69
|
<MaxVideoView
|
|
69
|
-
user={defaultContent[
|
|
70
|
-
key={
|
|
70
|
+
user={defaultContent[localUid]}
|
|
71
|
+
key={localUid}
|
|
71
72
|
fallback={() => (
|
|
72
73
|
<InlineNotification
|
|
73
74
|
text="Camera is currently off. Selected background will be applied as soon
|
|
@@ -41,6 +41,7 @@ import useJoinRoom from '../utils/useJoinRoom';
|
|
|
41
41
|
import {
|
|
42
42
|
useRoomInfo,
|
|
43
43
|
RoomInfoDefaultValue,
|
|
44
|
+
WaitingRoomStatus,
|
|
44
45
|
} from '../components/room-info/useRoomInfo';
|
|
45
46
|
import {SidePanelProvider} from '../utils/useSidePanel';
|
|
46
47
|
import VideoCallScreen from './video-call/VideoCallScreen';
|
|
@@ -115,6 +116,8 @@ const VideoCall: React.FC = () => {
|
|
|
115
116
|
|
|
116
117
|
const [isRecordingActive, setRecordingActive] = useState(false);
|
|
117
118
|
const [queryComplete, setQueryComplete] = useState(false);
|
|
119
|
+
const [waitingRoomAttendeeJoined, setWaitingRoomAttendeeJoined] =
|
|
120
|
+
useState(false);
|
|
118
121
|
const [sidePanel, setSidePanel] = useState<SidePanelType>(SidePanelType.None);
|
|
119
122
|
const [currentFocus, setFocus] = useState<currentFocus>({
|
|
120
123
|
editName: false,
|
|
@@ -159,7 +162,8 @@ const VideoCall: React.FC = () => {
|
|
|
159
162
|
|
|
160
163
|
const useJoin = useJoinRoom();
|
|
161
164
|
const {setRoomInfo} = useSetRoomInfo();
|
|
162
|
-
const {isJoinDataFetched, data, isInWaitingRoom} =
|
|
165
|
+
const {isJoinDataFetched, data, isInWaitingRoom, waitingRoomStatus} =
|
|
166
|
+
useRoomInfo();
|
|
163
167
|
|
|
164
168
|
React.useEffect(() => {
|
|
165
169
|
return () => {
|
|
@@ -221,7 +225,25 @@ const VideoCall: React.FC = () => {
|
|
|
221
225
|
}, [SdkJoinState]);
|
|
222
226
|
|
|
223
227
|
React.useEffect(() => {
|
|
224
|
-
if (
|
|
228
|
+
if (
|
|
229
|
+
//isJoinDataFetched === true && (!queryComplete || !isInWaitingRoom)
|
|
230
|
+
|
|
231
|
+
//non waiting room - host/attendee
|
|
232
|
+
(!$config.ENABLE_WAITING_ROOM &&
|
|
233
|
+
isJoinDataFetched === true &&
|
|
234
|
+
!queryComplete) ||
|
|
235
|
+
//waiting room - host
|
|
236
|
+
($config.ENABLE_WAITING_ROOM &&
|
|
237
|
+
isJoinDataFetched === true &&
|
|
238
|
+
data.isHost &&
|
|
239
|
+
!queryComplete) ||
|
|
240
|
+
//waiting room - attendee
|
|
241
|
+
($config.ENABLE_WAITING_ROOM &&
|
|
242
|
+
isJoinDataFetched === true &&
|
|
243
|
+
!data.isHost &&
|
|
244
|
+
(!queryComplete || !isInWaitingRoom) &&
|
|
245
|
+
!waitingRoomAttendeeJoined)
|
|
246
|
+
) {
|
|
225
247
|
setRtcProps(prevRtcProps => ({
|
|
226
248
|
...prevRtcProps,
|
|
227
249
|
channel: data.channel,
|
|
@@ -238,8 +260,23 @@ const VideoCall: React.FC = () => {
|
|
|
238
260
|
screenShareUid: data.screenShareUid,
|
|
239
261
|
screenShareToken: data.screenShareToken,
|
|
240
262
|
role: data.isHost ? ClientRole.Broadcaster : ClientRole.Audience,
|
|
263
|
+
preventJoin:
|
|
264
|
+
!$config.ENABLE_WAITING_ROOM ||
|
|
265
|
+
($config.ENABLE_WAITING_ROOM && data.isHost) ||
|
|
266
|
+
($config.ENABLE_WAITING_ROOM &&
|
|
267
|
+
!data.isHost &&
|
|
268
|
+
waitingRoomStatus === WaitingRoomStatus.APPROVED)
|
|
269
|
+
? false
|
|
270
|
+
: true,
|
|
241
271
|
}));
|
|
242
272
|
|
|
273
|
+
if (
|
|
274
|
+
$config.ENABLE_WAITING_ROOM &&
|
|
275
|
+
!data.isHost &&
|
|
276
|
+
waitingRoomStatus === WaitingRoomStatus.APPROVED
|
|
277
|
+
) {
|
|
278
|
+
setWaitingRoomAttendeeJoined(true);
|
|
279
|
+
}
|
|
243
280
|
// 1. Store the display name from API
|
|
244
281
|
// if (data.username) {
|
|
245
282
|
// setUsername(data.username);
|
|
@@ -343,8 +343,8 @@ export const ScreenshareConfigure = (props: {children: React.ReactNode}) => {
|
|
|
343
343
|
Toast.show({
|
|
344
344
|
leadingIconName: 'alert',
|
|
345
345
|
type: 'error',
|
|
346
|
-
text1: 'Failed to
|
|
347
|
-
text2: '
|
|
346
|
+
text1: 'Failed to initiate screen sharing',
|
|
347
|
+
text2: 'Permission denied',
|
|
348
348
|
visibilityTime: 1000 * 10,
|
|
349
349
|
primaryBtn: null,
|
|
350
350
|
secondaryBtn: null
|