@ray-js/ray-ipc-utils 1.1.0-beta-13 → 1.1.0-beta-15
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/lib/i18n/index.d.ts +30 -0
- package/lib/i18n/index.js +7 -0
- package/lib/i18n/strings.d.ts +17 -0
- package/lib/i18n/strings.js +16 -0
- package/lib/service/index.js +31 -23
- package/package.json +3 -3
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { kit } from '@ray-js/panel-sdk';
|
|
2
|
+
declare const Strings: kit.I18N<{
|
|
3
|
+
en: {
|
|
4
|
+
ipc_utils_get_ipc_config_info_api_err: string;
|
|
5
|
+
ipc_utils_collect_name_empty: string;
|
|
6
|
+
ipc_utils_collect_name_limit_tip: string;
|
|
7
|
+
ipc_utils_collect_number_max_tip: string;
|
|
8
|
+
ipc_utils_cruise_ing_tip: string;
|
|
9
|
+
};
|
|
10
|
+
zh: {
|
|
11
|
+
ipc_utils_get_ipc_config_info_api_err: string;
|
|
12
|
+
ipc_utils_collect_name_empty: string;
|
|
13
|
+
ipc_utils_collect_name_limit_tip: string;
|
|
14
|
+
ipc_utils_collect_number_max_tip: string;
|
|
15
|
+
ipc_utils_cruise_ing_tip: string;
|
|
16
|
+
};
|
|
17
|
+
}, {
|
|
18
|
+
ipc_utils_get_ipc_config_info_api_err: string;
|
|
19
|
+
ipc_utils_collect_name_empty: string;
|
|
20
|
+
ipc_utils_collect_name_limit_tip: string;
|
|
21
|
+
ipc_utils_collect_number_max_tip: string;
|
|
22
|
+
ipc_utils_cruise_ing_tip: string;
|
|
23
|
+
} | {
|
|
24
|
+
ipc_utils_get_ipc_config_info_api_err: string;
|
|
25
|
+
ipc_utils_collect_name_empty: string;
|
|
26
|
+
ipc_utils_collect_name_limit_tip: string;
|
|
27
|
+
ipc_utils_collect_number_max_tip: string;
|
|
28
|
+
ipc_utils_cruise_ing_tip: string;
|
|
29
|
+
}>;
|
|
30
|
+
export default Strings;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
en: {
|
|
3
|
+
ipc_utils_get_ipc_config_info_api_err: string;
|
|
4
|
+
ipc_utils_collect_name_empty: string;
|
|
5
|
+
ipc_utils_collect_name_limit_tip: string;
|
|
6
|
+
ipc_utils_collect_number_max_tip: string;
|
|
7
|
+
ipc_utils_cruise_ing_tip: string;
|
|
8
|
+
};
|
|
9
|
+
zh: {
|
|
10
|
+
ipc_utils_get_ipc_config_info_api_err: string;
|
|
11
|
+
ipc_utils_collect_name_empty: string;
|
|
12
|
+
ipc_utils_collect_name_limit_tip: string;
|
|
13
|
+
ipc_utils_collect_number_max_tip: string;
|
|
14
|
+
ipc_utils_cruise_ing_tip: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
en: {
|
|
3
|
+
ipc_utils_get_ipc_config_info_api_err: 'Error in retrieving config information',
|
|
4
|
+
ipc_utils_collect_name_empty: 'Please enter a collection point name',
|
|
5
|
+
ipc_utils_collect_name_limit_tip: 'Collection point name cannot exceed 10 characters',
|
|
6
|
+
ipc_utils_collect_number_max_tip: 'You can add up to 6 collection points only',
|
|
7
|
+
ipc_utils_cruise_ing_tip: 'Cruising in progress, please stop first'
|
|
8
|
+
},
|
|
9
|
+
zh: {
|
|
10
|
+
ipc_utils_get_ipc_config_info_api_err: '配置信息获取出错',
|
|
11
|
+
ipc_utils_collect_name_empty: '请输入收藏点名称',
|
|
12
|
+
ipc_utils_collect_name_limit_tip: '收藏点名称不能超过10个字符',
|
|
13
|
+
ipc_utils_collect_number_max_tip: '最多只能添加6个收藏点',
|
|
14
|
+
ipc_utils_cruise_ing_tip: '正在巡航,请先停止巡航'
|
|
15
|
+
}
|
|
16
|
+
};
|
package/lib/service/index.js
CHANGED
|
@@ -4,8 +4,9 @@ import "core-js/modules/esnext.iterator.map.js";
|
|
|
4
4
|
import "core-js/modules/esnext.iterator.some.js";
|
|
5
5
|
/* eslint-disable camelcase */
|
|
6
6
|
import _trim from 'lodash/trim';
|
|
7
|
+
import Strings from '../i18n';
|
|
7
8
|
import { JsonUtil, getInitUtmTid } from '../utils';
|
|
8
|
-
import { getDevInfo, getNativeStorage, setNativeStorage, publishDps, getDpStateValue, getDpIdByCode, jumpToWebView, goToMiniProgramByShortLink, getCurrentSupportedTalkMode } from '../kit';
|
|
9
|
+
import { getDevInfo, getNativeStorage, setNativeStorage, publishDps, getDpStateValue, getDpIdByCode, jumpToWebView, goToMiniProgramByShortLink, getCurrentSupportedTalkMode, ipcTTTOperatorLog } from '../kit';
|
|
9
10
|
import { ClarityType, IntercomMode, MuteMode, ServeTpe } from '../interface';
|
|
10
11
|
const errStyle = 'background: red; color: #fff;';
|
|
11
12
|
|
|
@@ -111,7 +112,8 @@ export const getCameraConfigInfo = async deviceId => {
|
|
|
111
112
|
}
|
|
112
113
|
const {
|
|
113
114
|
isVirtualDevice
|
|
114
|
-
} = devInfo.data;
|
|
115
|
+
} = devInfo === null || devInfo === void 0 ? void 0 : devInfo.data;
|
|
116
|
+
ipcTTTOperatorLog(`Utils: config info isVirtualDevice status: ${isVirtualDevice}`);
|
|
115
117
|
// 配置默认值
|
|
116
118
|
const defaultResolution = ClarityType.HD;
|
|
117
119
|
const supportedResolutions = [ClarityType.HD, ClarityType.SD];
|
|
@@ -138,6 +140,7 @@ export const getCameraConfigInfo = async deviceId => {
|
|
|
138
140
|
// native 缓存Key值
|
|
139
141
|
|
|
140
142
|
const nativeStorageInfo = await Promise.all([`${deviceId}_resolution`, `${deviceId}_intercom`, `${deviceId}_microphone`, `${deviceId}_maxZoomSettings`].map(key => getNativeStorage(key)));
|
|
143
|
+
ipcTTTOperatorLog(`Utils: nativeStorageInfo: ${nativeStorageInfo}`);
|
|
141
144
|
console.log(nativeStorageInfo, 'nativeStorageInfo');
|
|
142
145
|
const [resolutionStorage, intercomStorage, microphoneStorage, maxZoomSettingsStorage] = nativeStorageInfo;
|
|
143
146
|
// 任意缓存为空,则请求接口
|
|
@@ -149,6 +152,7 @@ export const getCameraConfigInfo = async deviceId => {
|
|
|
149
152
|
if (!isVirtualDevice) {
|
|
150
153
|
var _microphoneStorage$da, _intercomStorage$data, _resolutionStorage$da, _maxZoomSettingsStora;
|
|
151
154
|
const rtcInfo = await getIpcConfigInfo(deviceId);
|
|
155
|
+
ipcTTTOperatorLog(`Utils: rtcInfo: ${rtcInfo}`);
|
|
152
156
|
if (rtcInfo.code === 0) {
|
|
153
157
|
var _rtcApiResult$audioAt, _rtcApiResult$audioAt2, _rtcApiResult$audioAt3;
|
|
154
158
|
const rtcApiResult = rtcInfo.data;
|
|
@@ -156,6 +160,7 @@ export const getCameraConfigInfo = async deviceId => {
|
|
|
156
160
|
p2pType
|
|
157
161
|
} = rtcApiResult;
|
|
158
162
|
const p2p4 = p2pType >= 8;
|
|
163
|
+
ipcTTTOperatorLog(`Utils: p2p4: ${p2p4}`);
|
|
159
164
|
// 1. 拾音器模块
|
|
160
165
|
const isMicrophoneSupported = rtcApiResult === null || rtcApiResult === void 0 || (_rtcApiResult$audioAt = rtcApiResult.audioAttributes) === null || _rtcApiResult$audioAt === void 0 || (_rtcApiResult$audioAt = _rtcApiResult$audioAt.hardwareCapability) === null || _rtcApiResult$audioAt === void 0 ? void 0 : _rtcApiResult$audioAt.includes(1);
|
|
161
166
|
// 拾音器默认声音都为关闭, 若接口返回不支持,则将缓存值设置为关闭
|
|
@@ -242,10 +247,11 @@ export const getCameraConfigInfo = async deviceId => {
|
|
|
242
247
|
});
|
|
243
248
|
} catch (err) {
|
|
244
249
|
console.log(err, 'err');
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
250
|
+
ipcTTTOperatorLog(`UTILS: getCameraConfigInfo_error_info: ${JSON.stringify(err)}`);
|
|
251
|
+
// ty.showToast({
|
|
252
|
+
// title: Strings.getLang('ipc_utils_get_ipc_config_info_api_err'),
|
|
253
|
+
// icon: 'error',
|
|
254
|
+
// });
|
|
249
255
|
return Promise.resolve({
|
|
250
256
|
code: -1,
|
|
251
257
|
msg: err.errorMsg ? err.errorMsg : String(err)
|
|
@@ -283,21 +289,21 @@ export const updateCollectionPointsInfo = (deviceId, id, name) => {
|
|
|
283
289
|
if (_trim(name) === '') {
|
|
284
290
|
ty.showToast({
|
|
285
291
|
icon: 'error',
|
|
286
|
-
title: '
|
|
292
|
+
title: Strings.getLang('ipc_utils_collect_name_empty')
|
|
287
293
|
});
|
|
288
294
|
return Promise.resolve({
|
|
289
295
|
code: -1,
|
|
290
|
-
msg: '
|
|
296
|
+
msg: Strings.getLang('ipc_utils_collect_name_empty')
|
|
291
297
|
});
|
|
292
298
|
}
|
|
293
299
|
if (_trim(name).length > 10) {
|
|
294
300
|
ty.showToast({
|
|
295
301
|
icon: 'error',
|
|
296
|
-
title: '
|
|
302
|
+
title: Strings.getLang('ipc_utils_collect_name_limit_tip')
|
|
297
303
|
});
|
|
298
304
|
return Promise.resolve({
|
|
299
305
|
code: -1,
|
|
300
|
-
msg: '
|
|
306
|
+
msg: Strings.getLang('ipc_utils_collect_name_limit_tip')
|
|
301
307
|
});
|
|
302
308
|
}
|
|
303
309
|
return api(url, {
|
|
@@ -326,11 +332,11 @@ export const delCollectionPointsInfo = async (deviceId, pointData) => {
|
|
|
326
332
|
}
|
|
327
333
|
if (cruiseSwitchInfo.data) {
|
|
328
334
|
ty.showToast({
|
|
329
|
-
title: '
|
|
335
|
+
title: Strings.getLang('ipc_utils_cruise_ing_tip')
|
|
330
336
|
});
|
|
331
337
|
return {
|
|
332
338
|
code: -1,
|
|
333
|
-
msg: '
|
|
339
|
+
msg: Strings.getLang('ipc_utils_cruise_ing_tip')
|
|
334
340
|
};
|
|
335
341
|
}
|
|
336
342
|
// 2. 下发DP删除收藏点 dpCode: memory_point_set
|
|
@@ -375,11 +381,11 @@ export const addCollectionPointsInfo = async (deviceId, name) => {
|
|
|
375
381
|
if (pointsInfo.data.length >= 6) {
|
|
376
382
|
ty.showToast({
|
|
377
383
|
icon: 'error',
|
|
378
|
-
title: '
|
|
384
|
+
title: Strings.getLang('ipc_utils_collect_number_max_tip')
|
|
379
385
|
});
|
|
380
386
|
return {
|
|
381
387
|
code: -1,
|
|
382
|
-
msg: '
|
|
388
|
+
msg: Strings.getLang('ipc_utils_collect_number_max_tip')
|
|
383
389
|
};
|
|
384
390
|
}
|
|
385
391
|
const cruiseSwitchInfo = await getDpStateValue(deviceId, 'cruise_switch');
|
|
@@ -396,11 +402,11 @@ export const addCollectionPointsInfo = async (deviceId, name) => {
|
|
|
396
402
|
if (cruiseSwitchInfo.data) {
|
|
397
403
|
ty.showToast({
|
|
398
404
|
icon: 'error',
|
|
399
|
-
title: '
|
|
405
|
+
title: Strings.getLang('ipc_utils_cruise_ing_tip')
|
|
400
406
|
});
|
|
401
407
|
return {
|
|
402
408
|
code: -1,
|
|
403
|
-
msg: '
|
|
409
|
+
msg: Strings.getLang('ipc_utils_cruise_ing_tip')
|
|
404
410
|
};
|
|
405
411
|
}
|
|
406
412
|
// 2. 下发DP删除收藏点 dpCode: memory_point_set
|
|
@@ -418,21 +424,21 @@ export const addCollectionPointsInfo = async (deviceId, name) => {
|
|
|
418
424
|
if (_trim(name) === '') {
|
|
419
425
|
ty.showToast({
|
|
420
426
|
icon: 'error',
|
|
421
|
-
title: '
|
|
427
|
+
title: Strings.getLang('ipc_utils_collect_name_empty')
|
|
422
428
|
});
|
|
423
429
|
return {
|
|
424
430
|
code: -1,
|
|
425
|
-
msg: '
|
|
431
|
+
msg: Strings.getLang('ipc_utils_collect_name_empty')
|
|
426
432
|
};
|
|
427
433
|
}
|
|
428
434
|
if (_trim(name).length > 10) {
|
|
429
435
|
ty.showToast({
|
|
430
436
|
icon: 'error',
|
|
431
|
-
title: '
|
|
437
|
+
title: Strings.getLang('ipc_utils_collect_name_limit_tip')
|
|
432
438
|
});
|
|
433
439
|
return {
|
|
434
440
|
code: -1,
|
|
435
|
-
msg: '
|
|
441
|
+
msg: Strings.getLang('ipc_utils_collect_name_limit_tip')
|
|
436
442
|
};
|
|
437
443
|
}
|
|
438
444
|
const publishResult = await publishDps(deviceId, {
|
|
@@ -470,6 +476,7 @@ export const getServiceUrl = async function (deviceId, serveType) {
|
|
|
470
476
|
let action = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
471
477
|
let utm_rtid = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : getInitUtmTid();
|
|
472
478
|
try {
|
|
479
|
+
var _result$data, _result$data3;
|
|
473
480
|
const {
|
|
474
481
|
homeId
|
|
475
482
|
} = await ty.home.getCurrentHomeInfo();
|
|
@@ -511,13 +518,14 @@ export const getServiceUrl = async function (deviceId, serveType) {
|
|
|
511
518
|
if (!action) {
|
|
512
519
|
return result;
|
|
513
520
|
}
|
|
514
|
-
if ((result === null || result === void 0 ? void 0 :
|
|
521
|
+
if ((result === null || result === void 0 || (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.type) === 2) {
|
|
522
|
+
var _result$data2;
|
|
515
523
|
// 跳转小程序
|
|
516
|
-
const minResult = await goToMiniProgramByShortLink(result === null || result === void 0 ? void 0 :
|
|
524
|
+
const minResult = await goToMiniProgramByShortLink(result === null || result === void 0 || (_result$data2 = result.data) === null || _result$data2 === void 0 ? void 0 : _result$data2.url);
|
|
517
525
|
return minResult;
|
|
518
526
|
}
|
|
519
527
|
// 跳转H5
|
|
520
|
-
const webResult = await jumpToWebView(result === null || result === void 0 ? void 0 :
|
|
528
|
+
const webResult = await jumpToWebView(result === null || result === void 0 || (_result$data3 = result.data) === null || _result$data3 === void 0 ? void 0 : _result$data3.url);
|
|
521
529
|
return webResult;
|
|
522
530
|
} catch (err) {
|
|
523
531
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/ray-ipc-utils",
|
|
3
|
-
"version": "1.1.0-beta-
|
|
3
|
+
"version": "1.1.0-beta-15",
|
|
4
4
|
"description": "IPC 工具库",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"files": [
|
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
"@ray-js/ray": "^1.4.9"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"clsx": "^1.2.1"
|
|
38
|
+
"clsx": "^1.2.1",
|
|
39
|
+
"@ray-js/panel-sdk": "^1.13.1"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
42
|
"@commitlint/cli": "^7.2.1",
|
|
42
43
|
"@commitlint/config-conventional": "^9.0.1",
|
|
43
44
|
"@ray-js/cli": "^1.4.9",
|
|
44
|
-
"@ray-js/panel-sdk": "^1.13.0-storage.7",
|
|
45
45
|
"@ray-js/ray": "^1.4.9",
|
|
46
46
|
"@testing-library/react-hooks": "^8.0.1",
|
|
47
47
|
"@types/jest": "^29.5.14",
|