agora-appbuilder-core 2.3.0-beta.9 → 3.0.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 (205) hide show
  1. package/Readme.md +11 -6
  2. package/package.json +1 -1
  3. package/template/Gulpfile.js +121 -83
  4. package/template/_gitignore +2 -2
  5. package/template/_package-lock.json +12959 -13248
  6. package/template/agora-rn-uikit/src/AgoraUIKit.tsx +2 -2
  7. package/template/agora-rn-uikit/src/Contexts/PropsContext.tsx +2 -0
  8. package/template/agora-rn-uikit/src/Contexts/RtcContext.tsx +3 -3
  9. package/template/agora-rn-uikit/src/Controls/BtnTemplate.tsx +4 -5
  10. package/template/agora-rn-uikit/src/Controls/ImageIcon.tsx +3 -1
  11. package/template/agora-rn-uikit/src/Controls/LocalControls.tsx +2 -2
  12. package/template/agora-rn-uikit/src/Reducer/LocalMuteAudio.ts +1 -1
  13. package/template/agora-rn-uikit/src/Reducer/LocalMuteVideo.ts +1 -1
  14. package/template/agora-rn-uikit/src/Reducer/RemoteAudioStateChanged.ts +1 -1
  15. package/template/agora-rn-uikit/src/Reducer/RemoteVideoStateChanged.ts +1 -1
  16. package/template/agora-rn-uikit/src/Reducer/UpdateDualStreamMode.ts +4 -4
  17. package/template/agora-rn-uikit/src/Reducer/UserJoined.ts +7 -5
  18. package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteAudio.ts +1 -1
  19. package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteVideo.ts +1 -1
  20. package/template/agora-rn-uikit/src/Reducer/UserOffline.ts +2 -2
  21. package/template/agora-rn-uikit/src/Rtc/Create.tsx +88 -43
  22. package/template/agora-rn-uikit/src/Rtc/Join.tsx +13 -4
  23. package/template/agora-rn-uikit/src/RtcConfigure.tsx +36 -19
  24. package/template/agora-rn-uikit/src/Utils/permission.ts +17 -6
  25. package/template/babel.config.js +9 -9
  26. package/template/bridge/rtc/webNg/RtcEngine.ts +51 -26
  27. package/template/customization-api/action-library.ts +22 -0
  28. package/template/{fpe-api/context.ts → customization-api/app-state.ts} +16 -14
  29. package/template/customization-api/customEvents.ts +9 -0
  30. package/template/{fpe-api/install.ts → customization-api/customize.ts} +27 -26
  31. package/template/{fpe-api → customization-api}/index.ts +11 -6
  32. package/template/{fpe-api/components.ts → customization-api/sub-components.ts} +22 -3
  33. package/template/{fpe-api → customization-api}/typeDefinition.ts +13 -14
  34. package/template/customization-api/utils.ts +30 -0
  35. package/template/{fpe-implementation → customization-implementation}/createHook.ts +0 -0
  36. package/template/{fpe-implementation/dummyFpe.ts → customization-implementation/dummyConfig.ts} +4 -4
  37. package/template/customization-implementation/index.ts +4 -0
  38. package/template/{fpe-api/useFpe.tsx → customization-implementation/useCustomization.tsx} +12 -12
  39. package/template/{fpe.config.js → customization.config.js} +11 -11
  40. package/template/electron/main/index.js +42 -35
  41. package/template/esbuild.rsdk.go +8 -17
  42. package/template/global.d.ts +4 -3
  43. package/template/index.rsdk.tsx +13 -5
  44. package/template/index.wsdk.tsx +21 -5
  45. package/template/package.json +3 -0
  46. package/template/react-native-toast-message/src/index.js +3 -7
  47. package/template/react-native-toast-message/src/{index.wsdk.js → index.sdk.tsx} +1 -1
  48. package/template/react-native-toast-message/src/styles.sdk.ts +17 -0
  49. package/template/src/App.tsx +8 -4
  50. package/template/src/AppWrapper.tsx +8 -6
  51. package/template/src/SDKAppWrapper.tsx +28 -21
  52. package/template/src/app-state/useLocalUserInfo.ts +8 -0
  53. package/template/src/app-state/useMessages.ts +52 -0
  54. package/template/src/atoms/PrimaryButton.tsx +2 -2
  55. package/template/src/atoms/SecondaryButton.tsx +12 -4
  56. package/template/src/atoms/TextInput.tsx +2 -2
  57. package/template/src/components/Chat.tsx +22 -11
  58. package/template/src/components/ChatContext.ts +10 -27
  59. package/template/src/components/Controls.native.tsx +13 -7
  60. package/template/src/components/Controls.tsx +15 -24
  61. package/template/src/components/DeviceConfigure.tsx +4 -3
  62. package/template/src/components/EventsConfigure.tsx +54 -0
  63. package/template/src/components/GridVideo.tsx +5 -6
  64. package/template/src/components/HostControlView.tsx +13 -19
  65. package/template/src/components/Navbar.tsx +54 -41
  66. package/template/src/components/NetworkQualityContext.tsx +4 -3
  67. package/template/src/components/ParticipantsView.tsx +7 -7
  68. package/template/src/components/PinnedVideo.tsx +3 -4
  69. package/template/src/components/Precall.native.tsx +3 -3
  70. package/template/src/components/Precall.tsx +14 -10
  71. package/template/src/components/RTMConfigure.tsx +61 -219
  72. package/template/src/components/SettingsView.tsx +6 -3
  73. package/template/src/components/Share.tsx +24 -18
  74. package/template/src/components/chat-messages/useChatMessages.tsx +397 -80
  75. package/template/src/components/chat-notification/useChatNotification.tsx +2 -2
  76. package/template/src/components/chat-ui/useChatUIControl.tsx +1 -1
  77. package/template/src/components/common/Logo.tsx +3 -2
  78. package/template/src/components/contexts/LiveStreamDataContext.tsx +3 -3
  79. package/template/src/components/contexts/ScreenShareContext.tsx +3 -1
  80. package/template/src/components/contexts/VideoMeetingDataContext.tsx +85 -0
  81. package/template/src/components/contexts/WhiteboardContext.tsx +8 -8
  82. package/template/src/components/livestream/LiveStreamContext.tsx +88 -74
  83. package/template/src/components/meeting-info/useMeetingInfo.tsx +23 -19
  84. package/template/src/components/meeting-info/useSetMeetingInfo.tsx +1 -1
  85. package/template/src/components/participants/AllAudienceParticipants.tsx +2 -2
  86. package/template/src/components/participants/AllHostParticipants.tsx +4 -4
  87. package/template/src/components/participants/MeParticipant.tsx +5 -3
  88. package/template/src/components/participants/ParticipantName.tsx +2 -2
  89. package/template/src/components/participants/RemoteParticipants.tsx +9 -7
  90. package/template/src/components/precall/LocalMute.native.tsx +14 -10
  91. package/template/src/components/precall/LocalMute.tsx +7 -5
  92. package/template/src/components/precall/VideoPreview.native.tsx +6 -6
  93. package/template/src/components/precall/VideoPreview.tsx +3 -3
  94. package/template/src/components/precall/joinCallBtn.tsx +3 -3
  95. package/template/src/components/precall/meetingTitle.tsx +3 -1
  96. package/template/src/components/precall/selectDevice.tsx +2 -2
  97. package/template/src/components/precall/usePreCall.tsx +1 -1
  98. package/template/src/components/styles.ts +3 -3
  99. package/template/src/components/useShareLink.tsx +69 -29
  100. package/template/src/components/useUserPreference.tsx +16 -15
  101. package/template/src/components/useWakeLock.tsx +3 -3
  102. package/template/src/language/i18nTypes.ts +1 -1
  103. package/template/src/language/index.ts +2 -2
  104. package/template/src/language/useLanguage.tsx +2 -3
  105. package/template/src/pages/Authenticate.tsx +3 -2
  106. package/template/src/pages/Create.tsx +18 -20
  107. package/template/src/pages/Join.tsx +6 -7
  108. package/template/src/pages/VideoCall.tsx +74 -66
  109. package/template/src/pages/create/useCreate.tsx +1 -1
  110. package/template/src/pages/video-call/CustomUserContextHolder.tsx +14 -6
  111. package/template/src/pages/video-call/DefaultLayouts.ts +8 -8
  112. package/template/src/pages/video-call/{NameWithMicStatus.tsx → NameWithMicIcon.tsx} +8 -1
  113. package/template/src/pages/video-call/RenderComponent.tsx +7 -10
  114. package/template/src/pages/video-call/VideoCallScreen.tsx +31 -22
  115. package/template/src/pages/video-call/VideoComponent.tsx +13 -15
  116. package/template/src/pages/video-call/VideoRenderer.tsx +6 -6
  117. package/template/src/pages/video-call/useLayoutsData.ts +23 -0
  118. package/template/src/rtm/RTMEngine.ts +13 -0
  119. package/template/src/rtm-events/EventUtils.ts +20 -20
  120. package/template/src/rtm-events/EventsQueue.ts +9 -3
  121. package/template/src/rtm-events/constants.ts +5 -0
  122. package/template/src/rtm-events/index.tsx +1 -3
  123. package/template/src/{custom-events/CustomEvents.ts → rtm-events-api/Events.ts} +67 -61
  124. package/template/src/rtm-events-api/index.tsx +6 -0
  125. package/template/src/rtm-events-api/types.ts +22 -0
  126. package/template/src/subComponents/ChatBubble.tsx +24 -8
  127. package/template/src/subComponents/ChatContainer.tsx +24 -15
  128. package/template/src/subComponents/ChatInput.tsx +56 -42
  129. package/template/src/subComponents/LanguageSelector.tsx +2 -2
  130. package/template/src/subComponents/LayoutIconDropdown.native.tsx +5 -5
  131. package/template/src/subComponents/LayoutIconDropdown.tsx +7 -7
  132. package/template/src/subComponents/LocalAudioMute.tsx +3 -4
  133. package/template/src/subComponents/LocalEndCall.tsx +3 -6
  134. package/template/src/subComponents/LocalSwitchCamera.tsx +3 -4
  135. package/template/src/subComponents/LocalVideoMute.tsx +3 -3
  136. package/template/src/subComponents/NetworkQualityPill.tsx +8 -9
  137. package/template/src/subComponents/OpenInNativeButton.tsx +2 -3
  138. package/template/src/subComponents/RemoteAudioMute.tsx +5 -11
  139. package/template/src/subComponents/RemoteEndCall.tsx +3 -10
  140. package/template/src/subComponents/RemoteVideoMute.tsx +3 -10
  141. package/template/src/subComponents/SelectDevice.tsx +1 -1
  142. package/template/src/subComponents/SelectOAuth.tsx +3 -2
  143. package/template/src/subComponents/SidePanelButtons.ts +6 -5
  144. package/template/src/subComponents/TextWithTooltip.tsx +6 -2
  145. package/template/src/subComponents/{toastConfig.tsx → ToastConfig.tsx} +2 -2
  146. package/template/src/subComponents/chat/ChatParticipants.tsx +6 -5
  147. package/template/src/subComponents/livestream/CurrentLiveStreamRequestsView.tsx +2 -2
  148. package/template/src/subComponents/livestream/controls/RemoteLiveStreamApprovedRequestRecall.tsx +4 -3
  149. package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestApprove.tsx +2 -2
  150. package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestReject.tsx +2 -4
  151. package/template/src/subComponents/livestream/index.ts +2 -2
  152. package/template/src/subComponents/recording/useRecording.tsx +44 -23
  153. package/template/src/subComponents/recording/useRecordingLayoutQuery.tsx +11 -5
  154. package/template/src/subComponents/screenshare/ScreenshareConfigure.native.tsx +46 -34
  155. package/template/src/subComponents/screenshare/ScreenshareConfigure.tsx +97 -38
  156. package/template/src/subComponents/screenshare/useScreenshare.tsx +1 -1
  157. package/template/src/utils/SdkEvents.ts +9 -46
  158. package/template/src/utils/common.tsx +25 -9
  159. package/template/src/utils/getUniqueID.ts +5 -0
  160. package/template/src/utils/isMobileOrTablet.native.ts +2 -2
  161. package/template/src/utils/isMobileOrTablet.ts +21 -8
  162. package/template/src/utils/useButtonTemplate.tsx +1 -1
  163. package/template/src/utils/useCreateMeeting.ts +21 -10
  164. package/template/src/utils/useGetMeetingPhrase.ts +11 -8
  165. package/template/src/utils/{IsAttendeeUser.ts → useIsAttendee.ts} +3 -1
  166. package/template/src/utils/{isAudioEnabled.ts → useIsAudioEnabled.ts} +4 -4
  167. package/template/src/utils/{isHostUser.ts → useIsHost.ts} +13 -16
  168. package/template/src/utils/{isPSTNUser.ts → useIsPSTN.ts} +2 -2
  169. package/template/src/utils/{isScreenShareUser.ts → useIsScreenShare.ts} +0 -0
  170. package/template/src/utils/{isVideoEnabled.ts → useIsVideoEnabled.ts} +5 -6
  171. package/template/src/utils/useJoinMeeting.ts +8 -6
  172. package/template/src/utils/useLayout.tsx +5 -5
  173. package/template/src/utils/useMutePSTN.ts +5 -3
  174. package/template/src/utils/useMuteToggleLocal.ts +3 -4
  175. package/template/src/utils/useRemoteEndCall.ts +11 -10
  176. package/template/src/utils/useRemoteMute.ts +42 -20
  177. package/template/src/utils/useSidePanel.tsx +1 -1
  178. package/template/src/utils/useString.ts +2 -2
  179. package/template/src/utils/useUserName.ts +11 -0
  180. package/template/tsconfig_fpeApi.json +8 -9
  181. package/template/tsconfig_rsdk_index.json +8 -9
  182. package/template/tsconfig_wsdk_index.json +8 -9
  183. package/template/webpack.commons.js +9 -9
  184. package/template/webpack.rsdk.config.js +4 -2
  185. package/template/webpack.ts.config.js +6 -6
  186. package/template/webpack.wsdk.config.js +2 -1
  187. package/template/fpe-api/fpeEvents.ts +0 -9
  188. package/template/fpe-api/utils.ts +0 -61
  189. package/template/fpe-implementation/index.ts +0 -1
  190. package/template/fpe-todo.txt +0 -14
  191. package/template/src/components/RTMEvents.tsx +0 -84
  192. package/template/src/custom-events/index.tsx +0 -4
  193. package/template/src/custom-events/types.ts +0 -51
  194. package/template/src/pages/video-call/CustomLayout.ts +0 -17
  195. package/template/src/rtm-events/types.ts +0 -7
  196. package/template/src/utils/getMeetingInvite.ts +0 -53
  197. package/template/src/utils/useGroupMessages.ts +0 -24
  198. package/template/src/utils/useNavParams.ts +0 -6
  199. package/template/src/utils/useNavigateTo.ts +0 -8
  200. package/template/src/utils/usePrivateMessages.ts +0 -33
  201. package/template/src/utils/useSendControlMessage.ts +0 -51
  202. package/template/src/utils/useSendMessage.ts +0 -40
  203. package/template/src/utils/useSetUnreadMessageCount.ts +0 -43
  204. package/template/src/utils/useUnreadMessageCount.ts +0 -50
  205. package/template/src/utils/useUserList.ts +0 -26
@@ -23,12 +23,23 @@ import ChatParticipants from '../subComponents/chat/ChatParticipants';
23
23
  import ColorContext from './ColorContext';
24
24
  import {useChatNotification} from './chat-notification/useChatNotification';
25
25
  import {useString} from '../utils/useString';
26
- import {isIOS, isValidReactComponent, isWeb} from '../utils/common';
26
+ import {isIOS, isValidReactComponent, isWebInternal} from '../utils/common';
27
27
  import {useChatUIControl} from './chat-ui/useChatUIControl';
28
- import {useFpe} from 'fpe-api';
28
+ import {useCustomization} from 'customization-implementation';
29
29
  import {UidType} from '../../agora-rn-uikit';
30
+ import {ChatBubbleProps} from './ChatContext';
31
+ import {
32
+ ChatTextInputProps,
33
+ ChatSendButtonProps,
34
+ } from '../subComponents/ChatInput';
35
+
36
+ interface ChatProps {
37
+ chatBubble?: React.ComponentType<ChatBubbleProps>;
38
+ chatInput?: React.ComponentType<ChatTextInputProps>;
39
+ chatSendButton?: React.ComponentType<ChatSendButtonProps>;
40
+ }
30
41
 
31
- const Chat = () => {
42
+ const Chat = (props?: ChatProps) => {
32
43
  // commented for v1 release
33
44
  // const groupChatLabel = useString('groupChatLabel')();
34
45
  // const privateChatLabel = useString('privateChatLabel')();
@@ -93,7 +104,7 @@ const Chat = () => {
93
104
  );
94
105
  };
95
106
 
96
- const {ChatAfterView, ChatBeforeView} = useFpe((data) => {
107
+ const {ChatAfterView, ChatBeforeView} = useCustomization((data) => {
97
108
  let components: {
98
109
  ChatAfterView: React.ComponentType;
99
110
  ChatBeforeView: React.ComponentType;
@@ -131,7 +142,7 @@ const Chat = () => {
131
142
  <>
132
143
  <View
133
144
  style={
134
- isWeb
145
+ isWebInternal()
135
146
  ? !isSmall
136
147
  ? style.chatView
137
148
  : style.chatViewNative
@@ -190,12 +201,12 @@ const Chat = () => {
190
201
  </View>
191
202
  {groupActive ? (
192
203
  <>
193
- <ChatContainer privateActive={privateActive} />
204
+ <ChatContainer {...props} />
194
205
  <View style={[style.chatInputLineSeparator, {marginBottom: 0}]} />
195
206
  <View>
196
207
  <View style={style.chatInputContainer}>
197
208
  <View style={[style.chatInputLineSeparator, {opacity: 0.3}]} />
198
- <ChatInput />
209
+ <ChatInput {...props} />
199
210
  </View>
200
211
  </View>
201
212
  </>
@@ -205,7 +216,7 @@ const Chat = () => {
205
216
  <ChatParticipants selectUser={selectUser} />
206
217
  ) : (
207
218
  <>
208
- <ChatContainer selectPrivate={selectPrivate} />
219
+ <ChatContainer {...props} />
209
220
  <View
210
221
  style={[style.chatInputLineSeparator, {marginBottom: 0}]}
211
222
  />
@@ -214,7 +225,7 @@ const Chat = () => {
214
225
  <View
215
226
  style={[style.chatInputLineSeparator, {opacity: 0.3}]}
216
227
  />
217
- <ChatInput />
228
+ <ChatInput {...props} />
218
229
  </View>
219
230
  </View>
220
231
  </>
@@ -340,7 +351,7 @@ const style = StyleSheet.create({
340
351
  justifyContent: 'center',
341
352
  backgroundColor: $config.PRIMARY_COLOR,
342
353
  color: $config.SECONDARY_FONT_COLOR,
343
- fontFamily: isIOS ? 'Helvetica' : 'sans-serif',
354
+ fontFamily: isIOS() ? 'Helvetica' : 'sans-serif',
344
355
  borderRadius: 10,
345
356
  position: 'absolute',
346
357
  left: 25,
@@ -354,7 +365,7 @@ const style = StyleSheet.create({
354
365
  justifyContent: 'center',
355
366
  backgroundColor: $config.PRIMARY_COLOR,
356
367
  color: $config.SECONDARY_FONT_COLOR,
357
- fontFamily: isIOS ? 'Helvetica' : 'sans-serif',
368
+ fontFamily: isIOS() ? 'Helvetica' : 'sans-serif',
358
369
  borderRadius: 10,
359
370
  position: 'absolute',
360
371
  right: 20,
@@ -16,51 +16,36 @@ import {createContext, SetStateAction} from 'react';
16
16
  export interface ChatBubbleProps {
17
17
  isLocal: boolean;
18
18
  message: string;
19
- timestamp: string;
19
+ createdTimestamp: string;
20
+ updatedTimestamp?: string;
20
21
  uid: UidType;
22
+ msgId: string;
23
+ isDeleted: boolean;
21
24
  render?: (
22
25
  isLocal: boolean,
23
26
  message: string,
24
- timestamp: string,
27
+ createdTimestamp: string,
25
28
  uid: UidType,
29
+ msgId: string,
30
+ isDeleted: boolean,
31
+ updatedTimestamp?: string,
26
32
  ) => JSX.Element;
27
33
  }
28
34
 
29
35
  export interface messageStoreInterface {
30
- ts: string;
36
+ createdTimestamp: string;
37
+ updatedTimestamp?: string;
31
38
  uid: UidType;
32
39
  msg: string;
33
40
  }
34
41
 
35
- export interface messageEventInterface extends messageStoreInterface {
36
- type: messageActionType;
37
- source: messageSourceType;
38
- }
39
-
40
- export enum messageSourceType {
41
- Core = 'core',
42
- }
43
-
44
- export enum messageChannelType {
45
- Private = 'private',
46
- Public = 'public',
47
- }
48
-
49
42
  export enum messageActionType {
50
43
  Control = '0',
51
44
  Normal = '1',
52
45
  }
53
46
 
54
- export enum attrRequestTypes {
55
- none = 'NONE',
56
- }
57
-
58
47
  export interface chatContext {
59
48
  hasUserJoinedRTM: boolean;
60
- sendMessage: (msg: string) => void;
61
- sendMessageToUid: (msg: string, uid: number | string) => void;
62
- sendControlMessage: (msg: string) => void;
63
- sendControlMessageToUid: (msg: string, uid: number) => void;
64
49
  engine: RtmEngine;
65
50
  localUid: UidType;
66
51
  onlineUsersCount: number;
@@ -72,8 +57,6 @@ export enum controlMessageEnum {
72
57
  muteSingleVideo = '3',
73
58
  muteSingleAudio = '4',
74
59
  kickUser = '5',
75
- cloudRecordingActive = '6',
76
- cloudRecordingUnactive = '7',
77
60
  }
78
61
 
79
62
  const ChatContext = createContext(null as unknown as chatContext);
@@ -32,7 +32,9 @@ import LocalSwitchCamera, {
32
32
  } from '../subComponents/LocalSwitchCamera';
33
33
 
34
34
  const Controls = () => {
35
- const {isHost} = useMeetingInfo();
35
+ const {
36
+ data: {isHost},
37
+ } = useMeetingInfo();
36
38
  const {rtcProps} = useContext(PropsContext);
37
39
 
38
40
  return (
@@ -54,17 +56,21 @@ const Controls = () => {
54
56
  <View style={{alignSelf: 'center'}}>
55
57
  <LocalAudioMute />
56
58
  </View>
57
- <View style={{alignSelf: 'center'}}>
58
- <LocalVideoMute />
59
- </View>
59
+ {!$config.AUDIO_ROOM && (
60
+ <View style={{alignSelf: 'center'}}>
61
+ <LocalVideoMute />
62
+ </View>
63
+ )}
60
64
  {isHost && $config.CLOUD_RECORDING && (
61
65
  <View style={{alignSelf: 'baseline'}}>
62
66
  <Recording />
63
67
  </View>
64
68
  )}
65
- <View style={{alignSelf: 'center'}}>
66
- <LocalSwitchCamera />
67
- </View>
69
+ {!$config.AUDIO_ROOM && (
70
+ <View style={{alignSelf: 'center'}}>
71
+ <LocalSwitchCamera />
72
+ </View>
73
+ )}
68
74
  </>
69
75
  )}
70
76
  <View style={{alignSelf: 'center'}}>
@@ -31,7 +31,7 @@ import {ClientRole} from '../../agora-rn-uikit';
31
31
  import LiveStreamControls, {
32
32
  LiveStreamControlsProps,
33
33
  } from './livestream/views/LiveStreamControls';
34
- import {isIOS, isWeb} from '../utils/common';
34
+ import {isWebInternal} from '../utils/common';
35
35
  import {useMeetingInfo} from './meeting-info/useMeetingInfo';
36
36
  import LocalEndcall, {LocalEndcallProps} from '../subComponents/LocalEndCall';
37
37
 
@@ -47,8 +47,9 @@ const Controls = () => {
47
47
  Dimensions.get('window').width > Dimensions.get('window').height,
48
48
  ]);
49
49
  const isDesktop = dim[0] > 1224;
50
- const {isHost} = useMeetingInfo();
51
-
50
+ const {
51
+ data: {isHost},
52
+ } = useMeetingInfo();
52
53
  return (
53
54
  <View
54
55
  style={[
@@ -76,10 +77,12 @@ const Controls = () => {
76
77
  <View style={{alignSelf: 'center'}}>
77
78
  <LocalAudioMute />
78
79
  </View>
79
- <View style={{alignSelf: 'center'}}>
80
- <LocalVideoMute />
81
- </View>
82
- {isMobileOrTablet() && (
80
+ {!$config.AUDIO_ROOM && (
81
+ <View style={{alignSelf: 'center'}}>
82
+ <LocalVideoMute />
83
+ </View>
84
+ )}
85
+ {!$config.AUDIO_ROOM && isMobileOrTablet() && (
83
86
  <View style={{alignSelf: 'center'}}>
84
87
  <LocalSwitchCamera />
85
88
  </View>
@@ -103,7 +106,7 @@ const Controls = () => {
103
106
  );
104
107
  };
105
108
 
106
- export const ControlsComponentsArray: [
109
+ type ControlsComponentsArrayProps = [
107
110
  (props: LocalAudioMuteProps) => JSX.Element,
108
111
  (props: LocalVideoMuteProps) => JSX.Element,
109
112
  (props: LocalSwitchCameraProps) => JSX.Element,
@@ -111,7 +114,9 @@ export const ControlsComponentsArray: [
111
114
  (props: RecordingButtonProps) => JSX.Element,
112
115
  (props: LocalEndcallProps) => JSX.Element,
113
116
  (props: LiveStreamControlsProps) => JSX.Element,
114
- ] = [
117
+ ];
118
+
119
+ export const ControlsComponentsArray: ControlsComponentsArrayProps = [
115
120
  LocalAudioMute,
116
121
  LocalVideoMute,
117
122
  LocalSwitchCamera,
@@ -124,23 +129,9 @@ export const ControlsComponentsArray: [
124
129
  const style = StyleSheet.create({
125
130
  // @ts-ignore
126
131
  controlsHolder: {
127
- flex: isWeb ? 1.3 : 1.6,
132
+ flex: isWebInternal() ? 1.3 : 1.6,
128
133
  ...controlsHolder,
129
134
  },
130
- chatNotification: {
131
- width: 20,
132
- height: 20,
133
- display: 'flex',
134
- alignItems: 'center',
135
- justifyContent: 'center',
136
- backgroundColor: $config.PRIMARY_COLOR,
137
- color: $config.SECONDARY_FONT_COLOR,
138
- fontFamily: isIOS ? 'Helvetica' : 'sans-serif',
139
- borderRadius: 10,
140
- position: 'absolute',
141
- left: 25,
142
- top: -10,
143
- },
144
135
  });
145
136
 
146
137
  export default Controls;
@@ -9,10 +9,11 @@
9
9
  information visit https://appbuilder.agora.io.
10
10
  *********************************************
11
11
  */
12
- import React, {useState, useContext, useEffect, useCallback} from 'react';
13
- import {RtcContext, ClientRole} from '../../agora-rn-uikit';
12
+ import React, {useState, useEffect, useCallback} from 'react';
13
+ import {ClientRole} from '../../agora-rn-uikit';
14
14
  import DeviceContext from './DeviceContext';
15
15
  import AgoraRTC from 'agora-rtc-sdk-ng';
16
+ import {useRtc} from 'customization-api';
16
17
 
17
18
  interface Props {
18
19
  userRole: ClientRole;
@@ -33,7 +34,7 @@ const DeviceConfigure: React.FC<Props> = (props: any) => {
33
34
  const [selectedCam, setSelectedCam] = useState('');
34
35
  const [selectedMic, setSelectedMic] = useState('');
35
36
  const [deviceList, setDeviceList] = useState<any>([]);
36
- const rtc = useContext(RtcContext);
37
+ const rtc = useRtc();
37
38
 
38
39
  const refreshDevices = useCallback(async () => {
39
40
  rtc.RtcEngine.getDevices(function (devices: deviceInfo[]) {
@@ -0,0 +1,54 @@
1
+ /*
2
+ ********************************************
3
+ Copyright © 2022 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 React, {useContext, useEffect} from 'react';
13
+ import {RtcContext} from '../../agora-rn-uikit';
14
+ import events from '../rtm-events-api';
15
+ import {controlMessageEnum} from '../components/ChatContext';
16
+
17
+ interface Props {
18
+ children: React.ReactNode;
19
+ }
20
+
21
+ const EventsConfigure: React.FC<Props> = (props) => {
22
+ const {RtcEngine, dispatch} = useContext(RtcContext);
23
+ useEffect(() => {
24
+ events.on(controlMessageEnum.muteVideo, () => {
25
+ RtcEngine.muteLocalVideoStream(true);
26
+ dispatch({
27
+ type: 'LocalMuteVideo',
28
+ value: [0],
29
+ });
30
+ });
31
+ events.on(controlMessageEnum.muteAudio, () => {
32
+ RtcEngine.muteLocalAudioStream(true);
33
+ dispatch({
34
+ type: 'LocalMuteAudio',
35
+ value: [0],
36
+ });
37
+ });
38
+ events.on(controlMessageEnum.kickUser, () => {
39
+ dispatch({
40
+ type: 'EndCall',
41
+ value: [],
42
+ });
43
+ });
44
+ return () => {
45
+ events.off(controlMessageEnum.muteVideo);
46
+ events.off(controlMessageEnum.muteAudio);
47
+ events.off(controlMessageEnum.kickUser);
48
+ };
49
+ }, []);
50
+
51
+ return <>{props.children}</>;
52
+ };
53
+
54
+ export default EventsConfigure;
@@ -9,11 +9,10 @@
9
9
  information visit https://appbuilder.agora.io.
10
10
  *********************************************
11
11
  */
12
- import {layoutComponent} from 'fpe-api';
13
- import React, {useMemo, useContext, useState} from 'react';
12
+ import {layoutComponent, useRtc} from 'customization-api';
13
+ import React, {useMemo, useState} from 'react';
14
14
  import {View, StyleSheet, Dimensions, Pressable} from 'react-native';
15
- import {isWeb} from '../utils/common';
16
- import {RtcContext} from '../../agora-rn-uikit';
15
+ import {isWebInternal} from '../utils/common';
17
16
  import {useSetPinnedLayout} from '../pages/video-call/DefaultLayouts';
18
17
  import RenderComponent from '../pages/video-call/RenderComponent';
19
18
  const layout = (len: number, isDesktop: boolean = true) => {
@@ -35,7 +34,7 @@ const layout = (len: number, isDesktop: boolean = true) => {
35
34
  };
36
35
 
37
36
  const GridVideo: layoutComponent = ({renderData}) => {
38
- const {dispatch} = useContext(RtcContext);
37
+ const {dispatch} = useRtc();
39
38
  let onLayout = (e: any) => {
40
39
  setDim([
41
40
  e.nativeEvent.layout.width,
@@ -74,7 +73,7 @@ const GridVideo: layoutComponent = ({renderData}) => {
74
73
  setPinnedLayout();
75
74
  }}
76
75
  style={{
77
- flex: isWeb ? 1 / dims.c : 1,
76
+ flex: isWebInternal() ? 1 / dims.c : 1,
78
77
  marginHorizontal: 'auto',
79
78
  }}
80
79
  key={cidx}>
@@ -11,27 +11,21 @@
11
11
  */
12
12
  import React from 'react';
13
13
  import {View, Text, StyleSheet} from 'react-native';
14
- import {controlMessageEnum} from './ChatContext';
15
14
  import SecondaryButton from '../atoms/SecondaryButton';
16
15
  import {useString} from '../utils/useString';
17
- import useSendControlMessage, {
18
- CONTROL_MESSAGE_TYPE,
19
- } from '../utils/useSendControlMessage';
16
+ import useRemoteMute, {MUTE_REMOTE_TYPE} from '../utils/useRemoteMute';
20
17
 
21
18
  export interface MuteAllAudioButtonProps {
22
19
  render?: (onPress: () => void) => JSX.Element;
23
20
  }
24
21
 
25
22
  export const MuteAllAudioButton = (props: MuteAllAudioButtonProps) => {
26
- const sendCtrlMsg = useSendControlMessage();
23
+ const muteRemoteAudio = useRemoteMute();
27
24
  //commented for v1 release
28
25
  //const muteAllAudioButton = useString('muteAllAudioButton')();
29
26
  const muteAllAudioButton = 'Mute all audios';
30
- const onPress = () =>
31
- sendCtrlMsg(
32
- CONTROL_MESSAGE_TYPE.controlMessageToEveryOne,
33
- controlMessageEnum.muteAudio,
34
- );
27
+ const onPress = () => muteRemoteAudio(MUTE_REMOTE_TYPE.audio);
28
+
35
29
  return props?.render ? (
36
30
  props.render(onPress)
37
31
  ) : (
@@ -43,15 +37,13 @@ export interface MuteAllVideoButtonProps {
43
37
  render?: (onPress: () => void) => JSX.Element;
44
38
  }
45
39
  export const MuteAllVideoButton = (props: MuteAllVideoButtonProps) => {
46
- const sendCtrlMsg = useSendControlMessage();
40
+ const muteRemoteVideo = useRemoteMute();
41
+
47
42
  //commented for v1 release
48
43
  //const muteAllVideoButton = useString('muteAllVideoButton')();
49
44
  const muteAllVideoButton = 'Mute all videos';
50
- const onPress = () =>
51
- sendCtrlMsg(
52
- CONTROL_MESSAGE_TYPE.controlMessageToEveryOne,
53
- controlMessageEnum.muteVideo,
54
- );
45
+ const onPress = () => muteRemoteVideo(MUTE_REMOTE_TYPE.video);
46
+
55
47
  return props?.render ? (
56
48
  props.render(onPress)
57
49
  ) : (
@@ -70,9 +62,11 @@ const HostControlView = () => {
70
62
  <View style={style.btnContainer}>
71
63
  <MuteAllAudioButton />
72
64
  </View>
73
- <View style={style.btnContainer}>
74
- <MuteAllVideoButton />
75
- </View>
65
+ {!$config.AUDIO_ROOM && (
66
+ <View style={style.btnContainer}>
67
+ <MuteAllVideoButton />
68
+ </View>
69
+ )}
76
70
  </View>
77
71
  </>
78
72
  );