mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-01 13:14:16 +08:00
Fix autoupdate crash (nativeImage => NativeImage) #1425
This commit is contained in:
parent
6bd51c70f6
commit
590a746b1a
1 changed files with 7 additions and 9 deletions
|
@ -1,5 +1,5 @@
|
||||||
/* eslint global-require: 0*/
|
/* eslint global-require: 0*/
|
||||||
import { dialog, NativeImage } from 'electron';
|
import { dialog, nativeImage } from 'electron';
|
||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
@ -161,12 +161,10 @@ export default class AutoUpdateManager extends EventEmitter {
|
||||||
autoUpdater.quitAndInstall();
|
autoUpdater.quitAndInstall();
|
||||||
}
|
}
|
||||||
|
|
||||||
iconURL() {
|
dialogIcon() {
|
||||||
const url = path.join(process.resourcesPath, 'static', 'images', 'mailspring.png');
|
const iconPath = path.join(global.application.resourcePath, 'static', 'images', 'mailspring.png');
|
||||||
if (!fs.existsSync(url)) {
|
if (!fs.existsSync(iconPath)) return undefined;
|
||||||
return undefined;
|
return nativeImage.createFromPath(iconPath);
|
||||||
}
|
|
||||||
return url;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onUpdateNotAvailable = () => {
|
onUpdateNotAvailable = () => {
|
||||||
|
@ -174,7 +172,7 @@ export default class AutoUpdateManager extends EventEmitter {
|
||||||
dialog.showMessageBox({
|
dialog.showMessageBox({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
buttons: [localized('OK')],
|
buttons: [localized('OK')],
|
||||||
icon: NativeImage.createFromPath(this.iconURL()),
|
icon: this.dialogIcon(),
|
||||||
message: localized('No update available.'),
|
message: localized('No update available.'),
|
||||||
title: localized('No update available.'),
|
title: localized('No update available.'),
|
||||||
detail: localized(`You're running the latest version of Mailspring (%@).`, this.version),
|
detail: localized(`You're running the latest version of Mailspring (%@).`, this.version),
|
||||||
|
@ -186,7 +184,7 @@ export default class AutoUpdateManager extends EventEmitter {
|
||||||
dialog.showMessageBox({
|
dialog.showMessageBox({
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
buttons: [localized('OK')],
|
buttons: [localized('OK')],
|
||||||
icon: NativeImage.createFromPath(this.iconURL()),
|
icon: this.dialogIcon(),
|
||||||
message: localized('There was an error checking for updates.'),
|
message: localized('There was an error checking for updates.'),
|
||||||
title: localized('Update Error'),
|
title: localized('Update Error'),
|
||||||
detail: message,
|
detail: message,
|
||||||
|
|
Loading…
Reference in a new issue