@lvce-editor/update-worker 1.5.0 → 1.6.0

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.
@@ -837,6 +837,8 @@ const WebWorkerRpcClient = {
837
837
  create: create$1
838
838
  };
839
839
 
840
+ const Electron = 2;
841
+
840
842
  const RendererWorker = 1;
841
843
 
842
844
  const rpcs = Object.create(null);
@@ -903,11 +905,12 @@ const promptRestart = () => {
903
905
  return i18nString(UiStrings.DoYouWantToRestart);
904
906
  };
905
907
 
906
- // TODO avoid js prompt in elctron, since it crashes electron
907
-
908
908
  const confirmPrompt = async message => {
909
- // TODO
910
- return true;
909
+ const result = await invoke('ConfirmPrompt.prompt', message, {
910
+ // @ts-ignore
911
+ platform: Electron
912
+ });
913
+ return result;
911
914
  };
912
915
 
913
916
  const downloadToDisk = async (diskPath, response) => {
@@ -984,7 +987,7 @@ const getDiskPath = async downloadUrl => {
984
987
  // @ts-ignore
985
988
  const cacheDir = await invoke('PlatformPaths.getCachePath');
986
989
  const baseName = getBaseName(downloadUrl);
987
- const diskPath = `${cacheDir}/${baseName}`;
990
+ const diskPath = `${cacheDir}/auto-updater/${baseName}`;
988
991
  return diskPath;
989
992
  };
990
993
 
@@ -1025,6 +1028,8 @@ const getUpdateUrl = (repository, version) => {
1025
1028
  };
1026
1029
 
1027
1030
  const exec = async (path, args, options) => {
1031
+ // @ts-ignore
1032
+ await invoke('Exec.exec', path, args, options);
1028
1033
  // TODO
1029
1034
  return {
1030
1035
  type: 0,
@@ -1069,8 +1074,8 @@ const shouldUpdate = async (updateSetting, version) => {
1069
1074
  if (updateSetting && updateSetting !== 'none') {
1070
1075
  return true;
1071
1076
  }
1072
- promptMessage(version);
1073
- const shouldUpdate = await confirmPrompt();
1077
+ const message = promptMessage(version);
1078
+ const shouldUpdate = await confirmPrompt(message);
1074
1079
  return shouldUpdate;
1075
1080
  };
1076
1081
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/update-worker",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Update Worker",
5
5
  "repository": {
6
6
  "type": "git",