agora-appbuilder-core 4.0.24 → 4.0.25-beta-2
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 +1 -1
- package/template/agora-rn-uikit/.eslintrc.js +0 -5
- package/template/agora-rn-uikit/package-lock.json +6116 -23528
- package/template/agora-rn-uikit/package.json +14 -14
- package/template/agora-rn-uikit/src/AgoraUIKit.tsx +6 -6
- package/template/agora-rn-uikit/src/Contexts/LocalUserContext.tsx +6 -6
- package/template/agora-rn-uikit/src/Contexts/PropsContext.tsx +40 -79
- package/template/agora-rn-uikit/src/Contexts/RenderContext.tsx +10 -0
- package/template/agora-rn-uikit/src/Contexts/RtcContext.tsx +17 -26
- package/template/agora-rn-uikit/src/Controls/BtnTemplate.tsx +0 -1
- package/template/agora-rn-uikit/src/Controls/Icons.ts +0 -51
- package/template/agora-rn-uikit/src/Controls/Local/EndCall.tsx +4 -6
- package/template/agora-rn-uikit/src/Controls/Local/FullScreen.tsx +1 -3
- package/template/agora-rn-uikit/src/Controls/Local/LocalAudioMute.tsx +2 -5
- package/template/agora-rn-uikit/src/Controls/Local/LocalVideoMute.tsx +2 -5
- package/template/agora-rn-uikit/src/Controls/Local/Recording.tsx +2 -0
- package/template/agora-rn-uikit/src/Controls/Local/SwitchCamera.tsx +6 -7
- package/template/agora-rn-uikit/src/Controls/LocalControls.tsx +5 -5
- package/template/agora-rn-uikit/src/Controls/Remote/RemoteAudioMute.tsx +4 -5
- package/template/agora-rn-uikit/src/Controls/Remote/RemoteSwap.tsx +1 -3
- package/template/agora-rn-uikit/src/Controls/Remote/RemoteVideoMute.tsx +4 -5
- package/template/agora-rn-uikit/src/Controls/RemoteControls.tsx +2 -2
- package/template/agora-rn-uikit/src/Reducer/ActiveSpeakerDetected.ts +11 -0
- package/template/agora-rn-uikit/src/Reducer/LocalMuteAudio.ts +7 -8
- package/template/agora-rn-uikit/src/Reducer/LocalMuteVideo.ts +7 -8
- package/template/agora-rn-uikit/src/Reducer/LocalPermissionState.ts +7 -6
- package/template/agora-rn-uikit/src/Reducer/RemoteAudioStateChanged.ts +8 -7
- package/template/agora-rn-uikit/src/Reducer/RemoteVideoStateChanged.ts +9 -9
- package/template/agora-rn-uikit/src/Reducer/UpdateDualStreamMode.ts +8 -7
- package/template/agora-rn-uikit/src/Reducer/UserJoined.ts +13 -14
- package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteAudio.ts +7 -6
- package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteVideo.ts +7 -6
- package/template/agora-rn-uikit/src/Reducer/UserOffline.ts +6 -5
- package/template/agora-rn-uikit/src/Reducer/UserPin.ts +3 -20
- package/template/agora-rn-uikit/src/Reducer/index.ts +1 -2
- package/template/agora-rn-uikit/src/Rtc/Create.tsx +125 -122
- package/template/agora-rn-uikit/src/Rtc/Join.tsx +27 -46
- package/template/agora-rn-uikit/src/RtcConfigure.tsx +77 -175
- package/template/agora-rn-uikit/src/Utils/quality.tsx +0 -8
- package/template/agora-rn-uikit/src/Views/MaxVideoView.native.tsx +12 -56
- package/template/agora-rn-uikit/src/Views/MaxVideoView.tsx +17 -47
- package/template/agora-rn-uikit/src/Views/MinVideoView.tsx +11 -19
- package/template/agora-rn-uikit/src/index.ts +9 -16
- package/template/customization-api/typeDefinition.ts +1 -4
- package/template/customization-api/utils.ts +1 -0
- package/template/defaultConfig.js +2 -0
- package/template/global.d.ts +2 -0
- package/template/src/AppRoutes.tsx +1 -7
- package/template/src/auth/AuthProvider.tsx +70 -24
- package/template/src/auth/useIDPAuth.electron.tsx +59 -2
- package/template/src/auth/useIDPAuth.native.tsx +59 -2
- package/template/src/auth/useIDPAuth.tsx +60 -2
- package/template/src/auth/useTokenAuth.tsx +66 -4
- package/template/src/components/DeviceConfigure.tsx +74 -68
- package/template/src/components/GraphQLProvider.tsx +0 -1
- package/template/src/components/contexts/WaitingRoomContext.tsx +11 -4
- package/template/src/components/recording-bot/RecordingBotRoute.tsx +1 -1
- package/template/src/components/useUserPreference.tsx +56 -9
- package/template/src/components/whiteboard/WhiteboardConfigure.tsx +4 -1
- package/template/src/components/whiteboard/WhiteboardToolBox.tsx +185 -24
- package/template/src/components/whiteboard/WhiteboardWidget.tsx +47 -6
- package/template/src/logger/AppBuilderLogger.tsx +94 -36
- package/template/src/logger/transports/customer-transport.ts +7 -3
- package/template/src/pages/VideoCall.tsx +3 -5
- package/template/src/subComponents/SelectDevice.tsx +14 -52
- package/template/src/subComponents/caption/useSTTAPI.tsx +39 -3
- package/template/src/subComponents/recording/useRecording.tsx +69 -20
- package/template/src/subComponents/waiting-rooms/useWaitingRoomAPI.ts +30 -8
- package/template/src/utils/common.tsx +6 -1
- package/template/src/utils/useCreateRoom.ts +21 -2
- package/template/src/utils/useFindActiveSpeaker.ts +12 -5
- package/template/src/utils/useGetMeetingPhrase.ts +44 -1
- package/template/src/utils/useJoinRoom.ts +29 -2
- package/template/src/utils/useMutePSTN.ts +29 -0
- package/template/agora-rn-uikit/src/Contexts/ContentContext.tsx +0 -10
- package/template/agora-rn-uikit/src/Contexts/DispatchContext.tsx +0 -22
- package/template/agora-rn-uikit/src/Reducer/ActiveSpeaker.ts +0 -30
- package/template/agora-rn-uikit/src/Reducer/UserSecondaryPin.ts +0 -23
- package/template/agora-rn-uikit/src/Utils/isBotUser.ts +0 -15
|
@@ -8,6 +8,7 @@ import useGetName from './useGetName';
|
|
|
8
8
|
import useWaitingRoomAPI from '../subComponents/waiting-rooms/useWaitingRoomAPI';
|
|
9
9
|
import {base64ToUint8Array} from '../utils';
|
|
10
10
|
import {LogSource, logger} from '../logger/AppBuilderLogger';
|
|
11
|
+
import getUniqueID from './getUniqueID';
|
|
11
12
|
|
|
12
13
|
const JOIN_CHANNEL_PHRASE_AND_GET_USER = gql`
|
|
13
14
|
query JoinChannel($passphrase: String!) {
|
|
@@ -99,6 +100,8 @@ export default function useJoinRoom() {
|
|
|
99
100
|
};
|
|
100
101
|
});
|
|
101
102
|
try {
|
|
103
|
+
const requestId = getUniqueID();
|
|
104
|
+
const startReqTs = Date.now();
|
|
102
105
|
let response = null;
|
|
103
106
|
if (isWaitingRoomEnabled) {
|
|
104
107
|
logger.log(
|
|
@@ -115,8 +118,17 @@ export default function useJoinRoom() {
|
|
|
115
118
|
LogSource.NetworkRest,
|
|
116
119
|
'joinChannel',
|
|
117
120
|
'API joinChannel. Trying to join channel. Waiting room is disabled',
|
|
121
|
+
{
|
|
122
|
+
startReqTs,
|
|
123
|
+
requestId,
|
|
124
|
+
},
|
|
118
125
|
);
|
|
119
126
|
response = await client.query({
|
|
127
|
+
context: {
|
|
128
|
+
headers: {
|
|
129
|
+
'X-Request-Id': requestId,
|
|
130
|
+
},
|
|
131
|
+
},
|
|
120
132
|
query:
|
|
121
133
|
store.token === null
|
|
122
134
|
? JOIN_CHANNEL_PHRASE
|
|
@@ -127,6 +139,8 @@ export default function useJoinRoom() {
|
|
|
127
139
|
},
|
|
128
140
|
});
|
|
129
141
|
}
|
|
142
|
+
const endReqTs = Date.now();
|
|
143
|
+
const latency = endReqTs - startReqTs;
|
|
130
144
|
if (response?.error) {
|
|
131
145
|
logger.error(
|
|
132
146
|
LogSource.NetworkRest,
|
|
@@ -134,7 +148,13 @@ export default function useJoinRoom() {
|
|
|
134
148
|
`API ${
|
|
135
149
|
isWaitingRoomEnabled ? 'channel_join_request' : 'joinChannel'
|
|
136
150
|
} failed.`,
|
|
137
|
-
|
|
151
|
+
{
|
|
152
|
+
error: response?.error,
|
|
153
|
+
startReqTs,
|
|
154
|
+
endReqTs,
|
|
155
|
+
latency,
|
|
156
|
+
requestId,
|
|
157
|
+
},
|
|
138
158
|
);
|
|
139
159
|
throw response.error;
|
|
140
160
|
} else {
|
|
@@ -146,7 +166,14 @@ export default function useJoinRoom() {
|
|
|
146
166
|
`API to ${
|
|
147
167
|
isWaitingRoomEnabled ? 'channel_join_request' : 'joinChannel'
|
|
148
168
|
} successful.`,
|
|
149
|
-
|
|
169
|
+
{
|
|
170
|
+
responseData: data,
|
|
171
|
+
phrase: phrase,
|
|
172
|
+
startReqTs,
|
|
173
|
+
endReqTs,
|
|
174
|
+
latency,
|
|
175
|
+
requestId,
|
|
176
|
+
},
|
|
150
177
|
);
|
|
151
178
|
let roomInfo: Partial<RoomInfoContextInterface['data']> = {};
|
|
152
179
|
|
|
@@ -2,6 +2,8 @@ import {gql, useMutation} from '@apollo/client';
|
|
|
2
2
|
import {UidType} from '../../agora-rn-uikit';
|
|
3
3
|
import {useRoomInfo} from '../components/room-info/useRoomInfo';
|
|
4
4
|
import useIsPSTN from './useIsPSTN';
|
|
5
|
+
import getUniqueID from './getUniqueID';
|
|
6
|
+
import {LogSource, logger} from '../logger/AppBuilderLogger';
|
|
5
7
|
const MUTE_PSTN = gql`
|
|
6
8
|
mutation mutePSTN($uid: Int!, $passphrase: String!, $mute: Boolean!) {
|
|
7
9
|
mutePSTN(uid: $uid, passphrase: $passphrase, mute: $mute) {
|
|
@@ -18,9 +20,22 @@ const useMutePSTN = () => {
|
|
|
18
20
|
} = useRoomInfo();
|
|
19
21
|
const isPSTN = useIsPSTN();
|
|
20
22
|
return async (uid: UidType) => {
|
|
23
|
+
const startReqTs = Date.now();
|
|
24
|
+
const requestId = getUniqueID();
|
|
21
25
|
if (isHost) {
|
|
22
26
|
if (isPSTN(uid)) {
|
|
27
|
+
logger.log(
|
|
28
|
+
LogSource.Internals,
|
|
29
|
+
'MUTE_PSTN',
|
|
30
|
+
'Mutation try to call MUTE_PSTN ',
|
|
31
|
+
{startReqTs, requestId},
|
|
32
|
+
);
|
|
23
33
|
await mutePSTN({
|
|
34
|
+
context: {
|
|
35
|
+
headers: {
|
|
36
|
+
'X-Request-Id': requestId,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
24
39
|
variables: {
|
|
25
40
|
uid: uid,
|
|
26
41
|
passphrase: roomId?.host,
|
|
@@ -32,8 +47,22 @@ const useMutePSTN = () => {
|
|
|
32
47
|
console.error('UID does not belong to the PSTN user.');
|
|
33
48
|
}
|
|
34
49
|
if (!loading && error) {
|
|
50
|
+
const endReqTs = Date.now();
|
|
51
|
+
logger.error(
|
|
52
|
+
LogSource.Internals,
|
|
53
|
+
'MUTE_PSTN',
|
|
54
|
+
'Mutation MUTE_PSTN success',
|
|
55
|
+
{startReqTs, endReqTs, latency: endReqTs - startReqTs, requestId},
|
|
56
|
+
);
|
|
35
57
|
throw error;
|
|
36
58
|
} else {
|
|
59
|
+
const endReqTs = Date.now();
|
|
60
|
+
logger.log(
|
|
61
|
+
LogSource.Internals,
|
|
62
|
+
'MUTE_PSTN',
|
|
63
|
+
'Mutation MUTE_PSTN success',
|
|
64
|
+
{startReqTs, endReqTs, latency: endReqTs - startReqTs, requestId},
|
|
65
|
+
);
|
|
37
66
|
return data;
|
|
38
67
|
}
|
|
39
68
|
} else {
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {ContentStateInterface} from './RtcContext';
|
|
3
|
-
|
|
4
|
-
const ContentContext = React.createContext<ContentStateInterface>(
|
|
5
|
-
{} as ContentStateInterface,
|
|
6
|
-
);
|
|
7
|
-
|
|
8
|
-
export const ContentProvider = ContentContext.Provider;
|
|
9
|
-
export const ContentConsumer = ContentContext.Consumer;
|
|
10
|
-
export default ContentContext;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {CallbacksInterface} from './PropsContext';
|
|
3
|
-
|
|
4
|
-
export type DispatchType = <
|
|
5
|
-
T extends keyof CallbacksInterface,
|
|
6
|
-
V extends Parameters<CallbacksInterface[T]>,
|
|
7
|
-
>(action: {
|
|
8
|
-
type: T;
|
|
9
|
-
value: V;
|
|
10
|
-
}) => void;
|
|
11
|
-
|
|
12
|
-
export interface DispatchContextInterface {
|
|
13
|
-
dispatch: DispatchType;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const DispatchContext = React.createContext<DispatchContextInterface>(
|
|
17
|
-
{} as DispatchContextInterface,
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
export const DispatchProvider = DispatchContext.Provider;
|
|
21
|
-
export const DispatchConsumer = DispatchContext.Consumer;
|
|
22
|
-
export default DispatchContext;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import {ActionType, ContentStateInterface} from '../Contexts/RtcContext';
|
|
2
|
-
|
|
3
|
-
export default function ActiveSpeaker(
|
|
4
|
-
state: ContentStateInterface,
|
|
5
|
-
action: ActionType<'ActiveSpeaker'>,
|
|
6
|
-
) {
|
|
7
|
-
let localActiveUids = [...state.activeUids];
|
|
8
|
-
let pinnedUid = state.pinnedUid;
|
|
9
|
-
let secondaryPinnedUid = state.secondaryPinnedUid;
|
|
10
|
-
const activeSpeaker =
|
|
11
|
-
action?.value && action.value?.length ? action.value[0] : 0;
|
|
12
|
-
if (activeSpeaker) {
|
|
13
|
-
const filteredData = localActiveUids?.filter((i) => i !== activeSpeaker);
|
|
14
|
-
const [first, second, ...remaining] = filteredData;
|
|
15
|
-
if (pinnedUid && secondaryPinnedUid) {
|
|
16
|
-
localActiveUids = [first, second, activeSpeaker, ...remaining];
|
|
17
|
-
} else if (pinnedUid && !secondaryPinnedUid) {
|
|
18
|
-
localActiveUids = [first, activeSpeaker, second, ...remaining];
|
|
19
|
-
} else if (!pinnedUid && secondaryPinnedUid) {
|
|
20
|
-
localActiveUids = [activeSpeaker, second, first, ...remaining];
|
|
21
|
-
} else {
|
|
22
|
-
localActiveUids = [activeSpeaker, first, second, ...remaining];
|
|
23
|
-
}
|
|
24
|
-
console.log('debugging activeSpeaker ', activeSpeaker, localActiveUids);
|
|
25
|
-
}
|
|
26
|
-
return {
|
|
27
|
-
...state,
|
|
28
|
-
activeUids: localActiveUids,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import {ActionType, ContentStateInterface} from '../Contexts/RtcContext';
|
|
2
|
-
|
|
3
|
-
export default function UserSecondaryPin(
|
|
4
|
-
state: ContentStateInterface,
|
|
5
|
-
action: ActionType<'UserSecondaryPin'>,
|
|
6
|
-
) {
|
|
7
|
-
let localActiveUids = [...state.activeUids];
|
|
8
|
-
const secondaryPinnedUid =
|
|
9
|
-
action?.value && action.value?.length ? action.value[0] : 0;
|
|
10
|
-
if (secondaryPinnedUid) {
|
|
11
|
-
const filteredData: any = localActiveUids?.filter(
|
|
12
|
-
(i) => i !== secondaryPinnedUid,
|
|
13
|
-
);
|
|
14
|
-
const [maxUid, ...minUids] = filteredData;
|
|
15
|
-
localActiveUids = [maxUid, secondaryPinnedUid, ...minUids];
|
|
16
|
-
}
|
|
17
|
-
return {
|
|
18
|
-
...state,
|
|
19
|
-
secondaryPinnedUid,
|
|
20
|
-
pinnedUid: state?.pinnedUid === secondaryPinnedUid ? 0 : state?.pinnedUid,
|
|
21
|
-
activeUids: localActiveUids,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export function isBotUser(args: [uid: number, elapsed: number]): boolean {
|
|
2
|
-
// STT bot
|
|
3
|
-
if (args[0] === 111111) {
|
|
4
|
-
return true;
|
|
5
|
-
}
|
|
6
|
-
// Web Recording bot (userUid)
|
|
7
|
-
if (args[0] === 100000) {
|
|
8
|
-
return true;
|
|
9
|
-
}
|
|
10
|
-
// Web Recording bot (screenUid)
|
|
11
|
-
if (args[0] === 100001) {
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
return false;
|
|
15
|
-
}
|