mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-06 08:08:10 +08:00
fix(win): windows can re-launch with/without dev mode flag
Fixes https://github.com/nylas/N1/issues/2142
This commit is contained in:
parent
335a20aabb
commit
ae81f8f7c6
3 changed files with 18 additions and 12 deletions
|
@ -44,20 +44,20 @@ export default class Application extends EventEmitter {
|
||||||
|
|
||||||
this.temporaryInitializeDisabledPackages();
|
this.temporaryInitializeDisabledPackages();
|
||||||
|
|
||||||
// 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.
|
|
||||||
if (this.config.get('devMode')) {
|
|
||||||
this.devMode = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
let initializeInBackground = options.background;
|
let initializeInBackground = options.background;
|
||||||
if (initializeInBackground === undefined) {
|
if (initializeInBackground === undefined) {
|
||||||
initializeInBackground = false;
|
initializeInBackground = false;
|
||||||
}
|
}
|
||||||
this.autoUpdateManager = new AutoUpdateManager(version, config, specMode);
|
this.autoUpdateManager = new AutoUpdateManager(version, config, specMode);
|
||||||
this.applicationMenu = new ApplicationMenu(version);
|
this.applicationMenu = new ApplicationMenu(version);
|
||||||
this.windowManager = new WindowManager({resourcePath, configDirPath, config, devMode, safeMode, initializeInBackground});
|
this.windowManager = new WindowManager({
|
||||||
|
resourcePath: this.resourcePath,
|
||||||
|
configDirPath: this.configDirPath,
|
||||||
|
config: this.config,
|
||||||
|
devMode: this.devMode,
|
||||||
|
safeMode: this.safeMode,
|
||||||
|
initializeInBackground: initializeInBackground,
|
||||||
|
});
|
||||||
this.systemTrayManager = new SystemTrayManager(process.platform, this);
|
this.systemTrayManager = new SystemTrayManager(process.platform, this);
|
||||||
this._databasePhase = 'setup';
|
this._databasePhase = 'setup';
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ const DEBUG_SHOW_HOT_WINDOW = false;
|
||||||
export default class WindowLauncher {
|
export default class WindowLauncher {
|
||||||
static EMPTY_WINDOW = "emptyWindow"
|
static EMPTY_WINDOW = "emptyWindow"
|
||||||
|
|
||||||
constructor({devMode, safeMode, resourcePath, configDirPath, onCreatedHotWindow}) {
|
constructor({devMode, safeMode, resourcePath, configDirPath, onCreatedHotWindow, config}) {
|
||||||
this.defaultWindowOpts = {
|
this.defaultWindowOpts = {
|
||||||
frame: process.platform !== "darwin",
|
frame: process.platform !== "darwin",
|
||||||
hidden: false,
|
hidden: false,
|
||||||
|
@ -28,12 +28,18 @@ export default class WindowLauncher {
|
||||||
resourcePath: resourcePath,
|
resourcePath: resourcePath,
|
||||||
configDirPath: configDirPath,
|
configDirPath: configDirPath,
|
||||||
}
|
}
|
||||||
|
this.config = config;
|
||||||
this.onCreatedHotWindow = onCreatedHotWindow;
|
this.onCreatedHotWindow = onCreatedHotWindow;
|
||||||
this.createHotWindow();
|
this.createHotWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
newWindow(options) {
|
newWindow(options) {
|
||||||
const opts = Object.assign({}, this.defaultWindowOpts, 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);
|
||||||
|
|
||||||
let win;
|
let win;
|
||||||
if (this._mustUseColdWindow(opts)) {
|
if (this._mustUseColdWindow(opts)) {
|
||||||
|
|
|
@ -9,7 +9,7 @@ const ONBOARDING_WINDOW = "onboarding"
|
||||||
|
|
||||||
export default class WindowManager {
|
export default class WindowManager {
|
||||||
|
|
||||||
constructor({devMode, safeMode, resourcePath, configDirPath, initializeInBackground}) {
|
constructor({devMode, safeMode, resourcePath, configDirPath, initializeInBackground, config}) {
|
||||||
this.initializeInBackground = initializeInBackground;
|
this.initializeInBackground = initializeInBackground;
|
||||||
this._windows = {};
|
this._windows = {};
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ export default class WindowManager {
|
||||||
this._registerWindow(win);
|
this._registerWindow(win);
|
||||||
this._didCreateNewWindow(win);
|
this._didCreateNewWindow(win);
|
||||||
}
|
}
|
||||||
this.windowLauncher = new WindowLauncher({devMode, safeMode, resourcePath, configDirPath, onCreatedHotWindow});
|
this.windowLauncher = new WindowLauncher({devMode, safeMode, resourcePath, configDirPath, config, onCreatedHotWindow});
|
||||||
}
|
}
|
||||||
|
|
||||||
get(windowKey) {
|
get(windowKey) {
|
||||||
|
|
Loading…
Reference in a new issue