@arkts/image-manager 0.5.4 → 0.5.6

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/dist/index.cjs CHANGED
@@ -32,7 +32,7 @@ let base64_js = require("base64-js");
32
32
  let vscode_fs = require("vscode-fs");
33
33
 
34
34
  //#region package.json
35
- var version = "0.5.4";
35
+ var version = "0.5.6";
36
36
 
37
37
  //#endregion
38
38
  //#region src/common/serializable-content.ts
@@ -283,6 +283,22 @@ var EmulatorFileImpl = class extends SerializableFileImpl {
283
283
  else this.getDeviceItems(item.getChildren());
284
284
  return items;
285
285
  }
286
+ findRemoteImageByDeviceItem(deviceItem, remoteImages) {
287
+ return remoteImages.find((image) => {
288
+ if (image.getApiVersion() !== deviceItem.getContent().api) return false;
289
+ if (image.getFullDeviceType() === deviceItem.getContent().deviceType) return true;
290
+ if (image.getFullDeviceType() === "pc_all") {
291
+ if (deviceItem.getContent().deviceType === "2in1") return true;
292
+ else if (deviceItem.getContent().deviceType === "2in1_foldable") return true;
293
+ } else if (image.getFullDeviceType() === "phone_all") {
294
+ if (deviceItem.getContent().deviceType === "phone") return true;
295
+ else if (deviceItem.getContent().deviceType === "foldable") return true;
296
+ else if (deviceItem.getContent().deviceType === "widefold") return true;
297
+ else if (deviceItem.getContent().deviceType === "triplefold") return true;
298
+ }
299
+ return false;
300
+ });
301
+ }
286
302
  findDeviceItems(options = {}) {
287
303
  const items = [];
288
304
  const pushDeviceItem = (item) => {
@@ -1327,16 +1343,16 @@ let OptionsResolver;
1327
1343
  default: return join(URI.file(os.homedir()), ".huawei", "Emulator");
1328
1344
  }
1329
1345
  }
1330
- const imageBasePath = typeof options.imageBasePath === "string" ? URI.file(options.imageBasePath) : options.imageBasePath || resolveDefaultImageBasePath();
1331
- const cachePath = typeof options.cachePath === "string" ? URI.file(options.cachePath) : options.cachePath || join(imageBasePath, "cache");
1346
+ const imageBasePath = typeof options.imageBasePath === "string" ? options.imageBasePath ? URI.file(options.imageBasePath) : resolveDefaultImageBasePath() : options.imageBasePath ? options.imageBasePath : resolveDefaultImageBasePath();
1347
+ const cachePath = typeof options.cachePath === "string" ? options.cachePath ? URI.file(options.cachePath) : join(imageBasePath, "cache") : options.cachePath ? options.cachePath : join(imageBasePath, "cache");
1332
1348
  return {
1333
1349
  imageBasePath,
1334
- deployedPath: typeof options.deployedPath === "string" ? URI.file(options.deployedPath) : options.deployedPath || resolveDefaultDeployedPath(),
1350
+ deployedPath: typeof options.deployedPath === "string" ? options.deployedPath ? URI.file(options.deployedPath) : resolveDefaultDeployedPath() : options.deployedPath ? options.deployedPath : resolveDefaultDeployedPath(),
1335
1351
  cachePath,
1336
- sdkPath: typeof options.sdkPath === "string" ? URI.file(options.sdkPath) : options.sdkPath || resolveDefaultSdkPath(),
1337
- configPath: typeof options.configPath === "string" ? URI.file(options.configPath) : options.configPath || resolveDefaultConfigPath(),
1338
- logPath: typeof options.logPath === "string" ? URI.file(options.logPath) : options.logPath || resolveDefaultLogPath(),
1339
- emulatorPath: typeof options.emulatorPath === "string" ? URI.file(options.emulatorPath) : options.emulatorPath || resolveDefaultEmulatorPath(),
1352
+ sdkPath: typeof options.sdkPath === "string" ? options.sdkPath ? URI.file(options.sdkPath) : resolveDefaultSdkPath() : options.sdkPath ? options.sdkPath : resolveDefaultSdkPath(),
1353
+ configPath: typeof options.configPath === "string" ? options.configPath ? URI.file(options.configPath) : resolveDefaultConfigPath() : options.configPath ? options.configPath : resolveDefaultConfigPath(),
1354
+ logPath: typeof options.logPath === "string" ? options.logPath ? URI.file(options.logPath) : resolveDefaultLogPath() : options.logPath ? options.logPath : resolveDefaultLogPath(),
1355
+ emulatorPath: typeof options.emulatorPath === "string" ? options.emulatorPath ? URI.file(options.emulatorPath) : resolveDefaultEmulatorPath() : options.emulatorPath ? options.emulatorPath : resolveDefaultEmulatorPath(),
1340
1356
  adapter
1341
1357
  };
1342
1358
  }