@ray-js/lock-sdk 1.2.3 → 1.2.4-beta.1
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 +2 -3
- package/lib/api/gesture.js +2 -3
- package/lib/entries/main/exports/gesture.d.ts +1 -1
- package/lib/feature/gesture/gesture.d.ts +2 -4
- package/lib/feature/gesture/gesture.js +23 -2
- package/lib/feature/misc/is-use-near-channel-for-runtime.js +1 -1
- package/lib/feature/state/init-state.js +18 -20
- package/package.json +1 -1
package/lib/api/gesture.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
export interface GestureStatus {
|
|
2
2
|
status: boolean;
|
|
3
|
-
password
|
|
4
|
-
[k: string]: any;
|
|
3
|
+
password?: string;
|
|
5
4
|
}
|
|
6
5
|
export declare const getGestureStatusApi: (devId: string) => Promise<GestureStatus>;
|
|
7
6
|
export interface UpdateGestureStatusParams {
|
|
8
|
-
password
|
|
7
|
+
password?: string;
|
|
9
8
|
open: boolean;
|
|
10
9
|
}
|
|
11
10
|
export declare const setGestureStatusApi: (params: UpdateGestureStatusParams & {
|
package/lib/api/gesture.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { THING } from "../utils/constant";
|
|
2
1
|
import { requestApi } from "./request";
|
|
3
2
|
export const getGestureStatusApi = (devId) => {
|
|
4
3
|
return requestApi({
|
|
5
4
|
logName: "getGestureStatus",
|
|
6
|
-
api:
|
|
5
|
+
api: "m.lock.device.gesturepwd.check",
|
|
7
6
|
version: "1.0",
|
|
8
7
|
data: { devId },
|
|
9
8
|
});
|
|
@@ -11,7 +10,7 @@ export const getGestureStatusApi = (devId) => {
|
|
|
11
10
|
export const setGestureStatusApi = (params) => {
|
|
12
11
|
return requestApi({
|
|
13
12
|
logName: "setGestureStatus",
|
|
14
|
-
api:
|
|
13
|
+
api: "m.lock.device.gesturepwd.set",
|
|
15
14
|
version: "1.0",
|
|
16
15
|
data: params,
|
|
17
16
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { UpdateGestureStatusParams } from "../../../api/gesture";
|
|
2
2
|
export type { GestureStatus, UpdateGestureStatusParams, } from "../../../api/gesture";
|
|
3
3
|
export declare function getGestureStatus(): Promise<import("../../../api/gesture").GestureStatus>;
|
|
4
|
-
export declare function updateGestureStatus(params: UpdateGestureStatusParams): Promise<
|
|
4
|
+
export declare function updateGestureStatus(params: UpdateGestureStatusParams): Promise<void>;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
+
import { UpdateGestureStatusParams } from "../../api/gesture";
|
|
1
2
|
import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
|
|
2
3
|
export declare const getGestureStatusForRuntime: (rt: LockDeviceRuntime) => Promise<import("../../api/gesture").GestureStatus>;
|
|
3
|
-
export declare const updateGestureStatusForRuntime: (rt: LockDeviceRuntime, params:
|
|
4
|
-
password: string;
|
|
5
|
-
open: boolean;
|
|
6
|
-
}) => Promise<boolean>;
|
|
4
|
+
export declare const updateGestureStatusForRuntime: (rt: LockDeviceRuntime, params: UpdateGestureStatusParams) => Promise<void>;
|
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
import { decrypt, encrypt } from "../../platform";
|
|
1
2
|
import { getGestureStatusApi, setGestureStatusApi } from "../../api/gesture";
|
|
2
|
-
|
|
3
|
-
export const
|
|
3
|
+
import { getError } from "../../utils/errors";
|
|
4
|
+
export const getGestureStatusForRuntime = async (rt) => {
|
|
5
|
+
const res = await getGestureStatusApi(rt.config.devInfo.devId);
|
|
6
|
+
if (res.status && res.password) {
|
|
7
|
+
res.password = await decrypt(rt.config.devInfo.devId, res.password);
|
|
8
|
+
}
|
|
9
|
+
return res;
|
|
10
|
+
};
|
|
11
|
+
export const updateGestureStatusForRuntime = async (rt, params) => {
|
|
12
|
+
let encryptedPassword = undefined;
|
|
13
|
+
if (params.open) {
|
|
14
|
+
if (!params.password) {
|
|
15
|
+
throw getError(1009, "password");
|
|
16
|
+
}
|
|
17
|
+
encryptedPassword = await encrypt(rt.config.devInfo.devId, params.password);
|
|
18
|
+
}
|
|
19
|
+
await setGestureStatusApi({
|
|
20
|
+
devId: rt.config.devInfo.devId,
|
|
21
|
+
password: encryptedPassword,
|
|
22
|
+
open: params.open,
|
|
23
|
+
});
|
|
24
|
+
};
|
|
@@ -17,7 +17,7 @@ import { fetchDeviceProperties } from "./remote-permissions";
|
|
|
17
17
|
import { ipc, yuChannelSyncSingleSync } from "../../platform";
|
|
18
18
|
import { sdkLog } from "../../utils/sdk-log";
|
|
19
19
|
import { ProductCommunicationType, RotateType } from "../../constant";
|
|
20
|
-
import {
|
|
20
|
+
import { isVirtualDevice } from "../../utils";
|
|
21
21
|
import { getError } from "../../utils/errors";
|
|
22
22
|
import { isSupportMediaForRuntime } from "../media/media";
|
|
23
23
|
export const initState = async (runtime) => {
|
|
@@ -130,25 +130,23 @@ export const initState = async (runtime) => {
|
|
|
130
130
|
runtime.config.supportTalk = true;
|
|
131
131
|
runtime.config.isTwoWayTalk =
|
|
132
132
|
ipcConfig.value?.audioAttributes?.callMode?.[0] === 2;
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
});
|
|
151
|
-
}
|
|
133
|
+
try {
|
|
134
|
+
const modeRes = await ipc.getCurrentSupportedTalkMode(devId);
|
|
135
|
+
runtime.config.isTwoWayTalk = modeRes.talkbackMode === 2;
|
|
136
|
+
sdkLog("info", "initState", "supportTalk", {
|
|
137
|
+
devId,
|
|
138
|
+
duration: Date.now() - startedAt,
|
|
139
|
+
data: {
|
|
140
|
+
mode: modeRes.talkbackMode,
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
catch (e) {
|
|
145
|
+
sdkLog("error", "initState", "supportTalk", {
|
|
146
|
+
devId,
|
|
147
|
+
duration: Date.now() - startedAt,
|
|
148
|
+
error: e,
|
|
149
|
+
});
|
|
152
150
|
}
|
|
153
151
|
}
|
|
154
152
|
if (!isSEI &&
|