agora-appbuilder-core 3.0.10 → 3.0.12

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 (249) hide show
  1. package/Readme.md +0 -6
  2. package/package.json +2 -2
  3. package/template/_package-lock.json +4979 -7086
  4. package/template/agora-rn-uikit/src/Contexts/LocalUserContext.tsx +0 -4
  5. package/template/agora-rn-uikit/src/Contexts/PropsContext.tsx +0 -18
  6. package/template/agora-rn-uikit/src/Contexts/RtcContext.tsx +0 -2
  7. package/template/agora-rn-uikit/src/Controls/BtnTemplate.tsx +26 -30
  8. package/template/agora-rn-uikit/src/Controls/Icons.ts +83 -30
  9. package/template/agora-rn-uikit/src/Controls/ImageIcon.tsx +6 -6
  10. package/template/agora-rn-uikit/src/Reducer/LocalMuteAudio.ts +0 -1
  11. package/template/agora-rn-uikit/src/Reducer/LocalMuteVideo.ts +0 -1
  12. package/template/agora-rn-uikit/src/Reducer/RemoteAudioStateChanged.ts +0 -1
  13. package/template/agora-rn-uikit/src/Reducer/RemoteVideoStateChanged.ts +0 -1
  14. package/template/agora-rn-uikit/src/Reducer/UpdateDualStreamMode.ts +0 -1
  15. package/template/agora-rn-uikit/src/Reducer/UserJoined.ts +0 -2
  16. package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteAudio.ts +0 -1
  17. package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteVideo.ts +0 -1
  18. package/template/agora-rn-uikit/src/Reducer/UserOffline.ts +0 -1
  19. package/template/agora-rn-uikit/src/Reducer/index.ts +0 -3
  20. package/template/agora-rn-uikit/src/Rtc/Create.tsx +1 -89
  21. package/template/agora-rn-uikit/src/RtcConfigure.tsx +2 -39
  22. package/template/agora-rn-uikit/src/Views/MaxVideoView.native.tsx +5 -15
  23. package/template/agora-rn-uikit/src/Views/MaxVideoView.tsx +9 -15
  24. package/template/agora-rn-uikit/src/index.ts +1 -3
  25. package/template/android/app/build.gradle +0 -1
  26. package/template/android/app/src/main/AndroidManifest.xml +15 -22
  27. package/template/android/app/src/main/java/com/helloworld/MainActivity.java +0 -50
  28. package/template/android/build.gradle +3 -3
  29. package/template/babel.config.js +0 -1
  30. package/template/bridge/rtc/webNg/RtcEngine.ts +17 -110
  31. package/template/customization-api/sub-components.ts +1 -1
  32. package/template/customization-api/typeDefinition.ts +1 -2
  33. package/template/electron/index.html +27 -27
  34. package/template/electron/renderer/index.js +0 -1
  35. package/template/global.d.ts +4 -26
  36. package/template/index.js +0 -4
  37. package/template/index.rsdk.tsx +0 -1
  38. package/template/index.web.js +1 -7
  39. package/template/index.wsdk.tsx +1 -1
  40. package/template/ios/HelloWorld/Info.plist +1 -14
  41. package/template/ios/HelloWorld.xcodeproj/project.pbxproj +0 -17
  42. package/template/metro.config.js +1 -1
  43. package/template/package.json +7 -21
  44. package/template/react-native-toast-message/index.d.ts +43 -43
  45. package/template/react-native-toast-message/src/colors/index.js +2 -3
  46. package/template/react-native-toast-message/src/components/base/index.js +59 -46
  47. package/template/react-native-toast-message/src/components/base/styles.js +32 -16
  48. package/template/react-native-toast-message/src/components/error.js +2 -3
  49. package/template/react-native-toast-message/src/components/info.js +2 -3
  50. package/template/react-native-toast-message/src/components/success.js +2 -3
  51. package/template/react-native-toast-message/src/index.js +31 -122
  52. package/template/react-native-toast-message/src/index.sdk.tsx +35 -125
  53. package/template/react-native-toast-message/src/styles.js +4 -3
  54. package/template/react-native-toast-message/src/styles.sdk.ts +4 -3
  55. package/template/src/App.tsx +0 -6
  56. package/template/src/AppWrapper.tsx +28 -63
  57. package/template/src/assets/icons.ts +102 -0
  58. package/template/src/atoms/HorizontalRule.tsx +1 -3
  59. package/template/src/atoms/PrimaryButton.tsx +26 -51
  60. package/template/src/atoms/SecondaryButton.tsx +5 -8
  61. package/template/src/atoms/TextInput.tsx +14 -12
  62. package/template/src/components/Chat.tsx +214 -86
  63. package/template/src/components/ChatContext.ts +1 -8
  64. package/template/src/components/ColorConfigure.tsx +1 -1
  65. package/template/src/components/ColorContext.ts +1 -1
  66. package/template/src/components/{Controls1.native.tsx → Controls.native.tsx} +4 -6
  67. package/template/src/components/Controls.tsx +42 -342
  68. package/template/src/components/DeviceConfigure.tsx +101 -461
  69. package/template/src/components/DeviceContext.tsx +4 -8
  70. package/template/src/components/EventsConfigure.tsx +7 -144
  71. package/template/src/components/GraphQLProvider.tsx +1 -1
  72. package/template/src/components/GridVideo.tsx +44 -59
  73. package/template/src/components/HostControlView.tsx +35 -114
  74. package/template/src/components/Navbar.tsx +398 -216
  75. package/template/src/components/NetworkQualityContext.tsx +20 -20
  76. package/template/src/components/ParticipantsView.tsx +154 -177
  77. package/template/src/components/PinnedVideo.tsx +120 -207
  78. package/template/src/components/Precall.native.tsx +119 -358
  79. package/template/src/components/Precall.tsx +135 -269
  80. package/template/src/components/RTMConfigure.tsx +4 -27
  81. package/template/src/components/Router.electron.ts +0 -1
  82. package/template/src/components/Router.native.ts +0 -1
  83. package/template/src/components/Router.sdk.ts +0 -1
  84. package/template/src/components/Router.ts +0 -1
  85. package/template/src/components/Settings.tsx +95 -26
  86. package/template/src/components/SettingsView.tsx +56 -251
  87. package/template/src/components/Share.tsx +273 -302
  88. package/template/src/components/StorageContext.tsx +3 -30
  89. package/template/src/components/chat-messages/useChatMessages.tsx +23 -69
  90. package/template/src/components/chat-ui/useChatUIControl.tsx +0 -7
  91. package/template/src/components/common/Error.tsx +6 -20
  92. package/template/src/components/common/Logo.tsx +15 -16
  93. package/template/src/components/contexts/LiveStreamDataContext.tsx +5 -10
  94. package/template/src/components/contexts/VideoMeetingDataContext.tsx +7 -37
  95. package/template/src/components/livestream/LiveStreamContext.tsx +36 -270
  96. package/template/src/components/livestream/Types.ts +14 -39
  97. package/template/src/components/livestream/index.ts +0 -1
  98. package/template/src/components/livestream/views/LiveStreamControls.tsx +4 -12
  99. package/template/src/components/participants/AllAudienceParticipants.tsx +30 -101
  100. package/template/src/components/participants/AllHostParticipants.tsx +34 -103
  101. package/template/src/components/participants/MeParticipant.tsx +38 -0
  102. package/template/src/components/participants/ParticipantName.tsx +7 -13
  103. package/template/src/components/participants/ParticipantSectionTitle.tsx +10 -35
  104. package/template/src/components/participants/RemoteParticipants.tsx +71 -0
  105. package/template/src/components/participants/ScreenshareParticipants.tsx +12 -144
  106. package/template/src/components/precall/{LocalMute1.native.tsx → LocalMute.native.tsx} +5 -21
  107. package/template/src/components/precall/LocalMute.tsx +14 -84
  108. package/template/src/components/precall/VideoPreview.native.tsx +3 -48
  109. package/template/src/components/precall/VideoPreview.tsx +7 -163
  110. package/template/src/components/precall/joinCallBtn.tsx +2 -15
  111. package/template/src/components/precall/meetingTitle.tsx +12 -15
  112. package/template/src/components/precall/selectDevice.tsx +21 -1
  113. package/template/src/components/precall/textInput.tsx +4 -32
  114. package/template/src/components/precall/usePreCall.tsx +0 -16
  115. package/template/src/components/styles.ts +21 -42
  116. package/template/src/components/useShareLink.tsx +14 -12
  117. package/template/src/language/default-labels/precallScreenLabels.ts +3 -3
  118. package/template/src/pages/Authenticate.tsx +15 -5
  119. package/template/src/pages/Create.tsx +165 -293
  120. package/template/src/pages/Join.tsx +67 -93
  121. package/template/src/pages/VideoCall.tsx +64 -89
  122. package/template/src/pages/video-call/DefaultLayouts.ts +4 -4
  123. package/template/src/pages/video-call/NameWithMicIcon.tsx +44 -120
  124. package/template/src/pages/video-call/RenderComponent.tsx +2 -3
  125. package/template/src/pages/video-call/VideoCallScreen.tsx +9 -45
  126. package/template/src/pages/video-call/VideoComponent.tsx +3 -18
  127. package/template/src/pages/video-call/VideoRenderer.tsx +60 -218
  128. package/template/src/rtm-events/constants.ts +0 -2
  129. package/template/src/subComponents/ChatBubble.tsx +83 -123
  130. package/template/src/subComponents/ChatContainer.tsx +84 -257
  131. package/template/src/subComponents/ChatInput.tsx +46 -61
  132. package/template/src/subComponents/Checkbox.native.tsx +5 -16
  133. package/template/src/subComponents/Checkbox.tsx +2 -2
  134. package/template/src/subComponents/CopyJoinInfo.tsx +58 -36
  135. package/template/src/subComponents/FallbackLogo.tsx +40 -122
  136. package/template/src/subComponents/LanguageSelector.tsx +1 -1
  137. package/template/src/subComponents/{LayoutIconDropdown1.native.tsx → LayoutIconDropdown.native.tsx} +18 -4
  138. package/template/src/subComponents/LayoutIconDropdown.tsx +134 -131
  139. package/template/src/subComponents/LocalAudioMute.tsx +27 -119
  140. package/template/src/subComponents/LocalEndCall.tsx +33 -71
  141. package/template/src/subComponents/LocalSwitchCamera.tsx +30 -17
  142. package/template/src/subComponents/LocalVideoMute.tsx +27 -117
  143. package/template/src/subComponents/Logo.tsx +4 -3
  144. package/template/src/subComponents/LogoutButton.tsx +1 -1
  145. package/template/src/subComponents/NetworkQualityPill.tsx +63 -60
  146. package/template/src/subComponents/OpenInNativeButton.tsx +3 -3
  147. package/template/src/subComponents/Recording.tsx +29 -28
  148. package/template/src/subComponents/RemoteAudioMute.tsx +29 -83
  149. package/template/src/subComponents/RemoteEndCall.tsx +5 -8
  150. package/template/src/subComponents/RemoteVideoMute.tsx +21 -74
  151. package/template/src/subComponents/ScreenShareNotice.tsx +8 -83
  152. package/template/src/subComponents/SelectDevice.tsx +61 -404
  153. package/template/src/subComponents/SelectOAuth.tsx +8 -9
  154. package/template/src/subComponents/ToastConfig.tsx +10 -150
  155. package/template/src/subComponents/chat/ChatParticipants.tsx +78 -187
  156. package/template/src/subComponents/livestream/CurrentLiveStreamRequestsView.tsx +32 -95
  157. package/template/src/subComponents/livestream/controls/LocalRaiseHand.tsx +33 -29
  158. package/template/src/subComponents/livestream/controls/RemoteLiveStreamApprovedRequestRecall.tsx +6 -6
  159. package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestApprove.tsx +11 -24
  160. package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestReject.tsx +10 -17
  161. package/template/src/subComponents/recording/useRecording.tsx +27 -79
  162. package/template/src/subComponents/screenshare/ScreenshareButton.tsx +70 -52
  163. package/template/src/subComponents/screenshare/ScreenshareConfigure.native.tsx +2 -11
  164. package/template/src/subComponents/screenshare/ScreenshareConfigure.tsx +4 -26
  165. package/template/src/utils/common.tsx +1 -155
  166. package/template/src/utils/index.tsx +0 -19
  167. package/template/src/utils/isMobileOrTablet.ts +2 -7
  168. package/template/src/utils/useButtonTemplate.tsx +0 -1
  169. package/template/src/utils/useMuteToggleLocal.ts +3 -54
  170. package/template/web/index.html +0 -5
  171. package/template/webpack.commons.js +8 -13
  172. package/template/webpack.web.config.js +0 -1
  173. package/template/agora-rn-uikit/src/Reducer/ActiveSpeakerDetected.ts +0 -11
  174. package/template/agora-rn-uikit/src/Reducer/LocalPermissionState.ts +0 -24
  175. package/template/agora-rn-uikit/src/Reducer/UserPin.ts +0 -11
  176. package/template/android/app/src/main/assets/fonts/SourceSansPro-Regular.ttf +0 -0
  177. package/template/android/app/src/main/assets/fonts/icomoon.ttf +0 -0
  178. package/template/android/app/src/main/res/values/colors.xml +0 -7
  179. package/template/react-native-toast-message/src/components/checkbox.js +0 -178
  180. package/template/react-native.config.js +0 -7
  181. package/template/src/assets/font-styles.css +0 -329
  182. package/template/src/assets/fonts/SourceSansPro-Regular.ttf +0 -0
  183. package/template/src/assets/fonts/icomoon.ttf +0 -0
  184. package/template/src/assets/permission.png +0 -0
  185. package/template/src/assets/selection.json +0 -1
  186. package/template/src/atoms/ActionMenu.tsx +0 -236
  187. package/template/src/atoms/AnimatedActiveSpeaker.native.tsx +0 -71
  188. package/template/src/atoms/AnimatedActiveSpeaker.tsx +0 -84
  189. package/template/src/atoms/AnimatedRings.native.tsx +0 -68
  190. package/template/src/atoms/AnimatedRings.tsx +0 -70
  191. package/template/src/atoms/Card.tsx +0 -61
  192. package/template/src/atoms/CircularProgress.native.tsx +0 -121
  193. package/template/src/atoms/CircularProgress.tsx +0 -102
  194. package/template/src/atoms/CustomIcon.tsx +0 -88
  195. package/template/src/atoms/CustomSwitch.tsx +0 -287
  196. package/template/src/atoms/Dropdown.tsx +0 -306
  197. package/template/src/atoms/IconButton.tsx +0 -162
  198. package/template/src/atoms/ImageIcon.tsx +0 -98
  199. package/template/src/atoms/InfoBubble.tsx +0 -291
  200. package/template/src/atoms/Input.tsx +0 -87
  201. package/template/src/atoms/InviteInfo.tsx +0 -166
  202. package/template/src/atoms/LinkButton.tsx +0 -28
  203. package/template/src/atoms/OutlineButton.tsx +0 -61
  204. package/template/src/atoms/ParticipantsCount.tsx +0 -73
  205. package/template/src/atoms/Popup.tsx +0 -147
  206. package/template/src/atoms/RecordingInfo.tsx +0 -49
  207. package/template/src/atoms/Spacer.tsx +0 -22
  208. package/template/src/atoms/TertiaryButton.tsx +0 -78
  209. package/template/src/atoms/Toggle.tsx +0 -47
  210. package/template/src/atoms/Tooltip.native.tsx +0 -65
  211. package/template/src/atoms/Tooltip.tsx +0 -94
  212. package/template/src/atoms/UserAvatar.tsx +0 -60
  213. package/template/src/components/CommonStyles.ts +0 -44
  214. package/template/src/components/ToastComponent.tsx +0 -8
  215. package/template/src/components/participants/Participant.tsx +0 -302
  216. package/template/src/components/participants/UserActionMenuOptions.tsx +0 -398
  217. package/template/src/components/popups/InvitePopup.tsx +0 -115
  218. package/template/src/components/popups/StopRecordingPopup.tsx +0 -114
  219. package/template/src/components/precall/PermissionHelper.native.tsx +0 -5
  220. package/template/src/components/precall/PermissionHelper.tsx +0 -126
  221. package/template/src/components/precall/PreCallSettings.tsx +0 -52
  222. package/template/src/components/useToast.tsx +0 -41
  223. package/template/src/components/useVideoCall.tsx +0 -65
  224. package/template/src/pages/Endcall.tsx +0 -148
  225. package/template/src/pages/video-call/ActionSheet.native.tsx +0 -215
  226. package/template/src/pages/video-call/ActionSheet.tsx +0 -226
  227. package/template/src/pages/video-call/ActionSheetContent.tsx +0 -479
  228. package/template/src/pages/video-call/ActionSheetHandle.tsx +0 -38
  229. package/template/src/pages/video-call/ActionSheetStyles.css +0 -138
  230. package/template/src/pages/video-call/SidePanelHeader.tsx +0 -190
  231. package/template/src/pages/video-call/VideoCallMobileView.tsx +0 -139
  232. package/template/src/pages/video-call/VideoCallScreen.native.tsx +0 -37
  233. package/template/src/subComponents/ChatInput.ios.tsx +0 -237
  234. package/template/src/subComponents/EndcallPopup.tsx +0 -107
  235. package/template/src/subComponents/LayoutIconButton.tsx +0 -201
  236. package/template/src/subComponents/RemoteMutePopup.tsx +0 -193
  237. package/template/src/subComponents/RemoveMeetingPopup.tsx +0 -109
  238. package/template/src/subComponents/RemoveScreensharePopup.tsx +0 -109
  239. package/template/src/subComponents/SelectDeviceSettings.backup.tsx +0 -207
  240. package/template/src/subComponents/SidePanelHeader.tsx +0 -112
  241. package/template/src/theme/index.ts +0 -46
  242. package/template/src/utils/PlatformWrapper.tsx +0 -21
  243. package/template/src/utils/hexadecimalTransparency.ts +0 -108
  244. package/template/src/utils/pendingStateUpdateHelper.ts +0 -19
  245. package/template/src/utils/useFocus.tsx +0 -46
  246. package/template/src/utils/useIsActiveSpeaker.ts +0 -27
  247. package/template/src/utils/useIsHandRaised.ts +0 -13
  248. package/template/src/utils/useRemoteEndScreenshare.ts +0 -26
  249. package/template/src/utils/useRemoteRequest.ts +0 -84
@@ -1,14 +1,17 @@
1
1
  import React, {SetStateAction, useContext} from 'react';
2
- import {View, StyleSheet, TouchableWithoutFeedback, Modal} from 'react-native';
3
- import {isMobileUA, isWebInternal} from '../utils/common';
2
+ import {
3
+ View,
4
+ Text,
5
+ StyleSheet,
6
+ TouchableOpacity,
7
+ TouchableWithoutFeedback,
8
+ Modal,
9
+ } from 'react-native';
10
+ import {isWebInternal} from '../utils/common';
11
+ import {ImageIcon} from '../../agora-rn-uikit';
4
12
  import useLayoutsData from '../pages/video-call/useLayoutsData';
5
13
  import {useLayout} from '../utils/useLayout';
6
- import IconButton, {IconButtonProps} from '../atoms/IconButton';
7
- import Spacer from '../atoms/Spacer';
8
- import hexadecimalTransparency from '../utils/hexadecimalTransparency';
9
- import {getPinnedLayoutName} from '../pages/video-call/DefaultLayouts';
10
- import {useRender} from 'customization-api';
11
- import isMobileOrTablet from '../utils/isMobileOrTablet';
14
+ import DimensionContext from '../components/dimension/DimensionContext';
12
15
 
13
16
  interface LayoutIconDropdownProps {
14
17
  modalPosition?: {
@@ -19,27 +22,31 @@ interface LayoutIconDropdownProps {
19
22
  };
20
23
  showDropdown: boolean;
21
24
  setShowDropdown: React.Dispatch<SetStateAction<boolean>>;
22
- caretPosition?: {
23
- top?: number;
24
- right?: number;
25
- left?: number;
26
- bottom?: number;
27
- };
28
- onHoverPlaceHolder?: 'vertical' | 'horizontal';
29
25
  }
30
26
 
31
27
  const LayoutIconDropdown = (props: LayoutIconDropdownProps) => {
32
28
  const {
33
29
  showDropdown,
34
30
  setShowDropdown,
35
- modalPosition = {top: 0, left: 0},
36
- onHoverPlaceHolder = 'horizontal',
31
+ modalPosition = {top: 45, right: 15, bottom: undefined, left: undefined},
37
32
  } = props;
38
- const {activeUids} = useRender();
39
- const layouts = useLayoutsData();
40
- const {setLayout, currentLayout} = useLayout();
41
- const isMobileView = isMobileUA();
33
+ const {getDimensionData} = useContext(DimensionContext);
34
+ const {isDesktop, dim} = getDimensionData();
42
35
 
36
+ const layouts = useLayoutsData();
37
+ const {currentLayout, setLayout} = useLayout();
38
+ const renderSeparatorHorizontal = () => {
39
+ return isWebInternal() && isDesktop ? (
40
+ <View style={style.navItem}>
41
+ <View style={style.navItemSeparatorHorizontal}></View>
42
+ </View>
43
+ ) : (
44
+ <View style={{marginHorizontal: 2}}></View>
45
+ );
46
+ };
47
+ const selectedItemHighlighter = (isSelected: boolean) => {
48
+ return <View style={isSelected ? style.highlighter : {}} />;
49
+ };
43
50
  const renderDropdown = () => {
44
51
  const data = layouts.map((item, index) => {
45
52
  let onPress = () => {
@@ -47,108 +54,53 @@ const LayoutIconDropdown = (props: LayoutIconDropdownProps) => {
47
54
  setShowDropdown(false);
48
55
  };
49
56
  let content = [];
50
- const disabled =
51
- item.name === getPinnedLayoutName() && activeUids?.length === 1
52
- ? true
53
- : false;
54
- let iconButtonProps: IconButtonProps = {
55
- disabled,
56
- hoverEffect: disabled
57
- ? false
58
- : currentLayout !== item.name
59
- ? true
60
- : false,
61
- hoverEffectStyle: {
62
- backgroundColor:
63
- $config.CARD_LAYER_5_COLOR + hexadecimalTransparency['15%'],
64
- },
65
- containerStyle: {
66
- opacity: disabled ? 0.4 : 1,
67
- flexDirection: 'row',
68
- marginHorizontal: 8,
69
- marginTop: 8,
70
- marginBottom: layouts.length - 1 === index ? 8 : 0,
71
- borderRadius: 4,
72
- backgroundColor:
73
- currentLayout === item.name
74
- ? $config.PRIMARY_ACTION_BRAND_COLOR
75
- : 'transparent',
76
- },
77
- onPress,
78
- iconProps: {
79
- iconContainerStyle: {
80
- padding: 10,
81
- },
82
- iconType: 'plain',
83
- name:
84
- item.iconName === 'pinned' && isMobileView
85
- ? 'list-view'
86
- : item.iconName,
87
- tintColor: $config.SECONDARY_ACTION_COLOR,
88
- },
89
- btnTextProps: {
90
- textStyle: {
91
- marginTop: 0,
92
- },
93
- //text: $config.ICON_TEXT ? item.label : '',
94
- text: item.label,
95
- textColor: $config.FONT_COLOR,
96
- },
97
- };
57
+ let BtnTemplateLocal = [
58
+ item?.iconName ? (
59
+ <ImageIcon
60
+ key={'btnTemplateNameDropdown' + index}
61
+ style={style.btnHolderCustom}
62
+ name={item?.iconName}
63
+ />
64
+ ) : (
65
+ <ImageIcon
66
+ key={'btnTemplateIconDropdown' + index}
67
+ style={style.btnHolderCustom}
68
+ icon={item.icon}
69
+ />
70
+ ),
71
+ ];
98
72
  content.push(
99
- <IconButton key={'layout_button' + item.name} {...iconButtonProps} />,
73
+ <TouchableOpacity
74
+ key={'dropdownLayoutIcon' + index}
75
+ style={style.dropdownInnerIconContainer}
76
+ onPress={onPress}>
77
+ <>
78
+ <View style={style.highlighterContainer}>
79
+ {selectedItemHighlighter(item.name === currentLayout)}
80
+ </View>
81
+ <View style={{flex: 1}}>{BtnTemplateLocal}</View>
82
+ <View style={style.layoutNameContainer}>
83
+ <Text numberOfLines={2} style={style.layoutNameText}>
84
+ {item.label}
85
+ </Text>
86
+ </View>
87
+ </>
88
+ </TouchableOpacity>,
100
89
  );
90
+ if (layouts.length - 1 !== index) {
91
+ content.push(
92
+ <View
93
+ style={style.separaterContainer}
94
+ key={'navLayoutIconSeparater' + index}>
95
+ {renderSeparatorHorizontal()}
96
+ </View>,
97
+ );
98
+ }
101
99
  return content;
102
100
  });
103
-
104
- let viewContent = (
105
- <View style={[style.dropdownContainer, modalPosition]}>
106
- <View
107
- style={[
108
- {
109
- width: 20,
110
- height: 20,
111
- backgroundColor: $config.CARD_LAYER_4_COLOR,
112
- position: 'absolute',
113
- borderRadius: 2,
114
- transform: [{rotate: '45deg'}],
115
- zIndex: -1,
116
- },
117
- props?.caretPosition,
118
- ]}></View>
119
- {!isMobileUA() && (
120
- <View
121
- style={[
122
- {
123
- zIndex: -2,
124
- position: 'absolute',
125
- },
126
- onHoverPlaceHolder === 'vertical'
127
- ? {width: 20, height: '100%', bottom: 0, right: -20}
128
- : {width: '100%', height: 20, bottom: -20},
129
- ]}
130
- />
131
- )}
132
- <View
133
- style={{
134
- flex: 1,
135
- flexDirection: 'column',
136
- justifyContent: 'space-between',
137
- }}>
138
- {data}
139
- </View>
140
- </View>
141
- );
142
-
143
- return !isMobileOrTablet() ? (
144
- showDropdown ? (
145
- viewContent
146
- ) : (
147
- <></>
148
- )
149
- ) : (
101
+ return (
150
102
  <Modal
151
- animationType="none"
103
+ animationType="fade"
152
104
  transparent={true}
153
105
  visible={showDropdown}
154
106
  onRequestClose={() => {
@@ -160,7 +112,18 @@ const LayoutIconDropdown = (props: LayoutIconDropdownProps) => {
160
112
  }}>
161
113
  <View style={style.backDrop} />
162
114
  </TouchableWithoutFeedback>
163
- {viewContent}
115
+ <View
116
+ style={[
117
+ style.dropdownContainer,
118
+ {
119
+ top: modalPosition?.top,
120
+ right: modalPosition?.right,
121
+ left: modalPosition?.left,
122
+ bottom: modalPosition?.bottom,
123
+ },
124
+ ]}>
125
+ {data}
126
+ </View>
164
127
  </Modal>
165
128
  );
166
129
  };
@@ -168,20 +131,60 @@ const LayoutIconDropdown = (props: LayoutIconDropdownProps) => {
168
131
  };
169
132
 
170
133
  const style = StyleSheet.create({
134
+ layoutNameContainer: {
135
+ flex: 2,
136
+ justifyContent: 'center',
137
+ paddingHorizontal: 5,
138
+ },
139
+ layoutNameText: {
140
+ textAlign: 'left',
141
+ },
142
+ highlighter: {
143
+ justifyContent: 'center',
144
+ alignSelf: 'center',
145
+ height: 1,
146
+ width: 1,
147
+ borderRadius: 10,
148
+ borderWidth: 4,
149
+ borderColor: $config.PRIMARY_COLOR,
150
+ },
151
+ highlighterContainer: {flex: 0.5, justifyContent: 'center'},
152
+ dropdownInnerIconContainer: {
153
+ flex: 1,
154
+ flexDirection: 'row',
155
+ paddingHorizontal: 5,
156
+ paddingVertical: 5,
157
+ minHeight: 40,
158
+ },
159
+ navItem: {
160
+ height: '100%',
161
+ alignItems: 'center',
162
+ position: 'relative',
163
+ },
164
+ navItemSeparatorHorizontal: {
165
+ backgroundColor: $config.PRIMARY_FONT_COLOR + '80',
166
+ width: '100%',
167
+ height: 1,
168
+ marginVertical: 10,
169
+ alignSelf: 'center',
170
+ opacity: 0.8,
171
+ },
172
+ separaterContainer: {
173
+ flex: 0.5,
174
+ paddingHorizontal: 5,
175
+ },
171
176
  dropdownContainer: {
172
- width: 140,
173
177
  position: 'absolute',
174
- backgroundColor: $config.CARD_LAYER_4_COLOR,
175
- borderRadius: 8,
176
- zIndex: 999,
177
- shadowColor: $config.HARD_CODED_BLACK_COLOR,
178
- shadowOffset: {
179
- width: 0,
180
- height: -4,
181
- },
182
- shadowOpacity: 0.1,
183
- shadowRadius: 8,
184
- elevation: 1,
178
+ marginTop: 5,
179
+ width: 160,
180
+ backgroundColor: 'white',
181
+ borderRadius: 10,
182
+ paddingVertical: 10,
183
+ },
184
+ btnHolderCustom: {
185
+ width: '100%',
186
+ height: '100%',
187
+ resizeMode: 'contain',
185
188
  },
186
189
  backDrop: {
187
190
  position: 'absolute',
@@ -9,155 +9,63 @@
9
9
  information visit https://appbuilder.agora.io.
10
10
  *********************************************
11
11
  */
12
- import React, {useContext} from 'react';
12
+ import React from 'react';
13
13
  import {
14
+ BtnTemplate,
14
15
  ToggleState,
15
- PermissionState,
16
- ImageIcon as UIKitImageIcon,
17
- ClientRole,
18
- PropsContext,
19
- useLocalUid,
16
+ BtnTemplateInterface,
20
17
  } from '../../agora-rn-uikit';
21
18
  import useMuteToggleLocal, {MUTE_LOCAL_TYPE} from '../utils/useMuteToggleLocal';
22
19
  import Styles from '../components/styles';
20
+ import {
21
+ ButtonTemplateName,
22
+ useButtonTemplate,
23
+ } from '../utils/useButtonTemplate';
23
24
  import {useString} from '../utils/useString';
24
- import {useLocalUserInfo, useMeetingInfo} from 'customization-api';
25
- import IconButton, {IconButtonProps} from '../atoms/IconButton';
26
- import ThemeConfig from '../theme';
27
- import {ImageIconProps} from '../atoms/ImageIcon';
28
- import useIsHandRaised from '../utils/useIsHandRaised';
25
+ import {useLocalUserInfo} from 'customization-api';
29
26
  /**
30
27
  * A component to mute / unmute the local audio
31
28
  */
32
29
  export interface LocalAudioMuteProps {
33
- plainIconHoverEffect?: boolean;
34
- showToolTip?: boolean;
35
- showLabel?: boolean;
36
- iconProps?: (
30
+ buttonTemplateName?: ButtonTemplateName;
31
+ render?: (
32
+ onPress: () => void,
37
33
  isAudioEnabled: boolean,
38
- isPermissionDenied: boolean,
39
- ) => Partial<ImageIconProps>;
40
- render?: (onPress: () => void, isAudioEnabled: boolean) => JSX.Element;
41
- disabled?: boolean;
42
- isOnActionSheet?: boolean;
43
- showWarningIcon?: boolean;
44
- isMobileView?: boolean;
34
+ buttonTemplateName?: ButtonTemplateName,
35
+ ) => JSX.Element;
45
36
  }
46
37
 
47
38
  function LocalAudioMute(props: LocalAudioMuteProps) {
48
- const {rtcProps} = useContext(PropsContext);
49
- const {
50
- data: {isHost},
51
- } = useMeetingInfo();
52
39
  const local = useLocalUserInfo();
53
- const isHandRaised = useIsHandRaised();
54
40
  const localMute = useMuteToggleLocal();
55
- const {
56
- showToolTip = false,
57
- showLabel = $config.ICON_TEXT,
58
- disabled = false,
59
- isOnActionSheet = false,
60
- showWarningIcon = true,
61
- isMobileView = false,
62
- } = props;
63
41
  //commented for v1 release
64
42
  //const audioLabel = useString('toggleAudioButton')();
43
+ const audioLabel = 'Audio';
44
+
45
+ const defaultTemplateValue = useButtonTemplate().buttonTemplateName;
46
+ const {buttonTemplateName = defaultTemplateValue} = props;
65
47
 
66
48
  const onPress = () => {
67
49
  localMute(MUTE_LOCAL_TYPE.audio);
68
50
  };
69
51
  const isAudioEnabled = local.audio === ToggleState.enabled;
70
52
 
71
- const permissionDenied =
72
- local.permissionStatus === PermissionState.REJECTED ||
73
- local.permissionStatus === PermissionState.GRANTED_FOR_CAM_ONLY;
74
-
75
- const audioLabel = permissionDenied
76
- ? 'Mic'
77
- : isAudioEnabled
78
- ? 'Mic On'
79
- : 'Mic Off';
80
-
81
- let iconProps: IconButtonProps['iconProps'] = {
82
- showWarningIcon: permissionDenied && showWarningIcon ? true : false,
83
- name: isAudioEnabled ? 'mic-on' : 'mic-off',
84
-
85
- iconBackgroundColor: isAudioEnabled
86
- ? $config.PRIMARY_ACTION_BRAND_COLOR
87
- : '',
88
- tintColor: isAudioEnabled
89
- ? $config.PRIMARY_ACTION_TEXT_COLOR
90
- : disabled
91
- ? $config.SEMANTIC_NEUTRAL
92
- : permissionDenied
93
- ? $config.SEMANTIC_NEUTRAL
94
- : $config.SEMANTIC_ERROR,
95
- ...(props?.iconProps
96
- ? props.iconProps(isAudioEnabled, permissionDenied)
97
- : {}),
98
- };
99
-
100
- let iconButtonProps: IconButtonProps = {
101
- hoverEffect: !permissionDenied
102
- ? props?.plainIconHoverEffect
103
- ? true
104
- : false
105
- : false,
106
- hoverEffectStyle: props?.plainIconHoverEffect
107
- ? {backgroundColor: $config.ICON_BG_COLOR, borderRadius: 20}
108
- : {},
109
- onPress,
110
- iconProps,
111
- btnTextProps: {
112
- text: showLabel ? audioLabel : '',
113
- textColor: $config.FONT_COLOR,
114
- },
115
- disabled: permissionDenied || disabled ? true : false,
53
+ let btnTemplateProps: BtnTemplateInterface = {
54
+ onPress: onPress,
55
+ name: isAudioEnabled ? 'mic' : 'micOff',
116
56
  };
117
57
 
118
- iconButtonProps.isOnActionSheet = isOnActionSheet;
119
-
120
- if (!isMobileView) {
121
- iconButtonProps.toolTipMessage = showToolTip
122
- ? permissionDenied
123
- ? 'Give Permissions'
124
- : isAudioEnabled
125
- ? 'Disable Mic'
126
- : 'Enable Mic'
127
- : '';
128
- }
129
-
130
- if (
131
- rtcProps.role == ClientRole.Audience &&
132
- $config.EVENT_MODE &&
133
- !$config.RAISE_HAND
134
- ) {
135
- return null;
136
- }
137
-
138
- if (
139
- rtcProps.role == ClientRole.Audience &&
140
- $config.EVENT_MODE &&
141
- $config.RAISE_HAND &&
142
- !isHost
143
- ) {
144
- iconButtonProps.iconProps = {
145
- ...iconButtonProps.iconProps,
146
- name: 'mic-off',
147
- tintColor: $config.SEMANTIC_NEUTRAL,
148
- };
149
- iconButtonProps.toolTipMessage = showToolTip
150
- ? isHandRaised(local.uid)
151
- ? 'Waiting for host to appove the request'
152
- : 'Raise Hand in order to turn mic on'
153
- : '';
154
- iconButtonProps.disabled = true;
58
+ if (buttonTemplateName === ButtonTemplateName.topBar) {
59
+ btnTemplateProps.style = Styles.fullWidthButton as Object;
60
+ } else {
61
+ btnTemplateProps.style = Styles.localButton as Object;
62
+ btnTemplateProps.btnText = audioLabel;
155
63
  }
156
64
 
157
65
  return props?.render ? (
158
- props.render(onPress, isAudioEnabled)
66
+ props.render(onPress, isAudioEnabled, buttonTemplateName)
159
67
  ) : (
160
- <IconButton {...iconButtonProps} />
68
+ <BtnTemplate {...btnTemplateProps} />
161
69
  );
162
70
  }
163
71
 
@@ -1,87 +1,49 @@
1
- import React, {useContext, useState} from 'react';
1
+ import React, {useContext} from 'react';
2
+ import {
3
+ ButtonTemplateName,
4
+ useButtonTemplate,
5
+ } from '../utils/useButtonTemplate';
6
+ import {BtnTemplate, BtnTemplateInterface} from '../../agora-rn-uikit';
7
+ import Styles from '../components/styles';
8
+ import {useString} from '../utils/useString';
2
9
  import {useRtc} from 'customization-api';
3
- import EndcallPopup from './EndcallPopup';
4
- import StorageContext from '../components/StorageContext';
5
- import {Prompt, useParams} from '../components/Router';
6
- import IconButton, {IconButtonProps} from '../atoms/IconButton';
7
- import ReactNativeForegroundService from '@supersami/rn-foreground-service';
8
- import {Platform} from 'react-native';
10
+
9
11
  export interface LocalEndcallProps {
10
- showLabel?: boolean;
11
- isOnActionSheet?: boolean;
12
- render?: (onPress: () => void) => JSX.Element;
12
+ buttonTemplateName?: ButtonTemplateName;
13
+ render?: (
14
+ onPress: () => void,
15
+ buttonTemplateName?: ButtonTemplateName,
16
+ ) => JSX.Element;
13
17
  }
14
18
 
15
- /* For android only, bg audio */
16
- const stopForegroundService = () => {
17
- if (Platform.OS === 'android') {
18
- ReactNativeForegroundService.stop();
19
- console.log('stopping foreground service');
20
- }
21
- };
22
-
23
19
  const LocalEndcall = (props: LocalEndcallProps) => {
24
20
  const {dispatch} = useRtc();
25
- const {showLabel = $config.ICON_TEXT, isOnActionSheet = false} = props;
26
21
  //commented for v1 release
27
22
  //const endCallLabel = useString('endCallButton')();
28
- const endCallLabel = 'Leave';
29
- const {setStore} = useContext(StorageContext);
30
- const [endcallVisible, setEndcallVisible] = useState(false);
31
- const {phrase} = useParams<{phrase: string}>();
32
- const onPress = () => {
33
- setEndcallVisible(true);
34
- };
35
-
36
- const endCall = async () => {
37
- setTimeout(() => {
38
- dispatch({
39
- type: 'EndCall',
40
- value: [],
41
- });
23
+ const endCallLabel = 'Hang Up';
24
+ const defaultTemplateValue = useButtonTemplate().buttonTemplateName;
25
+ const {buttonTemplateName = defaultTemplateValue} = props;
26
+ const onPress = () =>
27
+ dispatch({
28
+ type: 'EndCall',
29
+ value: [],
42
30
  });
43
- // stopping foreground servie on end call
44
- stopForegroundService();
45
- };
46
-
47
- let iconButtonProps: IconButtonProps = {
48
- iconProps: {
49
- name: 'end-call',
50
- tintColor: $config.PRIMARY_ACTION_TEXT_COLOR,
51
- iconBackgroundColor: $config.SEMANTIC_ERROR,
52
- iconContainerStyle: !isOnActionSheet && {
53
- width: 72,
54
- height: 52,
55
- },
56
- },
57
- onPress,
58
- btnTextProps: {
59
- text: showLabel ? endCallLabel : '',
60
- textColor: $config.FONT_COLOR,
61
- },
31
+ let btnTemplateProps: BtnTemplateInterface = {
32
+ name: 'callEnd',
33
+ color: '#FD0845',
34
+ onPress: onPress,
62
35
  };
63
36
 
37
+ if (buttonTemplateName === ButtonTemplateName.topBar) {
38
+ btnTemplateProps.style = Styles.fullWidthButton as Object;
39
+ } else {
40
+ btnTemplateProps.btnText = endCallLabel;
41
+ btnTemplateProps.style = Styles.endCall as Object;
42
+ }
64
43
  return props?.render ? (
65
- props.render(onPress)
44
+ props.render(onPress, buttonTemplateName)
66
45
  ) : (
67
- <>
68
- <Prompt
69
- when={true}
70
- message={(location, action) => {
71
- if (action === 'POP') {
72
- onPress();
73
- return false;
74
- }
75
- return true;
76
- }}
77
- />
78
- <EndcallPopup
79
- endCall={endCall}
80
- setModalVisible={setEndcallVisible}
81
- modalVisible={endcallVisible}
82
- />
83
- <IconButton {...iconButtonProps} />
84
- </>
46
+ <BtnTemplate {...btnTemplateProps} />
85
47
  );
86
48
  };
87
49
  export default LocalEndcall;
@@ -1,46 +1,59 @@
1
1
  import React, {useContext} from 'react';
2
+ import {
3
+ ButtonTemplateName,
4
+ useButtonTemplate,
5
+ } from '../utils/useButtonTemplate';
2
6
  import {useString} from '../utils/useString';
3
- import {PropsContext, ToggleState} from '../../agora-rn-uikit';
7
+ import {
8
+ BtnTemplate,
9
+ PropsContext,
10
+ ToggleState,
11
+ BtnTemplateInterface,
12
+ } from '../../agora-rn-uikit';
4
13
  import Styles from '../components/styles';
5
14
  import {useLocalUserInfo, useRtc} from 'customization-api';
6
- import IconButton, {IconButtonProps} from '../atoms/IconButton';
7
15
 
8
16
  export interface LocalSwitchCameraProps {
9
- showLabel?: boolean;
10
- render?: (onPress: () => void, isVideoEnabled: boolean) => JSX.Element;
11
- disabled?: boolean;
17
+ buttonTemplateName?: ButtonTemplateName;
18
+ render?: (
19
+ onPress: () => void,
20
+ isVideoEnabled: boolean,
21
+ buttonTemplateName?: ButtonTemplateName,
22
+ ) => JSX.Element;
12
23
  }
13
24
 
14
25
  function LocalSwitchCamera(props: LocalSwitchCameraProps) {
15
26
  const {callbacks} = useContext(PropsContext);
16
27
  const {RtcEngine} = useRtc();
17
28
  const local = useLocalUserInfo();
18
- const {showLabel = $config.ICON_TEXT, disabled = false} = props;
19
29
  //commented for v1 release
20
30
  //const switchCameraButtonText = useString('switchCameraButton')();
21
31
  const switchCameraButtonText = 'Switch';
22
32
 
33
+ const defaultTemplateValue = useButtonTemplate().buttonTemplateName;
34
+ const {buttonTemplateName = defaultTemplateValue} = props;
23
35
  const onPress = () => {
24
36
  RtcEngine.switchCamera();
25
37
  callbacks?.SwitchCamera && callbacks.SwitchCamera();
26
38
  };
27
39
  const isVideoEnabled = local.video === ToggleState.enabled;
28
- let iconButtonProps: IconButtonProps = {
29
- iconProps: {
30
- name: 'switch-camera',
31
- tintColor:
32
- isVideoEnabled || !disabled
33
- ? $config.SECONDARY_ACTION_COLOR
34
- : $config.SEMANTIC_NEUTRAL,
35
- },
36
- disabled: !isVideoEnabled || disabled ? true : false,
40
+ let btnTemplateProps: BtnTemplateInterface = {
41
+ name: 'switchCamera',
42
+ disabled: isVideoEnabled ? false : true,
37
43
  onPress: onPress,
38
44
  };
39
45
 
46
+ if (buttonTemplateName === ButtonTemplateName.topBar) {
47
+ btnTemplateProps.style = Styles.fullWidthButton as Object;
48
+ } else {
49
+ btnTemplateProps.style = Styles.localButton as Object;
50
+ btnTemplateProps.btnText = switchCameraButtonText;
51
+ }
52
+
40
53
  return props?.render ? (
41
- props.render(onPress, isVideoEnabled)
54
+ props.render(onPress, isVideoEnabled, buttonTemplateName)
42
55
  ) : (
43
- <IconButton {...iconButtonProps} />
56
+ <BtnTemplate {...btnTemplateProps} />
44
57
  );
45
58
  }
46
59