agora-appbuilder-core 3.0.9 → 3.0.10
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/Readme.md +6 -0
- package/package.json +2 -2
- package/template/_package-lock.json +5871 -4728
- package/template/agora-rn-uikit/src/Contexts/LocalUserContext.tsx +4 -0
- package/template/agora-rn-uikit/src/Contexts/PropsContext.tsx +18 -0
- package/template/agora-rn-uikit/src/Contexts/RtcContext.tsx +2 -0
- package/template/agora-rn-uikit/src/Controls/BtnTemplate.tsx +30 -26
- package/template/agora-rn-uikit/src/Controls/Icons.ts +30 -83
- package/template/agora-rn-uikit/src/Controls/ImageIcon.tsx +6 -6
- package/template/agora-rn-uikit/src/Reducer/ActiveSpeakerDetected.ts +11 -0
- package/template/agora-rn-uikit/src/Reducer/LocalMuteAudio.ts +1 -0
- package/template/agora-rn-uikit/src/Reducer/LocalMuteVideo.ts +1 -0
- package/template/agora-rn-uikit/src/Reducer/LocalPermissionState.ts +24 -0
- package/template/agora-rn-uikit/src/Reducer/RemoteAudioStateChanged.ts +1 -0
- package/template/agora-rn-uikit/src/Reducer/RemoteVideoStateChanged.ts +1 -0
- package/template/agora-rn-uikit/src/Reducer/UpdateDualStreamMode.ts +1 -0
- package/template/agora-rn-uikit/src/Reducer/UserJoined.ts +2 -0
- package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteAudio.ts +1 -0
- package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteVideo.ts +1 -0
- package/template/agora-rn-uikit/src/Reducer/UserOffline.ts +1 -0
- package/template/agora-rn-uikit/src/Reducer/UserPin.ts +11 -0
- package/template/agora-rn-uikit/src/Reducer/index.ts +3 -0
- package/template/agora-rn-uikit/src/Rtc/Create.tsx +89 -1
- package/template/agora-rn-uikit/src/RtcConfigure.tsx +39 -2
- package/template/agora-rn-uikit/src/Views/MaxVideoView.native.tsx +15 -5
- package/template/agora-rn-uikit/src/Views/MaxVideoView.tsx +15 -9
- package/template/agora-rn-uikit/src/index.ts +3 -1
- package/template/android/app/build.gradle +1 -0
- package/template/android/app/src/main/AndroidManifest.xml +22 -15
- package/template/android/app/src/main/assets/fonts/SourceSansPro-Regular.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/icomoon.ttf +0 -0
- package/template/android/app/src/main/java/com/helloworld/MainActivity.java +50 -0
- package/template/android/app/src/main/res/values/colors.xml +7 -0
- package/template/android/build.gradle +3 -3
- package/template/babel.config.js +1 -0
- package/template/bridge/rtc/webNg/RtcEngine.ts +110 -17
- package/template/customization-api/sub-components.ts +1 -1
- package/template/customization-api/typeDefinition.ts +2 -1
- package/template/electron/index.html +27 -27
- package/template/electron/renderer/index.js +1 -0
- package/template/global.d.ts +25 -4
- package/template/index.rsdk.tsx +1 -0
- package/template/index.web.js +2 -1
- package/template/index.wsdk.tsx +1 -1
- package/template/ios/HelloWorld/Info.plist +14 -1
- package/template/ios/HelloWorld.xcodeproj/project.pbxproj +17 -0
- package/template/metro.config.js +1 -1
- package/template/package.json +18 -7
- package/template/react-native-toast-message/index.d.ts +43 -43
- package/template/react-native-toast-message/src/colors/index.js +3 -2
- package/template/react-native-toast-message/src/components/base/index.js +46 -59
- package/template/react-native-toast-message/src/components/base/styles.js +16 -32
- package/template/react-native-toast-message/src/components/checkbox.js +178 -0
- package/template/react-native-toast-message/src/components/error.js +3 -2
- package/template/react-native-toast-message/src/components/info.js +3 -2
- package/template/react-native-toast-message/src/components/success.js +3 -2
- package/template/react-native-toast-message/src/index.js +122 -31
- package/template/react-native-toast-message/src/index.sdk.tsx +125 -35
- package/template/react-native-toast-message/src/styles.js +3 -4
- package/template/react-native-toast-message/src/styles.sdk.ts +3 -4
- package/template/react-native.config.js +7 -0
- package/template/src/App.tsx +6 -0
- package/template/src/AppWrapper.tsx +63 -28
- package/template/src/assets/font-styles.css +329 -0
- package/template/src/assets/fonts/SourceSansPro-Regular.ttf +0 -0
- package/template/src/assets/fonts/icomoon.ttf +0 -0
- package/template/src/assets/permission.png +0 -0
- package/template/src/assets/selection.json +1 -0
- package/template/src/atoms/ActionMenu.tsx +236 -0
- package/template/src/atoms/AnimatedActiveSpeaker.native.tsx +71 -0
- package/template/src/atoms/AnimatedActiveSpeaker.tsx +84 -0
- package/template/src/atoms/AnimatedRings.native.tsx +68 -0
- package/template/src/atoms/AnimatedRings.tsx +70 -0
- package/template/src/atoms/Card.tsx +61 -0
- package/template/src/atoms/CircularProgress.native.tsx +121 -0
- package/template/src/atoms/CircularProgress.tsx +102 -0
- package/template/src/atoms/CustomIcon.tsx +88 -0
- package/template/src/atoms/CustomSwitch.tsx +287 -0
- package/template/src/atoms/Dropdown.tsx +306 -0
- package/template/src/atoms/HorizontalRule.tsx +3 -1
- package/template/src/atoms/IconButton.tsx +162 -0
- package/template/src/atoms/ImageIcon.tsx +98 -0
- package/template/src/atoms/InfoBubble.tsx +291 -0
- package/template/src/atoms/Input.tsx +87 -0
- package/template/src/atoms/InviteInfo.tsx +166 -0
- package/template/src/atoms/LinkButton.tsx +28 -0
- package/template/src/atoms/OutlineButton.tsx +61 -0
- package/template/src/atoms/ParticipantsCount.tsx +73 -0
- package/template/src/atoms/Popup.tsx +147 -0
- package/template/src/atoms/PrimaryButton.tsx +51 -26
- package/template/src/atoms/RecordingInfo.tsx +49 -0
- package/template/src/atoms/SecondaryButton.tsx +8 -5
- package/template/src/atoms/Spacer.tsx +22 -0
- package/template/src/atoms/TertiaryButton.tsx +78 -0
- package/template/src/atoms/TextInput.tsx +12 -14
- package/template/src/atoms/Toggle.tsx +47 -0
- package/template/src/atoms/Tooltip.native.tsx +65 -0
- package/template/src/atoms/Tooltip.tsx +94 -0
- package/template/src/atoms/UserAvatar.tsx +60 -0
- package/template/src/components/Chat.tsx +86 -214
- package/template/src/components/ChatContext.ts +8 -1
- package/template/src/components/ColorConfigure.tsx +1 -1
- package/template/src/components/ColorContext.ts +1 -1
- package/template/src/components/CommonStyles.ts +44 -0
- package/template/src/components/Controls.tsx +342 -42
- package/template/src/components/{Controls.native.tsx → Controls1.native.tsx} +6 -4
- package/template/src/components/DeviceConfigure.tsx +461 -101
- package/template/src/components/DeviceContext.tsx +8 -4
- package/template/src/components/EventsConfigure.tsx +144 -7
- package/template/src/components/GraphQLProvider.tsx +1 -1
- package/template/src/components/GridVideo.tsx +59 -44
- package/template/src/components/HostControlView.tsx +114 -35
- package/template/src/components/Navbar.tsx +216 -398
- package/template/src/components/NetworkQualityContext.tsx +20 -20
- package/template/src/components/ParticipantsView.tsx +177 -154
- package/template/src/components/PinnedVideo.tsx +207 -120
- package/template/src/components/Precall.native.tsx +358 -119
- package/template/src/components/Precall.tsx +269 -135
- package/template/src/components/RTMConfigure.tsx +27 -4
- package/template/src/components/Router.electron.ts +1 -0
- package/template/src/components/Router.native.ts +1 -0
- package/template/src/components/Router.sdk.ts +1 -0
- package/template/src/components/Router.ts +1 -0
- package/template/src/components/Settings.tsx +26 -95
- package/template/src/components/SettingsView.tsx +251 -56
- package/template/src/components/Share.tsx +302 -273
- package/template/src/components/StorageContext.tsx +30 -3
- package/template/src/components/ToastComponent.tsx +8 -0
- package/template/src/components/chat-messages/useChatMessages.tsx +69 -23
- package/template/src/components/chat-ui/useChatUIControl.tsx +7 -0
- package/template/src/components/common/Error.tsx +20 -6
- package/template/src/components/common/Logo.tsx +16 -15
- package/template/src/components/contexts/LiveStreamDataContext.tsx +10 -5
- package/template/src/components/contexts/VideoMeetingDataContext.tsx +37 -7
- package/template/src/components/livestream/LiveStreamContext.tsx +270 -36
- package/template/src/components/livestream/Types.ts +39 -14
- package/template/src/components/livestream/index.ts +1 -0
- package/template/src/components/livestream/views/LiveStreamControls.tsx +12 -4
- package/template/src/components/participants/AllAudienceParticipants.tsx +101 -30
- package/template/src/components/participants/AllHostParticipants.tsx +103 -34
- package/template/src/components/participants/Participant.tsx +302 -0
- package/template/src/components/participants/ParticipantName.tsx +13 -7
- package/template/src/components/participants/ParticipantSectionTitle.tsx +35 -10
- package/template/src/components/participants/ScreenshareParticipants.tsx +144 -12
- package/template/src/components/participants/UserActionMenuOptions.tsx +398 -0
- package/template/src/components/popups/InvitePopup.tsx +115 -0
- package/template/src/components/popups/StopRecordingPopup.tsx +114 -0
- package/template/src/components/precall/LocalMute.tsx +84 -14
- package/template/src/components/precall/{LocalMute.native.tsx → LocalMute1.native.tsx} +21 -5
- package/template/src/components/precall/PermissionHelper.native.tsx +5 -0
- package/template/src/components/precall/PermissionHelper.tsx +126 -0
- package/template/src/components/precall/PreCallSettings.tsx +52 -0
- package/template/src/components/precall/VideoPreview.native.tsx +48 -3
- package/template/src/components/precall/VideoPreview.tsx +163 -7
- package/template/src/components/precall/joinCallBtn.tsx +15 -2
- package/template/src/components/precall/meetingTitle.tsx +15 -12
- package/template/src/components/precall/selectDevice.tsx +1 -21
- package/template/src/components/precall/textInput.tsx +32 -4
- package/template/src/components/precall/usePreCall.tsx +16 -0
- package/template/src/components/styles.ts +42 -21
- package/template/src/components/useShareLink.tsx +12 -14
- package/template/src/components/useToast.tsx +41 -0
- package/template/src/components/useVideoCall.tsx +65 -0
- package/template/src/language/default-labels/precallScreenLabels.ts +3 -3
- package/template/src/pages/Authenticate.tsx +5 -15
- package/template/src/pages/Create.tsx +293 -165
- package/template/src/pages/Endcall.tsx +148 -0
- package/template/src/pages/Join.tsx +93 -67
- package/template/src/pages/VideoCall.tsx +89 -64
- package/template/src/pages/video-call/ActionSheet.native.tsx +215 -0
- package/template/src/pages/video-call/ActionSheet.tsx +226 -0
- package/template/src/pages/video-call/ActionSheetContent.tsx +479 -0
- package/template/src/pages/video-call/ActionSheetHandle.tsx +38 -0
- package/template/src/pages/video-call/ActionSheetStyles.css +138 -0
- package/template/src/pages/video-call/DefaultLayouts.ts +4 -4
- package/template/src/pages/video-call/NameWithMicIcon.tsx +120 -44
- package/template/src/pages/video-call/RenderComponent.tsx +3 -2
- package/template/src/pages/video-call/SidePanelHeader.tsx +190 -0
- package/template/src/pages/video-call/VideoCallMobileView.tsx +139 -0
- package/template/src/pages/video-call/VideoCallScreen.native.tsx +37 -0
- package/template/src/pages/video-call/VideoCallScreen.tsx +45 -9
- package/template/src/pages/video-call/VideoComponent.tsx +18 -3
- package/template/src/pages/video-call/VideoRenderer.tsx +218 -60
- package/template/src/rtm-events/constants.ts +2 -0
- package/template/src/subComponents/ChatBubble.tsx +123 -83
- package/template/src/subComponents/ChatContainer.tsx +257 -84
- package/template/src/subComponents/ChatInput.ios.tsx +237 -0
- package/template/src/subComponents/ChatInput.tsx +61 -46
- package/template/src/subComponents/Checkbox.native.tsx +16 -5
- package/template/src/subComponents/Checkbox.tsx +2 -2
- package/template/src/subComponents/CopyJoinInfo.tsx +36 -58
- package/template/src/subComponents/EndcallPopup.tsx +107 -0
- package/template/src/subComponents/FallbackLogo.tsx +122 -40
- package/template/src/subComponents/LanguageSelector.tsx +1 -1
- package/template/src/subComponents/LayoutIconButton.tsx +201 -0
- package/template/src/subComponents/LayoutIconDropdown.tsx +131 -134
- package/template/src/subComponents/{LayoutIconDropdown.native.tsx → LayoutIconDropdown1.native.tsx} +4 -18
- package/template/src/subComponents/LocalAudioMute.tsx +119 -27
- package/template/src/subComponents/LocalEndCall.tsx +71 -33
- package/template/src/subComponents/LocalSwitchCamera.tsx +17 -30
- package/template/src/subComponents/LocalVideoMute.tsx +117 -27
- package/template/src/subComponents/Logo.tsx +3 -4
- package/template/src/subComponents/LogoutButton.tsx +1 -1
- package/template/src/subComponents/NetworkQualityPill.tsx +60 -63
- package/template/src/subComponents/OpenInNativeButton.tsx +3 -3
- package/template/src/subComponents/Recording.tsx +28 -29
- package/template/src/subComponents/RemoteAudioMute.tsx +83 -29
- package/template/src/subComponents/RemoteEndCall.tsx +8 -5
- package/template/src/subComponents/RemoteMutePopup.tsx +193 -0
- package/template/src/subComponents/RemoteVideoMute.tsx +74 -21
- package/template/src/subComponents/RemoveMeetingPopup.tsx +109 -0
- package/template/src/subComponents/RemoveScreensharePopup.tsx +109 -0
- package/template/src/subComponents/ScreenShareNotice.tsx +83 -8
- package/template/src/subComponents/SelectDevice.tsx +404 -61
- package/template/src/subComponents/SelectDeviceSettings.backup.tsx +207 -0
- package/template/src/subComponents/SelectOAuth.tsx +9 -8
- package/template/src/subComponents/SidePanelHeader.tsx +112 -0
- package/template/src/subComponents/ToastConfig.tsx +150 -10
- package/template/src/subComponents/chat/ChatParticipants.tsx +187 -78
- package/template/src/subComponents/livestream/CurrentLiveStreamRequestsView.tsx +95 -32
- package/template/src/subComponents/livestream/controls/LocalRaiseHand.tsx +29 -33
- package/template/src/subComponents/livestream/controls/RemoteLiveStreamApprovedRequestRecall.tsx +6 -6
- package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestApprove.tsx +24 -11
- package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestReject.tsx +17 -10
- package/template/src/subComponents/recording/useRecording.tsx +79 -27
- package/template/src/subComponents/screenshare/ScreenshareButton.tsx +52 -70
- package/template/src/subComponents/screenshare/ScreenshareConfigure.native.tsx +11 -2
- package/template/src/subComponents/screenshare/ScreenshareConfigure.tsx +26 -4
- package/template/src/theme/index.ts +46 -0
- package/template/src/utils/PlatformWrapper.tsx +21 -0
- package/template/src/utils/common.tsx +155 -1
- package/template/src/utils/hexadecimalTransparency.ts +108 -0
- package/template/src/utils/index.tsx +19 -0
- package/template/src/utils/isMobileOrTablet.ts +7 -2
- package/template/src/utils/pendingStateUpdateHelper.ts +19 -0
- package/template/src/utils/useButtonTemplate.tsx +1 -0
- package/template/src/utils/useFocus.tsx +46 -0
- package/template/src/utils/useIsActiveSpeaker.ts +27 -0
- package/template/src/utils/useIsHandRaised.ts +13 -0
- package/template/src/utils/useMuteToggleLocal.ts +54 -3
- package/template/src/utils/useRemoteEndScreenshare.ts +26 -0
- package/template/src/utils/useRemoteRequest.ts +84 -0
- package/template/web/index.html +5 -0
- package/template/webpack.commons.js +13 -8
- package/template/webpack.web.config.js +1 -0
- package/template/src/assets/icons.ts +0 -102
- package/template/src/components/participants/MeParticipant.tsx +0 -38
- package/template/src/components/participants/RemoteParticipants.tsx +0 -71
|
@@ -10,11 +10,21 @@
|
|
|
10
10
|
*********************************************
|
|
11
11
|
*/
|
|
12
12
|
import React from 'react';
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
Platform as ReactNativePlatform,
|
|
15
|
+
useWindowDimensions,
|
|
16
|
+
} from 'react-native';
|
|
14
17
|
import Platform from '../subComponents/Platform';
|
|
15
18
|
|
|
16
19
|
import * as ReactIs from 'react-is';
|
|
17
20
|
|
|
21
|
+
const trimText = (text: string, length: number = 25) => {
|
|
22
|
+
if (!text) {
|
|
23
|
+
return '';
|
|
24
|
+
}
|
|
25
|
+
return text?.substring(0, length) + (text?.length > length ? '...' : '');
|
|
26
|
+
};
|
|
27
|
+
const maxInputLimit = 60;
|
|
18
28
|
const isValidReactComponent = <T,>(Component?: React.ComponentType<T>) =>
|
|
19
29
|
Component && ReactIs.isValidElementType(Component) ? true : false;
|
|
20
30
|
|
|
@@ -57,10 +67,150 @@ const isIOS = () => Platform === 'native' && ReactNativePlatform.OS === 'ios';
|
|
|
57
67
|
//@ts-ignore
|
|
58
68
|
const isDesktop = () => Platform === 'electron';
|
|
59
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Checks whether the application is running on mobile device (user agent) and returns true/false.
|
|
72
|
+
* @returns function
|
|
73
|
+
*/
|
|
74
|
+
//@ts-ignore
|
|
75
|
+
const isMobileUA = () => {
|
|
76
|
+
let check = false;
|
|
77
|
+
(function (a) {
|
|
78
|
+
if (
|
|
79
|
+
/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(
|
|
80
|
+
a,
|
|
81
|
+
) ||
|
|
82
|
+
isAndroid() ||
|
|
83
|
+
isIOS()
|
|
84
|
+
)
|
|
85
|
+
check = true;
|
|
86
|
+
})(navigator?.userAgent || navigator?.vendor || window?.opera);
|
|
87
|
+
return check;
|
|
88
|
+
};
|
|
89
|
+
|
|
60
90
|
const isArray = (data: any[]) =>
|
|
61
91
|
data && Array.isArray(data) && data.length ? true : false ? true : false;
|
|
92
|
+
|
|
93
|
+
interface calculatedPositionProps {
|
|
94
|
+
px: number;
|
|
95
|
+
py: number;
|
|
96
|
+
localWidth: number;
|
|
97
|
+
localHeight: number;
|
|
98
|
+
globalWidth: number;
|
|
99
|
+
globalHeight: number;
|
|
100
|
+
extra?: {
|
|
101
|
+
top?: number;
|
|
102
|
+
bottom?: number;
|
|
103
|
+
left?: number;
|
|
104
|
+
right?: number;
|
|
105
|
+
};
|
|
106
|
+
popupWidth?: number;
|
|
107
|
+
}
|
|
108
|
+
const calculatePosition = (params: calculatedPositionProps) => {
|
|
109
|
+
const {
|
|
110
|
+
px,
|
|
111
|
+
py,
|
|
112
|
+
localWidth,
|
|
113
|
+
localHeight,
|
|
114
|
+
globalWidth,
|
|
115
|
+
globalHeight,
|
|
116
|
+
extra: {top = 0, bottom = 0, left = 0, right = 0} = {},
|
|
117
|
+
popupWidth = 220,
|
|
118
|
+
} = params;
|
|
119
|
+
//right hand side
|
|
120
|
+
if (px > globalWidth / 2) {
|
|
121
|
+
// if actionmenu overflow - horizontal
|
|
122
|
+
const w = globalWidth - px + popupWidth;
|
|
123
|
+
let minus = 0;
|
|
124
|
+
if (w > globalWidth) {
|
|
125
|
+
minus = w - globalWidth + 10;
|
|
126
|
+
}
|
|
127
|
+
//right bottom
|
|
128
|
+
if (py > globalHeight / 2) {
|
|
129
|
+
return {
|
|
130
|
+
bottom: globalHeight - py + bottom,
|
|
131
|
+
right: globalWidth - px - minus + right,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
//right top
|
|
135
|
+
else {
|
|
136
|
+
return {
|
|
137
|
+
top: py + localHeight + top,
|
|
138
|
+
right: globalWidth - px - minus + right,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
//left hand side
|
|
143
|
+
else {
|
|
144
|
+
// if actionmenu overflow - horizontal
|
|
145
|
+
const w = px + localWidth + popupWidth;
|
|
146
|
+
let minus = 0;
|
|
147
|
+
if (w > globalWidth) {
|
|
148
|
+
minus = w - globalWidth + 10;
|
|
149
|
+
}
|
|
150
|
+
//left bottom
|
|
151
|
+
if (py > globalHeight / 2) {
|
|
152
|
+
return {
|
|
153
|
+
bottom: globalHeight - py + bottom,
|
|
154
|
+
left: px + localWidth - minus + left,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
//left top
|
|
158
|
+
else {
|
|
159
|
+
return {
|
|
160
|
+
top: py + localHeight + top + top,
|
|
161
|
+
left: px + localWidth - minus + left,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
const BREAKPOINTS = {
|
|
168
|
+
xs: 360,
|
|
169
|
+
sm: 576,
|
|
170
|
+
md: 768,
|
|
171
|
+
lg: 992,
|
|
172
|
+
xl: 1330,
|
|
173
|
+
xxl: 1400,
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
const useIsDesktop = () => {
|
|
177
|
+
const {width, height} = useWindowDimensions();
|
|
178
|
+
return (from: 'default' | 'toolbar' | 'popup' = 'default') => {
|
|
179
|
+
if (from === 'default') {
|
|
180
|
+
return width > height ? true : false;
|
|
181
|
+
} else if (from === 'toolbar') {
|
|
182
|
+
return width > BREAKPOINTS.xl;
|
|
183
|
+
} else if (from === 'popup') {
|
|
184
|
+
return width > BREAKPOINTS.md;
|
|
185
|
+
}
|
|
186
|
+
return width >= BREAKPOINTS.xl;
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
const useIsSmall = () => {
|
|
190
|
+
const {width} = useWindowDimensions();
|
|
191
|
+
return (number = BREAKPOINTS.sm) => {
|
|
192
|
+
return width < number;
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
const useResponsive = () => {
|
|
197
|
+
const {width} = useWindowDimensions();
|
|
198
|
+
return (input: number) => {
|
|
199
|
+
if (width < BREAKPOINTS.xs) {
|
|
200
|
+
return input / 3;
|
|
201
|
+
} else if (width < BREAKPOINTS.md) {
|
|
202
|
+
return input / 2;
|
|
203
|
+
} else {
|
|
204
|
+
return input;
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
};
|
|
62
208
|
export {
|
|
209
|
+
useIsDesktop,
|
|
210
|
+
useIsSmall,
|
|
211
|
+
BREAKPOINTS,
|
|
63
212
|
useHasBrandLogo,
|
|
213
|
+
isMobileUA,
|
|
64
214
|
isAndroid,
|
|
65
215
|
isIOS,
|
|
66
216
|
isWebInternal,
|
|
@@ -69,4 +219,8 @@ export {
|
|
|
69
219
|
shouldAuthenticate,
|
|
70
220
|
isArray,
|
|
71
221
|
isValidReactComponent,
|
|
222
|
+
maxInputLimit,
|
|
223
|
+
trimText,
|
|
224
|
+
calculatePosition,
|
|
225
|
+
useResponsive,
|
|
72
226
|
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hexadecimal color code for transparency
|
|
3
|
+
* ref https://gist.github.com/lopspower/03fb1cc0ac9f32ef38f4
|
|
4
|
+
*/
|
|
5
|
+
const hexadecimalTransparency = {
|
|
6
|
+
'100%': 'FF',
|
|
7
|
+
'99%': 'FC',
|
|
8
|
+
'98%': 'FA',
|
|
9
|
+
'97%': 'F7',
|
|
10
|
+
'96%': 'F5',
|
|
11
|
+
'95%': 'F2',
|
|
12
|
+
'94%': 'F0',
|
|
13
|
+
'93%': 'ED',
|
|
14
|
+
'92%': 'EB',
|
|
15
|
+
'91%': 'E8',
|
|
16
|
+
'90%': 'E6',
|
|
17
|
+
'89%': 'E3',
|
|
18
|
+
'88%': 'E0',
|
|
19
|
+
'87%': 'DE',
|
|
20
|
+
'86%': 'DB',
|
|
21
|
+
'85%': 'D9',
|
|
22
|
+
'84%': 'D6',
|
|
23
|
+
'83%': 'D4',
|
|
24
|
+
'82%': 'D1',
|
|
25
|
+
'81%': 'CF',
|
|
26
|
+
'80%': 'CC',
|
|
27
|
+
'79%': 'C9',
|
|
28
|
+
'78%': 'C7',
|
|
29
|
+
'77%': 'C4',
|
|
30
|
+
'76%': 'C2',
|
|
31
|
+
'75%': 'BF',
|
|
32
|
+
'74%': 'BD',
|
|
33
|
+
'73%': 'BA',
|
|
34
|
+
'72%': 'B8',
|
|
35
|
+
'71%': 'B5',
|
|
36
|
+
'70%': 'B3',
|
|
37
|
+
'69%': 'B0',
|
|
38
|
+
'68%': 'AD',
|
|
39
|
+
'67%': 'AB',
|
|
40
|
+
'66%': 'A8',
|
|
41
|
+
'65%': 'A6',
|
|
42
|
+
'64%': 'A3',
|
|
43
|
+
'63%': 'A1',
|
|
44
|
+
'62%': '9E',
|
|
45
|
+
'61%': '9C',
|
|
46
|
+
'60%': '99',
|
|
47
|
+
'59%': '96',
|
|
48
|
+
'58%': '94',
|
|
49
|
+
'57%': '91',
|
|
50
|
+
'56%': '8F',
|
|
51
|
+
'55%': '8C',
|
|
52
|
+
'54%': '8A',
|
|
53
|
+
'53%': '87',
|
|
54
|
+
'52%': '85',
|
|
55
|
+
'51%': '82',
|
|
56
|
+
'50%': '80',
|
|
57
|
+
'49%': '7D',
|
|
58
|
+
'48%': '7A',
|
|
59
|
+
'47%': '78',
|
|
60
|
+
'46%': '75',
|
|
61
|
+
'45%': '73',
|
|
62
|
+
'44%': '70',
|
|
63
|
+
'43%': '6E',
|
|
64
|
+
'42%': '6B',
|
|
65
|
+
'41%': '69',
|
|
66
|
+
'40%': '66',
|
|
67
|
+
'39%': '63',
|
|
68
|
+
'38%': '61',
|
|
69
|
+
'37%': '5E',
|
|
70
|
+
'36%': '5C',
|
|
71
|
+
'35%': '59',
|
|
72
|
+
'34%': '57',
|
|
73
|
+
'33%': '54',
|
|
74
|
+
'32%': '52',
|
|
75
|
+
'31%': '4F',
|
|
76
|
+
'30%': '4D',
|
|
77
|
+
'29%': '4A',
|
|
78
|
+
'28%': '47',
|
|
79
|
+
'27%': '45',
|
|
80
|
+
'26%': '42',
|
|
81
|
+
'25%': '40',
|
|
82
|
+
'24%': '3D',
|
|
83
|
+
'23%': '3B',
|
|
84
|
+
'22%': '38',
|
|
85
|
+
'21%': '36',
|
|
86
|
+
'20%': '33',
|
|
87
|
+
'19%': '30',
|
|
88
|
+
'18%': '2E',
|
|
89
|
+
'17%': '2B',
|
|
90
|
+
'16%': '29',
|
|
91
|
+
'15%': '26',
|
|
92
|
+
'14%': '24',
|
|
93
|
+
'13%': '21',
|
|
94
|
+
'12%': '1F',
|
|
95
|
+
'11%': '1C',
|
|
96
|
+
'10%': '1A',
|
|
97
|
+
'9%': '17',
|
|
98
|
+
'8%': '14',
|
|
99
|
+
'7%': '12',
|
|
100
|
+
'6%': '0F',
|
|
101
|
+
'5%': '0D',
|
|
102
|
+
'4%': '0A',
|
|
103
|
+
'3%': '08',
|
|
104
|
+
'2%': '05',
|
|
105
|
+
'1%': '03',
|
|
106
|
+
'0%': '00',
|
|
107
|
+
};
|
|
108
|
+
export default hexadecimalTransparency;
|
|
@@ -55,3 +55,22 @@ export function isEmptyObject(obj: object) {
|
|
|
55
55
|
}
|
|
56
56
|
return true;
|
|
57
57
|
}
|
|
58
|
+
|
|
59
|
+
export const randomNameGenerator = (num: number) => {
|
|
60
|
+
let res = '';
|
|
61
|
+
for (let i = 0; i < num; i++) {
|
|
62
|
+
const random = Math.floor(Math.random() * 10);
|
|
63
|
+
res += String.fromCharCode(97 + random);
|
|
64
|
+
}
|
|
65
|
+
return res;
|
|
66
|
+
};
|
|
67
|
+
export function formatAMPM(date) {
|
|
68
|
+
var hours = date.getHours();
|
|
69
|
+
var minutes = date.getMinutes();
|
|
70
|
+
var ampm = hours >= 12 ? 'pm' : 'am';
|
|
71
|
+
hours = hours % 12;
|
|
72
|
+
hours = hours ? hours : 12; // the hour '0' should be '12'
|
|
73
|
+
minutes = minutes < 10 ? '0' + minutes : minutes;
|
|
74
|
+
var strTime = hours + ':' + minutes + ' ' + ampm;
|
|
75
|
+
return strTime;
|
|
76
|
+
}
|
|
@@ -13,14 +13,19 @@ const isMobileOrTablet = () => {
|
|
|
13
13
|
(function (a) {
|
|
14
14
|
if (
|
|
15
15
|
/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(
|
|
16
|
-
a
|
|
16
|
+
a
|
|
17
17
|
) ||
|
|
18
18
|
/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(
|
|
19
|
-
a.substr(0, 4)
|
|
19
|
+
a.substr(0, 4)
|
|
20
20
|
)
|
|
21
21
|
)
|
|
22
22
|
check = true;
|
|
23
23
|
})(navigator?.userAgent || navigator?.vendor || window?.opera);
|
|
24
|
+
check =
|
|
25
|
+
(/Macintosh/i.test(navigator?.userAgent) &&
|
|
26
|
+
navigator?.maxTouchPoints &&
|
|
27
|
+
navigator?.maxTouchPoints > 1) ||
|
|
28
|
+
check;
|
|
24
29
|
return check;
|
|
25
30
|
};
|
|
26
31
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wrapper around 200ms buffered updates.
|
|
3
|
+
* @param action - The asynchronous action that causes update
|
|
4
|
+
* @param cb - Callback method called with true if 200ms exceeded in performing
|
|
5
|
+
* provided action and called with false after action completed
|
|
6
|
+
*/
|
|
7
|
+
const pendingStateUpdateHelper = async (
|
|
8
|
+
action: () => Promise<any>,
|
|
9
|
+
cb: (exceeded200ms: boolean) => void,
|
|
10
|
+
) => {
|
|
11
|
+
const pendingTimeout = setTimeout(() => {
|
|
12
|
+
cb(true);
|
|
13
|
+
}, 200);
|
|
14
|
+
await action();
|
|
15
|
+
clearTimeout(pendingTimeout);
|
|
16
|
+
cb(false);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default pendingStateUpdateHelper;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*
|
|
2
|
+
********************************************
|
|
3
|
+
Copyright © 2021 Agora Lab, Inc., all rights reserved.
|
|
4
|
+
AppBuilder and all associated components, source code, APIs, services, and documentation
|
|
5
|
+
(the “Materials”) are owned by Agora Lab, Inc. and its licensors. The Materials may not be
|
|
6
|
+
accessed, used, modified, or distributed for any purpose without a license from Agora Lab, Inc.
|
|
7
|
+
Use without a license or in violation of any license terms and conditions (including use for
|
|
8
|
+
any purpose competitive to Agora Lab, Inc.’s business) is strictly prohibited. For more
|
|
9
|
+
information visit https://appbuilder.agora.io.
|
|
10
|
+
*********************************************
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import React, {SetStateAction} from 'react';
|
|
14
|
+
import {createHook} from 'customization-implementation';
|
|
15
|
+
|
|
16
|
+
export interface currentFocus {
|
|
17
|
+
editName: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface FocusContextInterface {
|
|
20
|
+
currentFocus: currentFocus;
|
|
21
|
+
setFocus: React.Dispatch<SetStateAction<currentFocus>>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const FocusContext = React.createContext<FocusContextInterface>({
|
|
25
|
+
currentFocus: {editName: false},
|
|
26
|
+
setFocus: () => {},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
interface FocusProviderProps {
|
|
30
|
+
value: FocusContextInterface;
|
|
31
|
+
children: React.ReactNode;
|
|
32
|
+
}
|
|
33
|
+
const FocusProvider = (props: FocusProviderProps) => {
|
|
34
|
+
return (
|
|
35
|
+
<FocusContext.Provider value={{...props.value}}>
|
|
36
|
+
{props.children}
|
|
37
|
+
</FocusContext.Provider>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The Focus app state governs the chatinput and editname.
|
|
43
|
+
*/
|
|
44
|
+
const useFocus = createHook(FocusContext);
|
|
45
|
+
|
|
46
|
+
export {FocusProvider, useFocus};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
********************************************
|
|
3
|
+
Copyright © 2021 Agora Lab, Inc., all rights reserved.
|
|
4
|
+
AppBuilder and all associated components, source code, APIs, services, and documentation
|
|
5
|
+
(the “Materials”) are owned by Agora Lab, Inc. and its licensors. The Materials may not be
|
|
6
|
+
accessed, used, modified, or distributed for any purpose without a license from Agora Lab, Inc.
|
|
7
|
+
Use without a license or in violation of any license terms and conditions (including use for
|
|
8
|
+
any purpose competitive to Agora Lab, Inc.’s business) is strictly prohibited. For more
|
|
9
|
+
information visit https://appbuilder.agora.io.
|
|
10
|
+
*********************************************
|
|
11
|
+
*/
|
|
12
|
+
import {useRender} from 'customization-api';
|
|
13
|
+
import {UidType} from '../../agora-rn-uikit';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Returns a function that checks whether the given uid is a active speaker and returns true/false
|
|
17
|
+
* @returns function
|
|
18
|
+
*/
|
|
19
|
+
function useIsActiveSpeaker() {
|
|
20
|
+
const {activeSpeaker, renderList} = useRender();
|
|
21
|
+
const isActiveSpeaker = (uid: UidType) => {
|
|
22
|
+
return renderList[uid].audio && activeSpeaker === uid;
|
|
23
|
+
};
|
|
24
|
+
return isActiveSpeaker;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default useIsActiveSpeaker;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {useContext} from 'react';
|
|
2
|
+
import {UidType} from '../../agora-rn-uikit';
|
|
3
|
+
import LiveStreamContext from '../components/livestream/LiveStreamContext';
|
|
4
|
+
import {RaiseHandValue} from '../components/livestream/Types';
|
|
5
|
+
|
|
6
|
+
const useIsHandRaised = () => {
|
|
7
|
+
const {raiseHandList} = useContext(LiveStreamContext);
|
|
8
|
+
const isHandRaised = (uid: UidType) => {
|
|
9
|
+
return raiseHandList[uid]?.raised === RaiseHandValue.TRUE;
|
|
10
|
+
};
|
|
11
|
+
return isHandRaised;
|
|
12
|
+
};
|
|
13
|
+
export default useIsHandRaised;
|
|
@@ -10,7 +10,11 @@
|
|
|
10
10
|
*********************************************
|
|
11
11
|
*/
|
|
12
12
|
import {useLocalUserInfo, useRtc} from 'customization-api';
|
|
13
|
+
import {useContext, useEffect, useRef, useState} from 'react';
|
|
14
|
+
|
|
13
15
|
import {ToggleState} from '../../agora-rn-uikit/src/Contexts/PropsContext';
|
|
16
|
+
import {isMobileUA, isWebInternal} from './common';
|
|
17
|
+
import {AppState} from 'react-native';
|
|
14
18
|
|
|
15
19
|
export enum MUTE_LOCAL_TYPE {
|
|
16
20
|
audio,
|
|
@@ -23,6 +27,48 @@ function useMuteToggleLocal() {
|
|
|
23
27
|
const {RtcEngine, dispatch} = useRtc();
|
|
24
28
|
const local = useLocalUserInfo();
|
|
25
29
|
|
|
30
|
+
const appState = useRef(AppState.currentState);
|
|
31
|
+
const [appStateVisible, setAppStateVisible] = useState(appState.current);
|
|
32
|
+
const isCamON = useRef(local.video);
|
|
33
|
+
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if ($config.AUDIO_ROOM || !isMobileUA()) return;
|
|
36
|
+
const subscription = AppState.addEventListener('change', (nextAppState) => {
|
|
37
|
+
appState.current = nextAppState;
|
|
38
|
+
setAppStateVisible(appState.current);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
return () => {
|
|
42
|
+
subscription?.remove();
|
|
43
|
+
};
|
|
44
|
+
}, []);
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
// console.log(`Video State ${local.video} in Mode ${appStateVisible}`);
|
|
48
|
+
if (appStateVisible === 'background') {
|
|
49
|
+
isCamON.current = local.video;
|
|
50
|
+
if (isCamON.current) {
|
|
51
|
+
isWebInternal()
|
|
52
|
+
? RtcEngine.muteLocalVideoStream(true)
|
|
53
|
+
: RtcEngine.enableLocalVideo(false);
|
|
54
|
+
|
|
55
|
+
dispatch({
|
|
56
|
+
type: 'LocalMuteVideo',
|
|
57
|
+
value: [0],
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (appStateVisible === 'active' && isCamON.current) {
|
|
62
|
+
isWebInternal()
|
|
63
|
+
? RtcEngine.muteLocalVideoStream(false)
|
|
64
|
+
: RtcEngine.enableLocalVideo(true);
|
|
65
|
+
dispatch({
|
|
66
|
+
type: 'LocalMuteVideo',
|
|
67
|
+
value: [1],
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}, [appStateVisible]);
|
|
71
|
+
|
|
26
72
|
return async (type: MUTE_LOCAL_TYPE) => {
|
|
27
73
|
switch (type) {
|
|
28
74
|
case MUTE_LOCAL_TYPE.audio:
|
|
@@ -82,9 +128,14 @@ function useMuteToggleLocal() {
|
|
|
82
128
|
});
|
|
83
129
|
|
|
84
130
|
try {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
131
|
+
//enableLocalVideo not available on web
|
|
132
|
+
isWebInternal()
|
|
133
|
+
? await RtcEngine.muteLocalVideoStream(
|
|
134
|
+
localVideoState === ToggleState.enabled ? true : false,
|
|
135
|
+
)
|
|
136
|
+
: await RtcEngine.enableLocalVideo(
|
|
137
|
+
localVideoState === ToggleState.enabled ? false : true,
|
|
138
|
+
);
|
|
88
139
|
|
|
89
140
|
// Enable UI
|
|
90
141
|
dispatch({
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {controlMessageEnum} from '../components/ChatContext';
|
|
2
|
+
import {useMeetingInfo} from '../components/meeting-info/useMeetingInfo';
|
|
3
|
+
import {UidType} from '../../agora-rn-uikit';
|
|
4
|
+
import events, {EventPersistLevel} from '../rtm-events-api';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Returns a function to end the screenshare for a remote user with the given uid.
|
|
8
|
+
*/
|
|
9
|
+
const useRemoteEndScreenshare = () => {
|
|
10
|
+
const {
|
|
11
|
+
data: {isHost},
|
|
12
|
+
} = useMeetingInfo();
|
|
13
|
+
return (uid: UidType) => {
|
|
14
|
+
if (isHost && uid) {
|
|
15
|
+
events.send(
|
|
16
|
+
controlMessageEnum.kickScreenshare,
|
|
17
|
+
'',
|
|
18
|
+
EventPersistLevel.LEVEL1,
|
|
19
|
+
uid,
|
|
20
|
+
);
|
|
21
|
+
} else {
|
|
22
|
+
console.error('A host can only remove the screenshare from the call.');
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export default useRemoteEndScreenshare;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/*
|
|
2
|
+
********************************************
|
|
3
|
+
Copyright © 2021 Agora Lab, Inc., all rights reserved.
|
|
4
|
+
AppBuilder and all associated components, source code, APIs, services, and documentation
|
|
5
|
+
(the “Materials”) are owned by Agora Lab, Inc. and its licensors. The Materials may not be
|
|
6
|
+
accessed, used, modified, or distributed for any purpose without a license from Agora Lab, Inc.
|
|
7
|
+
Use without a license or in violation of any license terms and conditions (including use for
|
|
8
|
+
any purpose competitive to Agora Lab, Inc.’s business) is strictly prohibited. For more
|
|
9
|
+
information visit https://appbuilder.agora.io.
|
|
10
|
+
*********************************************
|
|
11
|
+
*/
|
|
12
|
+
import {useMeetingInfo} from '../components/meeting-info/useMeetingInfo';
|
|
13
|
+
import {controlMessageEnum} from '../components/ChatContext';
|
|
14
|
+
import useIsPSTN from './useIsPSTN';
|
|
15
|
+
import useMutePSTN from './useMutePSTN';
|
|
16
|
+
import {UidType} from '../../agora-rn-uikit';
|
|
17
|
+
import events, {EventPersistLevel} from '../rtm-events-api';
|
|
18
|
+
|
|
19
|
+
export enum REQUEST_REMOTE_TYPE {
|
|
20
|
+
audio,
|
|
21
|
+
video,
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Returns an asynchronous function to request audio/video for a remote user with the given uid or if no uid provided, request everyone else in the meeting.
|
|
25
|
+
*/
|
|
26
|
+
function useRemoteRequest() {
|
|
27
|
+
const {
|
|
28
|
+
data: {isHost},
|
|
29
|
+
} = useMeetingInfo();
|
|
30
|
+
const isPSTN = useIsPSTN();
|
|
31
|
+
|
|
32
|
+
return async (type: REQUEST_REMOTE_TYPE, uid?: UidType) => {
|
|
33
|
+
if (isHost) {
|
|
34
|
+
switch (type) {
|
|
35
|
+
case REQUEST_REMOTE_TYPE.audio:
|
|
36
|
+
// To individual
|
|
37
|
+
if (uid) {
|
|
38
|
+
if (isPSTN(uid)) {
|
|
39
|
+
//can't ask pstn user to unmute
|
|
40
|
+
} else {
|
|
41
|
+
events.send(
|
|
42
|
+
controlMessageEnum.requestAudio,
|
|
43
|
+
'',
|
|
44
|
+
EventPersistLevel.LEVEL1,
|
|
45
|
+
uid,
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
} else {
|
|
49
|
+
// To everyone
|
|
50
|
+
events.send(
|
|
51
|
+
controlMessageEnum.requestAudio,
|
|
52
|
+
'',
|
|
53
|
+
EventPersistLevel.LEVEL1,
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
break;
|
|
57
|
+
case REQUEST_REMOTE_TYPE.video:
|
|
58
|
+
if (uid) {
|
|
59
|
+
// To individual
|
|
60
|
+
if (!isPSTN(uid)) {
|
|
61
|
+
events.send(
|
|
62
|
+
controlMessageEnum.requestVideo,
|
|
63
|
+
'',
|
|
64
|
+
EventPersistLevel.LEVEL1,
|
|
65
|
+
uid,
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
// To everyone
|
|
70
|
+
events.send(
|
|
71
|
+
controlMessageEnum.requestVideo,
|
|
72
|
+
'',
|
|
73
|
+
EventPersistLevel.LEVEL1,
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
} else {
|
|
79
|
+
console.error('A host can only request audience audio or video.');
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export default useRemoteRequest;
|
package/template/web/index.html
CHANGED
|
@@ -3,9 +3,14 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
7
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
8
|
+
<!-- moved to template/src/assets/font-styles.css as it was not available for sdks-->
|
|
9
|
+
<!-- <link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap" rel="stylesheet"> -->
|
|
6
10
|
|
|
7
11
|
<base href="/">
|
|
8
12
|
<title><%= htmlWebpackPlugin.options.title %></title>
|
|
13
|
+
|
|
9
14
|
</head>
|
|
10
15
|
<body>
|
|
11
16
|
<style>
|