Rename src/resource to src/assets
- `dist/resources` was not included in linux packages. - There were two "resources" directories. Close #360
@@ -78,18 +78,18 @@ Format the source codes to pass `npm test`.
|
|||||||
```
|
```
|
||||||
Mattermost Desktop
|
Mattermost Desktop
|
||||||
├── docs/ - Documentations.
|
├── docs/ - Documentations.
|
||||||
├── resources/ - Resources which are used outside of the application codes.
|
├── resources/ - Resources which are used outside of the application codes, and original images of assets.
|
||||||
├── scripts/ - Helper scripts.
|
├── scripts/ - Helper scripts.
|
||||||
├── src/ - Application source code.
|
├── src/ - Application source code.
|
||||||
|
│ ├── assets/ - Assets which are loaded from the application codes.
|
||||||
│ ├── browser/ - Implementation of Electron's renderer process.
|
│ ├── browser/ - Implementation of Electron's renderer process.
|
||||||
│ │ ├── components/ - React.js components.
|
│ │ ├── components/ - React.js components.
|
||||||
│ │ ├── css/ - Stylesheets.
|
│ │ ├── css/ - Stylesheets.
|
||||||
│ │ ├── js/ - Helper JavaScript modules.
|
│ │ ├── js/ - Helper JavaScript modules.
|
||||||
│ │ └── webview/ - Injection code for Electron's <webview> tag.
|
│ │ └── webview/ - Injection code for Electron's <webview> tag.
|
||||||
│ ├── common/ - Common JavaScript modules for both Electron's processes.
|
│ ├── common/ - Common JavaScript modules for both Electron's processes.
|
||||||
│ ├── main/ - Implementation of Electron's main process.
|
│ └── main/ - Implementation of Electron's main process.
|
||||||
│ │ └── menus/ - Application menu.
|
│ └── menus/ - Application menu.
|
||||||
│ └── resources/ - Resources which are loaded from the application codes.
|
|
||||||
└── test/ - Automated tests.
|
└── test/ - Automated tests.
|
||||||
├── modules/ - Scripts which are commonly used in tests.
|
├── modules/ - Scripts which are commonly used in tests.
|
||||||
└── specs/ - Test scripts.
|
└── specs/ - Test scripts.
|
||||||
|
12
gulpfile.js
@@ -68,11 +68,11 @@ gulp.task('build', ['sync-meta', 'copy'], (cb) => {
|
|||||||
fs.writeFile('./dist/package.json', JSON.stringify(distPackageJson, null, ' '), cb);
|
fs.writeFile('./dist/package.json', JSON.stringify(distPackageJson, null, ' '), cb);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('copy', ['copy:resources', 'copy:html/css', 'copy:modules']);
|
gulp.task('copy', ['copy:assets', 'copy:html/css', 'copy:modules']);
|
||||||
|
|
||||||
gulp.task('copy:resources', () => {
|
gulp.task('copy:assets', () => {
|
||||||
return gulp.src('src/resources/**').
|
return gulp.src('src/assets/**').
|
||||||
pipe(gulp.dest('dist/resources'));
|
pipe(gulp.dest('dist/assets'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('copy:html/css', () => {
|
gulp.task('copy:html/css', () => {
|
||||||
@@ -108,9 +108,9 @@ gulp.task('watch', ['build', 'webpack:main', 'webpack:renderer'], () => {
|
|||||||
|
|
||||||
gulp.watch(['src/main.js', 'src/main/**/*.js', 'src/common/**/*.js'], ['webpack:main']);
|
gulp.watch(['src/main.js', 'src/main/**/*.js', 'src/common/**/*.js'], ['webpack:main']);
|
||||||
gulp.watch(['src/browser/**/*.js', 'src/browser/**/*.jsx'], ['webpack:renderer']);
|
gulp.watch(['src/browser/**/*.js', 'src/browser/**/*.jsx'], ['webpack:renderer']);
|
||||||
gulp.watch(['src/browser/**/*.css', 'src/browser/**/*.html', 'src/resources/**/*.png'], ['copy']);
|
gulp.watch(['src/browser/**/*.css', 'src/browser/**/*.html', 'src/assets/**/*.png'], ['copy']);
|
||||||
|
|
||||||
gulp.watch(['dist/main.js', 'dist/resources/**'], () => {
|
gulp.watch(['dist/main.js', 'dist/assets/**'], () => {
|
||||||
electron.restart(options);
|
electron.restart(options);
|
||||||
});
|
});
|
||||||
gulp.watch(['dist/browser/*.js'], electron.reload);
|
gulp.watch(['dist/browser/*.js'], electron.reload);
|
||||||
|
Before Width: | Height: | Size: 124 KiB After Width: | Height: | Size: 124 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 836 B After Width: | Height: | Size: 836 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 440 B After Width: | Height: | Size: 440 B |
Before Width: | Height: | Size: 913 B After Width: | Height: | Size: 913 B |
Before Width: | Height: | Size: 520 B After Width: | Height: | Size: 520 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 480 B After Width: | Height: | Size: 480 B |
Before Width: | Height: | Size: 1023 B After Width: | Height: | Size: 1023 B |
Before Width: | Height: | Size: 487 B After Width: | Height: | Size: 487 B |
Before Width: | Height: | Size: 1002 B After Width: | Height: | Size: 1002 B |
Before Width: | Height: | Size: 522 B After Width: | Height: | Size: 522 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 497 B After Width: | Height: | Size: 497 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
@@ -3,7 +3,7 @@
|
|||||||
const OriginalNotification = Notification;
|
const OriginalNotification = Notification;
|
||||||
const {remote} = require('electron');
|
const {remote} = require('electron');
|
||||||
|
|
||||||
const appIconURL = `file:///${remote.app.getAppPath()}/resources/appicon.png`;
|
const appIconURL = `file:///${remote.app.getAppPath()}/assets/appicon.png`;
|
||||||
|
|
||||||
function override(eventHandlers) {
|
function override(eventHandlers) {
|
||||||
Notification = function constructor(title, options) { // eslint-disable-line no-global-assign, no-native-reassign
|
Notification = function constructor(title, options) { // eslint-disable-line no-global-assign, no-native-reassign
|
||||||
|
38
src/main.js
@@ -58,6 +58,8 @@ const appMenu = require('./main/menus/app');
|
|||||||
const trayMenu = require('./main/menus/tray');
|
const trayMenu = require('./main/menus/tray');
|
||||||
const allowProtocolDialog = require('./main/allowProtocolDialog');
|
const allowProtocolDialog = require('./main/allowProtocolDialog');
|
||||||
|
|
||||||
|
const assetsDir = path.resolve(app.getAppPath(), 'assets');
|
||||||
|
|
||||||
// Keep a global reference of the window object, if you don't, the window will
|
// Keep a global reference of the window object, if you don't, the window will
|
||||||
// be closed automatically when the JavaScript object is garbage collected.
|
// be closed automatically when the JavaScript object is garbage collected.
|
||||||
var mainWindow = null;
|
var mainWindow = null;
|
||||||
@@ -122,34 +124,36 @@ const trayImages = (() => {
|
|||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case 'win32':
|
case 'win32':
|
||||||
return {
|
return {
|
||||||
normal: nativeImage.createFromPath(path.resolve(__dirname, 'resources/windows/tray.ico')),
|
normal: nativeImage.createFromPath(path.resolve(assetsDir, 'windows/tray.ico')),
|
||||||
unread: nativeImage.createFromPath(path.resolve(__dirname, 'resources/windows/tray_unread.ico')),
|
unread: nativeImage.createFromPath(path.resolve(assetsDir, 'windows/tray_unread.ico')),
|
||||||
mention: nativeImage.createFromPath(path.resolve(__dirname, 'resources/windows/tray_mention.ico'))
|
mention: nativeImage.createFromPath(path.resolve(assetsDir, 'windows/tray_mention.ico'))
|
||||||
};
|
};
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
{
|
{
|
||||||
const icons = {
|
const icons = {
|
||||||
light: {
|
light: {
|
||||||
normal: nativeImage.createFromPath(path.resolve(__dirname, 'resources/osx/MenuIcon.png')),
|
normal: nativeImage.createFromPath(path.resolve(assetsDir, 'osx/MenuIcon.png')),
|
||||||
unread: nativeImage.createFromPath(path.resolve(__dirname, 'resources/osx/MenuIconUnread.png')),
|
unread: nativeImage.createFromPath(path.resolve(assetsDir, 'osx/MenuIconUnread.png')),
|
||||||
mention: nativeImage.createFromPath(path.resolve(__dirname, 'resources/osx/MenuIconMention.png'))
|
mention: nativeImage.createFromPath(path.resolve(assetsDir, 'osx/MenuIconMention.png'))
|
||||||
},
|
},
|
||||||
clicked: {
|
clicked: {
|
||||||
normal: nativeImage.createFromPath(path.resolve(__dirname, 'resources/osx/ClickedMenuIcon.png')),
|
normal: nativeImage.createFromPath(path.resolve(assetsDir, 'osx/ClickedMenuIcon.png')),
|
||||||
unread: nativeImage.createFromPath(path.resolve(__dirname, 'resources/osx/ClickedMenuIconUnread.png')),
|
unread: nativeImage.createFromPath(path.resolve(assetsDir, 'osx/ClickedMenuIconUnread.png')),
|
||||||
mention: nativeImage.createFromPath(path.resolve(__dirname, 'resources/osx/ClickedMenuIconMention.png'))
|
mention: nativeImage.createFromPath(path.resolve(assetsDir, 'osx/ClickedMenuIconMention.png'))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
switchMenuIconImages(icons, systemPreferences.isDarkMode());
|
switchMenuIconImages(icons, systemPreferences.isDarkMode());
|
||||||
return icons;
|
return icons;
|
||||||
}
|
}
|
||||||
case 'linux':
|
case 'linux':
|
||||||
var resourcesDir = 'resources/linux/' + (config.trayIconTheme || 'light') + '/';
|
{
|
||||||
return {
|
const theme = config.trayIconTheme || 'light';
|
||||||
normal: nativeImage.createFromPath(path.resolve(__dirname, resourcesDir + 'MenuIconTemplate.png')),
|
return {
|
||||||
unread: nativeImage.createFromPath(path.resolve(__dirname, resourcesDir + 'MenuIconUnreadTemplate.png')),
|
normal: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconTemplate.png')),
|
||||||
mention: nativeImage.createFromPath(path.resolve(__dirname, resourcesDir + 'MenuIconMentionTemplate.png'))
|
unread: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconUnreadTemplate.png')),
|
||||||
};
|
mention: nativeImage.createFromPath(path.resolve(assetsDir, 'linux', theme, 'MenuIconMentionTemplate.png'))
|
||||||
|
};
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@@ -346,7 +350,7 @@ app.on('ready', () => {
|
|||||||
// In current version, use tray balloon for notification
|
// In current version, use tray balloon for notification
|
||||||
if (osVersion.isLowerThanOrEqualWindows8_1()) {
|
if (osVersion.isLowerThanOrEqualWindows8_1()) {
|
||||||
trayIcon.displayBalloon({
|
trayIcon.displayBalloon({
|
||||||
icon: path.resolve(__dirname, 'resources/appicon.png'),
|
icon: path.resolve(assetsDir, 'appicon.png'),
|
||||||
title: arg.title,
|
title: arg.title,
|
||||||
content: arg.options.body
|
content: arg.options.body
|
||||||
});
|
});
|
||||||
@@ -394,7 +398,7 @@ app.on('ready', () => {
|
|||||||
windowOptions = {};
|
windowOptions = {};
|
||||||
}
|
}
|
||||||
if (process.platform === 'linux') {
|
if (process.platform === 'linux') {
|
||||||
windowOptions.icon = path.resolve(__dirname, 'resources/appicon.png');
|
windowOptions.icon = path.resolve(assetsDir, 'appicon.png');
|
||||||
}
|
}
|
||||||
windowOptions.title = app.getName();
|
windowOptions.title = app.getName();
|
||||||
mainWindow = new BrowserWindow(windowOptions);
|
mainWindow = new BrowserWindow(windowOptions);
|
||||||
|