diff options
-rw-r--r-- | .github/workflows/builds.yml | 4 | ||||
-rw-r--r-- | electron-builder.yml | 4 | ||||
-rw-r--r-- | src/electron/ipc-api/autoUpdate.ts | 13 | ||||
-rw-r--r-- | src/index.ts | 17 |
4 files changed, 28 insertions, 10 deletions
diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 610826872..033c7df73 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml | |||
@@ -170,7 +170,7 @@ jobs: | |||
170 | shell: bash | 170 | shell: bash |
171 | env: | 171 | env: |
172 | GH_TOKEN: ${{ secrets.FERDIUM_PUBLISH_TOKEN }} | 172 | GH_TOKEN: ${{ secrets.FERDIUM_PUBLISH_TOKEN }} |
173 | CSC_IDENTITY_AUTO_DISCOVERY: false | 173 | CSC_IDENTITY_AUTO_DISCOVERY: true |
174 | # TODO: Commented out the code signing process for now (so as to at least get unsigned nightlies available for testing) | 174 | # TODO: Commented out the code signing process for now (so as to at least get unsigned nightlies available for testing) |
175 | # APPLEID: ${{ secrets.APPLEID }} | 175 | # APPLEID: ${{ secrets.APPLEID }} |
176 | # APPLEID_PASSWORD: ${{ secrets.APPLEID_PASSWORD }} | 176 | # APPLEID_PASSWORD: ${{ secrets.APPLEID_PASSWORD }} |
@@ -368,7 +368,7 @@ jobs: | |||
368 | shell: bash | 368 | shell: bash |
369 | env: | 369 | env: |
370 | GH_TOKEN: ${{ secrets.FERDIUM_PUBLISH_TOKEN }} | 370 | GH_TOKEN: ${{ secrets.FERDIUM_PUBLISH_TOKEN }} |
371 | CSC_IDENTITY_AUTO_DISCOVERY: false | 371 | CSC_IDENTITY_AUTO_DISCOVERY: true |
372 | # TODO: Commented out the code signing process for now (so as to at least get unsigned nightlies available for testing) | 372 | # TODO: Commented out the code signing process for now (so as to at least get unsigned nightlies available for testing) |
373 | # WIN_CSC_LINK: ${{ secrets.WIN_CSC_LINK }} | 373 | # WIN_CSC_LINK: ${{ secrets.WIN_CSC_LINK }} |
374 | # WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }} | 374 | # WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }} |
diff --git a/electron-builder.yml b/electron-builder.yml index 822200234..64809a6da 100644 --- a/electron-builder.yml +++ b/electron-builder.yml | |||
@@ -26,7 +26,9 @@ dmg: | |||
26 | { x: 122, y: 240, type: file }, | 26 | { x: 122, y: 240, type: file }, |
27 | ] | 27 | ] |
28 | 28 | ||
29 | afterSign: ./build-helpers/notarize.js | 29 | # TODO: When we have a registered developer account we need to uncomment this line so that the signing process can occur but without the notarization. |
30 | # This is the notarization which would allow to have the DMG analysed so that it can be opened straight away after download. | ||
31 | # afterSign: ./build-helpers/notarize.js | ||
30 | 32 | ||
31 | protocols: | 33 | protocols: |
32 | name: Ferdium | 34 | name: Ferdium |
diff --git a/src/electron/ipc-api/autoUpdate.ts b/src/electron/ipc-api/autoUpdate.ts index d20a413b3..fb91d3515 100644 --- a/src/electron/ipc-api/autoUpdate.ts +++ b/src/electron/ipc-api/autoUpdate.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import { app, ipcMain, BrowserWindow } from 'electron'; | 1 | import { ipcMain, BrowserWindow } from 'electron'; |
2 | import { autoUpdater } from 'electron-updater'; | 2 | import { autoUpdater } from 'electron-updater'; |
3 | import { isMac, isWindows } from '../../environment'; | 3 | import { isMac, isWindows } from '../../environment'; |
4 | import { appEvents } from '../..'; | ||
4 | 5 | ||
5 | const debug = require('../../preload-safe-debug')('Ferdium:ipcApi:autoUpdate'); | 6 | const debug = require('../../preload-safe-debug')('Ferdium:ipcApi:autoUpdate'); |
6 | 7 | ||
@@ -24,11 +25,13 @@ export default (params: { mainWindow: BrowserWindow; settings: any }) => { | |||
24 | autoUpdater.checkForUpdates(); | 25 | autoUpdater.checkForUpdates(); |
25 | } else if (args.action === 'install') { | 26 | } else if (args.action === 'install') { |
26 | debug('installing update'); | 27 | debug('installing update'); |
27 | app.removeAllListeners('window-all-closed'); | 28 | |
28 | params.mainWindow.removeAllListeners('close'); | 29 | appEvents.emit('install-update'); |
30 | |||
31 | const openedWindows = BrowserWindow.getAllWindows(); | ||
32 | for (const window of openedWindows) window.close(); | ||
33 | |||
29 | autoUpdater.quitAndInstall(); | 34 | autoUpdater.quitAndInstall(); |
30 | // TODO: based on https://github.com/electron-userland/electron-builder/issues/6058#issuecomment-1130344017 (not yet tested since we don't have signed builds yet for macos) | ||
31 | app.exit(); | ||
32 | } | 35 | } |
33 | } catch (error) { | 36 | } catch (error) { |
34 | event.sender.send('autoUpdate', { error }); | 37 | event.sender.send('autoUpdate', { error }); |
diff --git a/src/index.ts b/src/index.ts index 59a90a3cb..fad6b9b69 100644 --- a/src/index.ts +++ b/src/index.ts | |||
@@ -15,6 +15,7 @@ import { join } from 'path'; | |||
15 | import windowStateKeeper from 'electron-window-state'; | 15 | import windowStateKeeper from 'electron-window-state'; |
16 | import minimist from 'minimist'; | 16 | import minimist from 'minimist'; |
17 | import ms from 'ms'; | 17 | import ms from 'ms'; |
18 | import { EventEmitter } from 'events'; | ||
18 | import { enableWebContents, initializeRemote } from './electron-util'; | 19 | import { enableWebContents, initializeRemote } from './electron-util'; |
19 | import { enforceMacOSAppLocation } from './enforce-macos-app-location'; | 20 | import { enforceMacOSAppLocation } from './enforce-macos-app-location'; |
20 | 21 | ||
@@ -56,6 +57,9 @@ app.userAgentFallback = userAgent(); | |||
56 | // be closed automatically when the JavaScript object is garbage collected. | 57 | // be closed automatically when the JavaScript object is garbage collected. |
57 | let mainWindow: BrowserWindow | undefined; | 58 | let mainWindow: BrowserWindow | undefined; |
58 | let willQuitApp = false; | 59 | let willQuitApp = false; |
60 | let overrideAppQuitForUpdate = false; | ||
61 | |||
62 | export const appEvents = new EventEmitter(); | ||
59 | 63 | ||
60 | // Register methods to be called once the window has been loaded. | 64 | // Register methods to be called once the window has been loaded. |
61 | let onDidLoadFns: any[] | null = []; | 65 | let onDidLoadFns: any[] | null = []; |
@@ -320,7 +324,8 @@ const createWindow = () => { | |||
320 | debug('Window: hide'); | 324 | debug('Window: hide'); |
321 | mainWindow?.hide(); | 325 | mainWindow?.hide(); |
322 | } | 326 | } |
323 | } else { | 327 | } else if (!overrideAppQuitForUpdate) { |
328 | debug('Quitting the app'); | ||
324 | dbus.stop(); | 329 | dbus.stop(); |
325 | app.quit(); | 330 | app.quit(); |
326 | } | 331 | } |
@@ -653,12 +658,20 @@ app.on('window-all-closed', () => { | |||
653 | ) | 658 | ) |
654 | ) { | 659 | ) { |
655 | debug('Window: all windows closed, quit app'); | 660 | debug('Window: all windows closed, quit app'); |
656 | app.quit(); | 661 | if (!overrideAppQuitForUpdate) { |
662 | // TODO: based on https://github.com/electron-userland/electron-builder/issues/6058#issuecomment-1130344017 (not yet tested since we don't have signed builds yet for macos) | ||
663 | app.quit(); | ||
664 | } | ||
657 | } else { | 665 | } else { |
658 | debug("Window: don't quit app"); | 666 | debug("Window: don't quit app"); |
659 | } | 667 | } |
660 | }); | 668 | }); |
661 | 669 | ||
670 | appEvents.on('install-update', () => { | ||
671 | willQuitApp = true; | ||
672 | overrideAppQuitForUpdate = true; | ||
673 | }); | ||
674 | |||
662 | app.on('before-quit', event => { | 675 | app.on('before-quit', event => { |
663 | const yesButtonIndex = 0; | 676 | const yesButtonIndex = 0; |
664 | let selection = yesButtonIndex; | 677 | let selection = yesButtonIndex; |