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
@@ -0,0 +1,85 @@
1
+ import React, {createContext, useState, useEffect, useContext} from 'react';
2
+ import {createHook} from 'customization-implementation';
3
+ import {UidType, useLocalUid} from '../../../agora-rn-uikit';
4
+ import {useMeetingInfo} from '../meeting-info/useMeetingInfo';
5
+ import events, {EventPersistLevel} from '../../rtm-events-api';
6
+ import {EventNames} from '../../rtm-events';
7
+ import ChatContext from '../ChatContext';
8
+
9
+ export interface VideoMeetingDataInterface {
10
+ hostUids: UidType[];
11
+ attendeeUids: UidType[];
12
+ }
13
+ const VideoMeetingData = createContext<VideoMeetingDataInterface>({
14
+ hostUids: [],
15
+ attendeeUids: [],
16
+ });
17
+
18
+ interface VideoMeetingDataProviderProps {
19
+ children: React.ReactNode;
20
+ }
21
+ const VideoMeetingDataProvider = (props: VideoMeetingDataProviderProps) => {
22
+ const {
23
+ data: {isHost},
24
+ } = useMeetingInfo();
25
+ const {hasUserJoinedRTM} = useContext(ChatContext);
26
+ const localUid = useLocalUid();
27
+ const [hostUids, setHostUids] = useState<UidType[]>([]);
28
+ const [attendeeUids, setAttendeeUids] = useState<UidType[]>([]);
29
+
30
+ useEffect(() => {
31
+ //set local uid
32
+ isHost ? setHostUids([localUid]) : setAttendeeUids([localUid]);
33
+
34
+ //listen for remote user role
35
+ //if remote user is host then add it in the hostUids
36
+ events.on(EventNames.VIDEO_MEETING_HOST, (data) => {
37
+ const payload = JSON.parse(data?.payload);
38
+ const hostUid = payload?.uid;
39
+ if (hostUid && hostUids.indexOf(hostUid) === -1) {
40
+ setHostUids((prevState) => [...prevState, hostUid]);
41
+ }
42
+ });
43
+
44
+ //if remote user is not host then add it in the attendeeUids
45
+ events.on(EventNames.VIDEO_MEETING_ATTENDEE, (data) => {
46
+ const payload = JSON.parse(data?.payload);
47
+ const attendeeUid = payload?.uid;
48
+ if (attendeeUid && attendeeUids.indexOf(attendeeUid) === -1) {
49
+ setAttendeeUids((prevState) => [...prevState, attendeeUid]);
50
+ }
51
+ });
52
+
53
+ return () => {
54
+ events.off(EventNames.VIDEO_MEETING_HOST);
55
+ events.off(EventNames.VIDEO_MEETING_ATTENDEE);
56
+ };
57
+ }, []);
58
+
59
+ useEffect(() => {
60
+ //hasUserJoinedRTM ensure that RTM login successful and events can be sent.
61
+ if (hasUserJoinedRTM) {
62
+ //send user role event so newly joining user will get the previous user role details
63
+ events.send(
64
+ isHost
65
+ ? EventNames.VIDEO_MEETING_HOST
66
+ : EventNames.VIDEO_MEETING_ATTENDEE,
67
+ JSON.stringify({uid: localUid}),
68
+ EventPersistLevel.LEVEL2,
69
+ );
70
+ }
71
+ }, [isHost, hasUserJoinedRTM]);
72
+
73
+ return (
74
+ <VideoMeetingData.Provider
75
+ value={{
76
+ hostUids,
77
+ attendeeUids,
78
+ }}>
79
+ {props.children}
80
+ </VideoMeetingData.Provider>
81
+ );
82
+ };
83
+ const useVideoMeetingData = createHook(VideoMeetingData);
84
+
85
+ export {useVideoMeetingData, VideoMeetingDataProvider};
@@ -6,9 +6,9 @@ import React, {
6
6
  useEffect,
7
7
  useState,
8
8
  } from 'react';
9
- import {createHook} from 'fpe-implementation';
9
+ import {createHook} from 'customization-implementation';
10
10
  import {filterObject} from '../../utils/index';
11
- import {useRtcContext} from 'fpe-api';
11
+ import {useRtc} from 'customization-api';
12
12
 
13
13
  export interface WhiteboardObjectInterface {
14
14
  [key: number]: {
@@ -21,7 +21,7 @@ export interface WhiteboardContextInterface {
21
21
  whiteboardData: WhiteboardObjectInterface;
22
22
  setWhiteboardData: Dispatch<SetStateAction<WhiteboardObjectInterface>>;
23
23
  }
24
- const WhiteboardContext = createContext<WhiteboardContextInterface>({
24
+ const Whiteboard = createContext<WhiteboardContextInterface>({
25
25
  whiteboardData: {},
26
26
  setWhiteboardData: () => {},
27
27
  });
@@ -32,7 +32,7 @@ interface WhiteboardProviderProps {
32
32
  const WhiteboardProvider = (props: WhiteboardProviderProps) => {
33
33
  const [whiteboardData, setWhiteboardData] =
34
34
  useState<WhiteboardObjectInterface>({});
35
- const {dispatch} = useRtcContext();
35
+ const {dispatch} = useRtc();
36
36
 
37
37
  useEffect(() => {
38
38
  const activeData = filterObject(
@@ -49,11 +49,11 @@ const WhiteboardProvider = (props: WhiteboardProviderProps) => {
49
49
  }, [whiteboardData]);
50
50
 
51
51
  return (
52
- <WhiteboardContext.Provider value={{whiteboardData, setWhiteboardData}}>
52
+ <Whiteboard.Provider value={{whiteboardData, setWhiteboardData}}>
53
53
  {props.children}
54
- </WhiteboardContext.Provider>
54
+ </Whiteboard.Provider>
55
55
  );
56
56
  };
57
- const useScreenContext = createHook(WhiteboardContext);
57
+ const useWhiteBoard = createHook(Whiteboard);
58
58
 
59
- export {useScreenContext, WhiteboardProvider};
59
+ export {useWhiteBoard, WhiteboardProvider};
@@ -13,10 +13,10 @@ import {
13
13
  import {ClientRole, useLocalUid, UidType} from '../../../agora-rn-uikit';
14
14
  import {filterObject, isEmptyObject} from '../../utils';
15
15
  import {useMeetingInfo} from '../meeting-info/useMeetingInfo';
16
- import useUserList from '../../utils/useUserList';
17
16
  import {useScreenshare} from '../../subComponents/screenshare/useScreenshare';
18
- import CustomEvents, {EventLevel} from '../../custom-events';
17
+ import events, {EventPersistLevel} from '../../rtm-events-api';
19
18
  import {EventNames} from '../../rtm-events';
19
+ import {useRender} from 'customization-api';
20
20
 
21
21
  const LiveStreamContext = createContext(null as unknown as liveStreamContext);
22
22
 
@@ -29,7 +29,7 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
29
29
  const screenshareContextInstanceRef = useRef<any>();
30
30
  screenshareContextInstanceRef.current = screenshareContextInstance;
31
31
 
32
- const {renderList} = useUserList();
32
+ const {renderList} = useRender();
33
33
  const renderListRef = useRef<any>();
34
34
  renderListRef.current = renderList;
35
35
 
@@ -54,7 +54,9 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
54
54
  const {hasUserJoinedRTM} = useContext(ChatContext);
55
55
 
56
56
  const {setRtcProps, rtcProps, callActive} = props?.value;
57
- const {isHost} = useMeetingInfo();
57
+ const {
58
+ data: {isHost},
59
+ } = useMeetingInfo();
58
60
 
59
61
  const [lastCheckedRequestTimestamp, setLastCheckedRequestTimestamp] =
60
62
  useState(0);
@@ -89,7 +91,7 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
89
91
  };
90
92
 
91
93
  const addOrUpdateLiveStreamRequest = (
92
- userUID: string,
94
+ userUID: UidType,
93
95
  payload: Partial<raiseHandItemInterface>,
94
96
  ) => {
95
97
  if (userUID && !isEmptyObject(payload)) {
@@ -121,11 +123,14 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
121
123
  role: ClientRole.Audience,
122
124
  });
123
125
  // Audience notfies all host when request is rejected
124
- CustomEvents.send(EventNames.RAISED_ATTRIBUTE, {
125
- action: LiveStreamControlMessageEnum.notifyHostsInChannel,
126
- level: EventLevel.LEVEL2,
127
- value: RaiseHandValue.FALSE,
128
- });
126
+ events.send(
127
+ EventNames.RAISED_ATTRIBUTE,
128
+ JSON.stringify({
129
+ action: LiveStreamControlMessageEnum.notifyHostsInChannel,
130
+ value: RaiseHandValue.FALSE,
131
+ }),
132
+ EventPersistLevel.LEVEL2,
133
+ );
129
134
  break;
130
135
  case ClientRole.Broadcaster:
131
136
  // Update local state
@@ -135,11 +140,14 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
135
140
  role: ClientRole.Broadcaster,
136
141
  });
137
142
  // Audience notfies all host when request is approved
138
- CustomEvents.send(EventNames.RAISED_ATTRIBUTE, {
139
- action: LiveStreamControlMessageEnum.notifyHostsInChannel,
140
- value: RaiseHandValue.TRUE,
141
- level: EventLevel.LEVEL2,
142
- });
143
+ events.send(
144
+ EventNames.RAISED_ATTRIBUTE,
145
+ JSON.stringify({
146
+ action: LiveStreamControlMessageEnum.notifyHostsInChannel,
147
+ value: RaiseHandValue.TRUE,
148
+ }),
149
+ EventPersistLevel.LEVEL2,
150
+ );
143
151
  default:
144
152
  break;
145
153
  }
@@ -181,15 +189,15 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
181
189
 
182
190
  /** ******* SETTING UP ROLES BEGINS ******* */
183
191
  React.useEffect(() => {
184
- CustomEvents.on(EventNames.ROLE_ATTRIBUTE, (data) => {
192
+ events.on(EventNames.ROLE_ATTRIBUTE, (data) => {
185
193
  setRaiseHandList((prevState) => {
186
194
  return {
187
195
  ...prevState,
188
196
  [data.sender]: {
189
197
  ...prevState[data.sender],
190
198
  role:
191
- data.payload.value in ClientRole
192
- ? parseInt(data.payload.value)
199
+ data.payload in ClientRole
200
+ ? parseInt(data.payload)
193
201
  : ClientRole.Audience,
194
202
  },
195
203
  };
@@ -199,10 +207,13 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
199
207
 
200
208
  React.useEffect(() => {
201
209
  if (!callActive || !hasUserJoinedRTM) return;
202
- CustomEvents.send(EventNames.ROLE_ATTRIBUTE, {
203
- level: EventLevel.LEVEL2,
204
- value: rtcProps.role in ClientRole ? rtcProps.role : ClientRole.Audience,
205
- });
210
+ events.send(
211
+ EventNames.ROLE_ATTRIBUTE,
212
+ JSON.stringify(
213
+ rtcProps.role in ClientRole ? rtcProps.role : ClientRole.Audience,
214
+ ),
215
+ EventPersistLevel.LEVEL2,
216
+ );
206
217
  setRaiseHandList((prevState) => {
207
218
  return {
208
219
  ...prevState,
@@ -221,12 +232,16 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
221
232
 
222
233
  React.useEffect(() => {
223
234
  /** ********************** HOST EVENTS SECTION BEGINS ********************** */
224
- CustomEvents.on(EventNames.RAISED_ATTRIBUTE, (data) => {
235
+ events.on(EventNames.RAISED_ATTRIBUTE, (data) => {
225
236
  if (!isHost) return;
226
- switch (data?.payload?.action) {
237
+ const payload = JSON.parse(data.payload);
238
+ const action = payload.action;
239
+ const value = payload.value;
240
+
241
+ switch (action) {
227
242
  // 1. Host can receive raise hand request with true or false value
228
243
  case LiveStreamControlMessageEnum.raiseHandRequest:
229
- switch (data?.payload?.value) {
244
+ switch (value) {
230
245
  case RaiseHandValue.TRUE:
231
246
  // Step 1: Show notifications
232
247
  showToast(
@@ -261,7 +276,7 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
261
276
  // 2. All Hosts in channel gets notified when an attendee's request gets approved or rejected
262
277
  case LiveStreamControlMessageEnum.notifyHostsInChannel:
263
278
  if (!isHost) return;
264
- switch (data.payload.value) {
279
+ switch (value) {
265
280
  case RaiseHandValue.TRUE:
266
281
  addOrUpdateLiveStreamRequest(data.sender, {
267
282
  ts: data.ts,
@@ -288,48 +303,42 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
288
303
 
289
304
  /** ********************** AUDIENCE EVENTS SECTION BEGINS ********************** */
290
305
  // 1. Audience receives this when the request is accepted by host
291
- CustomEvents.on(
292
- LiveStreamControlMessageEnum.raiseHandRequestAccepted,
293
- (data) => {
294
- if (raiseHandList[localUidRef.current]?.raised === RaiseHandValue.FALSE)
295
- return;
296
- showToast(LSNotificationObject.RAISE_HAND_ACCEPTED);
297
- // Promote user's privileges to host
298
- changeClientRoleTo(ClientRole.Broadcaster);
299
- // Audience updates its local attributes and notfies all host when request is approved
300
- UpdtLocStateAndBCastAttr(ClientRole.Broadcaster, data.ts);
301
- },
302
- );
306
+ events.on(LiveStreamControlMessageEnum.raiseHandRequestAccepted, (data) => {
307
+ if (raiseHandList[localUidRef.current]?.raised === RaiseHandValue.FALSE)
308
+ return;
309
+ showToast(LSNotificationObject.RAISE_HAND_ACCEPTED);
310
+ // Promote user's privileges to host
311
+ changeClientRoleTo(ClientRole.Broadcaster);
312
+ // Audience updates its local attributes and notfies all host when request is approved
313
+ UpdtLocStateAndBCastAttr(ClientRole.Broadcaster, data.ts);
314
+ });
303
315
  /** 2. Audience receives this when the request is rejected by host
304
316
  * 2.a Audience receives this when the request is rejected by host which is not yet approved
305
317
  * 2.b Audience receives this when the request when is demoted by the host
306
318
  */
307
- CustomEvents.on(
308
- LiveStreamControlMessageEnum.raiseHandRequestRejected,
309
- (data) => {
310
- /** 2.a */
311
- if (
312
- raiseHandListRef.current[localUidRef.current].role ==
313
- ClientRole.Audience
314
- ) {
315
- showToast(LSNotificationObject.RAISE_HAND_REJECTED);
316
- } else if (
317
- raiseHandListRef.current[localUidRef.current].role ==
318
- ClientRole.Broadcaster
319
- ) {
320
- /** 2.b */
321
- showToast(LSNotificationObject.RAISE_HAND_APPROVED_REQUEST_RECALL);
322
- screenshareContextInstanceRef?.current?.stopUserScreenShare(); // This will not exist on ios
323
-
324
- // Demote user's privileges to audience
325
- changeClientRoleTo(ClientRole.Audience);
326
- }
327
- // Audience updates its local attributes and notfies all host when demoted/request rejected
328
- UpdtLocStateAndBCastAttr(ClientRole.Audience, data.ts);
329
- },
330
- );
319
+ events.on(LiveStreamControlMessageEnum.raiseHandRequestRejected, (data) => {
320
+ /** 2.a */
321
+ if (
322
+ raiseHandListRef.current[localUidRef.current].role ==
323
+ ClientRole.Audience
324
+ ) {
325
+ showToast(LSNotificationObject.RAISE_HAND_REJECTED);
326
+ } else if (
327
+ raiseHandListRef.current[localUidRef.current].role ==
328
+ ClientRole.Broadcaster
329
+ ) {
330
+ /** 2.b */
331
+ showToast(LSNotificationObject.RAISE_HAND_APPROVED_REQUEST_RECALL);
332
+ screenshareContextInstanceRef?.current?.stopUserScreenShare(); // This will not exist on ios
333
+
334
+ // Demote user's privileges to audience
335
+ changeClientRoleTo(ClientRole.Audience);
336
+ }
337
+ // Audience updates its local attributes and notfies all host when demoted/request rejected
338
+ UpdtLocStateAndBCastAttr(ClientRole.Audience, data.ts);
339
+ });
331
340
  // 3. Audience when receives kickUser notifies all host when is kicked out
332
- CustomEvents.on(controlMessageEnum.kickUser, (data) => {
341
+ events.on(controlMessageEnum.kickUser, (data) => {
333
342
  // Audience updates its local attributes and notfies all host when they(audience) are kicked out
334
343
  UpdtLocStateAndBCastAttr(ClientRole.Audience, data.ts);
335
344
  });
@@ -345,25 +354,27 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
345
354
  */
346
355
 
347
356
  const hostApprovesRequestOfUID = (uid: UidType) => {
348
- addOrUpdateLiveStreamRequest(`${uid}`, {
357
+ addOrUpdateLiveStreamRequest(uid, {
349
358
  raised: RaiseHandValue.TRUE,
350
359
  ts: new Date().getTime(),
351
360
  });
352
- CustomEvents.send(
361
+ events.send(
353
362
  LiveStreamControlMessageEnum.raiseHandRequestAccepted,
354
- {},
363
+ '',
364
+ EventPersistLevel.LEVEL1,
355
365
  uid,
356
366
  );
357
367
  };
358
368
 
359
369
  const hostRejectsRequestOfUID = (uid: UidType) => {
360
- addOrUpdateLiveStreamRequest(`${uid}`, {
370
+ addOrUpdateLiveStreamRequest(uid, {
361
371
  raised: RaiseHandValue.FALSE,
362
372
  ts: new Date().getTime(),
363
373
  });
364
- CustomEvents.send(
374
+ events.send(
365
375
  LiveStreamControlMessageEnum.raiseHandRequestRejected,
366
- {},
376
+ '',
377
+ EventPersistLevel.LEVEL1,
367
378
  uid,
368
379
  );
369
380
  };
@@ -382,11 +393,14 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
382
393
  if (raiseHandList[localUidRef.current]?.raised === RaiseHandValue.TRUE)
383
394
  return;
384
395
  showToast(LSNotificationObject.RAISE_HAND_REQUEST);
385
- CustomEvents.send(EventNames.RAISED_ATTRIBUTE, {
386
- action: LiveStreamControlMessageEnum.raiseHandRequest,
387
- level: EventLevel.LEVEL2,
388
- value: RaiseHandValue.TRUE,
389
- });
396
+ events.send(
397
+ EventNames.RAISED_ATTRIBUTE,
398
+ JSON.stringify({
399
+ action: LiveStreamControlMessageEnum.raiseHandRequest,
400
+ value: RaiseHandValue.TRUE,
401
+ }),
402
+ EventPersistLevel.LEVEL1,
403
+ );
390
404
  // Update local state
391
405
  addOrUpdateLiveStreamRequest(localUidRef.current, {
392
406
  raised: RaiseHandValue.TRUE,
@@ -10,38 +10,42 @@
10
10
  *********************************************
11
11
  */
12
12
  import React, {createContext} from 'react';
13
- import {createHook} from 'fpe-implementation';
13
+ import {createHook} from 'customization-implementation';
14
14
  import {UidType} from '../../../agora-rn-uikit';
15
15
  export interface MeetingInfoContextInterface {
16
16
  isJoinDataFetched?: boolean;
17
- isHost: boolean;
18
- meetingTitle: string;
19
- meetingPassphrase: {
20
- attendee: string;
21
- host?: string;
17
+ data?: {
18
+ isHost: boolean;
19
+ meetingTitle: string;
20
+ roomId: {
21
+ attendee: string;
22
+ host?: string;
23
+ };
22
24
  pstn?: {
23
25
  number: string;
24
26
  pin: string;
25
27
  };
28
+ isSeparateHostLink: boolean;
29
+ channel?: string;
30
+ uid?: UidType;
31
+ token?: string;
32
+ rtmToken?: string;
33
+ encryptionSecret?: string;
34
+ screenShareUid?: string;
35
+ screenShareToken?: string;
26
36
  };
27
- isSeparateHostLink: boolean;
28
- channel?: string;
29
- uid?: UidType;
30
- token?: string;
31
- rtm?: string;
32
- secret?: string;
33
- screenShareUid?: string;
34
- screenShareToken?: string;
35
37
  }
36
38
 
37
39
  export const MeetingInfoDefaultValue: MeetingInfoContextInterface = {
38
40
  isJoinDataFetched: false,
39
- isHost: false,
40
- meetingTitle: '',
41
- meetingPassphrase: {
42
- attendee: '',
41
+ data: {
42
+ isHost: false,
43
+ meetingTitle: '',
44
+ roomId: {
45
+ attendee: '',
46
+ },
47
+ isSeparateHostLink: true,
43
48
  },
44
- isSeparateHostLink: true,
45
49
  };
46
50
 
47
51
  const MeetingInfoContext = createContext(MeetingInfoDefaultValue);
@@ -10,7 +10,7 @@
10
10
  *********************************************
11
11
  */
12
12
  import React, {createContext, SetStateAction} from 'react';
13
- import {createHook} from 'fpe-implementation';
13
+ import {createHook} from 'customization-implementation';
14
14
  import {MeetingInfoContextInterface} from './useMeetingInfo';
15
15
 
16
16
  export interface SetMeetingInfoContextInterface {
@@ -4,11 +4,11 @@ import RemoteEndCall from '../../subComponents/RemoteEndCall';
4
4
  import ParticipantName from '../../components/participants/ParticipantName';
5
5
  import chatContext from '../ChatContext';
6
6
  import {useString} from '../../utils/useString';
7
- import {useRenderContext} from 'fpe-api';
7
+ import {useRender} from 'customization-api';
8
8
 
9
9
  const AllAudienceParticipants = (props: any) => {
10
10
  const {p_style, isHost, uids} = props;
11
- const {renderList} = useRenderContext();
11
+ const {renderList} = useRender();
12
12
  const {localUid} = useContext(chatContext);
13
13
  //commented for v1 release
14
14
  //const participantListPlaceholder = useString('participantListPlaceholder')();
@@ -3,8 +3,8 @@ import MeParticipant from './MeParticipant';
3
3
  import ScreenshareParticipants from './ScreenshareParticipants';
4
4
  import RemoteParticipants from './RemoteParticipants';
5
5
  import {useString} from '../../utils/useString';
6
- import useUserList from '../../utils/useUserList';
7
6
  import {UidType, useLocalUid} from '../../../agora-rn-uikit';
7
+ import {useRender} from 'customization-api';
8
8
 
9
9
  export default function AllHostParticipants(props: any) {
10
10
  const {p_style, isHost} = props;
@@ -12,7 +12,7 @@ export default function AllHostParticipants(props: any) {
12
12
  //commented for v1 release
13
13
  //const remoteUserDefaultLabel = useString('remoteUserDefaultLabel')();
14
14
  const remoteUserDefaultLabel = 'User';
15
- const {renderList, renderPosition} = useUserList();
15
+ const {renderList, activeUids} = useRender();
16
16
  const getParticipantName = (uid: UidType) => {
17
17
  return renderList[uid]?.name || remoteUserDefaultLabel;
18
18
  };
@@ -20,7 +20,7 @@ export default function AllHostParticipants(props: any) {
20
20
  return (
21
21
  <>
22
22
  {/* User should see his name first */}
23
- {renderPosition.filter((uid) => uid === localUid).length > 0 && (
23
+ {activeUids.filter((uid) => uid === localUid).length > 0 && (
24
24
  <MeParticipant
25
25
  name={getParticipantName(localUid)}
26
26
  p_style={p_style}
@@ -28,7 +28,7 @@ export default function AllHostParticipants(props: any) {
28
28
  />
29
29
  )}
30
30
  {/* Others Users in the call */}
31
- {renderPosition
31
+ {activeUids
32
32
  .filter((uid) => uid !== localUid)
33
33
  .map((uid) =>
34
34
  renderList[uid]?.type === 'screenshare' ? (
@@ -26,9 +26,11 @@ const MeParticipant = (props: any) => {
26
26
  <View style={[p_style.actionBtnIcon, {marginRight: 10}]}>
27
27
  <LocalAudioMute buttonTemplateName={ButtonTemplateName.topBar} />
28
28
  </View>
29
- <View style={p_style.actionBtnIcon}>
30
- <LocalVideoMute buttonTemplateName={ButtonTemplateName.topBar} />
31
- </View>
29
+ {!$config.AUDIO_ROOM && (
30
+ <View style={p_style.actionBtnIcon}>
31
+ <LocalVideoMute buttonTemplateName={ButtonTemplateName.topBar} />
32
+ </View>
33
+ )}
32
34
  </View>
33
35
  </View>
34
36
  );
@@ -13,11 +13,11 @@ import React from 'react';
13
13
  import {View, StyleSheet, useWindowDimensions, Platform} from 'react-native';
14
14
  import TextWithToolTip from '../../subComponents/TextWithTooltip';
15
15
  import {RFValue} from 'react-native-responsive-fontsize';
16
- import {isWeb} from '../../utils/common';
16
+ import {isWebInternal} from '../../utils/common';
17
17
 
18
18
  const ParticipantName = ({value}: {value: string}) => {
19
19
  const {height, width} = useWindowDimensions();
20
- const fontSize = isWeb ? 14 : 16;
20
+ const fontSize = isWebInternal() ? 14 : 16;
21
21
  return (
22
22
  <View style={{flex: 1}}>
23
23
  <TextWithToolTip
@@ -49,13 +49,15 @@ const RemoteParticipants = (props: remoteParticipantsInterface) => {
49
49
  isHost={isHost}
50
50
  />
51
51
  </View>
52
- <View style={[p_styles.actionBtnIcon]}>
53
- <RemoteVideoMute
54
- uid={user.uid}
55
- video={user.video}
56
- isHost={isHost}
57
- />
58
- </View>
52
+ {!$config.AUDIO_ROOM && (
53
+ <View style={[p_styles.actionBtnIcon]}>
54
+ <RemoteVideoMute
55
+ uid={user.uid}
56
+ video={user.video}
57
+ isHost={isHost}
58
+ />
59
+ </View>
60
+ )}
59
61
  </View>
60
62
  ) : (
61
63
  <></>
@@ -11,7 +11,7 @@
11
11
  */
12
12
  import React from 'react';
13
13
  import {View, StyleSheet} from 'react-native';
14
- import {useFpe} from 'fpe-api';
14
+ import {useCustomization} from 'customization-implementation';
15
15
  import {isValidReactComponent} from '../../utils/common';
16
16
  import LocalAudioMute, {
17
17
  LocalAudioMuteProps,
@@ -24,7 +24,7 @@ import LocalSwitchCamera, {
24
24
  } from '../../subComponents/LocalSwitchCamera';
25
25
 
26
26
  const PreCallLocalMute: React.FC = () => {
27
- const {VideoMute, AudioMute} = useFpe((data) => {
27
+ const {VideoMute, AudioMute} = useCustomization((data) => {
28
28
  let components: {
29
29
  VideoMute: React.ComponentType<LocalAudioMuteProps>;
30
30
  AudioMute: React.ComponentType<LocalVideoMuteProps>;
@@ -68,14 +68,18 @@ const PreCallLocalMute: React.FC = () => {
68
68
  <View style={style.width50}>
69
69
  <AudioMute />
70
70
  </View>
71
- <View style={style.width50} />
72
- <View style={style.width50}>
73
- <VideoMute />
74
- </View>
75
- <View style={style.width50} />
76
- <View style={style.width50}>
77
- <LocalSwitchCamera />
78
- </View>
71
+ {!$config.AUDIO_ROOM && (
72
+ <>
73
+ <View style={style.width50} />
74
+ <View style={style.width50}>
75
+ <VideoMute />
76
+ </View>
77
+ <View style={style.width50} />
78
+ <View style={style.width50}>
79
+ <LocalSwitchCamera />
80
+ </View>
81
+ </>
82
+ )}
79
83
  </>
80
84
  );
81
85
  };
@@ -11,7 +11,7 @@
11
11
  */
12
12
  import React from 'react';
13
13
  import {View, StyleSheet} from 'react-native';
14
- import {useFpe} from 'fpe-api';
14
+ import {useCustomization} from 'customization-implementation';
15
15
  import {isValidReactComponent} from '../../utils/common';
16
16
  import LocalVideoMute, {
17
17
  LocalVideoMuteProps,
@@ -21,7 +21,7 @@ import LocalAudioMute, {
21
21
  } from '../../subComponents/LocalAudioMute';
22
22
 
23
23
  const PreCallLocalMute: React.FC = () => {
24
- const {VideoMute, AudioMute} = useFpe((data) => {
24
+ const {VideoMute, AudioMute} = useCustomization((data) => {
25
25
  let components: {
26
26
  VideoMute: React.ComponentType<LocalAudioMuteProps>;
27
27
  AudioMute: React.ComponentType<LocalVideoMuteProps>;
@@ -65,9 +65,11 @@ const PreCallLocalMute: React.FC = () => {
65
65
  <View style={{alignSelf: 'center'}}>
66
66
  <AudioMute />
67
67
  </View>
68
- <View style={{alignSelf: 'center'}}>
69
- <VideoMute />
70
- </View>
68
+ {!$config.AUDIO_ROOM && (
69
+ <View style={{alignSelf: 'center'}}>
70
+ <VideoMute />
71
+ </View>
72
+ )}
71
73
  </View>
72
74
  );
73
75
  };