@ascua/electron 0.10.0 → 0.11.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.
@@ -114,11 +114,9 @@ export default class extends Service {
114
114
 
115
115
  @action reset() {
116
116
 
117
- const autoUpdater = this.autoUpdater;
118
-
119
- if (!autoUpdater) return;
117
+ if (Electron === null) return;
120
118
 
121
- autoUpdater.quitAndInstall(true, true);
119
+ Electron.ipcRenderer.send('install-update');
122
120
 
123
121
  }
124
122
 
@@ -1,6 +1,8 @@
1
1
  /* eslint-env node */
2
2
 
3
- const { app, BrowserWindow } = require('electron');
3
+ const { app, BrowserWindow, ipcMain } = require('electron');
4
+
5
+ const { autoUpdater } = require('electron-updater');
4
6
 
5
7
  const remote = require('@electron/remote/main');
6
8
 
@@ -8,6 +10,8 @@ const location = require('@ascua/app');
8
10
 
9
11
  const os = require('os');
10
12
 
13
+ let isUpdating = false;
14
+
11
15
  app.setName('My App');
12
16
 
13
17
  remote.initialize();
@@ -17,7 +21,21 @@ app.once('ready', () => {
17
21
  });
18
22
 
19
23
  app.once('window-all-closed', () => {
20
- app.quit();
24
+ if (!isUpdating) {
25
+ app.quit();
26
+ }
27
+ });
28
+
29
+ ipcMain.on('install-update', () => {
30
+ // Only udpate packaged applications
31
+ if (!app.isPackaged) return;
32
+ // Let the main process handle updates
33
+ try {
34
+ isUpdating = true;
35
+ autoUpdater.quitAndInstall(true, true);
36
+ } catch (error) {
37
+ console.error('Failed to install update:', error);
38
+ }
21
39
  });
22
40
 
23
41
  app.once('will-finish-launching', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ascua/electron",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Small description for @ascua/electron goes here",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -15,8 +15,8 @@
15
15
  "url": "https://surrealdb.com"
16
16
  },
17
17
  "dependencies": {
18
- "@ascua/config": "^0.10.0",
19
- "@ascua/service": "^0.10.0",
18
+ "@ascua/config": "^0.11.0",
19
+ "@ascua/service": "^0.11.0",
20
20
  "@electron/notarize": "^3.1.1",
21
21
  "builder-util": "^26.0.11",
22
22
  "electron": "40.0.0",
@@ -33,5 +33,5 @@
33
33
  "publishConfig": {
34
34
  "access": "public"
35
35
  },
36
- "gitHead": "18d3d333fcdb0b5c919ac42794fdb6d87d415ce8"
36
+ "gitHead": "07160c523596d693fbd858224c5de1c1c123ea4b"
37
37
  }