@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.
- package/lib/api/index.d.ts +3 -1
- package/lib/api/index.js +16 -0
- package/lib/api/notify.d.ts +28 -0
- package/lib/api/notify.js +17 -0
- package/lib/api/screen.d.ts +1 -0
- package/lib/api/service.d.ts +26 -0
- package/lib/api/service.js +25 -0
- package/lib/api/video.d.ts +9 -0
- package/lib/api/video.js +30 -0
- package/lib/api/voip.d.ts +10 -0
- package/lib/api/voip.js +17 -0
- package/lib/config/dp-code/index.d.ts +1 -0
- package/lib/config/dp-code/index.js +1 -0
- package/lib/config/dp-map/media.d.ts +13 -0
- package/lib/config/dp-map/media.js +19 -0
- package/lib/entries/fit/index.js +1 -1
- package/lib/entries/main/bootstrap/bootstrap.js +1 -0
- package/lib/entries/main/exports/ai.d.ts +4 -0
- package/lib/entries/main/exports/ai.js +11 -0
- package/lib/entries/main/exports/index.d.ts +4 -0
- package/lib/entries/main/exports/index.js +4 -0
- package/lib/entries/main/exports/media.d.ts +10 -1
- package/lib/entries/main/exports/media.js +29 -1
- package/lib/entries/main/exports/misc.d.ts +1 -1
- package/lib/entries/main/exports/notify.d.ts +7 -0
- package/lib/entries/main/exports/notify.js +8 -0
- package/lib/entries/main/exports/screen/bind.d.ts +6 -3
- package/lib/entries/main/exports/screen/bind.js +7 -0
- package/lib/entries/main/exports/service.d.ts +4 -0
- package/lib/entries/main/exports/service.js +11 -0
- package/lib/entries/main/exports/voip.d.ts +3 -0
- package/lib/entries/main/exports/voip.js +8 -0
- package/lib/entries/main/index.js +1 -1
- package/lib/entries/screen/exports/bind-events.d.ts +4 -0
- package/lib/entries/screen/exports/bind-events.js +8 -0
- package/lib/entries/screen/exports/index.d.ts +1 -0
- package/lib/entries/screen/exports/index.js +1 -0
- package/lib/feature/ai/report.d.ts +5 -0
- package/lib/feature/ai/report.js +37 -0
- package/lib/feature/media/camera.d.ts +18 -0
- package/lib/feature/media/camera.js +36 -0
- package/lib/feature/media/media.d.ts +10 -0
- package/lib/feature/media/media.js +31 -0
- package/lib/feature/misc/capability.js +63 -6
- package/lib/feature/misc/connect-device.js +2 -1
- package/lib/feature/notify/notify.d.ts +4 -0
- package/lib/feature/notify/notify.js +3 -0
- package/lib/feature/password/temporary/custom-dp.js +59 -54
- package/lib/feature/screen/bind-watch.d.ts +18 -0
- package/lib/feature/screen/bind-watch.js +92 -0
- package/lib/feature/screen/bind.d.ts +2 -2
- package/lib/feature/screen/bind.js +8 -38
- package/lib/feature/screen/list.js +13 -0
- package/lib/feature/service/goto-service.d.ts +3 -2
- package/lib/feature/service/goto-service.js +7 -1
- package/lib/feature/service/value-added.d.ts +4 -0
- package/lib/feature/service/value-added.js +4 -0
- package/lib/feature/state/device-status.js +2 -2
- package/lib/feature/state/init-state.js +26 -18
- package/lib/feature/state/remote-permissions.js +16 -0
- package/lib/feature/storage/index.d.ts +5 -0
- package/lib/feature/storage/index.js +32 -0
- package/lib/feature/unlock/sync/unlock-method.js +3 -0
- package/lib/feature/voip/voip.d.ts +3 -0
- package/lib/feature/voip/voip.js +3 -0
- package/lib/interface.d.ts +25 -1
- package/lib/platform/device.d.ts +5 -4
- package/lib/platform/device.js +1 -1
- package/lib/platform/index.d.ts +1 -0
- package/lib/platform/index.js +1 -0
- package/lib/platform/ipc.d.ts +3 -0
- package/lib/platform/ipc.js +23 -7
- package/lib/platform/storage.d.ts +3 -0
- package/lib/platform/storage.js +9 -0
- package/lib/runtime/lock-config.d.ts +3 -1
- package/lib/runtime/lock-config.js +2 -0
- package/lib/utils/errors.js +3 -1
- package/lib/utils/index.d.ts +35 -0
- package/lib/utils/index.js +11 -1
- package/lib/utils/parse.js +1 -1
- 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
|
-
|
|
80
|
-
const modeRes = await ipc.getCurrentSupportedTalkMode(devId);
|
|
81
|
+
if (isHarmony()) {
|
|
81
82
|
runtime.config.supportTalk = true;
|
|
82
|
-
runtime.config.isTwoWayTalk =
|
|
83
|
-
|
|
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
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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>;
|
package/lib/interface.d.ts
CHANGED
|
@@ -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
|
-
|
|
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 {};
|
package/lib/platform/device.d.ts
CHANGED
|
@@ -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
|
|
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.
|
|
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.
|
|
223
|
+
export declare const getLogManager: () => ty.LogManager;
|
|
223
224
|
export declare const getAppUserInfo: () => Promise<{
|
|
224
225
|
nickName: string;
|
|
225
226
|
avatarUrl: string;
|
package/lib/platform/device.js
CHANGED
|
@@ -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
|
|
101
|
+
export const getSystemInfoSync = () => ty.getSystemInfoSync();
|
|
102
102
|
export const showModal = (options) => {
|
|
103
103
|
return ty.showModal(options);
|
|
104
104
|
};
|
package/lib/platform/index.d.ts
CHANGED
package/lib/platform/index.js
CHANGED
package/lib/platform/ipc.d.ts
CHANGED
package/lib/platform/ipc.js
CHANGED
|
@@ -19,14 +19,29 @@ const connect = (deviceId) => {
|
|
|
19
19
|
});
|
|
20
20
|
};
|
|
21
21
|
const getCurrentSupportedTalkMode = (deviceId) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
};
|
|
@@ -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;
|
package/lib/utils/errors.js
CHANGED
|
@@ -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]) {
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -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;
|
package/lib/utils/index.js
CHANGED
|
@@ -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
|
+
};
|
package/lib/utils/parse.js
CHANGED
|
@@ -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.
|
|
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,
|