agora-appbuilder-core 2.2.0 → 2.3.0-beta.0

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.
Files changed (280) hide show
  1. package/Readme.md +7 -1
  2. package/package.json +4 -3
  3. package/template/Gulpfile.js +306 -87
  4. package/template/_gitignore +4 -1
  5. package/template/_package-lock.json +2297 -2533
  6. package/template/agora-rn-uikit/.git/HEAD +1 -1
  7. package/template/agora-rn-uikit/.git/config +3 -3
  8. package/template/agora-rn-uikit/.git/index +0 -0
  9. package/template/agora-rn-uikit/.git/logs/HEAD +2 -2
  10. package/template/agora-rn-uikit/.git/logs/refs/heads/master +1 -1
  11. package/template/agora-rn-uikit/.git/logs/refs/heads/release/fpe-1.0.0 +1 -0
  12. package/template/agora-rn-uikit/.git/logs/refs/remotes/origin/HEAD +1 -1
  13. package/template/agora-rn-uikit/.git/objects/pack/pack-f274a85fccfc9b5112d154bb3b6d34cb4b8dedde.idx +0 -0
  14. package/template/agora-rn-uikit/.git/objects/pack/{pack-0061d00cd98162a329a32b537488a35d0abeb069.pack → pack-f274a85fccfc9b5112d154bb3b6d34cb4b8dedde.pack} +0 -0
  15. package/template/agora-rn-uikit/.git/packed-refs +5 -1
  16. package/template/agora-rn-uikit/.git/refs/heads/release/fpe-1.0.0 +1 -0
  17. package/template/agora-rn-uikit/src/AgoraUIKit.tsx +23 -20
  18. package/template/agora-rn-uikit/src/Contexts/LocalUserContext.tsx +13 -8
  19. package/template/agora-rn-uikit/src/Contexts/PropsContext.tsx +25 -9
  20. package/template/agora-rn-uikit/src/Contexts/RenderContext.tsx +10 -0
  21. package/template/agora-rn-uikit/src/Contexts/RtcContext.tsx +11 -5
  22. package/template/agora-rn-uikit/src/Controls/BtnTemplate.tsx +6 -2
  23. package/template/agora-rn-uikit/src/Controls/ImageIcon.tsx +1 -1
  24. package/template/agora-rn-uikit/src/Controls/Local/EndCall.tsx +6 -2
  25. package/template/agora-rn-uikit/src/Controls/Local/LocalAudioMute.tsx +2 -2
  26. package/template/agora-rn-uikit/src/Controls/Local/LocalVideoMute.tsx +2 -2
  27. package/template/agora-rn-uikit/src/Controls/Local/SwitchCamera.tsx +6 -2
  28. package/template/agora-rn-uikit/src/Controls/LocalControls.tsx +11 -6
  29. package/template/agora-rn-uikit/src/Controls/Remote/RemoteAudioMute.tsx +10 -6
  30. package/template/agora-rn-uikit/src/Controls/Remote/RemoteSwap.tsx +7 -6
  31. package/template/agora-rn-uikit/src/Controls/Remote/RemoteVideoMute.tsx +6 -5
  32. package/template/agora-rn-uikit/src/Controls/RemoteControls.tsx +3 -3
  33. package/template/agora-rn-uikit/src/Reducer/LocalMuteAudio.ts +16 -13
  34. package/template/agora-rn-uikit/src/Reducer/LocalMuteVideo.ts +16 -13
  35. package/template/agora-rn-uikit/src/Reducer/RemoteAudioStateChanged.ts +13 -13
  36. package/template/agora-rn-uikit/src/Reducer/RemoteVideoStateChanged.ts +16 -13
  37. package/template/agora-rn-uikit/src/Reducer/UpdateDualStreamMode.ts +28 -31
  38. package/template/agora-rn-uikit/src/Reducer/UserJoined.ts +48 -35
  39. package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteAudio.ts +11 -13
  40. package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteVideo.ts +11 -13
  41. package/template/agora-rn-uikit/src/Reducer/UserOffline.ts +18 -15
  42. package/template/agora-rn-uikit/src/Rtc/Create.tsx +14 -2
  43. package/template/agora-rn-uikit/src/Rtc/Join.tsx +19 -3
  44. package/template/agora-rn-uikit/src/RtcConfigure.tsx +161 -44
  45. package/template/agora-rn-uikit/src/Utils/useLocalUid.ts +8 -0
  46. package/template/agora-rn-uikit/src/Views/MaxVideoView.native.tsx +8 -6
  47. package/template/agora-rn-uikit/src/Views/MaxVideoView.tsx +8 -6
  48. package/template/agora-rn-uikit/src/Views/MinVideoView.tsx +18 -9
  49. package/template/agora-rn-uikit/src/index.ts +12 -12
  50. package/template/babel.config.js +17 -1
  51. package/template/bridge/rtc/webNg/RtcEngine.ts +34 -28
  52. package/template/bridge/rtc/webNg/SurfaceView.tsx +3 -2
  53. package/template/bridge/rtc/webNg/Types.ts +14 -0
  54. package/template/bridge/rtc/webNg/index.ts +5 -2
  55. package/template/bridge/rtm/web/index.ts +13 -7
  56. package/template/electron-builder.js +3 -2
  57. package/template/esbuild.rsdk.go +226 -0
  58. package/template/{src/subComponents/LayoutEnum.tsx → esbuildConfigTransform.js} +1 -5
  59. package/template/fpe-api/components.ts +42 -0
  60. package/template/fpe-api/context.ts +45 -0
  61. package/template/fpe-api/fpeEvents.ts +9 -0
  62. package/template/fpe-api/index.ts +21 -0
  63. package/template/fpe-api/install.ts +128 -0
  64. package/template/fpe-api/typeDefinition.ts +143 -0
  65. package/template/fpe-api/useFpe.tsx +35 -0
  66. package/template/fpe-api/utils.ts +62 -0
  67. package/template/fpe-implementation/createHook.ts +33 -0
  68. package/template/fpe-implementation/dummyFpe.ts +17 -0
  69. package/template/fpe-implementation/index.ts +1 -0
  70. package/template/fpe-todo.txt +14 -0
  71. package/template/fpe.config.js +25 -0
  72. package/template/global.d.ts +4 -0
  73. package/template/index.rsdk.tsx +27 -0
  74. package/template/index.wsdk.tsx +27 -0
  75. package/template/package-lock.json +2297 -2533
  76. package/template/package.json +28 -12
  77. package/template/react-native-toast-message/src/index.js +9 -10
  78. package/template/react-native-toast-message/src/index.wsdk.js +419 -0
  79. package/template/src/App.tsx +97 -65
  80. package/template/src/AppWrapper.tsx +79 -0
  81. package/template/src/SDKAppWrapper.tsx +67 -0
  82. package/template/src/atoms/PrimaryButton.tsx +14 -8
  83. package/template/src/atoms/TextInput.tsx +13 -5
  84. package/template/src/components/Chat.tsx +171 -139
  85. package/template/src/components/ChatContext.ts +14 -22
  86. package/template/src/components/ColorConfigure.tsx +2 -2
  87. package/template/src/components/Controls.native.tsx +72 -62
  88. package/template/src/components/Controls.tsx +90 -69
  89. package/template/src/components/DeviceConfigure.tsx +1 -1
  90. package/template/src/components/DeviceContext.tsx +14 -7
  91. package/template/src/components/GraphQLProvider.tsx +9 -2
  92. package/template/src/components/GridVideo.tsx +20 -159
  93. package/template/src/components/HostControlView.tsx +54 -15
  94. package/template/src/components/Navbar.tsx +408 -157
  95. package/template/src/components/NetworkQualityContext.tsx +29 -22
  96. package/template/src/components/ParticipantsView.tsx +97 -119
  97. package/template/src/components/PinnedVideo.tsx +41 -188
  98. package/template/src/components/Precall.native.tsx +131 -97
  99. package/template/src/components/Precall.tsx +193 -158
  100. package/template/src/components/RTMConfigure.tsx +320 -398
  101. package/template/src/components/Router.sdk.ts +20 -0
  102. package/template/src/components/SessionContext.tsx +6 -3
  103. package/template/src/components/Settings.native.tsx +3 -0
  104. package/template/src/components/Settings.tsx +65 -31
  105. package/template/src/components/SettingsView.tsx +14 -8
  106. package/template/src/components/Share.tsx +188 -220
  107. package/template/src/components/StorageContext.tsx +5 -5
  108. package/template/src/components/StoreToken.tsx +5 -1
  109. package/template/src/components/chat-messages/useChatMessages.tsx +202 -0
  110. package/template/src/components/chat-notification/useChatNotification.tsx +78 -0
  111. package/template/src/components/chat-ui/useChatUIControl.tsx +66 -0
  112. package/template/src/components/common/Error.tsx +54 -0
  113. package/template/src/components/common/Logo.tsx +35 -0
  114. package/template/src/components/common/index.tsx +8 -0
  115. package/template/src/components/contexts/LiveStreamDataContext.tsx +79 -0
  116. package/template/src/components/contexts/ScreenShareContext.tsx +47 -0
  117. package/template/src/components/contexts/WhiteboardContext.tsx +59 -0
  118. package/template/src/components/dimension/DimensionContext.ts +27 -0
  119. package/template/src/components/dimension/DimensionProvider.tsx +34 -0
  120. package/template/src/components/livestream/LiveStreamContext.tsx +293 -272
  121. package/template/src/components/livestream/Types.ts +26 -7
  122. package/template/src/components/livestream/index.ts +13 -2
  123. package/template/src/components/livestream/views/LiveStreamControls.tsx +5 -1
  124. package/template/src/components/meeting-info/useMeetingInfo.tsx +63 -0
  125. package/template/src/components/meeting-info/useSetMeetingInfo.tsx +38 -0
  126. package/template/src/components/participants/AllAudienceParticipants.tsx +26 -21
  127. package/template/src/components/participants/AllHostParticipants.tsx +36 -53
  128. package/template/src/components/participants/MeParticipant.tsx +9 -10
  129. package/template/src/components/participants/ParticipantName.tsx +2 -1
  130. package/template/src/components/participants/RemoteParticipants.tsx +3 -3
  131. package/template/src/components/precall/LocalMute.native.tsx +91 -0
  132. package/template/src/components/precall/LocalMute.tsx +90 -0
  133. package/template/src/components/precall/VideoPreview.native.tsx +35 -0
  134. package/template/src/components/precall/VideoPreview.tsx +33 -0
  135. package/template/src/components/precall/index.tsx +28 -0
  136. package/template/src/components/precall/joinCallBtn.native.tsx +69 -0
  137. package/template/src/components/precall/joinCallBtn.tsx +91 -0
  138. package/template/src/components/precall/meetingTitle.tsx +26 -0
  139. package/template/src/components/precall/selectDevice.tsx +46 -0
  140. package/template/src/components/precall/textInput.tsx +43 -0
  141. package/template/src/components/precall/usePreCall.tsx +41 -0
  142. package/template/src/components/styles.ts +20 -3
  143. package/template/src/components/useShareLink.tsx +222 -0
  144. package/template/src/components/useWakeLock.tsx +3 -3
  145. package/template/src/custom-events/CustomEvents.ts +197 -0
  146. package/template/src/custom-events/index.tsx +4 -0
  147. package/template/src/custom-events/types.ts +51 -0
  148. package/template/src/language/default-labels/commonLabels.ts +21 -0
  149. package/template/src/language/default-labels/createScreenLabels.ts +22 -0
  150. package/template/src/language/default-labels/index.ts +38 -0
  151. package/template/src/language/default-labels/joinScreenLabels.ts +13 -0
  152. package/template/src/language/default-labels/precallScreenLabels.ts +33 -0
  153. package/template/src/language/default-labels/shareLinkScreenLabels.ts +44 -0
  154. package/template/src/language/default-labels/videoCallScreenLabels.ts +189 -0
  155. package/template/src/language/i18nTypes.ts +10 -0
  156. package/template/src/language/index.ts +18 -0
  157. package/template/src/language/useLanguage.tsx +92 -0
  158. package/template/src/pages/Authenticate.tsx +21 -15
  159. package/template/src/pages/Create.tsx +176 -159
  160. package/template/src/pages/Join.tsx +44 -32
  161. package/template/src/pages/VideoCall.tsx +134 -406
  162. package/template/src/pages/create/useCreate.tsx +37 -0
  163. package/template/src/pages/video-call/CustomLayout.ts +17 -0
  164. package/template/src/pages/video-call/CustomUserContextHolder.tsx +12 -0
  165. package/template/src/pages/video-call/DefaultLayouts.ts +65 -0
  166. package/template/src/pages/video-call/NameWithMicStatus.tsx +62 -0
  167. package/template/src/pages/video-call/RenderComponent.tsx +52 -0
  168. package/template/src/pages/video-call/VideoCallScreen.tsx +191 -0
  169. package/template/src/pages/video-call/VideoComponent.tsx +34 -0
  170. package/template/src/pages/video-call/VideoRenderer.tsx +86 -0
  171. package/template/src/pages/video-call/index.ts +20 -0
  172. package/template/src/rtm/RTMEngine.ts +58 -0
  173. package/template/src/rtm/utils.ts +28 -0
  174. package/template/src/rtm-events/EventUtils.ts +268 -0
  175. package/template/src/rtm-events/EventsQueue.ts +38 -0
  176. package/template/src/rtm-events/constants.ts +40 -0
  177. package/template/src/rtm-events/index.tsx +8 -0
  178. package/template/src/rtm-events/types.ts +7 -0
  179. package/template/src/subComponents/ChatBubble.tsx +18 -11
  180. package/template/src/subComponents/ChatContainer.tsx +78 -29
  181. package/template/src/subComponents/ChatInput.tsx +146 -70
  182. package/template/src/subComponents/CopyJoinInfo.tsx +52 -67
  183. package/template/src/subComponents/Error.tsx +35 -24
  184. package/template/src/subComponents/LanguageSelector.tsx +85 -0
  185. package/template/src/subComponents/LayoutIconDropdown.native.tsx +163 -0
  186. package/template/src/subComponents/LayoutIconDropdown.tsx +198 -0
  187. package/template/src/subComponents/LocalAudioMute.tsx +52 -30
  188. package/template/src/subComponents/LocalEndCall.tsx +52 -0
  189. package/template/src/subComponents/LocalSwitchCamera.tsx +61 -0
  190. package/template/src/subComponents/LocalVideoMute.tsx +48 -30
  191. package/template/src/subComponents/LogoutButton.tsx +20 -5
  192. package/template/src/subComponents/NetworkQualityPill.tsx +43 -13
  193. package/template/src/subComponents/OpenInNativeButton.tsx +3 -2
  194. package/template/src/subComponents/Recording.tsx +46 -138
  195. package/template/src/subComponents/RemoteAudioMute.tsx +30 -34
  196. package/template/src/subComponents/RemoteEndCall.tsx +18 -7
  197. package/template/src/subComponents/RemoteVideoMute.tsx +17 -9
  198. package/template/src/subComponents/ScreenShareNotice.tsx +40 -40
  199. package/template/src/subComponents/SelectDevice.tsx +88 -45
  200. package/template/src/subComponents/SelectOAuth.tsx +30 -6
  201. package/template/src/subComponents/SidePanelButtons.ts +39 -0
  202. package/template/src/subComponents/TextWithTooltip.native.tsx +2 -1
  203. package/template/src/subComponents/TextWithTooltip.tsx +15 -20
  204. package/template/src/subComponents/chat/ChatParticipants.tsx +31 -32
  205. package/template/src/subComponents/livestream/ApprovedLiveStreamControlsView.tsx +7 -3
  206. package/template/src/subComponents/livestream/CurrentLiveStreamRequestsView.tsx +32 -18
  207. package/template/src/subComponents/livestream/controls/LocalRaiseHand.tsx +22 -8
  208. package/template/src/subComponents/livestream/controls/RemoteLiveStreamApprovedRequestRecall.tsx +12 -7
  209. package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestApprove.tsx +24 -27
  210. package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestReject.tsx +23 -26
  211. package/template/src/subComponents/livestream/index.ts +10 -2
  212. package/template/src/subComponents/recording/useRecording.tsx +209 -0
  213. package/template/src/subComponents/recording/useRecordingLayoutQuery.tsx +64 -0
  214. package/template/src/subComponents/screenshare/ScreenshareButton.native.tsx +18 -0
  215. package/template/src/subComponents/screenshare/ScreenshareButton.tsx +59 -31
  216. package/template/src/subComponents/screenshare/ScreenshareConfigure.native.tsx +57 -52
  217. package/template/src/subComponents/screenshare/ScreenshareConfigure.tsx +97 -138
  218. package/template/src/subComponents/screenshare/useScreenshare.tsx +29 -0
  219. package/template/src/subComponents/toastConfig.tsx +25 -20
  220. package/template/src/utils/IsAttendeeUser.ts +34 -0
  221. package/template/src/utils/SdkEvents.ts +68 -0
  222. package/template/src/utils/common.tsx +40 -0
  223. package/template/src/utils/eventEmitter.ts +29 -0
  224. package/template/src/utils/getMeetingInvite.ts +30 -0
  225. package/template/src/utils/index.tsx +11 -2
  226. package/template/src/utils/isAudioEnabled.ts +29 -0
  227. package/template/src/utils/isHostUser.ts +33 -0
  228. package/template/src/utils/isMobileOrTablet.native.ts +5 -0
  229. package/template/src/utils/{mobileWebTest.tsx → isMobileOrTablet.ts} +5 -2
  230. package/template/src/utils/isPSTNUser.ts +30 -0
  231. package/template/src/utils/isSDK.sdk.ts +5 -0
  232. package/template/src/utils/isSDK.ts +5 -0
  233. package/template/src/utils/isScreenShareUser.ts +31 -0
  234. package/template/src/utils/isVideoEnabled.ts +29 -0
  235. package/template/src/utils/useButtonTemplate.tsx +43 -0
  236. package/template/src/utils/useCreateMeeting.ts +74 -0
  237. package/template/src/utils/useGetLiveStreamingRequests.ts +24 -0
  238. package/template/src/utils/useGetMeetingPhrase.ts +68 -0
  239. package/template/src/utils/useGetName.ts +20 -0
  240. package/template/src/{subComponents/screenshare/ScreenshareContext.tsx → utils/useGroupMessages.ts} +10 -7
  241. package/template/src/utils/useJoinMeeting.ts +120 -0
  242. package/template/src/utils/useLayout.tsx +40 -0
  243. package/template/src/utils/useLiveStreamingUids.ts +26 -0
  244. package/template/src/utils/useMutePSTN.ts +43 -0
  245. package/template/src/utils/useMuteToggleLocal.ts +109 -0
  246. package/template/src/utils/useNavParams.ts +6 -0
  247. package/template/src/utils/useNavigateTo.ts +8 -0
  248. package/template/src/utils/usePrivateMessages.ts +33 -0
  249. package/template/src/utils/useRemoteEndCall.ts +27 -0
  250. package/template/src/utils/useRemoteMute.ts +64 -0
  251. package/template/src/utils/useSendControlMessage.ts +51 -0
  252. package/template/src/utils/useSendMessage.ts +40 -0
  253. package/template/src/utils/useSetName.ts +20 -0
  254. package/template/src/utils/useSetUnreadMessageCount.ts +43 -0
  255. package/template/src/utils/useSidePanel.tsx +41 -0
  256. package/template/src/utils/useString.ts +61 -0
  257. package/template/src/utils/useUnreadMessageCount.ts +50 -0
  258. package/template/src/utils/useUserList.ts +26 -0
  259. package/template/tsconfig.json +4 -4
  260. package/template/tsconfig_fpeApi.json +103 -0
  261. package/template/tsconfig_rsdk_index.json +105 -0
  262. package/template/tsconfig_wsdk_index.json +104 -0
  263. package/template/webpack.commons.js +40 -16
  264. package/template/webpack.main.config.js +2 -1
  265. package/template/webpack.renderer.config.js +1 -1
  266. package/template/webpack.rsdk.config.js +33 -0
  267. package/template/webpack.ts.config.js +89 -0
  268. package/template/webpack.web.config.js +8 -1
  269. package/template/webpack.wsdk.config.js +34 -0
  270. package/template/agora-rn-uikit/.git/logs/refs/heads/ab-dev-auto +0 -1
  271. package/template/agora-rn-uikit/.git/objects/pack/pack-0061d00cd98162a329a32b537488a35d0abeb069.idx +0 -0
  272. package/template/agora-rn-uikit/.git/refs/heads/ab-dev-auto +0 -1
  273. package/template/agora-rn-uikit/src/Contexts/MaxUidContext.tsx +0 -7
  274. package/template/agora-rn-uikit/src/Contexts/MinUidContext.tsx +0 -8
  275. package/template/src/components/participants/context/ParticipantContext.tsx +0 -97
  276. package/template/src/subComponents/ScreenshareButton.tsx +0 -257
  277. package/template/src/subComponents/SwitchCamera.tsx +0 -35
  278. package/template/src/utils/hasBrandLogo.tsx +0 -3
  279. package/template/src/utils/mobileWebTest.native.tsx +0 -5
  280. package/template/src/utils/shouldAuthenticate.tsx +0 -7
@@ -10,68 +10,225 @@
10
10
  *********************************************
11
11
  */
12
12
  import React, {useContext, useState} from 'react';
13
- import {View, Text, Platform, StyleSheet, Dimensions} from 'react-native';
13
+ import {View, Text, StyleSheet, ViewStyle, TextStyle} from 'react-native';
14
14
  import icons from '../assets/icons';
15
- import Settings from './Settings';
16
- import CopyJoinInfo from '../subComponents/CopyJoinInfo';
15
+ import Settings, {
16
+ SettingsWithViewWrapper,
17
+ SettingsIconButtonProps,
18
+ } from './Settings';
19
+ import CopyJoinInfo, {CopyJoinInfoProps} from '../subComponents/CopyJoinInfo';
17
20
  import {SidePanelType} from '../subComponents/SidePanelEnum';
18
21
  import {navHolder} from '../../theme.json';
19
- import Layout from '../subComponents/LayoutEnum';
20
22
  import ChatContext from '../components/ChatContext';
21
- import mobileAndTabletCheck from '../utils/mobileWebTest';
22
- import {BtnTemplate} from '../../agora-rn-uikit';
23
- import {ImageIcon} from '../../agora-rn-uikit';
23
+ import isMobileOrTablet from '../utils/isMobileOrTablet';
24
+ import {
25
+ BtnTemplate,
26
+ BtnTemplateInterface,
27
+ ImageIcon,
28
+ } from '../../agora-rn-uikit';
24
29
  import LiveStreamContext from './livestream';
25
30
  import {numFormatter} from '../utils/index';
31
+ import {useLayout} from '../utils/useLayout';
32
+ import {useChatNotification} from '../components/chat-notification/useChatNotification';
33
+ import useCustomLayout from '../pages/video-call/CustomLayout';
34
+ import {isIOS, isValidReactComponent, isWeb} from '../utils/common';
35
+ import {useChangeDefaultLayout} from '../pages/video-call/DefaultLayouts';
36
+ import {useRecording} from '../subComponents/recording/useRecording';
37
+ import LayoutIconDropdown from '../subComponents/LayoutIconDropdown';
38
+ import DimensionContext from './dimension/DimensionContext';
39
+ import {useString} from '../utils/useString';
40
+ import {useMeetingInfo} from './meeting-info/useMeetingInfo';
41
+ import {useSidePanel} from '../utils/useSidePanel';
42
+ import {useChatUIControl} from './chat-ui/useChatUIControl';
43
+ import {
44
+ ButtonTemplateName,
45
+ useButtonTemplate,
46
+ } from '../utils/useButtonTemplate';
47
+ import Styles from './styles';
26
48
 
27
- const Navbar = (props: any) => {
28
- const {messageStore, onlineUsersCount} = useContext(ChatContext);
29
- const {isPendingRequestToReview, setLastCheckedRequestTimestamp} =
30
- useContext(LiveStreamContext);
49
+ const RenderSeparator = () => {
50
+ const {getDimensionData} = useContext(DimensionContext);
51
+ const {isDesktop} = getDimensionData();
52
+ return isWeb && isDesktop ? (
53
+ <View style={style.navItem}>
54
+ <View style={style.navItemSeparator}></View>
55
+ </View>
56
+ ) : (
57
+ <View style={{marginHorizontal: 2}}></View>
58
+ );
59
+ };
60
+
61
+ const ParticipantsCountView = () => {
62
+ const {onlineUsersCount} = useContext(ChatContext);
63
+ return (
64
+ <>
65
+ {onlineUsersCount !== 0 && (
66
+ <View style={[style.navItem, {justifyContent: 'center'}]}>
67
+ <View style={style.chip}>
68
+ {onlineUsersCount > 0 && (
69
+ <Text style={style.chipText}>
70
+ {numFormatter(onlineUsersCount)}
71
+ </Text>
72
+ )}
73
+ </View>
74
+ </View>
75
+ )}
76
+ </>
77
+ );
78
+ };
31
79
 
80
+ interface ParticipantsIconButtonInterface {
81
+ liveStreamingRequestAlertIconPosition?: {
82
+ top?: number;
83
+ right?: number;
84
+ left?: number;
85
+ bottom?: number;
86
+ };
87
+ buttonTemplateName?: ButtonTemplateName;
88
+ render?: (
89
+ onPress: () => void,
90
+ isPanelActive: boolean,
91
+ buttonTemplateName?: ButtonTemplateName,
92
+ ) => JSX.Element;
93
+ }
94
+ const ParticipantsIconButton = (props: ParticipantsIconButtonInterface) => {
32
95
  const {
33
- recordingActive,
34
- sidePanel,
35
- setSidePanel,
36
- layout,
37
- setLayout,
38
- pendingMessageLength,
39
- setLastCheckedPublicState,
40
- isHost,
41
- title,
96
+ liveStreamingRequestAlertIconPosition = {
97
+ top: isWeb ? -10 : 2,
98
+ left: undefined,
99
+ right: undefined,
100
+ bottom: undefined,
101
+ },
42
102
  } = props;
43
- const [dim, setDim] = useState([
44
- Dimensions.get('window').width,
45
- Dimensions.get('window').height,
46
- Dimensions.get('window').width > Dimensions.get('window').height,
47
- ]);
48
- let onLayout = (e: any) => {
49
- setDim([e.nativeEvent.layout.width, e.nativeEvent.layout.height]);
103
+ const {sidePanel, setSidePanel} = useSidePanel();
104
+ const {isPendingRequestToReview, setLastCheckedRequestTimestamp} =
105
+ useContext(LiveStreamContext);
106
+ //commented for v1 release
107
+ //const participantsLabel = useString('participantsLabel')();
108
+ const participantsLabel = 'Participants';
109
+ const defaultTemplateValue = useButtonTemplate().buttonTemplateName;
110
+ const {buttonTemplateName = defaultTemplateValue} = props;
111
+ const isPanelActive = sidePanel === SidePanelType.Participants;
112
+ const onPress = () => {
113
+ isPanelActive
114
+ ? setSidePanel(SidePanelType.None)
115
+ : setSidePanel(SidePanelType.Participants);
116
+ $config.EVENT_MODE && $config.RAISE_HAND;
117
+ setLastCheckedRequestTimestamp(new Date().getTime());
118
+ };
119
+ let btnTemplateProps: BtnTemplateInterface = {
120
+ onPress: onPress,
121
+ name: isPanelActive ? 'participantFilledIcon' : 'participantIcon',
50
122
  };
51
- const isDesktop = dim[0] > 1224;
52
123
 
53
- const renderSeparator = () => {
54
- return Platform.OS === 'web' && isDesktop ? (
55
- <View style={style.navItem}>
56
- <View style={style.navItemSeparator}></View>
57
- </View>
58
- ) : (
59
- <View style={{marginHorizontal: 2}}></View>
60
- );
124
+ if (buttonTemplateName === ButtonTemplateName.bottomBar) {
125
+ btnTemplateProps.btnText = participantsLabel;
126
+ btnTemplateProps.style = Styles.localButtonWithoutBG as Object;
127
+ } else {
128
+ btnTemplateProps.style = style.btnHolder;
129
+ }
130
+ return props?.render ? (
131
+ props.render(onPress, isPanelActive, buttonTemplateName)
132
+ ) : (
133
+ <>
134
+ <BtnTemplate {...btnTemplateProps} />
135
+ {$config.EVENT_MODE && $config.RAISE_HAND && isPendingRequestToReview && (
136
+ <View
137
+ style={{
138
+ position: 'absolute',
139
+ top: liveStreamingRequestAlertIconPosition.top,
140
+ bottom: liveStreamingRequestAlertIconPosition.bottom,
141
+ right: liveStreamingRequestAlertIconPosition.right,
142
+ left: liveStreamingRequestAlertIconPosition.left,
143
+ }}>
144
+ <View style={[style.badge, {paddingHorizontal: 3}]}>
145
+ <ImageIcon
146
+ icon={icons['exclamationIcon']}
147
+ color={$config.SECONDARY_FONT_COLOR}
148
+ />
149
+ </View>
150
+ </View>
151
+ )}
152
+ </>
153
+ );
154
+ };
155
+
156
+ interface ChatIconButtonInterface {
157
+ badgeContainerPosition?: {
158
+ top?: number;
159
+ right?: number;
160
+ left?: number;
161
+ bottom?: number;
61
162
  };
163
+ badgeTextStyle?: TextStyle;
164
+ buttonTemplateName?: ButtonTemplateName;
165
+ render?: (
166
+ onPress: () => void,
167
+ isPanelActive: boolean,
168
+ totalUnreadCount: number,
169
+ buttonTemplateName?: ButtonTemplateName,
170
+ ) => JSX.Element;
171
+ }
62
172
 
173
+ const ChatIconButton = (props: ChatIconButtonInterface) => {
174
+ const {
175
+ badgeContainerPosition = {
176
+ top: isWeb ? -10 : 2,
177
+ left: undefined,
178
+ right: undefined,
179
+ bottom: undefined,
180
+ },
181
+ badgeTextStyle = {
182
+ color: $config.SECONDARY_FONT_COLOR,
183
+ fontSize: 12,
184
+ },
185
+ } = props;
186
+ const {setUnreadGroupMessageCount, totalUnreadCount} = useChatNotification();
187
+ const {setGroupActive, setPrivateActive, setSelectedChatUserId} =
188
+ useChatUIControl();
189
+ const {sidePanel, setSidePanel} = useSidePanel();
190
+ //commented for v1 release
191
+ //const chatLabel = useString('chatLabel')();
192
+ const chatLabel = 'Chat';
193
+ const defaultTemplateValue = useButtonTemplate().buttonTemplateName;
194
+ const {buttonTemplateName = defaultTemplateValue} = props;
195
+ const isPanelActive = sidePanel === SidePanelType.Chat;
196
+ const onPress = () => {
197
+ if (isPanelActive) {
198
+ setSidePanel(SidePanelType.None);
199
+ setGroupActive(false);
200
+ setPrivateActive(false);
201
+ setSelectedChatUserId(0);
202
+ } else {
203
+ setUnreadGroupMessageCount(0);
204
+ setGroupActive(true);
205
+ setSidePanel(SidePanelType.Chat);
206
+ }
207
+ };
208
+ let btnTemplateProps: BtnTemplateInterface = {
209
+ onPress: onPress,
210
+ name: isPanelActive ? 'chatIconFilled' : 'chatIcon',
211
+ };
212
+ if (buttonTemplateName === ButtonTemplateName.bottomBar) {
213
+ btnTemplateProps.btnText = chatLabel;
214
+ btnTemplateProps.style = Styles.localButtonWithoutBG as Object;
215
+ } else {
216
+ btnTemplateProps.style = style.btnHolder;
217
+ }
63
218
  const renderBadge = (badgeCount: any) => {
64
219
  return (
65
220
  <View
66
221
  style={{
67
222
  position: 'absolute',
68
- top: Platform.OS === 'web' ? -10 : 2,
223
+ top: badgeContainerPosition?.top,
224
+ bottom: badgeContainerPosition?.bottom,
225
+ left: badgeContainerPosition?.left,
226
+ right: badgeContainerPosition?.right,
69
227
  }}>
70
228
  <View style={style.badge}>
71
229
  <Text
72
230
  style={{
73
- color: $config.SECONDARY_FONT_COLOR,
74
- fontSize: 12,
231
+ ...badgeTextStyle,
75
232
  }}>
76
233
  {numFormatter(badgeCount)}
77
234
  </Text>
@@ -79,22 +236,135 @@ const Navbar = (props: any) => {
79
236
  </View>
80
237
  );
81
238
  };
239
+ return props?.render ? (
240
+ props.render(onPress, isPanelActive, totalUnreadCount, buttonTemplateName)
241
+ ) : (
242
+ <>
243
+ <BtnTemplate {...btnTemplateProps} />
244
+ {sidePanel !== SidePanelType.Chat &&
245
+ totalUnreadCount !== 0 &&
246
+ renderBadge(totalUnreadCount)}
247
+ </>
248
+ );
249
+ };
250
+
251
+ interface LayoutIconButtonInterface {
252
+ modalPosition?: {
253
+ top?: number;
254
+ right?: number;
255
+ left?: number;
256
+ bottom?: number;
257
+ };
258
+ buttonTemplateName?: ButtonTemplateName;
259
+ render?: (
260
+ onPress: () => void,
261
+ buttonTemplateName?: ButtonTemplateName,
262
+ ) => JSX.Element;
263
+ }
264
+
265
+ const LayoutIconButton = (props: LayoutIconButtonInterface) => {
266
+ const {modalPosition} = props;
267
+ //commented for v1 release
268
+ //const layoutLabel = useString('layoutLabel')('');
269
+ const layoutLabel = 'Layouts';
270
+ const defaultTemplateValue = useButtonTemplate().buttonTemplateName;
271
+ const {buttonTemplateName = defaultTemplateValue} = props;
272
+ const [showDropdown, setShowDropdown] = useState(false);
273
+ const layouts = useCustomLayout();
274
+ const changeLayout = useChangeDefaultLayout();
275
+ const {activeLayoutName} = useLayout();
276
+ const layout = layouts.findIndex((item) => item.name === activeLayoutName);
277
+ const renderLayoutIcon = (showDropdown?: boolean) => {
278
+ let onPress = () => {};
279
+ let renderContent = [];
280
+ if (!showDropdown) {
281
+ onPress = () => {
282
+ changeLayout();
283
+ };
284
+ } else {
285
+ onPress = () => {
286
+ setShowDropdown(true);
287
+ };
288
+ }
289
+ let btnTemplateProps = {
290
+ onPress: onPress,
291
+ style: {},
292
+ btnText: '',
293
+ };
294
+ if (buttonTemplateName === ButtonTemplateName.bottomBar) {
295
+ btnTemplateProps.style = Styles.localButtonWithoutBG as Object;
296
+ btnTemplateProps.btnText = layoutLabel;
297
+ } else {
298
+ btnTemplateProps.style = style.btnHolder;
299
+ delete btnTemplateProps['btnText'];
300
+ }
301
+ renderContent.push(
302
+ props?.render ? (
303
+ props.render(onPress, buttonTemplateName)
304
+ ) : layouts[layout]?.iconName ? (
305
+ <BtnTemplate
306
+ key={'defaultLayoutIconWithName'}
307
+ name={layouts[layout]?.iconName}
308
+ {...btnTemplateProps}
309
+ />
310
+ ) : (
311
+ <BtnTemplate
312
+ key={'defaultLayoutIconWithIcon'}
313
+ icon={layouts[layout]?.icon}
314
+ {...btnTemplateProps}
315
+ />
316
+ ),
317
+ );
318
+ return renderContent;
319
+ };
320
+ return (
321
+ <>
322
+ {/**
323
+ * Based on the flag. it will render the dropdown
324
+ */}
325
+ <LayoutIconDropdown
326
+ showDropdown={showDropdown}
327
+ setShowDropdown={setShowDropdown}
328
+ modalPosition={modalPosition}
329
+ />
330
+ {/**
331
+ * If layout contains more than 2 data. it will render the dropdown.
332
+ */}
333
+ {layouts && Array.isArray(layouts) && layouts.length > 2
334
+ ? renderLayoutIcon(true)
335
+ : renderLayoutIcon(false)}
336
+ </>
337
+ );
338
+ };
339
+
340
+ const SettingsIconButton = (props: SettingsIconButtonProps) => {
341
+ return <Settings {...props} />;
342
+ };
343
+ const SettingsIconButtonWithWrapper = (props: SettingsIconButtonProps) => {
344
+ return <SettingsWithViewWrapper {...props} />;
345
+ };
346
+
347
+ const Navbar = () => {
348
+ //commented for v1 release
349
+ //const recordingLabel = useString('recordingLabel')();
350
+ const recordingLabel = 'Recording';
351
+ const {meetingTitle} = useMeetingInfo();
352
+ const {isRecordingActive} = useRecording();
353
+ const {getDimensionData} = useContext(DimensionContext);
354
+ const {isDesktop} = getDimensionData();
82
355
 
83
356
  return (
84
357
  <View
85
- onLayout={onLayout}
86
358
  style={[
87
- Platform.OS === 'web' ? style.navHolder : style.navHolderNative,
359
+ isWeb ? style.navHolder : style.navHolderNative,
88
360
  {backgroundColor: $config.SECONDARY_FONT_COLOR + 80},
89
- Platform.OS === 'web'
361
+ isWeb
90
362
  ? {
91
- justifyContent: mobileAndTabletCheck()
92
- ? 'space-between'
93
- : 'flex-end',
363
+ justifyContent: isMobileOrTablet() ? 'space-between' : 'flex-end',
94
364
  }
95
365
  : {},
96
366
  ]}>
97
- {recordingActive && !mobileAndTabletCheck() ? (
367
+ {isRecordingActive && !isMobileOrTablet() ? (
98
368
  <View
99
369
  style={[
100
370
  style.recordingView,
@@ -111,14 +381,14 @@ const Navbar = (props: any) => {
111
381
  />
112
382
  <Text
113
383
  style={{
114
- fontSize: Platform.OS === 'web' ? 16 : 12,
384
+ fontSize: isWeb ? 16 : 12,
115
385
  color: '#FD0845',
116
386
  fontWeight: '400',
117
387
  alignSelf: 'center',
118
388
  textAlign: 'center',
119
389
  flex: 1,
120
390
  }}>
121
- Recording
391
+ {recordingLabel}
122
392
  </Text>
123
393
  </View>
124
394
  ) : (
@@ -127,11 +397,12 @@ const Navbar = (props: any) => {
127
397
  <View
128
398
  style={[
129
399
  style.roomNameContainer,
130
- Platform.OS === 'web' && !mobileAndTabletCheck()
400
+ // @ts-ignore
401
+ isWeb && !isMobileOrTablet()
131
402
  ? {transform: [{translateX: '50%'}]}
132
403
  : {},
133
404
  ]}>
134
- {Platform.OS === 'web' ? (
405
+ {isWeb ? (
135
406
  <View
136
407
  style={{
137
408
  flexDirection: 'row',
@@ -140,11 +411,11 @@ const Navbar = (props: any) => {
140
411
  }}>
141
412
  <View>
142
413
  <Text style={style.roomNameText}>
143
- {mobileAndTabletCheck()
144
- ? title.length > 13
145
- ? title.slice(0, 13) + '..'
146
- : title
147
- : title}
414
+ {isMobileOrTablet()
415
+ ? meetingTitle.length > 13
416
+ ? meetingTitle.slice(0, 13) + '..'
417
+ : meetingTitle
418
+ : meetingTitle}
148
419
  </Text>
149
420
  </View>
150
421
  <View />
@@ -162,7 +433,7 @@ const Navbar = (props: any) => {
162
433
  </View>
163
434
  ) : (
164
435
  <View>
165
- <Text style={style.roomNameText}>{title}</Text>
436
+ <Text style={style.roomNameText}>{meetingTitle}</Text>
166
437
  </View>
167
438
  )}
168
439
  </View>
@@ -172,115 +443,66 @@ const Navbar = (props: any) => {
172
443
  style.navContainer,
173
444
  {
174
445
  minWidth:
175
- Platform.OS === 'web' && isDesktop
176
- ? 300
177
- : mobileAndTabletCheck()
178
- ? 160
179
- : 200,
446
+ isWeb && isDesktop ? 300 : isMobileOrTablet() ? 160 : 200,
180
447
  },
181
448
  ]}>
182
- {onlineUsersCount !== 0 && (
183
- <View style={[style.navItem, {justifyContent: 'center'}]}>
184
- <View style={style.chip}>
185
- {onlineUsersCount > 0 && (
186
- <Text style={style.chipText}>
187
- {numFormatter(onlineUsersCount)}
188
- </Text>
189
- )}
190
- </View>
191
- </View>
192
- )}
449
+ <ParticipantsCountView />
193
450
  <View style={[style.navItem, style.navSmItem]}>
194
- <BtnTemplate
195
- onPress={() => {
196
- sidePanel === SidePanelType.Participants
197
- ? setSidePanel(SidePanelType.None)
198
- : setSidePanel(SidePanelType.Participants);
199
- $config.EVENT_MODE && $config.RAISE_HAND;
200
- setLastCheckedRequestTimestamp(new Date().getTime());
201
- }}
202
- style={style.btnHolder}
203
- name={
204
- sidePanel === SidePanelType.Participants
205
- ? 'participantFilledIcon'
206
- : 'participantIcon'
207
- }
208
- />
209
- {$config.EVENT_MODE &&
210
- $config.RAISE_HAND &&
211
- isPendingRequestToReview && (
212
- <View
213
- style={{
214
- position: 'absolute',
215
- top: Platform.OS === 'web' ? -10 : 2,
216
- }}>
217
- <View style={[style.badge, {paddingHorizontal: 3}]}>
218
- <ImageIcon
219
- icon={icons['exclamationIcon']}
220
- color={$config.SECONDARY_FONT_COLOR}
221
- />
222
- </View>
223
- </View>
224
- )}
451
+ <ParticipantsIconButton />
225
452
  </View>
226
- {$config.CHAT && (
453
+ {$config.CHAT ? (
227
454
  <>
228
- {renderSeparator()}
455
+ <RenderSeparator />
229
456
  <View style={[style.navItem, style.navSmItem]}>
230
- <BtnTemplate
231
- style={style.btnHolder}
232
- onPress={() => {
233
- setLastCheckedPublicState(messageStore.length);
234
- sidePanel === SidePanelType.Chat
235
- ? setSidePanel(SidePanelType.None)
236
- : setSidePanel(SidePanelType.Chat);
237
- }}
238
- name={
239
- sidePanel === SidePanelType.Chat
240
- ? 'chatIconFilled'
241
- : 'chatIcon'
242
- }
243
- />
244
- {sidePanel !== SidePanelType.Chat &&
245
- pendingMessageLength !== 0 &&
246
- renderBadge(pendingMessageLength)}
457
+ <ChatIconButton />
247
458
  </View>
248
459
  </>
460
+ ) : (
461
+ <></>
249
462
  )}
250
- {renderSeparator()}
251
- <View style={[style.navItem, style.navSmItem]}>
252
- <BtnTemplate
253
- style={style.btnHolder}
254
- onPress={() => {
255
- setLayout((l: Layout) =>
256
- l === Layout.Pinned ? Layout.Grid : Layout.Pinned,
257
- );
258
- }}
259
- name={layout ? 'pinnedLayoutIcon' : 'gridLayoutIcon'}
260
- />
463
+ <RenderSeparator />
464
+ <View
465
+ style={[style.navItem, style.navSmItem]}
466
+ /**
467
+ * .measure returns undefined on Android unless collapsable=false or onLayout are specified
468
+ * so added collapsable property
469
+ * https://github.com/facebook/react-native/issues/29712
470
+ * */
471
+ collapsable={false}>
472
+ <LayoutIconButton />
261
473
  </View>
262
- {/** Show setting icon only in non native apps
263
- * show in web/electron/mobile web
264
- * hide in android/ios */}
265
- {Platform.OS !== 'android' && Platform.OS !== 'ios' && (
266
- <>
267
- {renderSeparator()}
268
- <View style={[style.navItem, style.navSmItem]}>
269
- <Settings
270
- sidePanel={sidePanel}
271
- setSidePanel={setSidePanel}
272
- isHost={isHost}
273
- />
274
- </View>
275
- </>
276
- )}
474
+ <RenderSeparator />
475
+ <SettingsIconButtonWithWrapper />
277
476
  </View>
278
477
  </View>
279
478
  </View>
280
479
  );
281
480
  };
481
+ export const NavBarComponentsArray: [
482
+ (props: CopyJoinInfoProps) => JSX.Element,
483
+ () => JSX.Element,
484
+ (props: ParticipantsIconButtonInterface) => JSX.Element,
485
+ (props: ChatIconButtonInterface) => JSX.Element,
486
+ (props: LayoutIconButtonInterface) => JSX.Element,
487
+ (props: SettingsIconButtonProps) => JSX.Element,
488
+ ] = [
489
+ CopyJoinInfo,
490
+ ParticipantsCountView,
491
+ ParticipantsIconButton,
492
+ ChatIconButton,
493
+ LayoutIconButton,
494
+ SettingsIconButton,
495
+ ];
282
496
  const style = StyleSheet.create({
283
- navHolder: navHolder,
497
+ backDrop: {
498
+ position: 'absolute',
499
+ top: 0,
500
+ bottom: 0,
501
+ left: 0,
502
+ right: 0,
503
+ backgroundColor: 'rgba(0,0,0,0.3)',
504
+ },
505
+ navHolder: navHolder as ViewStyle,
284
506
  navHolderNative: {
285
507
  position: 'relative',
286
508
  width: '100%',
@@ -310,7 +532,12 @@ const style = StyleSheet.create({
310
532
  resizeMode: 'contain',
311
533
  },
312
534
  btnHolder: {
313
- marginHorizontal: mobileAndTabletCheck() ? 2 : 0,
535
+ marginHorizontal: isMobileOrTablet() ? 2 : 0,
536
+ width: '100%',
537
+ height: '100%',
538
+ resizeMode: 'contain',
539
+ },
540
+ btnHolderCustom: {
314
541
  width: '100%',
315
542
  height: '100%',
316
543
  resizeMode: 'contain',
@@ -339,7 +566,7 @@ const style = StyleSheet.create({
339
566
  justifyContent: 'center',
340
567
  backgroundColor: $config.PRIMARY_COLOR,
341
568
  color: $config.SECONDARY_FONT_COLOR,
342
- fontFamily: Platform.OS === 'ios' ? 'Helvetica' : 'sans-serif',
569
+ fontFamily: isIOS ? 'Helvetica' : 'sans-serif',
343
570
  borderRadius: 10,
344
571
  position: 'absolute',
345
572
  paddingHorizontal: 5,
@@ -357,7 +584,7 @@ const style = StyleSheet.create({
357
584
  justifyContent: 'center',
358
585
  },
359
586
  chipText: {
360
- fontFamily: Platform.OS === 'ios' ? 'Helvetica' : 'sans-serif',
587
+ fontFamily: isIOS ? 'Helvetica' : 'sans-serif',
361
588
  fontSize: 12,
362
589
  color: $config.SECONDARY_FONT_COLOR,
363
590
  },
@@ -371,12 +598,11 @@ const style = StyleSheet.create({
371
598
  display: 'flex',
372
599
  flexDirection: 'row',
373
600
  justifyContent: 'space-around',
374
- backgroundColor:
375
- Platform.OS === 'web'
376
- ? $config.SECONDARY_FONT_COLOR
377
- : $config.SECONDARY_FONT_COLOR + '00',
601
+ backgroundColor: isWeb
602
+ ? $config.SECONDARY_FONT_COLOR
603
+ : $config.SECONDARY_FONT_COLOR + '00',
378
604
  paddingVertical: 4,
379
- paddingHorizontal: mobileAndTabletCheck() ? 0 : 10,
605
+ paddingHorizontal: isMobileOrTablet() ? 0 : 10,
380
606
  minHeight: 35,
381
607
  borderRadius: 10,
382
608
  },
@@ -398,6 +624,31 @@ const style = StyleSheet.create({
398
624
  alignSelf: 'center',
399
625
  opacity: 0.8,
400
626
  },
627
+ navItemSeparatorHorizontal: {
628
+ backgroundColor: $config.PRIMARY_FONT_COLOR + '80',
629
+ width: '100%',
630
+ height: 1,
631
+ marginVertical: 10,
632
+ alignSelf: 'center',
633
+ opacity: 0.8,
634
+ },
635
+ dropdownIconContainer: {
636
+ flex: 1,
637
+ paddingHorizontal: 5,
638
+ },
639
+ separaterContainer: {
640
+ flex: 0.5,
641
+ paddingHorizontal: 5,
642
+ },
643
+ dropdownContainer: {
644
+ position: 'absolute',
645
+ marginTop: 5,
646
+ width: 40,
647
+ height: 90,
648
+ backgroundColor: 'white',
649
+ borderRadius: 10,
650
+ paddingVertical: 10,
651
+ },
401
652
  });
402
653
 
403
654
  export default Navbar;