agora-appbuilder-core 4.1.14-beta.1 → 4.1.14

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.14-beta.1",
3
+ "version": "4.1.14",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -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.14-beta.1',
81
- CORE_VERSION: '4.1.14-beta.1',
80
+ CLI_VERSION: '3.1.14',
81
+ CORE_VERSION: '4.1.14',
82
82
  DISABLE_LANDSCAPE_MODE: false,
83
83
  STT_AUTO_START: false,
84
84
  CLOUD_RECORDING_AUTO_START: false,
@@ -160,33 +160,8 @@ const AdvancedSettings = () => {
160
160
  );
161
161
  };
162
162
 
163
- const ASRSettings = () => {
164
- const {agentId} = useContext(AgentContext);
165
- const {
166
- data: {agents},
167
- } = useRoomInfo();
168
-
169
- // Get the selected agent and check if ASR vendor is "ares"
170
- const selectedAgent = agents?.find(a => a.id === agentId);
171
- const isAresASR = selectedAgent?.asr?.vendor === 'ares';
172
-
173
- // Only render ASR settings if the agent uses "ares" as ASR vendor
174
- if (!isAresASR) {
175
- return null;
176
- }
177
-
178
- return (
179
- <>
180
- <SelectUserLanguage />
181
- <Spacer size={16} />
182
- <AdvancedSettings />
183
- </>
184
- );
185
- };
186
-
187
163
  const CustomSettingsPanel = () => {
188
164
  const isAgentAvailable = useIsAgentAvailable();
189
-
190
165
  return (
191
166
  <View style={styles.container}>
192
167
  <ScrollView style={styles.contentContainer}>
@@ -199,7 +174,9 @@ const CustomSettingsPanel = () => {
199
174
  <Spacer size={16} />
200
175
  <UserPrompt />
201
176
  <Spacer size={16} />
202
- <ASRSettings />
177
+ <SelectUserLanguage />
178
+ <Spacer size={16} />
179
+ <AdvancedSettings />
203
180
  </>
204
181
  ) : (
205
182
  <></>
@@ -85,10 +85,6 @@ export interface AIAgentInterface {
85
85
  region: string;
86
86
  };
87
87
  };
88
- asr: {
89
- vendor: string;
90
- params: Record<string, any>;
91
- };
92
88
  }
93
89
 
94
90
  export interface RoomInfoContextInterface {
@@ -1,11 +1,11 @@
1
1
  import React, {useState} from 'react';
2
2
  import {View, Text, StyleSheet} from 'react-native';
3
- import {useOrientation} from '../utils/useOrientation';
3
+ import {useOrientation, getDeviceClass} from '../utils/useOrientation';
4
4
  import ThemeConfig from '../theme';
5
- import {isMobileUA} from '../utils/common';
6
5
  import Popup from './../atoms/Popup';
7
6
  import {useString} from '../utils/useString';
8
7
  import {blockLandscapeModeMessageText} from '../language/default-labels/videoCallScreenLabels';
8
+ import {logger, LogSource} from '../logger/AppBuilderLogger';
9
9
 
10
10
  export default function BlockUI() {
11
11
  const blockLandscapeModeMessageTextLabel = useString(
@@ -15,10 +15,20 @@ export default function BlockUI() {
15
15
  const [isBlockModalVisible, setBlockModalVisible] = useState(true);
16
16
 
17
17
  const orientation = useOrientation();
18
- if (!isMobileUA()) {
19
- return <></>;
20
- }
21
- if (orientation === 'PORTRAIT') {
18
+ const deviceClass = getDeviceClass();
19
+ const shouldBlock = deviceClass === 'phone' && orientation === 'LANDSCAPE';
20
+
21
+ logger.log(
22
+ LogSource.Internals,
23
+ 'CREATE_MEETING',
24
+ 'current device orientation is',
25
+ {
26
+ orientation,
27
+ device: deviceClass,
28
+ shouldBlockLandscape: shouldBlock,
29
+ },
30
+ );
31
+ if (!shouldBlock) {
22
32
  return <></>;
23
33
  }
24
34
  return (
@@ -1,3 +1,20 @@
1
+ import {Dimensions} from 'react-native';
2
+
3
+ export type DeviceClass = 'phone' | 'tablet' | 'desktop';
4
+
5
+ export const getDeviceClass = (): DeviceClass => {
6
+ // Get the physical screen dimensions for native devices
7
+ const {width, height} = Dimensions.get('screen');
8
+ const minDim = Math.min(width, height);
9
+
10
+ // Touch + small screen → phone
11
+ if (minDim < 600) {
12
+ return 'phone';
13
+ }
14
+ // Touch + large screen → tablet
15
+ return 'tablet';
16
+ };
17
+
1
18
  export function useOrientation() {
2
19
  return 'PORTRAIT';
3
20
  }
@@ -1,59 +1,53 @@
1
- import {useState, useEffect} from 'react';
2
- import {Keyboard, Platform} from 'react-native';
1
+ import {useEffect, useState} from 'react';
2
+
3
+ type Orientation = 'PORTRAIT' | 'LANDSCAPE';
4
+ export type DeviceClass = 'phone' | 'tablet' | 'desktop';
5
+
6
+ // https://developer.mozilla.org/en-US/docs/Web/API/Screen_Orientation_API
7
+
8
+ const getOrientation = (): Orientation => {
9
+ // This gives the device hardware orientation
10
+ const type = window.screen?.orientation?.type;
11
+ if (type) {
12
+ return type.startsWith('portrait') ? 'PORTRAIT' : 'LANDSCAPE';
13
+ }
14
+ // In case above api does not exist -> use the physical device height and width
15
+ return window.screen.height >= window.screen.width ? 'PORTRAIT' : 'LANDSCAPE';
16
+ };
17
+
18
+ export const getDeviceClass = (): DeviceClass => {
19
+ const minDim = Math.min(screen.width, screen.height);
20
+
21
+ // Phones only
22
+ if (minDim < 600) {
23
+ return 'phone';
24
+ }
25
+
26
+ // Everything else (tablet + desktop)
27
+ return 'tablet';
28
+ };
3
29
 
4
30
  export function useOrientation() {
5
- const [orientation, setOrientation] = useState<'PORTRAIT' | 'LANDSCAPE'>(
6
- window.matchMedia('(orientation: portrait)').matches
7
- ? 'PORTRAIT'
8
- : 'LANDSCAPE',
9
- );
10
- const [keyboardVisible, setKeyboardVisible] = useState(false);
31
+ const [orientation, setOrientation] = useState<Orientation>(getOrientation());
11
32
 
12
33
  useEffect(() => {
13
34
  console.log('screen orientation changed', orientation);
14
35
  }, [orientation]);
15
36
 
16
37
  useEffect(() => {
17
- const handleOrientationChange = () => {
18
- if (keyboardVisible && Platform.OS === 'ios') {
19
- return; // Avoid changing orientation if the keyboard is visible on iOS
20
- }
21
- setOrientation(
22
- window.matchMedia('(orientation: portrait)').matches
23
- ? 'PORTRAIT'
24
- : 'LANDSCAPE',
25
- );
26
- };
27
-
28
- const handleResize = () => {
29
- if (!keyboardVisible) {
30
- handleOrientationChange();
31
- }
32
- };
33
-
34
- const keyboardDidShowListener = Keyboard.addListener(
35
- 'keyboardDidShow',
36
- () => {
37
- setKeyboardVisible(true);
38
- },
39
- );
38
+ const update = () => setOrientation(getOrientation());
40
39
 
41
- const keyboardDidHideListener = Keyboard.addListener(
42
- 'keyboardDidHide',
43
- () => {
44
- setKeyboardVisible(false);
45
- handleOrientationChange(); // Recheck orientation after the keyboard is hidden
46
- },
47
- );
40
+ window.addEventListener('resize', update);
48
41
 
49
- window.addEventListener('resize', handleResize);
42
+ // https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation/change_event
43
+ const screenOrientation = window.screen?.orientation;
44
+ screenOrientation?.addEventListener?.('change', update);
50
45
 
51
46
  return () => {
52
- keyboardDidShowListener.remove();
53
- keyboardDidHideListener.remove();
54
- window.removeEventListener('resize', handleResize);
47
+ window.removeEventListener('resize', update);
48
+ screenOrientation?.removeEventListener?.('change', update);
55
49
  };
56
- }, [keyboardVisible]);
50
+ }, []);
57
51
 
58
52
  return orientation;
59
53
  }