@ledvance/base 1.0.13 → 1.0.15

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/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "@ledvance/base",
5
5
  "pid": [],
6
6
  "uiid": "",
7
- "version": "1.0.13",
7
+ "version": "1.0.15",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@reduxjs/toolkit": "^1.8.6",
@@ -1,9 +1,10 @@
1
- import { NativeResult } from '../models/modules/Result';
1
+ import { NativeResult, Result } from '../models/modules/Result';
2
2
  export declare class NativeApi {
3
3
  static back(): void;
4
4
  static log(msg: string): void;
5
5
  static logObj(msg: any): void;
6
6
  static showObj(obj: any): void;
7
+ static getAllTaskTimer(devId: string, type?: number): Promise<Result<any>>;
7
8
  static timerList(deviceId: string): Promise<any>;
8
9
  static addTimer(deviceId: string, value: any, callback?: (res: any) => void): void;
9
10
  static editTimer(deviceId: string, value: any, callback?: (res: any) => void): void;
package/src/api/native.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import {NativeModules} from 'react-native'
2
- import {NativeResult} from '../models/modules/Result'
2
+ import {NativeResult, Result} from '../models/modules/Result'
3
3
 
4
4
  interface LDVDevicePanelManager {
5
5
  back: () => void
6
6
  control: (params: any, callback: (result: any) => void) => void
7
7
  setTimer: (params: any, callback: (result: any) => void) => void
8
+ getAllTaskTimer: (deviceId: string, type: number, callback: (res: NativeResult<string>) => void) => void
8
9
  deleteDevice: (deviceId: string, isReset: boolean, callback: (result: any) => void) => void
9
10
  rename: (deviceId: string, name: string, callback: (result: any) => void) => void
10
11
  toDeviceSettingsPage: (deviceId: string) => void
@@ -66,6 +67,16 @@ const deleteTimer = (devId, value, callback: any = undefined) => {
66
67
  })
67
68
  }
68
69
 
70
+ /**
71
+ * 获取所有Timer,不区分TASK
72
+ * @param devId 涂鸦 设备 ID 或群组 ID
73
+ * @param type 0:设备,1:群组
74
+ * @param callback
75
+ */
76
+ function getAllTaskTimer(devId: string, type: number = 0, callback: ((res: NativeResult<string>) => void)) {
77
+ devicePanel.getAllTaskTimer(devId, type, callback)
78
+ }
79
+
69
80
  const setDp = <T>(deviceId: string, key: string, value: any) => {
70
81
  return new Promise<NativeResult<T>>((resolve, _reject) => {
71
82
  control(deviceId, {[key]: value}, res => {
@@ -123,6 +134,18 @@ export class NativeApi {
123
134
  showObj(obj)
124
135
  }
125
136
 
137
+ static getAllTaskTimer(devId: string, type: number = 0): Promise<Result<any>> {
138
+ return new Promise<Result<any>>((resolve, _reject) => {
139
+ getAllTaskTimer(devId, type, res => {
140
+ resolve({
141
+ success: res.result,
142
+ data: res.result ? JSON.parse(res.data || '[]') : undefined,
143
+ msg: res.msg,
144
+ })
145
+ })
146
+ })
147
+ }
148
+
126
149
  static timerList(deviceId: string): Promise<any> {
127
150
  return timerList(deviceId)
128
151
  }