Move default icon to a path preserved in packaged app

This commit is contained in:
Ben Gotow 2019-03-12 23:30:36 -07:00
parent 731aa71134
commit 96c95eef18
5 changed files with 20 additions and 16 deletions

View file

@ -106,7 +106,14 @@ module.exports = grunt => {
writeFromTemplate(path.join(linuxAssetsDir, 'mailspring.desktop.in'), data);
writeFromTemplate(path.join(linuxAssetsDir, 'mailspring.appdata.xml.in'), data);
const icon = path.join(grunt.config('appDir'), 'build', 'resources', 'mailspring.png');
const icon = path.join(
grunt.config('appDir'),
'build',
'resources',
'linux',
'icons',
'512.png'
);
const cmd = path.join(grunt.config('appDir'), 'script', 'mkdeb');
const args = [version, arch, icon, linuxAssetsDir, contentsDir, outputDir];
spawn({ cmd, args }, spawnError => {

View file

@ -162,7 +162,7 @@ export default class AutoUpdateManager extends EventEmitter {
}
iconURL() {
const url = path.join(process.resourcesPath, 'app', 'mailspring.png');
const url = path.join(process.resourcesPath, 'static', 'images', 'mailspring.png');
if (!fs.existsSync(url)) {
return undefined;
}

View file

@ -114,16 +114,8 @@ export default class MailspringWindow extends EventEmitter {
if (process.platform === 'linux') {
if (!WindowIconPath) {
WindowIconPath = path.resolve('/usr', 'share', 'pixmaps', 'mailspring.png');
// Provides icon when running from npm start / development mode.
if (!fs.existsSync(WindowIconPath)) {
WindowIconPath = path.resolve(
__dirname,
'..',
'..',
'build',
'resources',
'mailspring.png'
);
WindowIconPath = path.resolve(this.resourcePath, 'static', 'images', 'mailspring.png');
}
}
browserWindowOptions.icon = WindowIconPath;

View file

@ -5,7 +5,12 @@ import fs from 'fs';
import os from 'os';
const platform = process.platform;
const DEFAULT_ICON = path.resolve(__dirname, '..', 'build', 'resources', 'mailspring.png');
const DEFAULT_ICON = path.resolve(
AppEnv.getLoadSettings().resourcePath,
'static',
'images',
'mailspring.png'
);
let MacNotifierNotification = null;
if (platform === 'darwin') {
@ -13,13 +18,13 @@ if (platform === 'darwin') {
MacNotifierNotification = require('node-mac-notifier');
} catch (err) {
console.error(
'node-mac-notifier (a platform-specific optionalDependency) was not installed correctly! Check the Travis build log for errors.',
'node-mac-notifier (a platform-specific optionalDependency) was not installed correctly! Check the Travis build log for errors.'
);
}
}
type INotificationCallback = (
args: { response: string | null; activationType: 'replied' | 'clicked' },
args: { response: string | null; activationType: 'replied' | 'clicked' }
) => any;
type INotificationOptions = {
@ -29,7 +34,7 @@ type INotificationOptions = {
tag?: string;
canReply?: boolean;
onActivate?: INotificationCallback;
}
};
class NativeNotifications {
_macNotificationsByTag = {};
@ -127,7 +132,7 @@ class NativeNotifications {
body,
tag,
canReply,
onActivate = args => { },
onActivate = args => {},
}: INotificationOptions = {}) {
let notif = null;

View file

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 71 KiB