react-native-electron-platform 0.0.22 → 0.0.23
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 +1 -1
- package/src/modules/autoUpdater.js +20 -1
package/package.json
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { app, dialog } from "electron";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import fs from "fs";
|
|
2
4
|
import electronUpdater from "electron-updater";
|
|
3
5
|
const { autoUpdater } = electronUpdater;
|
|
4
6
|
|
|
@@ -9,6 +11,14 @@ export function setupAutoUpdater(mainWindow) {
|
|
|
9
11
|
console.log("Auto-update disabled in development.");
|
|
10
12
|
return;
|
|
11
13
|
}
|
|
14
|
+
|
|
15
|
+
// Check if app-update.yml exists (required for auto-updates)
|
|
16
|
+
const appUpdatePath = path.join(process.resourcesPath, "app-update.yml");
|
|
17
|
+
if (!fs.existsSync(appUpdatePath)) {
|
|
18
|
+
console.log("⚠️ Auto-update disabled: app-update.yml not found.");
|
|
19
|
+
console.log(" This file is only created when publishing updates.");
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
12
22
|
|
|
13
23
|
autoUpdater.autoDownload = true;
|
|
14
24
|
autoUpdater.autoInstallOnAppQuit = true;
|
|
@@ -57,6 +67,9 @@ export function setupAutoUpdater(mainWindow) {
|
|
|
57
67
|
if (result.response === 0) {
|
|
58
68
|
autoUpdater.quitAndInstall();
|
|
59
69
|
}
|
|
70
|
+
})
|
|
71
|
+
.catch((err) => {
|
|
72
|
+
console.error("Error showing update dialog:", err);
|
|
60
73
|
});
|
|
61
74
|
});
|
|
62
75
|
|
|
@@ -67,6 +80,12 @@ export function setupAutoUpdater(mainWindow) {
|
|
|
67
80
|
|
|
68
81
|
// Check for updates after a short delay
|
|
69
82
|
setTimeout(() => {
|
|
70
|
-
|
|
83
|
+
try {
|
|
84
|
+
autoUpdater.checkForUpdates().catch((err) => {
|
|
85
|
+
console.error("Failed to check for updates:", err.message);
|
|
86
|
+
});
|
|
87
|
+
} catch (err) {
|
|
88
|
+
console.error("Auto-updater initialization error:", err);
|
|
89
|
+
}
|
|
71
90
|
}, 3000);
|
|
72
91
|
}
|