@ray-js/lock-sdk 1.2.0-beta.1 → 1.2.0-beta.11

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.
Files changed (81) hide show
  1. package/lib/api/index.d.ts +3 -1
  2. package/lib/api/index.js +16 -0
  3. package/lib/api/notify.d.ts +28 -0
  4. package/lib/api/notify.js +17 -0
  5. package/lib/api/screen.d.ts +1 -0
  6. package/lib/api/service.d.ts +26 -0
  7. package/lib/api/service.js +25 -0
  8. package/lib/api/video.d.ts +9 -0
  9. package/lib/api/video.js +30 -0
  10. package/lib/api/voip.d.ts +10 -0
  11. package/lib/api/voip.js +17 -0
  12. package/lib/config/dp-code/index.d.ts +1 -0
  13. package/lib/config/dp-code/index.js +1 -0
  14. package/lib/config/dp-map/media.d.ts +13 -0
  15. package/lib/config/dp-map/media.js +19 -0
  16. package/lib/entries/fit/index.js +1 -1
  17. package/lib/entries/main/bootstrap/bootstrap.js +1 -0
  18. package/lib/entries/main/exports/ai.d.ts +4 -0
  19. package/lib/entries/main/exports/ai.js +11 -0
  20. package/lib/entries/main/exports/index.d.ts +4 -0
  21. package/lib/entries/main/exports/index.js +4 -0
  22. package/lib/entries/main/exports/media.d.ts +10 -1
  23. package/lib/entries/main/exports/media.js +29 -1
  24. package/lib/entries/main/exports/misc.d.ts +1 -1
  25. package/lib/entries/main/exports/notify.d.ts +7 -0
  26. package/lib/entries/main/exports/notify.js +8 -0
  27. package/lib/entries/main/exports/screen/bind.d.ts +6 -3
  28. package/lib/entries/main/exports/screen/bind.js +7 -0
  29. package/lib/entries/main/exports/service.d.ts +4 -0
  30. package/lib/entries/main/exports/service.js +11 -0
  31. package/lib/entries/main/exports/voip.d.ts +3 -0
  32. package/lib/entries/main/exports/voip.js +8 -0
  33. package/lib/entries/main/index.js +1 -1
  34. package/lib/entries/screen/exports/bind-events.d.ts +4 -0
  35. package/lib/entries/screen/exports/bind-events.js +8 -0
  36. package/lib/entries/screen/exports/index.d.ts +1 -0
  37. package/lib/entries/screen/exports/index.js +1 -0
  38. package/lib/feature/ai/report.d.ts +5 -0
  39. package/lib/feature/ai/report.js +37 -0
  40. package/lib/feature/media/camera.d.ts +18 -0
  41. package/lib/feature/media/camera.js +36 -0
  42. package/lib/feature/media/media.d.ts +10 -0
  43. package/lib/feature/media/media.js +31 -0
  44. package/lib/feature/misc/capability.js +63 -6
  45. package/lib/feature/misc/connect-device.js +2 -1
  46. package/lib/feature/notify/notify.d.ts +4 -0
  47. package/lib/feature/notify/notify.js +3 -0
  48. package/lib/feature/password/temporary/custom-dp.js +59 -54
  49. package/lib/feature/screen/bind-watch.d.ts +18 -0
  50. package/lib/feature/screen/bind-watch.js +92 -0
  51. package/lib/feature/screen/bind.d.ts +2 -2
  52. package/lib/feature/screen/bind.js +8 -38
  53. package/lib/feature/screen/list.js +13 -0
  54. package/lib/feature/service/goto-service.d.ts +3 -2
  55. package/lib/feature/service/goto-service.js +7 -1
  56. package/lib/feature/service/value-added.d.ts +4 -0
  57. package/lib/feature/service/value-added.js +4 -0
  58. package/lib/feature/state/device-status.js +2 -2
  59. package/lib/feature/state/init-state.js +26 -18
  60. package/lib/feature/state/remote-permissions.js +16 -0
  61. package/lib/feature/storage/index.d.ts +5 -0
  62. package/lib/feature/storage/index.js +32 -0
  63. package/lib/feature/unlock/sync/unlock-method.js +3 -0
  64. package/lib/feature/voip/voip.d.ts +3 -0
  65. package/lib/feature/voip/voip.js +3 -0
  66. package/lib/interface.d.ts +25 -1
  67. package/lib/platform/device.d.ts +5 -4
  68. package/lib/platform/device.js +1 -1
  69. package/lib/platform/index.d.ts +1 -0
  70. package/lib/platform/index.js +1 -0
  71. package/lib/platform/ipc.d.ts +3 -0
  72. package/lib/platform/ipc.js +23 -7
  73. package/lib/platform/storage.d.ts +3 -0
  74. package/lib/platform/storage.js +9 -0
  75. package/lib/runtime/lock-config.d.ts +3 -1
  76. package/lib/runtime/lock-config.js +2 -0
  77. package/lib/utils/errors.js +3 -1
  78. package/lib/utils/index.d.ts +35 -0
  79. package/lib/utils/index.js +11 -1
  80. package/lib/utils/parse.js +1 -1
  81. package/package.json +1 -1
@@ -16,6 +16,7 @@ import { fetchDeviceProperties } from "./remote-permissions";
16
16
  import { ipc, yuChannelSyncSingleSync } from "../../platform";
17
17
  import { sdkLog } from "../../utils/sdk-log";
18
18
  import { RotateType } from "../../constant";
19
+ import { isHarmony } from "../../utils";
19
20
  export const initState = async (runtime) => {
20
21
  const { devInfo: { dps, devId, yuNetState }, dpSchema, } = runtime.config;
21
22
  const startedAt = Date.now();
@@ -38,9 +39,10 @@ export const initState = async (runtime) => {
38
39
  isSupportVideo,
39
40
  },
40
41
  });
41
- const [, , rotateInfo, deviceSkill, ipcConfig] = await Promise.allSettled([
42
+ const [, , , rotateInfo, deviceSkill, ipcConfig] = await Promise.allSettled([
42
43
  updateOnlineType(runtime),
43
44
  getCurrentUserForRuntime(runtime),
45
+ fetchDeviceProperties(runtime),
44
46
  isSupportVideo
45
47
  ? getDataWithPreFetchForRuntime(runtime, "getRotate", () => getRotateInfo(devId))
46
48
  : Promise.resolve({
@@ -76,24 +78,31 @@ export const initState = async (runtime) => {
76
78
  }
77
79
  if (ipcConfig.status === "fulfilled" &&
78
80
  ipcConfig.value?.audioAttributes?.hardwareCapability?.includes(2)) {
79
- try {
80
- const modeRes = await ipc.getCurrentSupportedTalkMode(devId);
81
+ if (isHarmony()) {
81
82
  runtime.config.supportTalk = true;
82
- runtime.config.isTwoWayTalk = modeRes.talkbackMode === 2;
83
- sdkLog("info", "initState", "supportTalk", {
84
- devId,
85
- duration: Date.now() - startedAt,
86
- data: {
87
- mode: modeRes.talkbackMode,
88
- },
89
- });
83
+ runtime.config.isTwoWayTalk =
84
+ ipcConfig.value?.audioAttributes?.callMode?.includes(2);
90
85
  }
91
- catch (e) {
92
- sdkLog("error", "initState", "supportTalk", {
93
- devId,
94
- duration: Date.now() - startedAt,
95
- data: {},
96
- });
86
+ else {
87
+ try {
88
+ runtime.config.supportTalk = true;
89
+ const modeRes = await ipc.getCurrentSupportedTalkMode(devId);
90
+ runtime.config.isTwoWayTalk = modeRes.talkbackMode === 2;
91
+ sdkLog("info", "initState", "supportTalk", {
92
+ devId,
93
+ duration: Date.now() - startedAt,
94
+ data: {
95
+ mode: modeRes.talkbackMode,
96
+ },
97
+ });
98
+ }
99
+ catch (e) {
100
+ sdkLog("error", "initState", "supportTalk", {
101
+ devId,
102
+ duration: Date.now() - startedAt,
103
+ error: e,
104
+ });
105
+ }
97
106
  }
98
107
  }
99
108
  if (!isSEI &&
@@ -103,7 +112,6 @@ export const initState = async (runtime) => {
103
112
  runtime.config.mediaHeight = temp;
104
113
  }
105
114
  }
106
- await fetchDeviceProperties(runtime);
107
115
  sdkLog("info", "initState", "ready", {
108
116
  devId,
109
117
  duration: Date.now() - startedAt,
@@ -10,10 +10,12 @@ var DeviceProperties;
10
10
  (function (DeviceProperties) {
11
11
  DeviceProperties["REMOTE_UNLOCK_AUTH"] = "REMOTE_UNLOCK_AUTH";
12
12
  DeviceProperties["UNLOCK_PHONE_REMOTE"] = "UNLOCK_PHONE_REMOTE";
13
+ DeviceProperties["LOCK_POS_ROT_ANGLE"] = "LOCK_POS_ROT_ANGLE";
13
14
  })(DeviceProperties || (DeviceProperties = {}));
14
15
  const propsList = [
15
16
  DeviceProperties.REMOTE_UNLOCK_AUTH,
16
17
  DeviceProperties.UNLOCK_PHONE_REMOTE,
18
+ DeviceProperties.LOCK_POS_ROT_ANGLE,
17
19
  ];
18
20
  export async function fetchDeviceProperties(runtime, isForce) {
19
21
  let result = null;
@@ -27,4 +29,18 @@ export async function fetchDeviceProperties(runtime, isForce) {
27
29
  result[DeviceProperties.UNLOCK_PHONE_REMOTE] === "true";
28
30
  runtime.config.remoteOpenPermission =
29
31
  permissions[+result[DeviceProperties.REMOTE_UNLOCK_AUTH] || 0];
32
+ if (result[DeviceProperties.LOCK_POS_ROT_ANGLE]) {
33
+ try {
34
+ const data = JSON.parse(result[DeviceProperties.LOCK_POS_ROT_ANGLE]);
35
+ runtime.config.cameraConfig = data.map((item) => ({
36
+ isVR: !!item.vr,
37
+ width: item.w,
38
+ height: item.h,
39
+ rotate: item.al,
40
+ localtion: item.p,
41
+ }));
42
+ }
43
+ catch (e) {
44
+ }
45
+ }
30
46
  }
@@ -0,0 +1,5 @@
1
+ import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
2
+ export declare const setStorageForRuntime: (rt: LockDeviceRuntime, key: string, data: unknown) => void;
3
+ export declare const getStorageForRuntime: <T = unknown>(rt: LockDeviceRuntime, key: string) => T | null;
4
+ export declare const removeStorageForRuntime: (rt: LockDeviceRuntime, key: string) => void;
5
+ export declare const clearStorageForRuntime: (rt: LockDeviceRuntime, keys: string[]) => void;
@@ -0,0 +1,32 @@
1
+ import { getStorageSync, removeStorageSync, setStorageSync, } from "../../platform";
2
+ const buildStorageKey = (rt, key) => {
3
+ const { devId, activeTime } = rt.config.devInfo;
4
+ return `${devId}_${activeTime}_${key}`;
5
+ };
6
+ export const setStorageForRuntime = (rt, key, data) => {
7
+ const value = typeof data === "string" ? data : JSON.stringify(data);
8
+ setStorageSync(buildStorageKey(rt, key), value);
9
+ };
10
+ export const getStorageForRuntime = (rt, key) => {
11
+ const raw = getStorageSync(buildStorageKey(rt, key));
12
+ if (raw == null || raw === "") {
13
+ return null;
14
+ }
15
+ if (typeof raw === "string") {
16
+ try {
17
+ return JSON.parse(raw);
18
+ }
19
+ catch {
20
+ return raw;
21
+ }
22
+ }
23
+ return raw;
24
+ };
25
+ export const removeStorageForRuntime = (rt, key) => {
26
+ removeStorageSync(buildStorageKey(rt, key));
27
+ };
28
+ export const clearStorageForRuntime = (rt, keys) => {
29
+ keys.forEach((key) => {
30
+ removeStorageSync(buildStorageKey(rt, key));
31
+ });
32
+ };
@@ -19,6 +19,9 @@ export const syncUnlockMethodWithRuntime = async (runtime) => {
19
19
  });
20
20
  rt.sync.unlockMethodAutoSyncEnabled = false;
21
21
  const { allOpenDps = "" } = await getCurrentUserForRuntime(rt);
22
+ if (!allOpenDps) {
23
+ return;
24
+ }
22
25
  const { ins = "", distributed = false } = await fetchSyncUnlockMethodInfo({
23
26
  devId: rt.config.devInfo.devId,
24
27
  dpIds: allOpenDps.split(","),
@@ -0,0 +1,3 @@
1
+ import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
2
+ export declare const getVoipAuthForRuntime: (rt: LockDeviceRuntime) => Promise<import("../../api/voip").VoipAuth>;
3
+ export declare const saveVoipAuthForRuntime: (rt: LockDeviceRuntime, userId: string) => Promise<boolean>;
@@ -0,0 +1,3 @@
1
+ import { getVoipAuthApi, saveVoipAuthApi } from "../../api/voip";
2
+ export const getVoipAuthForRuntime = (rt) => getVoipAuthApi(rt.config.devInfo.devId);
3
+ export const saveVoipAuthForRuntime = (rt, userId) => saveVoipAuthApi(rt.config.devInfo.devId, userId);
@@ -12,6 +12,7 @@ export interface LockSDKOption {
12
12
  supportMultipleFace?: boolean;
13
13
  supportOfflineDps?: boolean;
14
14
  preFetch?: boolean;
15
+ notSupportWake?: boolean;
15
16
  logLevel?: SDKLogLevel;
16
17
  logger?: SDKLogSink;
17
18
  logToConsole?: boolean;
@@ -334,10 +335,20 @@ export interface AlbumMessage extends MediaInfo {
334
335
  type: number;
335
336
  createTime: number;
336
337
  }
338
+ export type VRModeType = "original" | "VR" | "horizontal" | "vertical";
337
339
  export interface DeviceAdvancedAbility {
338
340
  cloudStorage: {
339
341
  support: boolean;
340
342
  };
343
+ vr: {
344
+ support: boolean;
345
+ coverMode: VRModeType;
346
+ modes: Array<{
347
+ mode: VRModeType;
348
+ value: number;
349
+ }>;
350
+ defaultMode: VRModeType;
351
+ };
341
352
  ai: {
342
353
  support: boolean;
343
354
  config: Record<string, any>;
@@ -348,7 +359,9 @@ export interface DeviceAdvancedAbility {
348
359
  };
349
360
  wechatVoip: {
350
361
  support: boolean;
351
- config: Record<string, any>;
362
+ isPublice: boolean;
363
+ appId?: string;
364
+ modeId?: string;
352
365
  };
353
366
  voip: {
354
367
  support: boolean;
@@ -386,4 +399,15 @@ export interface SharedUserInfo {
386
399
  lockUserId: number;
387
400
  userExist: boolean;
388
401
  }
402
+ export interface AIReportPopup {
403
+ reportId: string;
404
+ yearMonth: number;
405
+ }
406
+ export interface CameraConfig {
407
+ isVR: boolean;
408
+ width: number;
409
+ height: number;
410
+ rotate: number;
411
+ localtion: number;
412
+ }
389
413
  export {};
@@ -23,7 +23,7 @@ export declare const onOnlineChange: (func: ParamType<typeof ty.device.onDeviceO
23
23
  export declare const offOnlineChange: (func: ParamType<typeof ty.device.offDeviceOnlineStatusUpdate>) => void;
24
24
  export declare const onBleChange: (func: ParamType<typeof ty.device.onBLEConnectStatusChange>) => void;
25
25
  export declare const offBleChange: (func: ParamType<typeof ty.device.offBLEConnectStatusChange>) => void;
26
- export declare const getSystemInfo: () => {
26
+ export declare const getSystemInfoSync: () => {
27
27
  is24Hour: boolean;
28
28
  system: string;
29
29
  brand: string;
@@ -52,7 +52,7 @@ export declare const getSystemInfo: () => {
52
52
  locationEnabled: boolean;
53
53
  wifiEnabled: boolean;
54
54
  theme?: ty.Themes;
55
- deviceOrientation?: ty.Orientation;
55
+ deviceOrientation?: ty.PhoneOrientation;
56
56
  deviceLevel: string;
57
57
  isSupportPinShortcut?: boolean;
58
58
  deviceType?: string;
@@ -74,9 +74,10 @@ export declare const requestCloud: <T>(options: {
74
74
  export declare const getLaunchOptionsSync: () => {
75
75
  path: string;
76
76
  scene?: ty.MiniAppScene;
77
- query: any;
77
+ query: Record<string, any>;
78
78
  referrerInfo: ty.ReferrerInfo;
79
79
  apiCategory?: string;
80
+ extraQuery?: Record<string, any>;
80
81
  };
81
82
  export declare function encrypt(deviceId: string, plaintext: string): Promise<string>;
82
83
  export declare function decrypt(deviceId: string, plaintext: string): Promise<string>;
@@ -219,7 +220,7 @@ export declare const onResetMemberName: (cb: HomeMemberListener) => void;
219
220
  export declare const offResetMemberName: (cb: HomeMemberListener) => void;
220
221
  export declare const onResetMemberRole: (cb: HomeMemberListener) => void;
221
222
  export declare const offResetMemberRole: (cb: HomeMemberListener) => void;
222
- export declare const getLogManager: () => ty.GetLogManagerTask;
223
+ export declare const getLogManager: () => ty.LogManager;
223
224
  export declare const getAppUserInfo: () => Promise<{
224
225
  nickName: string;
225
226
  avatarUrl: string;
@@ -98,7 +98,7 @@ export const onBleChange = (func) => {
98
98
  export const offBleChange = (func) => {
99
99
  ty.device.offBLEConnectStatusChange(func);
100
100
  };
101
- export const getSystemInfo = () => ty.getSystemInfoSync();
101
+ export const getSystemInfoSync = () => ty.getSystemInfoSync();
102
102
  export const showModal = (options) => {
103
103
  return ty.showModal(options);
104
104
  };
@@ -1,2 +1,3 @@
1
1
  export * from "./device";
2
+ export * from "./storage";
2
3
  export { default as ipc } from "./ipc";
@@ -1,2 +1,3 @@
1
1
  export * from "./device";
2
+ export * from "./storage";
2
3
  export { default as ipc } from "./ipc";
@@ -10,5 +10,8 @@ declare const _default: {
10
10
  getCurrentSupportedTalkMode: (deviceId: string) => Promise<{
11
11
  talkbackMode: number;
12
12
  }>;
13
+ getTTTAbilityKeyList: (key: string) => Promise<{
14
+ abilityList: string[];
15
+ }>;
13
16
  };
14
17
  export default _default;
@@ -19,14 +19,29 @@ const connect = (deviceId) => {
19
19
  });
20
20
  };
21
21
  const getCurrentSupportedTalkMode = (deviceId) => {
22
- return new Promise((resolve, reject) => {
23
- ty.ipc.getCurrentSupportedTalkMode({
24
- deviceId,
25
- extendParam: {},
26
- success: resolve,
27
- fail: reject,
22
+ if (ty.ipc.getCurrentSupportedTalkMode) {
23
+ return new Promise((resolve, reject) => {
24
+ ty.ipc.getCurrentSupportedTalkMode({
25
+ deviceId,
26
+ extendParam: {},
27
+ success: resolve,
28
+ fail: reject,
29
+ });
28
30
  });
29
- });
31
+ }
32
+ return Promise.reject(new Error("not support"));
33
+ };
34
+ const getTTTAbilityKeyList = (key) => {
35
+ if (ty.ipc.getTTTAbilityKeyList) {
36
+ return new Promise((resolve, reject) => {
37
+ ty.ipc.getTTTAbilityKeyList({
38
+ key,
39
+ success: resolve,
40
+ fail: reject,
41
+ });
42
+ });
43
+ }
44
+ return Promise.resolve({ abilityList: [] });
30
45
  };
31
46
  export default {
32
47
  wakeUpDoorBell,
@@ -34,4 +49,5 @@ export default {
34
49
  isConnecting,
35
50
  connect,
36
51
  getCurrentSupportedTalkMode,
52
+ getTTTAbilityKeyList,
37
53
  };
@@ -0,0 +1,3 @@
1
+ export declare const setStorageSync: (key: string, data: string) => void;
2
+ export declare const getStorageSync: (key: string) => any;
3
+ export declare const removeStorageSync: (key: string) => void;
@@ -0,0 +1,9 @@
1
+ export const setStorageSync = (key, data) => {
2
+ ty.setStorageSync({ key, data });
3
+ };
4
+ export const getStorageSync = (key) => {
5
+ return ty.getStorageSync({ key });
6
+ };
7
+ export const removeStorageSync = (key) => {
8
+ ty.removeStorageSync({ key });
9
+ };
@@ -1,5 +1,5 @@
1
1
  import { ProductCommunicationType, RemotePermissionType } from "../constant";
2
- import { CapabilityInfo, DeviceInfo, DeviceStatus, DpSchema } from "../interface";
2
+ import { CameraConfig, CapabilityInfo, DeviceInfo, DeviceStatus, DpSchema } from "../interface";
3
3
  export type LockConfigState = {
4
4
  devInfo: DeviceInfo;
5
5
  dpSchema: Record<string, DpSchema>;
@@ -23,6 +23,8 @@ export type LockConfigState = {
23
23
  preFetch: boolean;
24
24
  supportTalk: boolean;
25
25
  isTwoWayTalk: boolean;
26
+ cameraConfig: CameraConfig[];
27
+ notSupportWake: boolean;
26
28
  };
27
29
  export declare function createDefaultDeviceStatus(): DeviceStatus;
28
30
  export declare function createLockConfigState(): LockConfigState;
@@ -33,5 +33,7 @@ export function createLockConfigState() {
33
33
  preFetch: false,
34
34
  supportTalk: false,
35
35
  isTwoWayTalk: false,
36
+ cameraConfig: [],
37
+ notSupportWake: false
36
38
  };
37
39
  }
@@ -102,7 +102,9 @@ const errors = {
102
102
  1100: "Binding limit reached",
103
103
  1101: "The lock has already been bound, please do not bind it again",
104
104
  1102: "Lock is binding",
105
- 1103: "Binding failed"
105
+ 1103: "Binding failed",
106
+ 1104: "Failed to switch cameras",
107
+ 1105: "Camera switching is not supported",
106
108
  };
107
109
  export const getError = (code, ...places) => {
108
110
  if (errors[code]) {
@@ -3,6 +3,40 @@ import type { EffectiveConfig, Week } from "../interface";
3
3
  import { LoopTypes } from "./constant";
4
4
  export declare const get24Time: (time: number) => number[];
5
5
  export declare const getNowTime: () => number;
6
+ export declare const getSystemInfo: () => {
7
+ is24Hour: boolean;
8
+ system: string;
9
+ brand: string;
10
+ model: string;
11
+ platform: string;
12
+ timezoneId: string;
13
+ pixelRatio: number;
14
+ screenWidth: number;
15
+ screenHeight: number;
16
+ windowWidth: number;
17
+ windowHeight: number;
18
+ useableWindowWidth: number;
19
+ useableWindowHeight: number;
20
+ statusBarHeight: number;
21
+ language: string;
22
+ safeArea: ty.SafeArea;
23
+ albumAuthorized: boolean;
24
+ cameraAuthorized: boolean;
25
+ locationAuthorized: boolean;
26
+ microphoneAuthorized: boolean;
27
+ notificationAuthorized: boolean;
28
+ notificationAlertAuthorized: boolean;
29
+ notificationBadgeAuthorized: boolean;
30
+ notificationSoundAuthorized: boolean;
31
+ bluetoothEnabled: boolean;
32
+ locationEnabled: boolean;
33
+ wifiEnabled: boolean;
34
+ theme?: ty.Themes;
35
+ deviceOrientation?: ty.PhoneOrientation;
36
+ deviceLevel: string;
37
+ isSupportPinShortcut?: boolean;
38
+ deviceType?: string;
39
+ };
6
40
  export declare const isOnlineByType: (onlineType: number, type: number) => boolean;
7
41
  export declare function isCapability(capability: number, id: number): boolean;
8
42
  export declare function getCapabilities(capability: number): ({
@@ -134,3 +168,4 @@ export declare const getAppUser: () => {
134
168
  phoneCode: string;
135
169
  isTemporaryUser: boolean;
136
170
  } | null;
171
+ export declare const isHarmony: () => boolean;
@@ -1,5 +1,5 @@
1
1
  import { LoopTypes } from "./constant";
2
- import { getAppUserInfo, getCurrentHomeInfo } from "../platform/device";
2
+ import { getAppUserInfo, getCurrentHomeInfo, getSystemInfoSync, } from "../platform/device";
3
3
  import { getError } from "./errors";
4
4
  export const get24Time = (time) => {
5
5
  const hours = Math.floor(time / 60);
@@ -10,6 +10,13 @@ export const getNowTime = () => {
10
10
  const now = new Date();
11
11
  return now.getHours() * 3600 + now.getMinutes() * 60 + now.getSeconds();
12
12
  };
13
+ let system;
14
+ export const getSystemInfo = () => {
15
+ if (!system) {
16
+ system = getSystemInfoSync();
17
+ }
18
+ return system;
19
+ };
13
20
  export const isOnlineByType = (onlineType, type) => {
14
21
  const base = 2 ** type;
15
22
  return (onlineType & base) >> type === 1;
@@ -210,3 +217,6 @@ const getAppUserAsync = async () => {
210
217
  getAppUserAsync().catch(() => {
211
218
  getAppUserAsync().catch(() => undefined);
212
219
  });
220
+ export const isHarmony = () => {
221
+ return getSystemInfo().platform === "harmony";
222
+ };
@@ -6,7 +6,7 @@ export const parseCapabilities = (dpValue) => {
6
6
  return null;
7
7
  }
8
8
  const data = dpUtils.parse(dpValue, capabilitiesMap);
9
- if (data.tyep === ModuleType.M7258) {
9
+ if (data.type === ModuleType.M7258) {
10
10
  return {
11
11
  ...data,
12
12
  rotateType: data.rotateType === 1 ? 0 : data.rotateType === 0 ? 1 : data.rotateType,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/lock-sdk",
3
- "version": "1.2.0-beta.1",
3
+ "version": "1.2.0-beta.11",
4
4
  "files": [
5
5
  "lib",
6
6
  "LICENSE.md"