agora-appbuilder-core 3.0.9 → 4.0.0-api.1
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/AgoraUIKit.tsx +6 -6
- package/template/agora-rn-uikit/src/Contexts/ContentContext.tsx +10 -0
- package/template/agora-rn-uikit/src/Contexts/DispatchContext.tsx +22 -0
- package/template/agora-rn-uikit/src/Contexts/LocalUserContext.tsx +10 -6
- package/template/agora-rn-uikit/src/Contexts/PropsContext.tsx +28 -8
- package/template/agora-rn-uikit/src/Contexts/RtcContext.tsx +7 -15
- 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/Controls/Local/LocalAudioMute.tsx +4 -2
- package/template/agora-rn-uikit/src/Controls/Local/LocalVideoMute.tsx +4 -2
- package/template/agora-rn-uikit/src/Controls/Local/Recording.tsx +0 -2
- package/template/agora-rn-uikit/src/Controls/Local/SwitchCamera.tsx +6 -6
- package/template/agora-rn-uikit/src/Controls/LocalControls.tsx +5 -5
- package/template/agora-rn-uikit/src/Controls/Remote/RemoteAudioMute.tsx +4 -4
- package/template/agora-rn-uikit/src/Controls/Remote/RemoteVideoMute.tsx +4 -4
- package/template/agora-rn-uikit/src/Controls/RemoteControls.tsx +2 -2
- package/template/agora-rn-uikit/src/Reducer/LocalMuteAudio.ts +6 -6
- package/template/agora-rn-uikit/src/Reducer/LocalMuteVideo.ts +6 -6
- package/template/agora-rn-uikit/src/Reducer/LocalPermissionState.ts +23 -0
- package/template/agora-rn-uikit/src/Reducer/RemoteAudioStateChanged.ts +6 -6
- package/template/agora-rn-uikit/src/Reducer/RemoteVideoStateChanged.ts +7 -7
- package/template/agora-rn-uikit/src/Reducer/UpdateDualStreamMode.ts +7 -7
- package/template/agora-rn-uikit/src/Reducer/UserJoined.ts +10 -10
- package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteAudio.ts +6 -6
- package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteVideo.ts +6 -6
- package/template/agora-rn-uikit/src/Reducer/UserOffline.ts +5 -5
- package/template/agora-rn-uikit/src/Reducer/UserPin.ts +11 -0
- package/template/agora-rn-uikit/src/Reducer/index.ts +2 -0
- package/template/agora-rn-uikit/src/Rtc/Create.tsx +72 -5
- package/template/agora-rn-uikit/src/Rtc/Join.tsx +5 -4
- package/template/agora-rn-uikit/src/RtcConfigure.tsx +76 -49
- package/template/agora-rn-uikit/src/Views/MaxVideoView.native.tsx +17 -7
- package/template/agora-rn-uikit/src/Views/MaxVideoView.tsx +17 -11
- package/template/agora-rn-uikit/src/Views/MinVideoView.tsx +2 -2
- package/template/agora-rn-uikit/src/index.ts +17 -9
- 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/action-library.ts +10 -14
- package/template/customization-api/app-state.ts +4 -6
- package/template/customization-api/customEvents.ts +2 -2
- package/template/customization-api/customize.ts +1 -1
- package/template/customization-api/sub-components.ts +4 -12
- package/template/customization-api/typeDefinition.ts +15 -38
- package/template/customization-implementation/createHook.ts +24 -6
- package/template/customization-implementation/index.ts +1 -1
- package/template/customization-implementation/useCustomization.tsx +5 -7
- package/template/electron/index.html +27 -27
- package/template/electron/renderer/index.js +1 -0
- package/template/global.d.ts +26 -4
- package/template/index.rsdk.tsx +1 -0
- package/template/index.web.js +2 -1
- package/template/index.wsdk.tsx +9 -2
- 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 +19 -14
- package/template/src/AppWrapper.tsx +74 -29
- package/template/src/SDKAppWrapper.tsx +60 -64
- package/template/src/app-state/useLocalUserInfo.ts +3 -3
- 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 +74 -0
- package/template/src/atoms/Popup.tsx +147 -0
- package/template/src/atoms/PrimaryButton.tsx +51 -26
- package/template/src/atoms/RecordingInfo.tsx +52 -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/Toolbar.tsx +68 -0
- package/template/src/atoms/ToolbarItem.tsx +63 -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 +164 -278
- 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 +331 -73
- package/template/src/components/{Controls.native.tsx → Controls1.native.tsx} +8 -6
- package/template/src/components/DeviceConfigure.tsx +511 -106
- package/template/src/components/DeviceContext.tsx +8 -4
- package/template/src/components/EventsConfigure.tsx +192 -10
- package/template/src/components/GraphQLProvider.tsx +1 -1
- package/template/src/components/GridVideo.tsx +60 -45
- package/template/src/components/HostControlView.tsx +114 -35
- package/template/src/components/Navbar.tsx +219 -437
- package/template/src/components/Navigation.tsx +15 -1
- package/template/src/components/NetworkQualityContext.tsx +22 -22
- package/template/src/components/ParticipantsView.tsx +178 -156
- package/template/src/components/PinnedVideo.tsx +206 -121
- package/template/src/components/Precall.native.tsx +358 -119
- package/template/src/components/Precall.tsx +272 -138
- package/template/src/components/RTMConfigure.tsx +66 -19
- 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/SdkApiContext.tsx +161 -0
- package/template/src/components/Settings.tsx +26 -95
- package/template/src/components/SettingsView.tsx +251 -56
- package/template/src/components/Share.tsx +305 -276
- package/template/src/components/StorageContext.tsx +30 -3
- package/template/src/components/ToastComponent.tsx +8 -0
- package/template/src/components/chat-messages/useChatMessages.tsx +100 -52
- package/template/src/components/chat-ui/useChatUIControls.tsx +76 -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 +16 -11
- package/template/src/components/contexts/VideoMeetingDataContext.tsx +41 -11
- package/template/src/components/contexts/WhiteboardContext.tsx +3 -3
- package/template/src/components/livestream/LiveStreamContext.tsx +284 -50
- 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 +9 -4
- package/template/src/components/participants/AllAudienceParticipants.tsx +102 -31
- package/template/src/components/participants/AllHostParticipants.tsx +106 -35
- package/template/src/components/participants/Participant.tsx +300 -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 +396 -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 +51 -6
- package/template/src/components/precall/VideoPreview.tsx +164 -8
- package/template/src/components/precall/joinCallBtn.native.tsx +2 -2
- package/template/src/components/precall/joinCallBtn.tsx +17 -4
- package/template/src/components/precall/meetingTitle.tsx +17 -14
- package/template/src/components/precall/selectDevice.tsx +1 -21
- package/template/src/components/precall/textInput.tsx +34 -6
- package/template/src/components/precall/usePreCall.tsx +39 -1
- package/template/src/components/{meeting-info/useMeetingInfo.tsx → room-info/useRoomInfo.tsx} +34 -10
- package/template/src/components/{meeting-info/useSetMeetingInfo.tsx → room-info/useSetRoomInfo.tsx} +12 -12
- package/template/src/components/styles.ts +42 -21
- package/template/src/components/useShareLink.tsx +19 -21
- package/template/src/components/useToast.tsx +41 -0
- package/template/src/components/useUserPreference.tsx +9 -6
- package/template/src/components/useVideoCall.tsx +84 -0
- package/template/src/language/default-labels/createScreenLabels.ts +3 -3
- package/template/src/language/default-labels/joinScreenLabels.ts +2 -2
- package/template/src/language/default-labels/precallScreenLabels.ts +3 -3
- package/template/src/language/default-labels/shareLinkScreenLabels.ts +5 -5
- package/template/src/language/default-labels/videoCallScreenLabels.ts +5 -5
- package/template/src/pages/Authenticate.tsx +5 -15
- package/template/src/pages/Create.tsx +304 -191
- package/template/src/pages/Endcall.tsx +148 -0
- package/template/src/pages/Join.tsx +96 -70
- package/template/src/pages/VideoCall.tsx +179 -69
- 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 +6 -6
- package/template/src/pages/video-call/NameWithMicIcon.tsx +93 -49
- package/template/src/pages/video-call/RenderComponent.tsx +6 -30
- package/template/src/pages/video-call/SidePanelHeader.tsx +186 -0
- package/template/src/pages/video-call/VideoCallMobileView.tsx +138 -0
- package/template/src/pages/video-call/VideoCallScreen.native.tsx +37 -0
- package/template/src/pages/video-call/VideoCallScreen.tsx +109 -66
- package/template/src/pages/video-call/VideoComponent.tsx +20 -4
- package/template/src/pages/video-call/VideoRenderer.tsx +227 -61
- package/template/src/pages/video-call/index.ts +35 -7
- package/template/src/rtm/RTMEngine.ts +8 -0
- package/template/src/rtm-events/constants.ts +3 -1
- package/template/src/rtm-events-api/Events.ts +5 -4
- package/template/src/rtm-events-api/LocalEvents.ts +6 -0
- package/template/src/rtm-events-api/types.ts +5 -5
- package/template/src/subComponents/ChatBubble.tsx +125 -84
- package/template/src/subComponents/ChatContainer.tsx +280 -93
- package/template/src/subComponents/ChatInput.ios.tsx +175 -0
- package/template/src/subComponents/ChatInput.tsx +72 -115
- 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 +73 -35
- package/template/src/subComponents/LocalSwitchCamera.tsx +19 -32
- 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 +66 -68
- 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/SidePanelButtons.ts +0 -3
- package/template/src/subComponents/SidePanelHeader.tsx +112 -0
- package/template/src/subComponents/ToastConfig.tsx +150 -10
- package/template/src/subComponents/chat/ChatParticipants.tsx +188 -79
- package/template/src/subComponents/livestream/CurrentLiveStreamRequestsView.tsx +97 -34
- package/template/src/subComponents/livestream/controls/LocalRaiseHand.tsx +29 -33
- package/template/src/subComponents/livestream/controls/RemoteLiveStreamApprovedRequestRecall.tsx +8 -8
- 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 +81 -29
- package/template/src/subComponents/screenshare/ScreenshareButton.tsx +52 -70
- package/template/src/subComponents/screenshare/ScreenshareConfigure.native.tsx +23 -12
- package/template/src/subComponents/screenshare/ScreenshareConfigure.tsx +44 -19
- package/template/src/theme/index.ts +46 -0
- package/template/src/utils/PlatformWrapper.tsx +21 -0
- package/template/src/utils/SdkEvents.ts +23 -14
- package/template/src/utils/SdkMethodEvents.ts +81 -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/useActiveSpeaker.ts +42 -0
- package/template/src/utils/{useCreateMeeting.ts → useCreateRoom.ts} +19 -14
- package/template/src/utils/{useButtonTemplate.tsx → useFocus.tsx} +19 -16
- package/template/src/utils/useGetMeetingPhrase.ts +10 -10
- package/template/src/utils/useIsAudioEnabled.ts +3 -3
- package/template/src/utils/useIsHandRaised.ts +13 -0
- package/template/src/utils/useIsPSTN.ts +3 -3
- package/template/src/utils/useIsVideoEnabled.ts +3 -3
- package/template/src/utils/{useJoinMeeting.ts → useJoinRoom.ts} +27 -21
- package/template/src/utils/useMutePSTN.ts +2 -2
- package/template/src/utils/useMuteToggleLocal.ts +58 -5
- package/template/src/utils/useRemoteEndCall.ts +4 -4
- package/template/src/utils/useRemoteEndScreenshare.ts +26 -0
- package/template/src/utils/useRemoteMute.ts +7 -7
- package/template/src/utils/useRemoteRequest.ts +84 -0
- package/template/src/utils/useSwitchCamera.native.tsx +25 -0
- package/template/src/utils/useSwitchCamera.tsx +19 -0
- package/template/src/utils/useToolbar.tsx +59 -0
- package/template/web/index.html +5 -0
- package/template/webpack.commons.js +13 -8
- package/template/webpack.rsdk.config.js +1 -2
- package/template/webpack.web.config.js +1 -0
- package/template/agora-rn-uikit/src/Contexts/RenderContext.tsx +0 -10
- package/template/src/assets/icons.ts +0 -102
- package/template/src/components/chat-ui/useChatUIControl.tsx +0 -69
- package/template/src/components/participants/MeParticipant.tsx +0 -38
- package/template/src/components/participants/RemoteParticipants.tsx +0 -71
- package/template/src/pages/video-call/CustomUserContextHolder.tsx +0 -20
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import hexadecimalTransparency from '../utils/hexadecimalTransparency';
|
|
2
|
+
|
|
3
|
+
const EmphasisOpacity = {
|
|
4
|
+
high: 1,
|
|
5
|
+
medium: 0.85,
|
|
6
|
+
disabled: 0.4,
|
|
7
|
+
};
|
|
8
|
+
const EmphasisPlus = {
|
|
9
|
+
high: '',
|
|
10
|
+
medium: hexadecimalTransparency['85%'],
|
|
11
|
+
disabled: hexadecimalTransparency['40%'],
|
|
12
|
+
};
|
|
13
|
+
const FontSize: {
|
|
14
|
+
extraLarge: 32;
|
|
15
|
+
large: 20;
|
|
16
|
+
medium: 18;
|
|
17
|
+
normal: 16;
|
|
18
|
+
small: 14;
|
|
19
|
+
tiny: 12;
|
|
20
|
+
} = {
|
|
21
|
+
extraLarge: 32,
|
|
22
|
+
large: 20,
|
|
23
|
+
medium: 18,
|
|
24
|
+
normal: 16,
|
|
25
|
+
small: 14,
|
|
26
|
+
tiny: 12,
|
|
27
|
+
};
|
|
28
|
+
const FontFamily = {
|
|
29
|
+
sansPro: 'Source Sans Pro',
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const BorderRadius: {small: 4; medium: 8; large: 12; extraLarge: 20} = {
|
|
33
|
+
small: 4,
|
|
34
|
+
medium: 8,
|
|
35
|
+
large: 12,
|
|
36
|
+
extraLarge: 20,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const ThemeConfig = {
|
|
40
|
+
EmphasisOpacity,
|
|
41
|
+
EmphasisPlus,
|
|
42
|
+
FontSize,
|
|
43
|
+
FontFamily,
|
|
44
|
+
BorderRadius,
|
|
45
|
+
};
|
|
46
|
+
export default ThemeConfig;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {useState} from 'react';
|
|
3
|
+
import {isWebInternal} from './common';
|
|
4
|
+
|
|
5
|
+
const PlatformWrapper = ({children}) => {
|
|
6
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
7
|
+
return isWebInternal() ? (
|
|
8
|
+
<div
|
|
9
|
+
onMouseEnter={() => {
|
|
10
|
+
setIsHovered(true);
|
|
11
|
+
}}
|
|
12
|
+
onMouseLeave={() => {
|
|
13
|
+
setIsHovered(false);
|
|
14
|
+
}}>
|
|
15
|
+
{children(isHovered)}
|
|
16
|
+
</div>
|
|
17
|
+
) : (
|
|
18
|
+
<>{children(false)}</>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
export default PlatformWrapper;
|
|
@@ -9,24 +9,33 @@
|
|
|
9
9
|
information visit https://appbuilder.agora.io.
|
|
10
10
|
*********************************************
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
* @format
|
|
14
|
-
*/
|
|
15
|
-
type callBackType = (...args: any[]) => void;
|
|
16
|
-
import {userEventsMapInterface} from '../SDKAppWrapper';
|
|
12
|
+
|
|
17
13
|
import {createNanoEvents} from 'nanoevents';
|
|
14
|
+
import {UidType} from 'agora-rn-uikit';
|
|
15
|
+
import {IRemoteTrack} from 'agora-rtc-sdk-ng';
|
|
18
16
|
|
|
19
|
-
interface
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
export interface userEventsMapInterface {
|
|
18
|
+
leave: () => void;
|
|
19
|
+
create: (
|
|
20
|
+
hostPhrase: string,
|
|
21
|
+
attendeePhrase?: string,
|
|
22
|
+
pstnNumer?: {
|
|
23
|
+
number: string;
|
|
24
|
+
pin: string;
|
|
25
|
+
},
|
|
26
|
+
) => void;
|
|
27
|
+
'ready-to-join': (meetingTitle: string, devices: MediaDeviceInfo[]) => void;
|
|
28
|
+
join: (
|
|
29
|
+
meetingTitle: string,
|
|
30
|
+
devices: MediaDeviceInfo[],
|
|
31
|
+
isHost: boolean,
|
|
27
32
|
) => void;
|
|
33
|
+
'rtc-user-published': (uid: UidType, trackType: 'audio' | 'video') => void;
|
|
34
|
+
'rtc-user-unpublished': (uid: UidType, trackType: 'audio' | 'video') => void;
|
|
35
|
+
'rtc-user-joined': (uid: UidType) => void;
|
|
36
|
+
'rtc-user-left': (uid: UidType) => void;
|
|
28
37
|
}
|
|
29
38
|
|
|
30
|
-
const SDKEvents = createNanoEvents<
|
|
39
|
+
const SDKEvents = createNanoEvents<userEventsMapInterface>();
|
|
31
40
|
|
|
32
41
|
export default SDKEvents;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import {SdkMethodEvents} from '../SDKAppWrapper';
|
|
2
|
+
import {createNanoEvents, Emitter} from 'nanoevents';
|
|
3
|
+
|
|
4
|
+
type EventParameterHelper<T extends keyof SdkMethodEvents> = Parameters<
|
|
5
|
+
SdkMethodEvents[T]
|
|
6
|
+
>;
|
|
7
|
+
|
|
8
|
+
type EventReturnTypeHelper<T extends keyof SdkMethodEvents> = ReturnType<
|
|
9
|
+
SdkMethodEvents[T]
|
|
10
|
+
>;
|
|
11
|
+
|
|
12
|
+
type EventKeyNameHelper = keyof SdkMethodEvents;
|
|
13
|
+
|
|
14
|
+
type injectAsync<T extends (...p: any) => any> = (
|
|
15
|
+
res: (result?: ReturnType<T> | PromiseLike<ReturnType<T>>) => void,
|
|
16
|
+
rej: (reason?: any) => void,
|
|
17
|
+
...params: Parameters<T>
|
|
18
|
+
) => void;
|
|
19
|
+
|
|
20
|
+
export type _InternalSDKMethodEventsMap = {
|
|
21
|
+
[K in EventKeyNameHelper]: injectAsync<SdkMethodEvents[K]>;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
type emitCacheType = {
|
|
25
|
+
[K in EventKeyNameHelper]?: Parameters<_InternalSDKMethodEventsMap[K]>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
type emitCacheEnabledType = {
|
|
29
|
+
[K in EventKeyNameHelper]?: boolean;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
class SDKMethodEvents {
|
|
33
|
+
constructor() {
|
|
34
|
+
this.emitter = createNanoEvents();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
emitter: Emitter;
|
|
38
|
+
|
|
39
|
+
emitCache: emitCacheType = {};
|
|
40
|
+
emitCacheDisabled: emitCacheEnabledType = {};
|
|
41
|
+
|
|
42
|
+
async emit<T extends EventKeyNameHelper>(
|
|
43
|
+
event: T,
|
|
44
|
+
...params: EventParameterHelper<T>
|
|
45
|
+
) {
|
|
46
|
+
if (this.emitCache[event]) {
|
|
47
|
+
throw new Error(`Event: ${event} already in callstack`);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const result = await new Promise<EventReturnTypeHelper<T>>((res, rej) => {
|
|
51
|
+
this.emitCache[event] = [res, rej, ...params] as any;
|
|
52
|
+
this.emitter.emit(event, res, rej, ...params);
|
|
53
|
+
})
|
|
54
|
+
.then((res) => {
|
|
55
|
+
delete this.emitCache[event];
|
|
56
|
+
return res;
|
|
57
|
+
})
|
|
58
|
+
.catch((e) => {
|
|
59
|
+
delete this.emitCache[event];
|
|
60
|
+
throw e;
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
on<T extends EventKeyNameHelper>(
|
|
67
|
+
event: T,
|
|
68
|
+
callback: _InternalSDKMethodEventsMap[T],
|
|
69
|
+
) {
|
|
70
|
+
const unsub = this.emitter.on(event, callback);
|
|
71
|
+
if (this.emitCache[event] && !this.emitCacheDisabled[event]) {
|
|
72
|
+
this.emitter.emit(event, ...this.emitCache[event]);
|
|
73
|
+
}
|
|
74
|
+
this.emitCacheDisabled[event] = true;
|
|
75
|
+
return unsub;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const SDKMethodEventsManager = new SDKMethodEvents();
|
|
80
|
+
|
|
81
|
+
export default SDKMethodEventsManager;
|
|
@@ -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,42 @@
|
|
|
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 {useContent} from 'customization-api';
|
|
13
|
+
import {useEffect, useState} from 'react';
|
|
14
|
+
import LocalEventEmitter, {
|
|
15
|
+
LocalEventsEnum,
|
|
16
|
+
} from '../rtm-events-api/LocalEvents';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Returns a function that checks whether the given uid is a active speaker and returns true/false
|
|
20
|
+
* @returns function
|
|
21
|
+
*/
|
|
22
|
+
function useActiveSpeaker() {
|
|
23
|
+
const [activeSpeaker, setActiveSpeaker] = useState(undefined);
|
|
24
|
+
const {defaultContent} = useContent();
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
const listenActiveSpeaker = (data) => {
|
|
27
|
+
setActiveSpeaker(data);
|
|
28
|
+
};
|
|
29
|
+
LocalEventEmitter.on(LocalEventsEnum.ACTIVE_SPEAKER, listenActiveSpeaker);
|
|
30
|
+
return () => {
|
|
31
|
+
LocalEventEmitter.off(
|
|
32
|
+
LocalEventsEnum.ACTIVE_SPEAKER,
|
|
33
|
+
listenActiveSpeaker,
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
}, []);
|
|
37
|
+
return activeSpeaker && defaultContent[activeSpeaker].audio
|
|
38
|
+
? activeSpeaker
|
|
39
|
+
: undefined;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default useActiveSpeaker;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {gql, useMutation} from '@apollo/client';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import {RoomInfoContextInterface} from '../components/room-info/useRoomInfo';
|
|
3
|
+
import {useSetRoomInfo} from '../components/room-info/useSetRoomInfo';
|
|
4
4
|
import SDKEvents from '../utils/SdkEvents';
|
|
5
5
|
|
|
6
6
|
const CREATE_CHANNEL = gql`
|
|
@@ -30,12 +30,17 @@ const CREATE_CHANNEL = gql`
|
|
|
30
30
|
/**
|
|
31
31
|
* Returns an asynchronous function to create a meeting with the given options.
|
|
32
32
|
*/
|
|
33
|
-
export
|
|
33
|
+
export type createRoomFun = (
|
|
34
|
+
roomTitle: string,
|
|
35
|
+
enablePSTN?: boolean,
|
|
36
|
+
) => Promise<void>;
|
|
37
|
+
export default function useCreateRoom(): createRoomFun {
|
|
34
38
|
const [createChannel, {error}] = useMutation(CREATE_CHANNEL);
|
|
35
|
-
const {
|
|
39
|
+
const {setRoomInfo} = useSetRoomInfo();
|
|
36
40
|
return async (
|
|
37
41
|
roomTitle: string,
|
|
38
42
|
enablePSTN?: boolean,
|
|
43
|
+
//isSeparateHostLink will be for internal usage since backend integration is not there
|
|
39
44
|
isSeparateHostLink?: boolean,
|
|
40
45
|
) => {
|
|
41
46
|
const res = await createChannel({
|
|
@@ -49,37 +54,37 @@ export default function useCreateMeeting() {
|
|
|
49
54
|
throw error;
|
|
50
55
|
}
|
|
51
56
|
if (res && res?.data && res?.data?.createChannel) {
|
|
52
|
-
let
|
|
57
|
+
let roomInfo: Partial<RoomInfoContextInterface['data']> = {
|
|
53
58
|
roomId: {
|
|
54
59
|
attendee: '',
|
|
55
60
|
},
|
|
56
61
|
};
|
|
57
62
|
if (res?.data?.createChannel?.passphrase?.view) {
|
|
58
|
-
|
|
63
|
+
roomInfo.roomId.attendee = res.data.createChannel.passphrase.view;
|
|
59
64
|
}
|
|
60
65
|
if (res?.data?.createChannel?.passphrase?.host) {
|
|
61
|
-
|
|
66
|
+
roomInfo.roomId.host = res.data.createChannel.passphrase.host;
|
|
62
67
|
}
|
|
63
68
|
if (enablePSTN === true && res?.data?.createChannel?.pstn) {
|
|
64
|
-
|
|
69
|
+
roomInfo.pstn = {
|
|
65
70
|
number: res.data.createChannel.pstn.number,
|
|
66
71
|
pin: res.data.createChannel.pstn.dtmf,
|
|
67
72
|
};
|
|
68
73
|
}
|
|
69
|
-
|
|
74
|
+
setRoomInfo({
|
|
70
75
|
data: {
|
|
71
76
|
isHost: true,
|
|
72
77
|
isSeparateHostLink: isSeparateHostLink ? true : false,
|
|
73
78
|
meetingTitle: roomTitle,
|
|
74
|
-
roomId:
|
|
75
|
-
pstn:
|
|
79
|
+
roomId: roomInfo?.roomId,
|
|
80
|
+
pstn: roomInfo?.pstn,
|
|
76
81
|
},
|
|
77
82
|
});
|
|
78
83
|
SDKEvents.emit(
|
|
79
84
|
'create',
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
85
|
+
roomInfo.roomId.host,
|
|
86
|
+
roomInfo.roomId.attendee,
|
|
87
|
+
roomInfo?.pstn,
|
|
83
88
|
);
|
|
84
89
|
} else {
|
|
85
90
|
throw new Error(`An error occurred in parsing the channel data.`);
|