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,5 +1,4 @@
1
1
  import React, {createContext, useContext, useState, useRef} from 'react';
2
- import {StyleSheet} from 'react-native';
3
2
  import ChatContext, {controlMessageEnum} from '../ChatContext';
4
3
  import Toast from '../../../react-native-toast-message';
5
4
  import {
@@ -17,10 +16,7 @@ import {useMeetingInfo} from '../meeting-info/useMeetingInfo';
17
16
  import {useScreenshare} from '../../subComponents/screenshare/useScreenshare';
18
17
  import events, {EventPersistLevel} from '../../rtm-events-api';
19
18
  import {EventNames} from '../../rtm-events';
20
- import {SidePanelType, useRender, useSidePanel} from 'customization-api';
21
- import TertiaryButton from '../../atoms/TertiaryButton';
22
- import PrimaryButton from '../../atoms/PrimaryButton';
23
- import {trimText} from '../../utils/common';
19
+ import {useRender} from 'customization-api';
24
20
 
25
21
  const LiveStreamContext = createContext(null as unknown as liveStreamContext);
26
22
 
@@ -43,18 +39,6 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
43
39
  const raiseHandListRef = useRef<any>();
44
40
  raiseHandListRef.current = raiseHandList;
45
41
 
46
- const [coHostUids, setCoHostUids] = useState<UidType[]>([]);
47
- const coHostUidsRef = useRef<any>();
48
- coHostUidsRef.current = coHostUids;
49
-
50
- const {sidePanel} = useSidePanel();
51
- const sidePanelRef = useRef<any>();
52
- sidePanelRef.current = sidePanel;
53
-
54
- React.useEffect(() => {
55
- sidePanelRef.current = sidePanel;
56
- }, [sidePanel]);
57
-
58
42
  React.useEffect(() => {
59
43
  renderListRef.current = renderList;
60
44
  }, [renderList]);
@@ -63,41 +47,11 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
63
47
  raiseHandListRef.current = raiseHandList;
64
48
  }, [raiseHandList]);
65
49
 
66
- React.useEffect(() => {
67
- coHostUidsRef.current = coHostUids;
68
- }, [coHostUids]);
69
-
70
- React.useEffect(() => {
71
- /**
72
- * when user rejoin the meeting. its showing previosly raised livesteaming request.
73
- * so deleting raise hand data once the user is offline
74
- * */
75
- let newRaiseHandList = raiseHandList;
76
- const data = Object.keys(
77
- filterObject(
78
- renderList,
79
- ([k, v]) => v?.type === 'rtc' && v.offline === true,
80
- ),
81
- );
82
- let isRaiseHandListChanged = false;
83
- data &&
84
- data.length &&
85
- data.forEach((uid, index) => {
86
- if (newRaiseHandList[uid]) {
87
- isRaiseHandListChanged = true;
88
- delete newRaiseHandList[uid];
89
- }
90
- if (data.length - 1 === index && isRaiseHandListChanged) {
91
- setRaiseHandList(newRaiseHandList);
92
- }
93
- });
94
- }, [renderList]);
95
-
96
50
  const localUid = useLocalUid();
97
51
  const localUidRef = useRef<any>();
98
52
  localUidRef.current = localUid;
99
53
 
100
- const {hasUserJoinedRTM, rtmInitTimstamp} = useContext(ChatContext);
54
+ const {hasUserJoinedRTM} = useContext(ChatContext);
101
55
 
102
56
  const {setRtcProps, rtcProps, callActive} = props?.value;
103
57
  const {
@@ -112,48 +66,11 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
112
66
 
113
67
  const [isPendingRequestToReview, setPendingRequestToReview] = useState(false);
114
68
 
115
- const showToast = (
116
- text: string,
117
- text2: string,
118
- uid?: UidType,
119
- toastId?: number,
120
- ) => {
121
- let btns: any = {};
122
- if (uid) {
123
- //toastId used to hide this particular notification
124
- btns.toastId = toastId;
125
- btns.primaryBtn = (
126
- <PrimaryButton
127
- containerStyle={style.primaryBtn}
128
- textStyle={style.primaryBtnText}
129
- text="ALLOW TO BE A PRESENTER"
130
- onPress={() => {
131
- hostApprovesRequestOfUID(uid);
132
- Toast.hide();
133
- }}
134
- />
135
- );
136
- btns.secondaryBtn = (
137
- <TertiaryButton
138
- containerStyle={style.secondaryBtn}
139
- text="DENY"
140
- onPress={() => {
141
- hostRejectsRequestOfUID(uid);
142
- Toast.hide();
143
- }}
144
- />
145
- );
146
- } else {
147
- btns.primaryBtn = null;
148
- btns.secondaryBtn = null;
149
- }
150
-
69
+ const showToast = (text: string) => {
151
70
  Toast.show({
152
- type: 'info',
71
+ type: 'success',
153
72
  text1: text,
154
- text2: text2 ? text2 : null,
155
- visibilityTime: 3000,
156
- ...btns,
73
+ visibilityTime: 1000,
157
74
  });
158
75
  };
159
76
 
@@ -184,7 +101,6 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
184
101
  [userId]: {
185
102
  raised: payload?.raised || RaiseHandValue.FALSE,
186
103
  ts: payload?.ts || Date.now(),
187
- isProcessed: payload?.isProcessed || false,
188
104
  role:
189
105
  payload?.role ||
190
106
  oldRaisedHandList[userId]?.role ||
@@ -212,23 +128,9 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
212
128
  JSON.stringify({
213
129
  action: LiveStreamControlMessageEnum.notifyHostsInChannel,
214
130
  value: RaiseHandValue.FALSE,
215
- ts: new Date().getTime(),
216
- isProcessed: true,
217
131
  }),
218
132
  EventPersistLevel.LEVEL2,
219
133
  );
220
- //update local cohost state
221
- setCoHostUids((prevState) => {
222
- return [
223
- ...prevState.filter((i) => i !== parseInt(localUidRef.current)),
224
- ];
225
- });
226
- // Audience notfies all users that co-host permission removed
227
- events.send(
228
- LiveStreamControlMessageEnum.coHostRemoved,
229
- JSON.stringify({uid: localUidRef.current}),
230
- EventPersistLevel.LEVEL2,
231
- );
232
134
  break;
233
135
  case ClientRole.Broadcaster:
234
136
  // Update local state
@@ -243,21 +145,9 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
243
145
  JSON.stringify({
244
146
  action: LiveStreamControlMessageEnum.notifyHostsInChannel,
245
147
  value: RaiseHandValue.TRUE,
246
- ts: new Date().getTime(),
247
- isProcessed: true,
248
148
  }),
249
149
  EventPersistLevel.LEVEL2,
250
150
  );
251
- //update local cohost state
252
- setCoHostUids((prevState) => {
253
- return [...prevState, localUidRef.current];
254
- });
255
- // Audience notfies all users that co-host has joined
256
- events.send(
257
- LiveStreamControlMessageEnum.coHostJoined,
258
- JSON.stringify({uid: localUidRef.current}),
259
- EventPersistLevel.LEVEL2,
260
- );
261
151
  default:
262
152
  break;
263
153
  }
@@ -347,7 +237,6 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
347
237
  const payload = JSON.parse(data.payload);
348
238
  const action = payload.action;
349
239
  const value = payload.value;
350
- const isProcessed = payload?.isProcessed || false;
351
240
 
352
241
  switch (action) {
353
242
  // 1. Host can receive raise hand request with true or false value
@@ -355,46 +244,30 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
355
244
  switch (value) {
356
245
  case RaiseHandValue.TRUE:
357
246
  // Step 1: Show notifications
358
- if (
359
- payload.ts > rtmInitTimstamp &&
360
- sidePanelRef.current !== SidePanelType.Participants
361
- ) {
362
- showToast(
363
- `${trimText(getAttendeeName(data.sender))} ${
364
- LSNotificationObject.RAISE_HAND_RECEIVED.text1
365
- }`,
366
- LSNotificationObject.RAISE_HAND_RECEIVED.text2,
367
- data.sender,
368
- data.ts,
369
- );
370
- }
247
+ showToast(
248
+ `${getAttendeeName(data.sender)} ${
249
+ LSNotificationObject.RAISE_HAND_RECEIVED
250
+ }`,
251
+ );
371
252
  // 2. All Hosts in channel update their raised state to "true" when attendee raise their hand
372
253
  addOrUpdateLiveStreamRequest(data.sender, {
373
254
  ts: data.ts,
374
255
  raised: RaiseHandValue.TRUE,
375
256
  role: ClientRole.Audience,
376
- isProcessed: isProcessed,
377
257
  });
378
258
  break;
379
259
  case RaiseHandValue.FALSE:
380
260
  // Step 1: Show notifications
381
- if (
382
- payload.ts > rtmInitTimstamp &&
383
- sidePanelRef.current !== SidePanelType.Participants
384
- ) {
385
- showToast(
386
- `${trimText(getAttendeeName(data.sender))} ${
387
- LSNotificationObject.RAISE_HAND_REQUEST_RECALL.text1
388
- }`,
389
- LSNotificationObject.RAISE_HAND_REQUEST_RECALL.text2,
390
- );
391
- }
261
+ showToast(
262
+ `${getAttendeeName(data.sender)} ${
263
+ LSNotificationObject.RAISE_HAND_REQUEST_RECALL
264
+ }`,
265
+ );
392
266
  // 2. All Hosts in channel update raised state to "false" when attendee recalls their request
393
267
  addOrUpdateLiveStreamRequest(data.sender, {
394
268
  ts: data.ts,
395
269
  raised: RaiseHandValue.FALSE,
396
270
  role: ClientRole.Audience,
397
- isProcessed: isProcessed,
398
271
  });
399
272
  default:
400
273
  break;
@@ -409,7 +282,6 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
409
282
  ts: data.ts,
410
283
  raised: RaiseHandValue.TRUE,
411
284
  role: ClientRole.Broadcaster,
412
- isProcessed: isProcessed,
413
285
  });
414
286
  break;
415
287
  case RaiseHandValue.FALSE:
@@ -417,7 +289,6 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
417
289
  ts: data.ts,
418
290
  raised: RaiseHandValue.FALSE,
419
291
  role: ClientRole.Audience,
420
- isProcessed: isProcessed,
421
292
  });
422
293
  break;
423
294
  default:
@@ -435,10 +306,7 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
435
306
  events.on(LiveStreamControlMessageEnum.raiseHandRequestAccepted, (data) => {
436
307
  if (raiseHandList[localUidRef.current]?.raised === RaiseHandValue.FALSE)
437
308
  return;
438
- showToast(
439
- LSNotificationObject.RAISE_HAND_ACCEPTED.text1,
440
- LSNotificationObject.RAISE_HAND_ACCEPTED.text2,
441
- );
309
+ showToast(LSNotificationObject.RAISE_HAND_ACCEPTED);
442
310
  // Promote user's privileges to host
443
311
  changeClientRoleTo(ClientRole.Broadcaster);
444
312
  // Audience updates its local attributes and notfies all host when request is approved
@@ -454,19 +322,13 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
454
322
  raiseHandListRef.current[localUidRef.current].role ==
455
323
  ClientRole.Audience
456
324
  ) {
457
- showToast(
458
- LSNotificationObject.RAISE_HAND_REJECTED.text1,
459
- LSNotificationObject.RAISE_HAND_REJECTED.text2,
460
- );
325
+ showToast(LSNotificationObject.RAISE_HAND_REJECTED);
461
326
  } else if (
462
327
  raiseHandListRef.current[localUidRef.current].role ==
463
328
  ClientRole.Broadcaster
464
329
  ) {
465
330
  /** 2.b */
466
- showToast(
467
- LSNotificationObject.RAISE_HAND_APPROVED_REQUEST_RECALL.text1,
468
- LSNotificationObject.RAISE_HAND_APPROVED_REQUEST_RECALL.text2,
469
- );
331
+ showToast(LSNotificationObject.RAISE_HAND_APPROVED_REQUEST_RECALL);
470
332
  screenshareContextInstanceRef?.current?.stopUserScreenShare(); // This will not exist on ios
471
333
 
472
334
  // Demote user's privileges to audience
@@ -480,39 +342,6 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
480
342
  // Audience updates its local attributes and notfies all host when they(audience) are kicked out
481
343
  UpdtLocStateAndBCastAttr(ClientRole.Audience, data.ts);
482
344
  });
483
- // 4. Host promote audience as co-host
484
- events.on(LiveStreamControlMessageEnum.promoteAsCoHost, (data) => {
485
- showToast(
486
- LSNotificationObject.PROMOTE_AS_CO_HOST.text1,
487
- LSNotificationObject.PROMOTE_AS_CO_HOST.text2,
488
- );
489
- // Promote user's privileges to host
490
- changeClientRoleTo(ClientRole.Broadcaster);
491
- // Audience updates its local attributes and notfies all host when request is approved
492
- UpdtLocStateAndBCastAttr(ClientRole.Broadcaster, data.ts);
493
- });
494
- // 4. New co-host has joined
495
- events.on(LiveStreamControlMessageEnum.coHostJoined, ({payload}) => {
496
- try {
497
- const data = JSON.parse(payload);
498
- if (data?.uid) {
499
- setCoHostUids((prevState) => {
500
- return [...prevState, parseInt(data.uid)];
501
- });
502
- }
503
- } catch (error) {}
504
- });
505
- // 5. Co-host removed
506
- events.on(LiveStreamControlMessageEnum.coHostRemoved, ({payload}) => {
507
- try {
508
- const data = JSON.parse(payload);
509
- if (data?.uid) {
510
- setCoHostUids((prevState) => {
511
- return [...prevState.filter((i) => i !== parseInt(data.uid))];
512
- });
513
- }
514
- } catch (error) {}
515
- });
516
345
  /** ********************** AUDIENCE EVENTS SECTION ENDS ********************** */
517
346
  }, []);
518
347
 
@@ -525,51 +354,25 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
525
354
  */
526
355
 
527
356
  const hostApprovesRequestOfUID = (uid: UidType) => {
528
- if (!raiseHandListRef.current[uid]?.isProcessed) {
529
- addOrUpdateLiveStreamRequest(uid, {
530
- raised: RaiseHandValue.TRUE,
531
- ts: new Date().getTime(),
532
- isProcessed: true,
533
- });
534
- events.send(
535
- LiveStreamControlMessageEnum.raiseHandRequestAccepted,
536
- '',
537
- EventPersistLevel.LEVEL1,
538
- uid,
539
- );
540
- } else {
541
- Toast.hide();
542
- setTimeout(() => {
543
- showToast('Request already processed.', null);
544
- });
545
- }
357
+ addOrUpdateLiveStreamRequest(uid, {
358
+ raised: RaiseHandValue.TRUE,
359
+ ts: new Date().getTime(),
360
+ });
361
+ events.send(
362
+ LiveStreamControlMessageEnum.raiseHandRequestAccepted,
363
+ '',
364
+ EventPersistLevel.LEVEL1,
365
+ uid,
366
+ );
546
367
  };
547
368
 
548
369
  const hostRejectsRequestOfUID = (uid: UidType) => {
549
- if (!raiseHandListRef.current[uid]?.isProcessed) {
550
- addOrUpdateLiveStreamRequest(uid, {
551
- raised: RaiseHandValue.FALSE,
552
- ts: new Date().getTime(),
553
- isProcessed: true,
554
- });
555
- events.send(
556
- LiveStreamControlMessageEnum.raiseHandRequestRejected,
557
- '',
558
- EventPersistLevel.LEVEL1,
559
- uid,
560
- );
561
- } else {
562
- Toast.hide();
563
- setTimeout(() => {
564
- showToast('Request already processed.', null);
565
- });
566
- }
567
- };
568
-
569
- // promote audience as co-host
570
- const promoteAudienceAsCoHost = async (uid: UidType): Promise<void> => {
370
+ addOrUpdateLiveStreamRequest(uid, {
371
+ raised: RaiseHandValue.FALSE,
372
+ ts: new Date().getTime(),
373
+ });
571
374
  events.send(
572
- LiveStreamControlMessageEnum.promoteAsCoHost,
375
+ LiveStreamControlMessageEnum.raiseHandRequestRejected,
573
376
  '',
574
377
  EventPersistLevel.LEVEL1,
575
378
  uid,
@@ -589,19 +392,14 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
589
392
  // If hand is already raised, skip the call
590
393
  if (raiseHandList[localUidRef.current]?.raised === RaiseHandValue.TRUE)
591
394
  return;
592
- showToast(
593
- LSNotificationObject.RAISE_HAND_REQUEST.text1,
594
- LSNotificationObject.RAISE_HAND_REQUEST.text2,
595
- );
395
+ showToast(LSNotificationObject.RAISE_HAND_REQUEST);
596
396
  events.send(
597
397
  EventNames.RAISED_ATTRIBUTE,
598
398
  JSON.stringify({
599
399
  action: LiveStreamControlMessageEnum.raiseHandRequest,
600
400
  value: RaiseHandValue.TRUE,
601
- ts: new Date().getTime(),
602
- isProcessed: false,
603
401
  }),
604
- EventPersistLevel.LEVEL2,
402
+ EventPersistLevel.LEVEL1,
605
403
  );
606
404
  // Update local state
607
405
  addOrUpdateLiveStreamRequest(localUidRef.current, {
@@ -626,22 +424,8 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
626
424
  // Change role
627
425
  changeClientRoleTo(ClientRole.Audience);
628
426
  }
629
- //notify host users
630
- events.send(
631
- EventNames.RAISED_ATTRIBUTE,
632
- JSON.stringify({
633
- action: LiveStreamControlMessageEnum.raiseHandRequest,
634
- value: RaiseHandValue.FALSE,
635
- ts: new Date().getTime(),
636
- isProcessed: true,
637
- }),
638
- EventPersistLevel.LEVEL2,
639
- );
640
427
  UpdtLocStateAndBCastAttr(ClientRole.Audience, new Date().getTime());
641
- showToast(
642
- LSNotificationObject.RAISE_HAND_REQUEST_RECALL_LOCAL.text1,
643
- LSNotificationObject.RAISE_HAND_REQUEST_RECALL_LOCAL.text2,
644
- );
428
+ showToast(LSNotificationObject.RAISE_HAND_REQUEST_RECALL_LOCAL);
645
429
  };
646
430
 
647
431
  /** ******* AUDIENCE CONTROLS SECTION ENDS ******* */
@@ -649,7 +433,6 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
649
433
  return (
650
434
  <LiveStreamContext.Provider
651
435
  value={{
652
- coHostUids: coHostUids,
653
436
  setLastCheckedRequestTimestamp,
654
437
  isPendingRequestToReview,
655
438
  raiseHandList,
@@ -657,7 +440,6 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
657
440
  hostRejectsRequestOfUID,
658
441
  audienceSendsRequest,
659
442
  audienceRecallsRequest,
660
- promoteAudienceAsCoHost,
661
443
  }}>
662
444
  {props.children}
663
445
  </LiveStreamContext.Provider>
@@ -665,19 +447,3 @@ export const LiveStreamContextProvider: React.FC<liveStreamPropsInterface> = (
665
447
  };
666
448
 
667
449
  export default LiveStreamContext;
668
-
669
- const style = StyleSheet.create({
670
- secondaryBtn: {marginLeft: 16, height: 40, paddingVertical: 5},
671
- primaryBtn: {
672
- minWidth: 'auto',
673
- paddingHorizontal: 12,
674
- height: 40,
675
- borderRadius: 4,
676
- paddingVertical: 5,
677
- },
678
- primaryBtnText: {
679
- fontWeight: '600',
680
- fontSize: 16,
681
- paddingLeft: 0,
682
- },
683
- });
@@ -16,7 +16,6 @@ export interface raiseHandItemInterface {
16
16
  role: ClientRole;
17
17
  raised: RaiseHandValue;
18
18
  ts: number;
19
- isProcessed: boolean;
20
19
  }
21
20
 
22
21
  import {UidType} from '../../../agora-rn-uikit';
@@ -43,45 +42,23 @@ export enum LiveStreamControlMessageEnum {
43
42
  notifyAllRequestApproved = 'NOTIFY_REQUEST_APPROVED',
44
43
  notifyAllRequestRejected = 'NOTIFY_REQUEST_REJECTED',
45
44
  notifyHostsInChannel = 'NOTIFY_HOSTS_IN_CHANNEL',
46
- promoteAsCoHost = 'PROMOTE_AS_CO_HOST',
47
- coHostJoined = 'CO_HOST_JOINED',
48
- coHostRemoved = 'CO_HOST_REMOVED',
49
45
  }
50
46
 
51
47
  export const LSNotificationObject = {
52
- [LiveStreamControlMessageEnum.raiseHandRequest]: {
53
- text1: 'You’ve raised your hand.',
54
- text2: 'Waiting for host to approve the request',
55
- },
56
- [LiveStreamControlMessageEnum.raiseHandRequestReceived]: {
57
- text1: 'has raised their hand to be a Presenter',
58
- text2:
59
- 'Once approved they will be able to speak, share their video and present during this call.',
60
- },
61
- [LiveStreamControlMessageEnum.raiseHandRequestAccepted]: {
62
- text1: 'Host has approved your request.',
63
- text2: 'You are now a Presenter',
64
- },
65
- [LiveStreamControlMessageEnum.raiseHandRequestRejected]: {
66
- text1: 'Your request was rejected by the host',
67
- text2: null,
68
- },
69
- [LiveStreamControlMessageEnum.raiseHandRequestRecall]: {
70
- text1: 'has lowered their hand',
71
- text2: null,
72
- },
73
- [LiveStreamControlMessageEnum.raiseHandRequestRecallLocal]: {
74
- text1: 'You’ve lowered your hand.',
75
- text2: null,
76
- },
77
- [LiveStreamControlMessageEnum.raiseHandApprovedRequestRecall]: {
78
- text1: 'Host has revoked streaming permissions.',
79
- text2: null,
80
- },
81
- [LiveStreamControlMessageEnum.promoteAsCoHost]: {
82
- text1: 'Host promoted you as a Presenter',
83
- text2: null,
84
- },
48
+ [LiveStreamControlMessageEnum.raiseHandRequest]:
49
+ 'You have raised your hand. Request sent to host for approval',
50
+ [LiveStreamControlMessageEnum.raiseHandRequestReceived]:
51
+ 'has raised their hand',
52
+ [LiveStreamControlMessageEnum.raiseHandRequestAccepted]:
53
+ 'Your request was approved, unmute to start talking',
54
+ [LiveStreamControlMessageEnum.raiseHandRequestRejected]:
55
+ 'Your request was rejected by the host',
56
+ [LiveStreamControlMessageEnum.raiseHandRequestRecall]:
57
+ 'has lowered their hand',
58
+ [LiveStreamControlMessageEnum.raiseHandRequestRecallLocal]:
59
+ 'You have lowered your hand',
60
+ [LiveStreamControlMessageEnum.raiseHandApprovedRequestRecall]:
61
+ 'The host has revoked streaming permissions',
85
62
  };
86
63
 
87
64
  export interface liveStreamPropsInterface {
@@ -97,8 +74,6 @@ export interface liveStreamContext {
97
74
  hostRejectsRequestOfUID: (uid: number) => void;
98
75
  audienceSendsRequest: () => void;
99
76
  audienceRecallsRequest: () => void;
100
- promoteAudienceAsCoHost: (uid: UidType) => void;
101
- coHostUids: UidType[];
102
77
  }
103
78
 
104
79
  export interface requestInterface {
@@ -10,7 +10,6 @@ import LiveStreamContext, {
10
10
  } from './LiveStreamContext';
11
11
 
12
12
  export {
13
- LiveStreamContext,
14
13
  LiveStreamContextProvider,
15
14
  LiveStreamControlMessageEnum,
16
15
  requestStatus,
@@ -15,24 +15,16 @@ import {LocalRaiseHand} from '../../../subComponents/livestream';
15
15
 
16
16
  export interface LiveStreamControlsProps {
17
17
  showControls: boolean;
18
- isDesktop: boolean;
19
- showLabel?: boolean;
20
18
  }
21
19
 
22
20
  const LiveStreamControls = (props: LiveStreamControlsProps) => {
23
- const {showControls, isDesktop, showLabel = $config.ICON_TEXT} = props;
21
+ const {showControls} = props;
24
22
  if (!$config.RAISE_HAND) return <></>;
25
23
  if (!showControls) return <></>;
26
24
  return (
27
- <>
28
- <View
29
- style={{
30
- alignSelf: 'center',
31
- marginHorizontal: 10,
32
- }}>
33
- <LocalRaiseHand showLabel={showLabel} />
34
- </View>
35
- </>
25
+ <View style={{alignSelf: 'center'}}>
26
+ <LocalRaiseHand />
27
+ </View>
36
28
  );
37
29
  };
38
30