agora-appbuilder-core 4.1.4-beta.7 → 4.1.4-beta.8

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agora-appbuilder-core",
3
- "version": "4.1.4-beta.7",
3
+ "version": "4.1.4-beta.8",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -94,6 +94,10 @@ export interface VideoCallInterface extends BeforeAndAfterInterface {
94
94
  title: string;
95
95
  renderComponent?: React.ComponentType;
96
96
  };
97
+ hostControls?: {
98
+ audioControl?: React.ComponentType;
99
+ videoControl?: React.ComponentType;
100
+ };
97
101
  }
98
102
 
99
103
  export type ComponentsInterface = {
@@ -77,8 +77,8 @@ const DefaultConfig = {
77
77
  CHAT_ORG_NAME: '',
78
78
  CHAT_APP_NAME: '',
79
79
  CHAT_URL: '',
80
- CLI_VERSION: '3.1.4-beta.7',
81
- CORE_VERSION: '4.1.4-beta.7',
80
+ CLI_VERSION: '3.1.4-beta.8',
81
+ CORE_VERSION: '4.1.4-beta.8',
82
82
  DISABLE_LANDSCAPE_MODE: false,
83
83
  STT_AUTO_START: false,
84
84
  CLOUD_RECORDING_AUTO_START: false,
@@ -16,12 +16,13 @@ import useRemoteMute, {MUTE_REMOTE_TYPE} from '../utils/useRemoteMute';
16
16
  import TertiaryButton from '../atoms/TertiaryButton';
17
17
  import Spacer from '../atoms/Spacer';
18
18
  import RemoteMutePopup from '../subComponents/RemoteMutePopup';
19
- import {calculatePosition} from '../utils/common';
19
+ import {calculatePosition, isValidReactComponent} from '../utils/common';
20
20
  import {
21
21
  I18nMuteType,
22
22
  peoplePanelMuteAllMicBtnText,
23
23
  peoplePanelTurnoffAllCameraBtnText,
24
24
  } from '../language/default-labels/videoCallScreenLabels';
25
+ import {useCustomization} from 'customization-implementation';
25
26
 
26
27
  export interface MuteAllAudioButtonProps {
27
28
  render?: (onPress: () => void) => JSX.Element;
@@ -145,17 +146,52 @@ export const MuteAllVideoButton = (props: MuteAllVideoButtonProps) => {
145
146
  };
146
147
 
147
148
  const HostControlView = () => {
149
+ const {AudioControlComponent, VideoControlComponent} = useCustomization(
150
+ data => {
151
+ let components: {
152
+ AudioControlComponent: React.ComponentType;
153
+ VideoControlComponent: React.ComponentType;
154
+ } = {
155
+ AudioControlComponent:
156
+ MuteAllAudioButton as React.ComponentType<MuteAllAudioButtonProps>,
157
+ VideoControlComponent:
158
+ MuteAllVideoButton as React.ComponentType<MuteAllVideoButtonProps>,
159
+ };
160
+
161
+ if (
162
+ data?.components?.videoCall?.hostControls?.audioControl &&
163
+ isValidReactComponent(
164
+ data?.components?.videoCall?.hostControls?.audioControl,
165
+ )
166
+ ) {
167
+ components.AudioControlComponent =
168
+ data?.components?.videoCall?.hostControls?.audioControl;
169
+ }
170
+
171
+ if (
172
+ data?.components?.videoCall?.hostControls?.videoControl &&
173
+ isValidReactComponent(
174
+ data?.components?.videoCall?.hostControls?.videoControl,
175
+ )
176
+ ) {
177
+ components.VideoControlComponent =
178
+ data?.components?.videoCall?.hostControls?.videoControl;
179
+ }
180
+
181
+ return components;
182
+ },
183
+ );
148
184
  return (
149
185
  // <View style={style.container}>
150
186
  <>
151
187
  {!$config.AUDIO_ROOM && (
152
188
  <View style={{display: 'flex', flex: 1}}>
153
- <MuteAllVideoButton />
189
+ <VideoControlComponent />
154
190
  </View>
155
191
  )}
156
192
  <Spacer horizontal size={16} />
157
193
  <View style={{display: 'flex', flex: 1}}>
158
- <MuteAllAudioButton />
194
+ <AudioControlComponent />
159
195
  </View>
160
196
  </>
161
197
  // </View>
@@ -1,16 +1,30 @@
1
1
  import React, {createContext, useContext, useState, useEffect} from 'react';
2
- import {UserActionMenuItemsConfig} from 'customization-api';
2
+ import {
3
+ UidType,
4
+ UserActionMenuItemsConfig,
5
+ DispatchContext,
6
+ useLayout,
7
+ } from 'customization-api';
8
+ import {
9
+ DefaultLayouts,
10
+ getGridLayoutName,
11
+ getPinnedLayoutName,
12
+ } from '../pages/video-call/DefaultLayouts';
3
13
 
4
14
  interface UserActionMenuContextType {
5
15
  userActionMenuItems: UserActionMenuItemsConfig;
6
16
  updateUserActionMenuItems: React.Dispatch<
7
17
  React.SetStateAction<UserActionMenuItemsConfig>
8
18
  >;
19
+ pinForEveryone: (uid: UidType) => void;
20
+ unPinForEveryone: () => void;
9
21
  }
10
22
 
11
23
  const UserActionMenuContext = createContext<UserActionMenuContextType>({
12
24
  userActionMenuItems: {},
13
25
  updateUserActionMenuItems: () => {},
26
+ pinForEveryone: () => {},
27
+ unPinForEveryone: () => {},
14
28
  });
15
29
 
16
30
  export const UserActionMenuProvider: React.FC<{children: React.ReactNode}> = ({
@@ -18,10 +32,33 @@ export const UserActionMenuProvider: React.FC<{children: React.ReactNode}> = ({
18
32
  }) => {
19
33
  const [userActionMenuItems, updateUserActionMenuItems] =
20
34
  useState<UserActionMenuItemsConfig>({});
35
+ const {dispatch} = useContext(DispatchContext);
36
+ const {setLayout} = useLayout();
37
+
38
+ const pinForEveryone = (uid: UidType) => {
39
+ dispatch({
40
+ type: 'UserPin',
41
+ value: [uid],
42
+ });
43
+ setLayout(getPinnedLayoutName());
44
+ };
45
+
46
+ const unPinForEveryone = () => {
47
+ dispatch({
48
+ type: 'UserPin',
49
+ value: [0],
50
+ });
51
+ setLayout(getGridLayoutName());
52
+ };
21
53
 
22
54
  return (
23
55
  <UserActionMenuContext.Provider
24
- value={{userActionMenuItems, updateUserActionMenuItems}}>
56
+ value={{
57
+ userActionMenuItems,
58
+ updateUserActionMenuItems,
59
+ pinForEveryone,
60
+ unPinForEveryone,
61
+ }}>
25
62
  {children}
26
63
  </UserActionMenuContext.Provider>
27
64
  );
@@ -9,6 +9,7 @@ import WhiteboardConfigure from '../../components/whiteboard/WhiteboardConfigure
9
9
  import ChatConfigure from '../../components/chat/chatConfigure';
10
10
  import {useControlPermissionMatrix} from '../../components/controls/useControlPermissionMatrix';
11
11
  import {useContent, useEndCall} from 'customization-api';
12
+ import RTMEngine from '../../../src/rtm/RTMEngine';
12
13
 
13
14
  const VideoCallScreenWithRecordingBot: React.FC = () => {
14
15
  const location = useLocation();
@@ -31,7 +32,10 @@ const VideoCallScreenWrapper: React.FC = () => {
31
32
 
32
33
  useEffect(() => {
33
34
  if (isUserBaned) {
34
- endCall();
35
+ RTMEngine.getInstance().engine.leaveChannel(rtcProps.channel);
36
+ setTimeout(() => {
37
+ endCall();
38
+ }, 0);
35
39
  }
36
40
  }, [isUserBaned]);
37
41