@ray-js/lock-sdk 1.2.4-beta.0 → 1.2.4-beta.2
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/password/temporary/custom-dp.js +1 -0
- package/lib/feature/user/user.js +4 -4
- 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
|
+
};
|
package/lib/feature/user/user.js
CHANGED
|
@@ -9,7 +9,7 @@ import { updateUserTimeSchedule, addNormalUser, removeNormalUser, } from "../../
|
|
|
9
9
|
import { validConfigDpMap } from "../../config/dp-map/common";
|
|
10
10
|
import { isUseNearChannelForRuntime } from "../misc/is-use-near-channel-for-runtime";
|
|
11
11
|
import { getUnlockMethodTypeByDpCodeForRuntime } from "../utils";
|
|
12
|
-
import { formatTimestampToMilliseconds, formatWeek, isAdmin, parseWeek, validateEffectiveConfig, } from "../../utils";
|
|
12
|
+
import { formatTimestampToMilliseconds, formatWeek, isAdmin, isHarmony, parseWeek, validateEffectiveConfig, } from "../../utils";
|
|
13
13
|
import { getCurrentHomeInfo, isSupportShortLink } from "../../platform/device";
|
|
14
14
|
import { LoopTypes } from "../../utils/constant";
|
|
15
15
|
import { getCurrentUserForRuntime } from "./current-user";
|
|
@@ -337,8 +337,8 @@ export const openAddFamilyUser = async () => {
|
|
|
337
337
|
if (!link) {
|
|
338
338
|
link = await isSupportShortLink("thingsh_family_add_member_rn");
|
|
339
339
|
}
|
|
340
|
-
if (link) {
|
|
341
|
-
const url = `tuyaSmart://${link}?homeId=${homeInfo.homeId}`;
|
|
340
|
+
if (link || isHarmony()) {
|
|
341
|
+
const url = `tuyaSmart://${isHarmony() ? "thingsh_family_add_member_rn" : link}?homeId=${homeInfo.homeId}`;
|
|
342
342
|
return new Promise((resolve, reject) => {
|
|
343
343
|
ty.router({
|
|
344
344
|
url: url,
|
|
@@ -369,7 +369,7 @@ export async function openFamilyUserDetailForRuntime(rt, userId) {
|
|
|
369
369
|
const { userType: currentUserType } = await getCurrentUserForRuntime(rt);
|
|
370
370
|
const role = userTypeMap[currentUserType];
|
|
371
371
|
let link = await isSupportShortLink("member_info");
|
|
372
|
-
if (link) {
|
|
372
|
+
if (link || isHarmony()) {
|
|
373
373
|
const url = `tuyaSmart://member_info?homeId=${homeId}&memberId=${userId}&role=${role}`;
|
|
374
374
|
ty.router({
|
|
375
375
|
url: url,
|