agora-appbuilder-core 4.0.0-beta.30 → 4.0.0-beta.31
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
|
@@ -9,7 +9,13 @@
|
|
|
9
9
|
information visit https://appbuilder.agora.io.
|
|
10
10
|
*********************************************
|
|
11
11
|
*/
|
|
12
|
-
import React, {
|
|
12
|
+
import React, {
|
|
13
|
+
useState,
|
|
14
|
+
useContext,
|
|
15
|
+
useEffect,
|
|
16
|
+
useRef,
|
|
17
|
+
useReducer,
|
|
18
|
+
} from 'react';
|
|
13
19
|
import {View, StyleSheet, useWindowDimensions} from 'react-native';
|
|
14
20
|
import {
|
|
15
21
|
DispatchContext,
|
|
@@ -72,6 +78,77 @@ import {useVB} from './virtual-background/useVB';
|
|
|
72
78
|
import WhiteboardWrapper from './whiteboard/WhiteboardWrapper';
|
|
73
79
|
import isSDK from '../utils/isSDK';
|
|
74
80
|
|
|
81
|
+
const WhiteboardListener = () => {
|
|
82
|
+
const {dispatch} = useContext(DispatchContext);
|
|
83
|
+
const {setCustomContent} = useContent();
|
|
84
|
+
const {currentLayout, setLayout} = useLayout();
|
|
85
|
+
|
|
86
|
+
const {isWhiteBoardOn} = useRoomInfo();
|
|
87
|
+
|
|
88
|
+
//whiteboard start
|
|
89
|
+
|
|
90
|
+
const {
|
|
91
|
+
whiteboardActive,
|
|
92
|
+
joinWhiteboardRoom,
|
|
93
|
+
leaveWhiteboardRoom,
|
|
94
|
+
whiteboardUid,
|
|
95
|
+
} = useContext(whiteboardContext);
|
|
96
|
+
|
|
97
|
+
const WhiteboardStoppedCallBack = () => {
|
|
98
|
+
toggleWhiteboard(true, false);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const WhiteboardStartedCallBack = () => {
|
|
102
|
+
toggleWhiteboard(false, false);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
whiteboardActive && currentLayout !== 'pinned' && setLayout('pinned');
|
|
107
|
+
}, []);
|
|
108
|
+
|
|
109
|
+
React.useEffect(() => {
|
|
110
|
+
if (isWhiteBoardOn) {
|
|
111
|
+
WhiteboardStartedCallBack();
|
|
112
|
+
} else {
|
|
113
|
+
WhiteboardStoppedCallBack();
|
|
114
|
+
}
|
|
115
|
+
}, [isWhiteBoardOn]);
|
|
116
|
+
|
|
117
|
+
const toggleWhiteboard = (
|
|
118
|
+
whiteboardActive: boolean,
|
|
119
|
+
triggerEvent: boolean,
|
|
120
|
+
) => {
|
|
121
|
+
if ($config.ENABLE_WHITEBOARD) {
|
|
122
|
+
if (whiteboardActive) {
|
|
123
|
+
leaveWhiteboardRoom();
|
|
124
|
+
setCustomContent(whiteboardUid, false);
|
|
125
|
+
setLayout('grid');
|
|
126
|
+
triggerEvent &&
|
|
127
|
+
events.send(
|
|
128
|
+
'WhiteBoardStopped',
|
|
129
|
+
JSON.stringify({}),
|
|
130
|
+
PersistanceLevel.Session,
|
|
131
|
+
);
|
|
132
|
+
} else {
|
|
133
|
+
joinWhiteboardRoom();
|
|
134
|
+
setCustomContent(whiteboardUid, WhiteboardWrapper, {}, true);
|
|
135
|
+
dispatch({
|
|
136
|
+
type: 'UserPin',
|
|
137
|
+
value: [whiteboardUid],
|
|
138
|
+
});
|
|
139
|
+
setLayout('pinned');
|
|
140
|
+
triggerEvent &&
|
|
141
|
+
events.send(
|
|
142
|
+
'WhiteBoardStarted',
|
|
143
|
+
JSON.stringify({}),
|
|
144
|
+
PersistanceLevel.Session,
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
return null;
|
|
150
|
+
};
|
|
151
|
+
|
|
75
152
|
const MoreButton = () => {
|
|
76
153
|
const {dispatch} = useContext(DispatchContext);
|
|
77
154
|
const {rtcProps} = useContext(PropsContext);
|
|
@@ -656,16 +733,26 @@ export const RecordingToolbarItem = () => {
|
|
|
656
733
|
|
|
657
734
|
export const MoreButtonToolbarItem = () => {
|
|
658
735
|
const {width} = useWindowDimensions();
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
736
|
+
const {
|
|
737
|
+
data: {isHost},
|
|
738
|
+
} = useRoomInfo();
|
|
739
|
+
const {isSTTActive} = useCaption();
|
|
740
|
+
const [_, forceUpdate] = useReducer(x => x + 1, 0);
|
|
741
|
+
|
|
742
|
+
useEffect(() => {
|
|
743
|
+
forceUpdate();
|
|
744
|
+
}, [isHost]);
|
|
745
|
+
|
|
746
|
+
return width < BREAKPOINTS.md ||
|
|
747
|
+
($config.ENABLE_STT && (isHost || (!isHost && isSTTActive))) ||
|
|
748
|
+
$config.ENABLE_NOISE_CANCELLATION ||
|
|
749
|
+
($config.ENABLE_VIRTUAL_BACKGROUND && !$config.AUDIO_ROOM) ||
|
|
750
|
+
(isHost && $config.ENABLE_WHITEBOARD && (isWeb() || isSDK())) ? (
|
|
751
|
+
<ToolbarItem testID="more-btn">
|
|
752
|
+
<MoreButton />
|
|
753
|
+
</ToolbarItem>
|
|
754
|
+
) : (
|
|
755
|
+
<WhiteboardListener />
|
|
669
756
|
);
|
|
670
757
|
};
|
|
671
758
|
export const LocalEndcallToolbarItem = () => {
|
|
@@ -36,7 +36,6 @@ const WhiteboardConfigure: React.FC<WhiteboardPropsInterface> = props => {
|
|
|
36
36
|
RoomPhase.Disconnected,
|
|
37
37
|
);
|
|
38
38
|
const whiteboardUidRef = useRef(Date.now());
|
|
39
|
-
console.log('debugging whiteboardUid', whiteboardUidRef.current);
|
|
40
39
|
const whiteWebSdkClient = useRef({} as WhiteWebSdk);
|
|
41
40
|
const whiteboardRoom = useRef({} as Room);
|
|
42
41
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {useState} from 'react';
|
|
1
|
+
import React, {useEffect, useReducer, useState} from 'react';
|
|
2
2
|
import {
|
|
3
3
|
View,
|
|
4
4
|
Text,
|
|
@@ -19,6 +19,8 @@ import UserAvatar from '../../atoms/UserAvatar';
|
|
|
19
19
|
import ThemeConfig from '../../theme';
|
|
20
20
|
import hexadecimalTransparency from '../../utils/hexadecimalTransparency';
|
|
21
21
|
import Spacer from '../../atoms/Spacer';
|
|
22
|
+
import {useLiveStreamDataContext} from '../../components/contexts/LiveStreamDataContext';
|
|
23
|
+
import {useWaitingRoomContext} from '../../components/contexts/WaitingRoomContext';
|
|
22
24
|
|
|
23
25
|
const ChatIcon = () => (
|
|
24
26
|
<View style={{alignSelf: 'center', marginRight: 20}}>
|
|
@@ -36,30 +38,61 @@ const ChatParticipants = (props: any) => {
|
|
|
36
38
|
const remoteUserDefaultLabel = 'User';
|
|
37
39
|
const {selectUser} = props;
|
|
38
40
|
const {defaultContent, activeUids, customContent} = useContent();
|
|
39
|
-
const activeUidsLen = activeUids?.filter(
|
|
41
|
+
const activeUidsLen = activeUids?.filter(i => !customContent[i])?.length;
|
|
40
42
|
const localUid = useLocalUid();
|
|
41
43
|
const {unreadIndividualMessageCount} = useChatNotification();
|
|
42
44
|
const isMobile = isMobileUA();
|
|
45
|
+
const {audienceUids, hostUids} = useLiveStreamDataContext();
|
|
46
|
+
const {waitingRoomUids} = useWaitingRoomContext();
|
|
47
|
+
const [_, forceUpdate] = useReducer(x => x + 1, 0);
|
|
48
|
+
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if ($config.ENABLE_WAITING_ROOM) {
|
|
51
|
+
forceUpdate();
|
|
52
|
+
}
|
|
53
|
+
}, [waitingRoomUids, activeUids]);
|
|
54
|
+
|
|
43
55
|
return (
|
|
44
56
|
<ScrollView>
|
|
45
|
-
{
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
{
|
|
58
|
+
//video meeting vertical
|
|
59
|
+
(!$config.EVENT_MODE && activeUids && activeUidsLen === 1) ||
|
|
60
|
+
//livestreaming vertical
|
|
61
|
+
($config.EVENT_MODE && hostUids.length + audienceUids.length === 1) ? (
|
|
62
|
+
<View style={style.defaultMessageContainer}>
|
|
63
|
+
<Text style={style.defaultMessageText}>
|
|
64
|
+
No one else has joined yet.
|
|
65
|
+
</Text>
|
|
66
|
+
</View>
|
|
67
|
+
) : (
|
|
68
|
+
<></>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
54
71
|
{Object.keys(defaultContent)
|
|
55
|
-
.map(
|
|
56
|
-
.filter(
|
|
72
|
+
.map(i => parseInt(i))
|
|
73
|
+
.filter(i => {
|
|
57
74
|
try {
|
|
58
75
|
if (isNaN(i)) {
|
|
59
76
|
return false;
|
|
60
77
|
} else {
|
|
61
78
|
const userId = i;
|
|
62
79
|
const userInfo = defaultContent[userId];
|
|
80
|
+
//video meeting with waiting room
|
|
81
|
+
if (
|
|
82
|
+
$config.ENABLE_WAITING_ROOM &&
|
|
83
|
+
!$config.EVENT_MODE &&
|
|
84
|
+
activeUids?.indexOf(userId) === -1
|
|
85
|
+
) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
//livestreaming with waiting room
|
|
89
|
+
if (
|
|
90
|
+
$config.ENABLE_WAITING_ROOM &&
|
|
91
|
+
$config.EVENT_MODE &&
|
|
92
|
+
hostUids?.concat(audienceUids)?.indexOf(userId) === -1
|
|
93
|
+
) {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
63
96
|
return (
|
|
64
97
|
userId !== localUid && //user can't chat with own user
|
|
65
98
|
// @ts-ignore
|
|
@@ -78,7 +111,7 @@ const ChatParticipants = (props: any) => {
|
|
|
78
111
|
defaultContent[a]?.lastMessageTimeStamp
|
|
79
112
|
);
|
|
80
113
|
})
|
|
81
|
-
.map(
|
|
114
|
+
.map(uid => {
|
|
82
115
|
const uidAsNumber = uid;
|
|
83
116
|
const name = defaultContent[uidAsNumber]
|
|
84
117
|
? defaultContent[uidAsNumber].name + ''
|