@ray-js/lock-sdk 1.2.0-beta.2 → 1.2.0-beta.21
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/gesture.d.ts +11 -0
- package/lib/api/gesture.js +18 -0
- package/lib/api/log.d.ts +21 -4
- package/lib/api/notify.d.ts +28 -0
- package/lib/api/notify.js +17 -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/bootstrap/bootstrap-lock-instance.js +16 -5
- package/lib/entries/fit/index.js +1 -1
- package/lib/entries/main/bootstrap/bootstrap-lock-instance.js +16 -5
- package/lib/entries/main/bootstrap/bootstrap.js +2 -0
- package/lib/entries/main/exports/capability.d.ts +2 -0
- package/lib/entries/main/exports/capability.js +7 -1
- package/lib/entries/main/exports/gesture.d.ts +6 -0
- package/lib/entries/main/exports/gesture.js +8 -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/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/feature/gesture/gesture.d.ts +6 -0
- package/lib/feature/gesture/gesture.js +3 -0
- package/lib/feature/log/log.js +34 -2
- 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/ble-control.js +1 -1
- package/lib/feature/misc/capability.d.ts +2 -0
- package/lib/feature/misc/capability.js +77 -10
- 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/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 +17 -11
- package/lib/feature/state/platform-routing.js +8 -2
- package/lib/feature/state/remote-permissions.js +17 -0
- package/lib/feature/storage/index.d.ts +5 -0
- package/lib/feature/storage/index.js +32 -0
- package/lib/feature/storage/swr-cache.d.ts +7 -0
- package/lib/feature/storage/swr-cache.js +54 -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 +27 -1
- package/lib/platform/device.d.ts +4 -3
- 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 +13 -0
- package/lib/platform/storage.d.ts +3 -0
- package/lib/platform/storage.js +9 -0
- package/lib/runtime/lock-config.d.ts +4 -1
- package/lib/runtime/lock-config.js +3 -0
- package/lib/utils/constant.d.ts +1 -0
- package/lib/utils/constant.js +6 -0
- package/lib/utils/errors.js +3 -1
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/parse.js +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import dpCodes from "../../config/dp-code";
|
|
2
2
|
import { getDeviceSkill, getIPCConfig, getRotateInfo } from "../../api/video";
|
|
3
3
|
import { getDataWithPreFetchForRuntime } from "../utils";
|
|
4
|
-
import {
|
|
4
|
+
import { getWithLocalCache } from "../storage/swr-cache";
|
|
5
|
+
import { getDeviceAdvancedAbilitiesForRuntime, } from "../misc/capability";
|
|
5
6
|
import { getCurrentUserForRuntime } from "../user/current-user";
|
|
6
7
|
import { checkOfflineDpUpdateForRuntime } from "../offline-dps";
|
|
7
8
|
import { autoSyncTemp } from "../password/sync-temp";
|
|
@@ -16,7 +17,7 @@ import { fetchDeviceProperties } from "./remote-permissions";
|
|
|
16
17
|
import { ipc, yuChannelSyncSingleSync } from "../../platform";
|
|
17
18
|
import { sdkLog } from "../../utils/sdk-log";
|
|
18
19
|
import { RotateType } from "../../constant";
|
|
19
|
-
import { isHarmony } from "
|
|
20
|
+
import { isHarmony } from "../../utils";
|
|
20
21
|
export const initState = async (runtime) => {
|
|
21
22
|
const { devInfo: { dps, devId, yuNetState }, dpSchema, } = runtime.config;
|
|
22
23
|
const startedAt = Date.now();
|
|
@@ -39,23 +40,28 @@ export const initState = async (runtime) => {
|
|
|
39
40
|
isSupportVideo,
|
|
40
41
|
},
|
|
41
42
|
});
|
|
42
|
-
const [, , rotateInfo, deviceSkill, ipcConfig] = await Promise.allSettled([
|
|
43
|
+
const [, , , advanceAbilities, rotateInfo, deviceSkill, ipcConfig] = await Promise.allSettled([
|
|
43
44
|
updateOnlineType(runtime),
|
|
44
45
|
getCurrentUserForRuntime(runtime),
|
|
46
|
+
fetchDeviceProperties(runtime),
|
|
47
|
+
getDeviceAdvancedAbilitiesForRuntime(runtime),
|
|
45
48
|
isSupportVideo
|
|
46
|
-
?
|
|
49
|
+
?
|
|
50
|
+
getDataWithPreFetchForRuntime(runtime, "getRotate", () => getWithLocalCache(runtime, "rotateInfo", () => getRotateInfo(devId), {
|
|
51
|
+
version: 1,
|
|
52
|
+
}))
|
|
47
53
|
: Promise.resolve({
|
|
48
54
|
angle: 0,
|
|
49
55
|
actualAngle: 0,
|
|
50
56
|
}),
|
|
51
57
|
isSupportVideo
|
|
52
|
-
? getDeviceSkill(devId)
|
|
58
|
+
? getWithLocalCache(runtime, "deviceSkill", () => getDeviceSkill(devId))
|
|
53
59
|
: Promise.resolve({
|
|
54
60
|
devId,
|
|
55
61
|
json: { videos: [{ width: 0, height: 0 }] },
|
|
56
62
|
}),
|
|
57
63
|
isSupportVideo
|
|
58
|
-
? getIPCConfig(devId)
|
|
64
|
+
? getWithLocalCache(runtime, "ipcConfig", () => getIPCConfig(devId))
|
|
59
65
|
: Promise.resolve({
|
|
60
66
|
audioAttributes: {
|
|
61
67
|
hardwareCapability: [],
|
|
@@ -84,8 +90,8 @@ export const initState = async (runtime) => {
|
|
|
84
90
|
}
|
|
85
91
|
else {
|
|
86
92
|
try {
|
|
87
|
-
const modeRes = await ipc.getCurrentSupportedTalkMode(devId);
|
|
88
93
|
runtime.config.supportTalk = true;
|
|
94
|
+
const modeRes = await ipc.getCurrentSupportedTalkMode(devId);
|
|
89
95
|
runtime.config.isTwoWayTalk = modeRes.talkbackMode === 2;
|
|
90
96
|
sdkLog("info", "initState", "supportTalk", {
|
|
91
97
|
devId,
|
|
@@ -99,7 +105,7 @@ export const initState = async (runtime) => {
|
|
|
99
105
|
sdkLog("error", "initState", "supportTalk", {
|
|
100
106
|
devId,
|
|
101
107
|
duration: Date.now() - startedAt,
|
|
102
|
-
|
|
108
|
+
error: e,
|
|
103
109
|
});
|
|
104
110
|
}
|
|
105
111
|
}
|
|
@@ -111,7 +117,6 @@ export const initState = async (runtime) => {
|
|
|
111
117
|
runtime.config.mediaHeight = temp;
|
|
112
118
|
}
|
|
113
119
|
}
|
|
114
|
-
await fetchDeviceProperties(runtime);
|
|
115
120
|
sdkLog("info", "initState", "ready", {
|
|
116
121
|
devId,
|
|
117
122
|
duration: Date.now() - startedAt,
|
|
@@ -121,7 +126,8 @@ export const initState = async (runtime) => {
|
|
|
121
126
|
videoAngle: runtime.config.videoAngle,
|
|
122
127
|
},
|
|
123
128
|
});
|
|
124
|
-
|
|
129
|
+
if (advanceAbilities.status === "fulfilled") {
|
|
130
|
+
const abilities = advanceAbilities.value;
|
|
125
131
|
sdkLog("debug", "initState", "advancedAbilitiesFetched", {
|
|
126
132
|
devId,
|
|
127
133
|
data: {
|
|
@@ -145,7 +151,7 @@ export const initState = async (runtime) => {
|
|
|
145
151
|
yuChannelSyncSingleSync(devId);
|
|
146
152
|
}
|
|
147
153
|
}
|
|
148
|
-
}
|
|
154
|
+
}
|
|
149
155
|
syncRemoteSerectKey(runtime);
|
|
150
156
|
checkOfflineDpUpdateForRuntime(runtime, {}, true).then(() => {
|
|
151
157
|
sdkLog("debug", "initState", "offlineDpCheckDone", { devId });
|
|
@@ -90,8 +90,14 @@ const globalHandleBleChange = ({ deviceId, status }) => {
|
|
|
90
90
|
devId: deviceId,
|
|
91
91
|
data: { status, registered: !!rt },
|
|
92
92
|
});
|
|
93
|
-
if (
|
|
94
|
-
|
|
93
|
+
if (rt) {
|
|
94
|
+
updateOnlineType(rt);
|
|
95
|
+
if (status === "CONNECTED") {
|
|
96
|
+
void syncRemoteSerectKey(rt);
|
|
97
|
+
autoSyncTemp(rt);
|
|
98
|
+
void syncT0(rt);
|
|
99
|
+
void syncOfflineDps(rt);
|
|
100
|
+
}
|
|
95
101
|
}
|
|
96
102
|
};
|
|
97
103
|
const globalHandleAppShow = () => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getDeviceProperties } from "../../api/setting";
|
|
2
2
|
import { getDataWithPreFetchForRuntime } from "../utils";
|
|
3
3
|
import { RemotePermissionType } from "../../constant";
|
|
4
|
+
import { cameraPositionMap } from "../../utils/constant";
|
|
4
5
|
export const permissions = [
|
|
5
6
|
RemotePermissionType.ADMINS_ONLY,
|
|
6
7
|
RemotePermissionType.EVERY_ONE,
|
|
@@ -10,10 +11,12 @@ var DeviceProperties;
|
|
|
10
11
|
(function (DeviceProperties) {
|
|
11
12
|
DeviceProperties["REMOTE_UNLOCK_AUTH"] = "REMOTE_UNLOCK_AUTH";
|
|
12
13
|
DeviceProperties["UNLOCK_PHONE_REMOTE"] = "UNLOCK_PHONE_REMOTE";
|
|
14
|
+
DeviceProperties["LOCK_POS_ROT_ANGLE"] = "LOCK_POS_ROT_ANGLE";
|
|
13
15
|
})(DeviceProperties || (DeviceProperties = {}));
|
|
14
16
|
const propsList = [
|
|
15
17
|
DeviceProperties.REMOTE_UNLOCK_AUTH,
|
|
16
18
|
DeviceProperties.UNLOCK_PHONE_REMOTE,
|
|
19
|
+
DeviceProperties.LOCK_POS_ROT_ANGLE,
|
|
17
20
|
];
|
|
18
21
|
export async function fetchDeviceProperties(runtime, isForce) {
|
|
19
22
|
let result = null;
|
|
@@ -27,4 +30,18 @@ export async function fetchDeviceProperties(runtime, isForce) {
|
|
|
27
30
|
result[DeviceProperties.UNLOCK_PHONE_REMOTE] === "true";
|
|
28
31
|
runtime.config.remoteOpenPermission =
|
|
29
32
|
permissions[+result[DeviceProperties.REMOTE_UNLOCK_AUTH] || 0];
|
|
33
|
+
if (result[DeviceProperties.LOCK_POS_ROT_ANGLE]) {
|
|
34
|
+
try {
|
|
35
|
+
const data = JSON.parse(result[DeviceProperties.LOCK_POS_ROT_ANGLE]);
|
|
36
|
+
runtime.config.cameraConfig = data.map((item) => ({
|
|
37
|
+
isVR: !!item.vr,
|
|
38
|
+
width: item.w,
|
|
39
|
+
height: item.h,
|
|
40
|
+
rotate: item.al,
|
|
41
|
+
location: cameraPositionMap[item.p],
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
catch (e) {
|
|
45
|
+
}
|
|
46
|
+
}
|
|
30
47
|
}
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
|
|
2
|
+
export interface SwrOptions<T> {
|
|
3
|
+
version?: number;
|
|
4
|
+
maxAge?: number;
|
|
5
|
+
applyToSession?: (rt: LockDeviceRuntime, fresh: T) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function getWithLocalCache<T>(rt: LockDeviceRuntime, key: string, fetcher: () => Promise<T>, options?: SwrOptions<T>): Promise<T>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { getRuntimeByDevId } from "../../runtime/registry";
|
|
2
|
+
import { sdkLog } from "../../utils/sdk-log";
|
|
3
|
+
import { getStorageForRuntime, setStorageForRuntime } from "./index";
|
|
4
|
+
const CACHE_KEY_PREFIX = "swr_";
|
|
5
|
+
const buildKey = (key) => `${CACHE_KEY_PREFIX}${key}`;
|
|
6
|
+
function readValidCache(rt, storageKey, version, maxAge) {
|
|
7
|
+
const envelope = getStorageForRuntime(rt, storageKey);
|
|
8
|
+
if (!envelope ||
|
|
9
|
+
typeof envelope !== "object" ||
|
|
10
|
+
envelope.v !== version ||
|
|
11
|
+
!("data" in envelope)) {
|
|
12
|
+
return { hit: false };
|
|
13
|
+
}
|
|
14
|
+
if (typeof maxAge === "number" && maxAge >= 0 && Date.now() - envelope.t > maxAge) {
|
|
15
|
+
return { hit: false };
|
|
16
|
+
}
|
|
17
|
+
return { hit: true, data: envelope.data };
|
|
18
|
+
}
|
|
19
|
+
export async function getWithLocalCache(rt, key, fetcher, options) {
|
|
20
|
+
if (!rt.config.localCache) {
|
|
21
|
+
return fetcher();
|
|
22
|
+
}
|
|
23
|
+
const version = options?.version ?? 1;
|
|
24
|
+
const storageKey = buildKey(key);
|
|
25
|
+
const devId = rt.devId;
|
|
26
|
+
const writeCache = (data) => {
|
|
27
|
+
if (getRuntimeByDevId(devId) !== rt) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const envelope = { v: version, t: Date.now(), data };
|
|
31
|
+
setStorageForRuntime(rt, storageKey, envelope);
|
|
32
|
+
};
|
|
33
|
+
const cached = readValidCache(rt, storageKey, version, options?.maxAge);
|
|
34
|
+
if (cached.hit) {
|
|
35
|
+
void (async () => {
|
|
36
|
+
try {
|
|
37
|
+
const fresh = await fetcher();
|
|
38
|
+
writeCache(fresh);
|
|
39
|
+
options?.applyToSession?.(rt, fresh);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
sdkLog("warn", "swrCache", "revalidateFailed", {
|
|
43
|
+
devId,
|
|
44
|
+
data: { key },
|
|
45
|
+
error,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
})();
|
|
49
|
+
return cached.data;
|
|
50
|
+
}
|
|
51
|
+
const fresh = await fetcher();
|
|
52
|
+
writeCache(fresh);
|
|
53
|
+
return fresh;
|
|
54
|
+
}
|
|
@@ -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,8 @@ export interface LockSDKOption {
|
|
|
12
12
|
supportMultipleFace?: boolean;
|
|
13
13
|
supportOfflineDps?: boolean;
|
|
14
14
|
preFetch?: boolean;
|
|
15
|
+
localCache?: boolean;
|
|
16
|
+
notSupportWake?: boolean;
|
|
15
17
|
logLevel?: SDKLogLevel;
|
|
16
18
|
logger?: SDKLogSink;
|
|
17
19
|
logToConsole?: boolean;
|
|
@@ -254,6 +256,11 @@ export interface MediaInfo {
|
|
|
254
256
|
fileUrl: string;
|
|
255
257
|
mediaBucket: string;
|
|
256
258
|
mediaKey: string;
|
|
259
|
+
width: number;
|
|
260
|
+
height: number;
|
|
261
|
+
angle: number;
|
|
262
|
+
position: number;
|
|
263
|
+
isVR: boolean;
|
|
257
264
|
}
|
|
258
265
|
export type LogType = "alarm_record" | "close_record" | "unlock_record" | "operation" | "local_operation";
|
|
259
266
|
export type CloseValue = "UNDEFINED" | "VOICE_REMOTE" | "APP_REMOTE" | "AUTO" | "LOCAL_MANUAL" | "FITTINGS" | "APP" | "GEO_FENCE";
|
|
@@ -334,10 +341,20 @@ export interface AlbumMessage extends MediaInfo {
|
|
|
334
341
|
type: number;
|
|
335
342
|
createTime: number;
|
|
336
343
|
}
|
|
344
|
+
export type VRModeType = "original" | "VR" | "horizontal" | "vertical";
|
|
337
345
|
export interface DeviceAdvancedAbility {
|
|
338
346
|
cloudStorage: {
|
|
339
347
|
support: boolean;
|
|
340
348
|
};
|
|
349
|
+
vr: {
|
|
350
|
+
support: boolean;
|
|
351
|
+
coverMode: VRModeType;
|
|
352
|
+
modes: Array<{
|
|
353
|
+
mode: VRModeType;
|
|
354
|
+
value: number;
|
|
355
|
+
}>;
|
|
356
|
+
defaultMode: VRModeType;
|
|
357
|
+
};
|
|
341
358
|
ai: {
|
|
342
359
|
support: boolean;
|
|
343
360
|
config: Record<string, any>;
|
|
@@ -348,7 +365,9 @@ export interface DeviceAdvancedAbility {
|
|
|
348
365
|
};
|
|
349
366
|
wechatVoip: {
|
|
350
367
|
support: boolean;
|
|
351
|
-
|
|
368
|
+
isPublice: boolean;
|
|
369
|
+
appId?: string;
|
|
370
|
+
modeId?: string;
|
|
352
371
|
};
|
|
353
372
|
voip: {
|
|
354
373
|
support: boolean;
|
|
@@ -390,4 +409,11 @@ export interface AIReportPopup {
|
|
|
390
409
|
reportId: string;
|
|
391
410
|
yearMonth: number;
|
|
392
411
|
}
|
|
412
|
+
export interface CameraConfig {
|
|
413
|
+
isVR: boolean;
|
|
414
|
+
width: number;
|
|
415
|
+
height: number;
|
|
416
|
+
rotate: number;
|
|
417
|
+
location: number;
|
|
418
|
+
}
|
|
393
419
|
export {};
|
package/lib/platform/device.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ export declare const getSystemInfoSync: () => {
|
|
|
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/index.d.ts
CHANGED
package/lib/platform/index.js
CHANGED
package/lib/platform/ipc.d.ts
CHANGED
package/lib/platform/ipc.js
CHANGED
|
@@ -31,10 +31,23 @@ const getCurrentSupportedTalkMode = (deviceId) => {
|
|
|
31
31
|
}
|
|
32
32
|
return Promise.reject(new Error("not support"));
|
|
33
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: [] });
|
|
45
|
+
};
|
|
34
46
|
export default {
|
|
35
47
|
wakeUpDoorBell,
|
|
36
48
|
isConnected,
|
|
37
49
|
isConnecting,
|
|
38
50
|
connect,
|
|
39
51
|
getCurrentSupportedTalkMode,
|
|
52
|
+
getTTTAbilityKeyList,
|
|
40
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>;
|
|
@@ -21,8 +21,11 @@ export type LockConfigState = {
|
|
|
21
21
|
supportMultipleFace: boolean;
|
|
22
22
|
supportOfflineDps: boolean;
|
|
23
23
|
preFetch: boolean;
|
|
24
|
+
localCache: boolean;
|
|
24
25
|
supportTalk: boolean;
|
|
25
26
|
isTwoWayTalk: boolean;
|
|
27
|
+
cameraConfig: CameraConfig[];
|
|
28
|
+
notSupportWake: boolean;
|
|
26
29
|
};
|
|
27
30
|
export declare function createDefaultDeviceStatus(): DeviceStatus;
|
|
28
31
|
export declare function createLockConfigState(): LockConfigState;
|
package/lib/utils/constant.d.ts
CHANGED
package/lib/utils/constant.js
CHANGED
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
|
@@ -32,7 +32,7 @@ export declare const getSystemInfo: () => {
|
|
|
32
32
|
locationEnabled: boolean;
|
|
33
33
|
wifiEnabled: boolean;
|
|
34
34
|
theme?: ty.Themes;
|
|
35
|
-
deviceOrientation?: ty.
|
|
35
|
+
deviceOrientation?: ty.PhoneOrientation;
|
|
36
36
|
deviceLevel: string;
|
|
37
37
|
isSupportPinShortcut?: boolean;
|
|
38
38
|
deviceType?: string;
|
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,
|