assistsx-js 0.0.2030 → 0.0.2032

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.
@@ -133,6 +133,13 @@ export declare class AssistsX {
133
133
  * @returns 是否成功打开
134
134
  */
135
135
  static openUrlInBrowser(url: string): boolean;
136
+ /**
137
+ * 保持屏幕常亮
138
+ * @param tip 提示文本
139
+ * @returns 是否保持屏幕常亮成功
140
+ */
141
+ static keepScreenOn(tip?: string): boolean;
142
+ static clearKeepScreenOn(): boolean;
136
143
  static isAppInstalled(packageName: string): boolean;
137
144
  /**
138
145
  * 对指定节点进行截图
package/dist/AssistsX.js CHANGED
@@ -180,6 +180,21 @@ export class AssistsX {
180
180
  });
181
181
  return response.getDataOrDefault(false);
182
182
  }
183
+ /**
184
+ * 保持屏幕常亮
185
+ * @param tip 提示文本
186
+ * @returns 是否保持屏幕常亮成功
187
+ */
188
+ static keepScreenOn(tip) {
189
+ const response = this.call(CallMethod.keepScreenOn, {
190
+ args: { tip },
191
+ });
192
+ return response.getDataOrDefault(false);
193
+ }
194
+ static clearKeepScreenOn() {
195
+ const response = this.call(CallMethod.clearKeepScreenOn, {});
196
+ return response.getDataOrDefault(false);
197
+ }
183
198
  static isAppInstalled(packageName) {
184
199
  const response = this.call(CallMethod.isAppInstalled, {
185
200
  args: { packageName },
@@ -380,4 +380,6 @@ export declare class AssistsXAsync {
380
380
  * @returns 是否成功打开
381
381
  */
382
382
  static openUrlInBrowser(url: string, timeout?: number): Promise<boolean>;
383
+ static download(url: string, timeout?: number): Promise<string | null | undefined>;
384
+ static audioPlayFromFile(filePath: string, timeout?: number): Promise<string | null | undefined>;
383
385
  }
@@ -638,4 +638,18 @@ export class AssistsXAsync {
638
638
  });
639
639
  return response.getDataOrDefault(false);
640
640
  }
641
+ static async download(url, timeout) {
642
+ const response = await this.asyncCall(CallMethod.download, {
643
+ args: { url },
644
+ timeout,
645
+ });
646
+ return response.getDataOrDefault(null);
647
+ }
648
+ static async audioPlayFromFile(filePath, timeout) {
649
+ const response = await this.asyncCall(CallMethod.audioPlayFromFile, {
650
+ args: { filePath },
651
+ timeout,
652
+ });
653
+ return response.getDataOrDefault(null);
654
+ }
641
655
  }
@@ -50,5 +50,9 @@ export declare const CallMethod: {
50
50
  readonly isAppInstalled: "isAppInstalled";
51
51
  readonly getClipboardLatestText: "getClipboardLatestText";
52
52
  readonly openUrlInBrowser: "openUrlInBrowser";
53
+ readonly keepScreenOn: "keepScreenOn";
54
+ readonly clearKeepScreenOn: "clearKeepScreenOn";
55
+ readonly download: "download";
56
+ readonly audioPlayFromFile: "audioPlayFromFile";
53
57
  };
54
58
  export type CallMethodType = (typeof CallMethod)[keyof typeof CallMethod];
@@ -51,4 +51,8 @@ export const CallMethod = {
51
51
  isAppInstalled: "isAppInstalled",
52
52
  getClipboardLatestText: "getClipboardLatestText",
53
53
  openUrlInBrowser: "openUrlInBrowser",
54
+ keepScreenOn: "keepScreenOn",
55
+ clearKeepScreenOn: "clearKeepScreenOn",
56
+ download: "download",
57
+ audioPlayFromFile: "audioPlayFromFile",
54
58
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assistsx-js",
3
- "version": "0.0.2030",
3
+ "version": "0.0.2032",
4
4
  "description": "assistsx-js自动化开发SDK",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
package/src/AssistsX.ts CHANGED
@@ -278,6 +278,21 @@ export class AssistsX {
278
278
  return response.getDataOrDefault(false);
279
279
  }
280
280
 
281
+ /**
282
+ * 保持屏幕常亮
283
+ * @param tip 提示文本
284
+ * @returns 是否保持屏幕常亮成功
285
+ */
286
+ public static keepScreenOn(tip?: string): boolean {
287
+ const response = this.call(CallMethod.keepScreenOn, {
288
+ args: { tip },
289
+ });
290
+ return response.getDataOrDefault(false);
291
+ }
292
+ public static clearKeepScreenOn(): boolean {
293
+ const response = this.call(CallMethod.clearKeepScreenOn, {});
294
+ return response.getDataOrDefault(false);
295
+ }
281
296
  public static isAppInstalled(packageName: string): boolean {
282
297
  const response = this.call(CallMethod.isAppInstalled, {
283
298
  args: { packageName },
@@ -915,6 +915,26 @@ export class AssistsXAsync {
915
915
  });
916
916
  return response.getDataOrDefault(false);
917
917
  }
918
+ public static async download(
919
+ url: string,
920
+ timeout?: number
921
+ ): Promise<string | null | undefined> {
922
+ const response = await this.asyncCall(CallMethod.download, {
923
+ args: { url },
924
+ timeout,
925
+ });
926
+ return response.getDataOrDefault(null);
927
+ }
928
+ public static async audioPlayFromFile(
929
+ filePath: string,
930
+ timeout?: number
931
+ ): Promise<string | null | undefined> {
932
+ const response = await this.asyncCall(CallMethod.audioPlayFromFile, {
933
+ args: { filePath },
934
+ timeout,
935
+ });
936
+ return response.getDataOrDefault(null);
937
+ }
918
938
 
919
939
  /**
920
940
  * 发送HTTP请求
package/src/CallMethod.ts CHANGED
@@ -55,6 +55,10 @@ export const CallMethod = {
55
55
  isAppInstalled: "isAppInstalled",
56
56
  getClipboardLatestText: "getClipboardLatestText",
57
57
  openUrlInBrowser: "openUrlInBrowser",
58
+ keepScreenOn: "keepScreenOn",
59
+ clearKeepScreenOn: "clearKeepScreenOn",
60
+ download: "download",
61
+ audioPlayFromFile: "audioPlayFromFile",
58
62
  } as const;
59
63
 
60
64
  // 导出类型定义