Add enableAutoUpdater to buildConfig
This commit is contained in:
@@ -24,6 +24,7 @@ const buildConfig = {
|
||||
],
|
||||
helpLink: 'https://about.mattermost.com/default-desktop-app-documentation/',
|
||||
enableServerManagement: true,
|
||||
enableAutoUpdater: true,
|
||||
};
|
||||
|
||||
export default buildConfig;
|
||||
|
25
src/main.js
25
src/main.js
@@ -26,6 +26,7 @@ import {protocols} from '../electron-builder.json';
|
||||
|
||||
import CriticalErrorHandler from './main/CriticalErrorHandler';
|
||||
import {upgradeAutoLaunch} from './main/autoLaunch';
|
||||
import buildConfig from './common/config/buildConfig';
|
||||
|
||||
const criticalErrorHandler = new CriticalErrorHandler();
|
||||
|
||||
@@ -636,18 +637,20 @@ app.on('ready', () => {
|
||||
permissionManager = new PermissionManager(permissionFile, trustedURLs);
|
||||
session.defaultSession.setPermissionRequestHandler(permissionRequestHandler(mainWindow, permissionManager));
|
||||
|
||||
const updaterConfig = autoUpdater.loadConfig(path.resolve(app.getAppPath(), '../app-updater-config.json'));
|
||||
autoUpdater.initialize(appState, mainWindow, updaterConfig.isNotifyOnly());
|
||||
ipcMain.on('check-for-updates', autoUpdater.checkForUpdates);
|
||||
mainWindow.once('show', () => {
|
||||
if (autoUpdater.shouldCheckForUpdatesOnStart(appState.updateCheckedDate)) {
|
||||
ipcMain.emit('check-for-updates');
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
if (buildConfig.enableAutoUpdater) {
|
||||
const updaterConfig = autoUpdater.loadConfig(path.resolve(app.getAppPath(), '../app-updater-config.json'));
|
||||
autoUpdater.initialize(appState, mainWindow, updaterConfig.isNotifyOnly());
|
||||
ipcMain.on('check-for-updates', autoUpdater.checkForUpdates);
|
||||
mainWindow.once('show', () => {
|
||||
if (autoUpdater.shouldCheckForUpdatesOnStart(appState.updateCheckedDate)) {
|
||||
ipcMain.emit('check-for-updates');
|
||||
}, autoUpdater.INTERVAL_48_HOURS_IN_MS);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
ipcMain.emit('check-for-updates');
|
||||
}, autoUpdater.INTERVAL_48_HOURS_IN_MS);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Open the DevTools.
|
||||
// mainWindow.openDevTools();
|
||||
|
@@ -230,12 +230,15 @@ function createTemplate(mainWindow, config, isDev) {
|
||||
submenu.push({
|
||||
label: `Version ${app.getVersion()}`,
|
||||
enabled: false,
|
||||
}, {
|
||||
label: 'Check for Updates...',
|
||||
click() {
|
||||
ipcMain.emit('check-for-updates', true);
|
||||
},
|
||||
});
|
||||
if (buildConfig.enableAutoUpdater) {
|
||||
submenu.push({
|
||||
label: 'Check for Updates...',
|
||||
click() {
|
||||
ipcMain.emit('check-for-updates', true);
|
||||
},
|
||||
});
|
||||
}
|
||||
template.push({label: '&Help', submenu});
|
||||
return template;
|
||||
}
|
||||
|
Reference in New Issue
Block a user