agora-appbuilder-core 4.0.0-beta.7 → 4.0.0-beta.9

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.0.0-beta.7",
3
+ "version": "4.0.0-beta.9",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -239,7 +239,7 @@ const DeviceConfigure: React.FC<Props> = (props: any) => {
239
239
 
240
240
  const logTag = 'useEffect[rtc,store]';
241
241
 
242
- if (activeDeviceId && deviceList.length !== 0) {
242
+ if (activeDeviceId) {
243
243
  // If stream exists and selected devices are empty, check for devices again
244
244
  if (!selectedCam || selectedCam.trim().length == 0) {
245
245
  log(logTag, 'cam: Device list populated but No selected cam');
@@ -35,102 +35,115 @@ const VideoRenderer: React.FC<VideoRendererProps> = ({user, isMax = false}) => {
35
35
  currentLayout === getPinnedLayoutName();
36
36
  const [videoTileWidth, setVideoTileWidth] = useState(0);
37
37
  const [avatarSize, setAvatarSize] = useState(100);
38
+ const videoMoreMenuRef = useRef(null);
39
+ const [actionMenuVisible, setActionMenuVisible] = React.useState(false);
38
40
  return (
39
- <PlatformWrapper isHovered={isHovered} setIsHovered={setIsHovered}>
40
- <View
41
- onLayout={({
42
- nativeEvent: {
43
- layout: {x, y, width, height},
44
- },
45
- }) => {
46
- setVideoTileWidth(width);
47
- setAvatarSize(Math.floor(width * 0.35));
41
+ <>
42
+ <UserActionMenuOptionsOptions
43
+ actionMenuVisible={actionMenuVisible}
44
+ setActionMenuVisible={(flag) => {
45
+ //once user clicks action menu item -> hide the action menu and set parent isHovered false
46
+ if (!flag) {
47
+ setIsHovered(false);
48
+ }
49
+ setActionMenuVisible(flag);
48
50
  }}
49
- style={[
50
- maxStyle.container,
51
- activeSpeaker
52
- ? maxStyle.activeContainerStyle
53
- : user.video
54
- ? maxStyle.noVideoStyle
55
- : maxStyle.nonActiveContainerStyle,
56
- ]}>
57
- {!showReplacePin && !showPinForMe && (
58
- <ScreenShareNotice uid={user.uid} isMax={isMax} />
59
- )}
60
- <NetworkQualityPill user={user} />
61
- <MaxVideoView
62
- fallback={() => {
63
- return FallbackLogo(
64
- user?.name,
65
- activeSpeaker,
66
- (showReplacePin || showPinForMe) && !isMobileUA() ? true : false,
67
- isMax,
68
- avatarSize,
69
- );
70
- }}
71
- user={user}
72
- containerStyle={{
73
- width: '100%',
74
- height: '100%',
51
+ user={user}
52
+ btnRef={videoMoreMenuRef}
53
+ from={'video-tile'}
54
+ />
55
+ <PlatformWrapper isHovered={isHovered} setIsHovered={setIsHovered}>
56
+ <View
57
+ onLayout={({
58
+ nativeEvent: {
59
+ layout: {x, y, width, height},
60
+ },
61
+ }) => {
62
+ setVideoTileWidth(width);
63
+ setAvatarSize(Math.floor(width * 0.35));
75
64
  }}
76
- key={user.uid}
77
- />
78
- <NameWithMicIcon
79
- videoTileWidth={videoTileWidth}
80
- user={user}
81
- isMax={isMax}
82
- />
83
- {user.uid !== rtcProps?.screenShareUid &&
84
- (isHovered || isMobileUA()) ? (
85
- <MoreMenu
86
- isMax={isMax}
87
- pinnedUid={pinnedUid}
88
- user={user}
89
- setIsHovered={setIsHovered}
90
- />
91
- ) : (
92
- <></>
93
- )}
94
- {(showReplacePin || showPinForMe) && !isMobileUA() ? (
95
- <IconButton
96
- onPress={() => {
97
- dispatch({type: 'UserPin', value: [user.uid]});
98
- }}
99
- containerStyle={maxStyle.replacePinContainer}
100
- btnTextProps={{
101
- text: showReplacePin ? 'Replace Pin' : 'Pin for me',
102
- textColor: $config.VIDEO_AUDIO_TILE_TEXT_COLOR,
103
- textStyle: {
104
- marginTop: 0,
105
- fontWeight: '700',
106
- marginLeft: 6,
107
- },
65
+ style={[
66
+ maxStyle.container,
67
+ activeSpeaker
68
+ ? maxStyle.activeContainerStyle
69
+ : user.video
70
+ ? maxStyle.noVideoStyle
71
+ : maxStyle.nonActiveContainerStyle,
72
+ ]}>
73
+ {!showReplacePin && !showPinForMe && (
74
+ <ScreenShareNotice uid={user.uid} isMax={isMax} />
75
+ )}
76
+ <NetworkQualityPill user={user} />
77
+ <MaxVideoView
78
+ fallback={() => {
79
+ return FallbackLogo(
80
+ user?.name,
81
+ activeSpeaker,
82
+ (showReplacePin || showPinForMe) && !isMobileUA()
83
+ ? true
84
+ : false,
85
+ isMax,
86
+ avatarSize,
87
+ );
108
88
  }}
109
- iconProps={{
110
- name: 'pin-filled',
111
- iconSize: 20,
112
- iconType: 'plain',
113
- tintColor: $config.VIDEO_AUDIO_TILE_TEXT_COLOR,
89
+ user={user}
90
+ containerStyle={{
91
+ width: '100%',
92
+ height: '100%',
114
93
  }}
94
+ key={user.uid}
115
95
  />
116
- ) : (
117
- <></>
118
- )}
119
- </View>
120
- </PlatformWrapper>
96
+ <NameWithMicIcon
97
+ videoTileWidth={videoTileWidth}
98
+ user={user}
99
+ isMax={isMax}
100
+ />
101
+ {user.uid !== rtcProps?.screenShareUid &&
102
+ (isHovered || actionMenuVisible || isMobileUA()) ? (
103
+ <MoreMenu
104
+ videoMoreMenuRef={videoMoreMenuRef}
105
+ setActionMenuVisible={setActionMenuVisible}
106
+ />
107
+ ) : (
108
+ <></>
109
+ )}
110
+ {(showReplacePin || showPinForMe) && !isMobileUA() ? (
111
+ <IconButton
112
+ onPress={() => {
113
+ dispatch({type: 'UserPin', value: [user.uid]});
114
+ }}
115
+ containerStyle={maxStyle.replacePinContainer}
116
+ btnTextProps={{
117
+ text: showReplacePin ? 'Replace Pin' : 'Pin for me',
118
+ textColor: $config.VIDEO_AUDIO_TILE_TEXT_COLOR,
119
+ textStyle: {
120
+ marginTop: 0,
121
+ fontWeight: '700',
122
+ marginLeft: 6,
123
+ },
124
+ }}
125
+ iconProps={{
126
+ name: 'pin-filled',
127
+ iconSize: 20,
128
+ iconType: 'plain',
129
+ tintColor: $config.VIDEO_AUDIO_TILE_TEXT_COLOR,
130
+ }}
131
+ />
132
+ ) : (
133
+ <></>
134
+ )}
135
+ </View>
136
+ </PlatformWrapper>
137
+ </>
121
138
  );
122
139
  };
123
140
 
124
141
  interface MoreMenuProps {
125
- user: RenderInterface;
126
- isMax: boolean;
127
- pinnedUid: UidType;
128
- setIsHovered: (isHovered: boolean) => void;
142
+ setActionMenuVisible: (f: boolean) => void;
143
+ videoMoreMenuRef: any;
129
144
  }
130
- const MoreMenu = ({user, isMax, pinnedUid, setIsHovered}: MoreMenuProps) => {
131
- const videoMoreMenuRef = useRef(null);
145
+ const MoreMenu = ({setActionMenuVisible, videoMoreMenuRef}: MoreMenuProps) => {
132
146
  const {activeUids} = useRender();
133
- const [actionMenuVisible, setActionMenuVisible] = React.useState(false);
134
147
  const {currentLayout} = useLayout();
135
148
  const reduceSpace =
136
149
  isMobileUA() &&
@@ -139,29 +152,15 @@ const MoreMenu = ({user, isMax, pinnedUid, setIsHovered}: MoreMenuProps) => {
139
152
  return (
140
153
  <>
141
154
  <View
155
+ ref={videoMoreMenuRef}
156
+ collapsable={false}
142
157
  style={{
143
158
  position: 'absolute',
144
159
  right: reduceSpace ? 2 : 8,
145
160
  bottom: reduceSpace ? 2 : 8,
146
161
  zIndex: 999,
147
162
  }}>
148
- <UserActionMenuOptionsOptions
149
- actionMenuVisible={actionMenuVisible}
150
- setActionMenuVisible={(flag) => {
151
- //once user clicks action menu item -> hide the action menu and set parent isHovered false
152
- if (!flag) {
153
- setIsHovered(false);
154
- }
155
- setActionMenuVisible(flag);
156
- }}
157
- user={user}
158
- btnRef={videoMoreMenuRef}
159
- from={'video-tile'}
160
- />
161
163
  <IconButton
162
- setRef={(ref) => {
163
- videoMoreMenuRef.current = ref;
164
- }}
165
164
  onPress={() => {
166
165
  setActionMenuVisible(true);
167
166
  }}
@@ -13,7 +13,7 @@ import {useLocalUserInfo, useRtc} from 'customization-api';
13
13
  import {useContext, useEffect, useRef, useState} from 'react';
14
14
 
15
15
  import {ToggleState} from '../../agora-rn-uikit/src/Contexts/PropsContext';
16
- import {isWebInternal} from './common';
16
+ import {isMobileUA, isWebInternal} from './common';
17
17
  import {AppState} from 'react-native';
18
18
 
19
19
  export enum MUTE_LOCAL_TYPE {
@@ -32,7 +32,7 @@ function useMuteToggleLocal() {
32
32
  const isCamON = useRef(local.video);
33
33
 
34
34
  useEffect(() => {
35
- if ($config.AUDIO_ROOM) return;
35
+ if ($config.AUDIO_ROOM || !isMobileUA()) return;
36
36
  const subscription = AppState.addEventListener('change', (nextAppState) => {
37
37
  appState.current = nextAppState;
38
38
  setAppStateVisible(appState.current);