mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-22 00:06:06 +08:00
fix(dev-mode): Don’t save to config.json, use flag instead
Turns out even the built, packaged version of the app can be restarted into dev mode by adding `—dev` to argv and using the new relaunch API.
This commit is contained in:
parent
08128e3dc6
commit
4eeb808976
|
@ -13,8 +13,6 @@ class ApplicationMenu
|
|||
@setActiveTemplate(@getDefaultTemplate())
|
||||
global.application.autoUpdateManager.on 'state-changed', (state) =>
|
||||
@updateAutoupdateMenuItem(state)
|
||||
global.application.config.observe 'devMode', (state) =>
|
||||
@updateDevModeItem()
|
||||
|
||||
# Public: Updates the entire menu with the given keybindings.
|
||||
#
|
||||
|
|
|
@ -319,17 +319,20 @@ export default class Application extends EventEmitter {
|
|||
});
|
||||
|
||||
this.on('application:install-update', () => {
|
||||
this.quitting = true
|
||||
this.windowManager.cleanupBeforeAppQuit()
|
||||
this.autoUpdateManager.install()
|
||||
this.quitting = true;
|
||||
this.windowManager.cleanupBeforeAppQuit();
|
||||
this.autoUpdateManager.install();
|
||||
});
|
||||
|
||||
this.on('application:toggle-dev', () => {
|
||||
this.devMode = !this.devMode;
|
||||
this.config.set('devMode', this.devMode ? true : undefined);
|
||||
this.windowManager.destroyAllWindows();
|
||||
this.windowManager.devMode = this.devMode;
|
||||
this.openWindowsForTokenState();
|
||||
let args = process.argv.slice(1);
|
||||
if (args.includes('--dev')) {
|
||||
args = args.filter(a => a !== '--dev');
|
||||
} else {
|
||||
args.push('--dev')
|
||||
}
|
||||
app.relaunch({args});
|
||||
app.quit();
|
||||
});
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
|
|
|
@ -36,12 +36,7 @@ export default class WindowLauncher {
|
|||
}
|
||||
|
||||
newWindow(options) {
|
||||
// Normally, you enter dev mode by passing the --dev command line flag.
|
||||
// But for developers using the compiled app, it's easier to toggle dev
|
||||
// mode from the menu and have it persist through relaunch.
|
||||
const devOpt = this.config.get('devMode') ? {devMode: true} : {};
|
||||
|
||||
const opts = Object.assign({}, this.defaultWindowOpts, devOpt, options);
|
||||
const opts = Object.assign({}, this.defaultWindowOpts, options);
|
||||
|
||||
let win;
|
||||
if (this._mustUseColdWindow(opts)) {
|
||||
|
|
Loading…
Reference in a new issue