agora-appbuilder-core 4.0.0-spl.14 → 4.0.0-spl.16

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-spl.14",
3
+ "version": "4.0.0-spl.16",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -76,6 +76,7 @@
76
76
  "babel-loader": "8.2.4",
77
77
  "babel-plugin-module-resolver": "4.1.0",
78
78
  "babel-plugin-transform-define": "2.0.1",
79
+ "babel-plugin-transform-remove-console": "^6.9.4",
79
80
  "cross-env": "7.0.3",
80
81
  "css-loader": "6.7.2",
81
82
  "del": "5.1.0",
@@ -7981,6 +7982,12 @@
7981
7982
  "node": ">= 8.x.x"
7982
7983
  }
7983
7984
  },
7985
+ "node_modules/babel-plugin-transform-remove-console": {
7986
+ "version": "6.9.4",
7987
+ "resolved": "https://registry.npmjs.org/babel-plugin-transform-remove-console/-/babel-plugin-transform-remove-console-6.9.4.tgz",
7988
+ "integrity": "sha512-88blrUrMX3SPiGkT1GnvVY8E/7A+k6oj3MNvUtTIxJflFzXTw1bHkuJ/y039ouhFMp2prRn5cQGzokViYi1dsg==",
7989
+ "dev": true
7990
+ },
7984
7991
  "node_modules/babel-preset-current-node-syntax": {
7985
7992
  "version": "1.0.1",
7986
7993
  "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz",
@@ -35646,6 +35653,12 @@
35646
35653
  "traverse": "0.6.6"
35647
35654
  }
35648
35655
  },
35656
+ "babel-plugin-transform-remove-console": {
35657
+ "version": "6.9.4",
35658
+ "resolved": "https://registry.npmjs.org/babel-plugin-transform-remove-console/-/babel-plugin-transform-remove-console-6.9.4.tgz",
35659
+ "integrity": "sha512-88blrUrMX3SPiGkT1GnvVY8E/7A+k6oj3MNvUtTIxJflFzXTw1bHkuJ/y039ouhFMp2prRn5cQGzokViYi1dsg==",
35660
+ "dev": true
35661
+ },
35649
35662
  "babel-preset-current-node-syntax": {
35650
35663
  "version": "1.0.1",
35651
35664
  "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz",
@@ -10,8 +10,8 @@
10
10
  *********************************************
11
11
  */
12
12
  const configVars = require('./configTransform');
13
- const { getCustomizationApiPath } = require('./customization.config');
14
-
13
+ const {getCustomizationApiPath} = require('./customization.config');
14
+ //
15
15
  // This file is read only by react native for IOS & Android. Doesn't apply to electron, Web targets
16
16
  module.exports = {
17
17
  presets: ['module:metro-react-native-babel-preset'],
@@ -29,6 +29,6 @@ module.exports = {
29
29
  },
30
30
  },
31
31
  ],
32
- 'react-native-reanimated/plugin'
32
+ 'react-native-reanimated/plugin',
33
33
  ],
34
34
  };
@@ -18,6 +18,7 @@ import {
18
18
  } from 'agora-react-native-rtm/lib/typescript/src';
19
19
  import {RtmClientEvents} from 'agora-react-native-rtm/lib/typescript/src/RtmEngine';
20
20
  import AgoraRTM, {VERSION} from 'agora-rtm-sdk';
21
+ import RtmClient from 'agora-react-native-rtm';
21
22
  // export {RtmAttribute}
22
23
  //
23
24
  interface RtmAttributePlaceholder {}
@@ -96,7 +97,14 @@ export default class RtmEngine {
96
97
 
97
98
  createClient(APP_ID: string) {
98
99
  this.appId = APP_ID;
99
- this.client = AgoraRTM.createInstance(this.appId);
100
+ this.client = AgoraRTM.createInstance(this.appId, {
101
+ logFilter:
102
+ APPBUILDER_PUBLIC_NODE_ENV === 'production' &&
103
+ (APPBUILDER_PUBLIC_TARGET === 'rsdk' ||
104
+ APPBUILDER_PUBLIC_TARGET === 'wsdk')
105
+ ? AgoraRTM.LOG_FILTER_OFF
106
+ : AgoraRTM.LOG_FILTER_INFO,
107
+ });
100
108
 
101
109
  window.rtmClient = this.client;
102
110
 
@@ -175,7 +183,7 @@ export default class RtmEngine {
175
183
  }
176
184
 
177
185
  async logout(): Promise<any> {
178
- return this.client.logout();
186
+ return await this.client.logout();
179
187
  }
180
188
 
181
189
  async joinChannel(channelId: string): Promise<any> {
@@ -101,6 +101,16 @@ interface ConfigInterface {
101
101
  TOAST_NOTIFICATIONS: boolean;
102
102
  }
103
103
  declare var $config: ConfigInterface;
104
+
105
+ declare var APPBUILDER_PUBLIC_NODE_ENV: 'production' | 'development';
106
+ declare var APPBUILDER_PUBLIC_TARGET:
107
+ | 'rsdk'
108
+ | 'wsdk'
109
+ | 'web'
110
+ | 'windows'
111
+ | 'linux'
112
+ | 'mac'
113
+ | 'android';
104
114
  declare module 'customization' {
105
115
  const customizationConfig: {};
106
116
  export default customizationConfig;
@@ -19,6 +19,7 @@ import SDKAppWrapper, {
19
19
  import React from 'react';
20
20
  import * as RN from 'react-native-web';
21
21
  import './src/assets/font-styles.css';
22
+ import AgoraRTC from 'agora-rtc-sdk-ng';
22
23
 
23
24
  export * from 'customization-api';
24
25
  export * from 'customization-implementation';
@@ -27,6 +28,10 @@ interface AppBuilderReactSdkInterface extends AppBuilderSdkApiInterface {
27
28
  View: React.FC;
28
29
  }
29
30
 
31
+ if (APPBUILDER_PUBLIC_NODE_ENV === 'production') {
32
+ AgoraRTC.setLogLevel(4);
33
+ }
34
+
30
35
  const AppBuilderReactSdkApi: AppBuilderReactSdkInterface = {
31
36
  ...AppBuilderSdkApi,
32
37
  View: SDKAppWrapper,
@@ -6,9 +6,14 @@ import SDKAppWrapper, {
6
6
  import React from 'react';
7
7
  import * as RN from 'react-native-web';
8
8
  import './src/assets/font-styles.css';
9
+ import AgoraRTC from 'agora-rtc-sdk-ng';
9
10
  export * from 'customization-api';
10
11
  export * from 'customization-implementation';
11
12
 
13
+ if (APPBUILDER_PUBLIC_NODE_ENV === 'production') {
14
+ AgoraRTC.setLogLevel(4);
15
+ }
16
+
12
17
  const AppBuilderWebSdkApi: AppBuilderSdkApiInterface = AppBuilderSdkApi;
13
18
 
14
19
  // init code
@@ -116,6 +116,7 @@
116
116
  "babel-loader": "8.2.4",
117
117
  "babel-plugin-module-resolver": "4.1.0",
118
118
  "babel-plugin-transform-define": "2.0.1",
119
+ "babel-plugin-transform-remove-console": "^6.9.4",
119
120
  "cross-env": "7.0.3",
120
121
  "css-loader": "6.7.2",
121
122
  "del": "5.1.0",
@@ -374,6 +374,12 @@ const DeviceConfigure: React.FC<Props> = (props: any) => {
374
374
  },
375
375
  }[kind];
376
376
 
377
+ // non chrome, ignore speaker
378
+ if (!isChrome && kind === 'audiooutput') {
379
+ setUiSelectedSpeaker('');
380
+ return;
381
+ }
382
+
377
383
  if (uiSelectedState && uiSelectedState.trim().length != 0) {
378
384
  return;
379
385
  }
@@ -440,7 +446,7 @@ const DeviceConfigure: React.FC<Props> = (props: any) => {
440
446
  checkDeviceExists(storedDevice, deviceList)
441
447
  ) {
442
448
  log(logTag, deviceLogTag, 'Setting to active id', storedDevice);
443
- setDevice(storedDevice).catch((e:Error) => {
449
+ setDevice(storedDevice).catch((e: Error) => {
444
450
  log(
445
451
  logTag,
446
452
  deviceLogTag,
@@ -731,6 +737,7 @@ const DeviceConfigure: React.FC<Props> = (props: any) => {
731
737
  setSelectedSpeaker,
732
738
  deviceList,
733
739
  setDeviceList,
740
+ isChrome,
734
741
  }}>
735
742
  {props.children}
736
743
  </DeviceContext.Provider>
@@ -20,6 +20,7 @@ interface DeviceContext {
20
20
  setSelectedSpeaker: (speaker: string) => Promise<any>;
21
21
  deviceList: MediaDeviceInfo[];
22
22
  setDeviceList: (devices: MediaDeviceInfo[]) => void;
23
+ isChrome: boolean;
23
24
  }
24
25
 
25
26
  const DeviceContext = createContext<DeviceContext>({
@@ -31,5 +32,6 @@ const DeviceContext = createContext<DeviceContext>({
31
32
  setSelectedMic: async () => {},
32
33
  setSelectedSpeaker: async () => {},
33
34
  setDeviceList: () => {},
35
+ isChrome: false,
34
36
  });
35
37
  export default DeviceContext;
@@ -251,7 +251,7 @@ interface SelectSpeakerDeviceProps {
251
251
  }
252
252
 
253
253
  const SelectSpeakerDevice = (props: SelectSpeakerDeviceProps) => {
254
- const {selectedSpeaker, setSelectedSpeaker, deviceList} =
254
+ const {selectedSpeaker, setSelectedSpeaker, deviceList, isChrome} =
255
255
  useContext(DeviceContext);
256
256
  const local = useContext(LocalContext);
257
257
  const [isPickerDisabled, btnTheme] = useSelectDevice();
@@ -299,7 +299,7 @@ const SelectSpeakerDevice = (props: SelectSpeakerDeviceProps) => {
299
299
  <Text style={style.label}>Speaker</Text>
300
300
  {(local.permissionStatus === PermissionState.GRANTED_FOR_CAM_AND_MIC ||
301
301
  local.permissionStatus === PermissionState.GRANTED_FOR_MIC_ONLY) &&
302
- (!data || data.length === 0) ? (
302
+ (!isChrome || !data || data.length === 0) ? (
303
303
  <Dropdown
304
304
  icon={props?.isIconDropdown ? 'speaker' : undefined}
305
305
  enabled={!isPickerDisabled}
@@ -16,6 +16,7 @@ competitive to Agora Lab, Inc.’s business) is strictly prohibited. For more
16
16
  */
17
17
  const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
18
18
  const isDevelopment = process.env.NODE_ENV === 'development';
19
+ const isProduction = process.env.NODE_ENV === 'production';
19
20
  const path = require('path');
20
21
  const HtmlWebpackPlugin = require('html-webpack-plugin');
21
22
  const configVars = require('./configTransform');
@@ -34,15 +35,15 @@ module.exports = {
34
35
  plugins: [
35
36
  // Using html webpack plugin to utilize our index.html
36
37
  !isSdk &&
37
- new HtmlWebpackPlugin({
38
- title: configVars['$config.APP_NAME'],
39
- template: isElectron ? 'electron/index.html' : 'web/index.html',
40
- }),
38
+ new HtmlWebpackPlugin({
39
+ title: configVars['$config.APP_NAME'],
40
+ template: isElectron ? 'electron/index.html' : 'web/index.html',
41
+ }),
41
42
  isDevelopment &&
42
- !isSdk &&
43
- new ReactRefreshWebpackPlugin({
44
- overlay: false,
45
- }),
43
+ !isSdk &&
44
+ new ReactRefreshWebpackPlugin({
45
+ overlay: false,
46
+ }),
46
47
  ].filter(Boolean),
47
48
  resolve: {
48
49
  alias: {
@@ -123,10 +124,18 @@ module.exports = {
123
124
  ],
124
125
  plugins: [
125
126
  // Adds support for class properties
126
- ['transform-define', configVars],
127
+ [
128
+ 'transform-define',
129
+ {
130
+ ...configVars,
131
+ APPBUILDER_PUBLIC_NODE_ENV: process.env.NODE_ENV,
132
+ APPBUILDER_PUBLIC_TARGET: process.env.TARGET,
133
+ },
134
+ ],
127
135
  '@babel/plugin-proposal-optional-chaining',
128
136
  '@babel/plugin-proposal-class-properties',
129
137
  isDevelopment && !isSdk && require.resolve('react-refresh/babel'),
138
+ isProduction && isSdk && 'transform-remove-console',
130
139
  ].filter(Boolean),
131
140
  },
132
141
  },
@@ -141,9 +150,8 @@ module.exports = {
141
150
  },
142
151
  {
143
152
  test: /\.css$/i,
144
- use: ["style-loader", "css-loader"],
153
+ use: ['style-loader', 'css-loader'],
145
154
  },
146
-
147
155
  ],
148
156
  },
149
157
  };