mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-24 16:14:01 +08:00
Provide a better recovery path after installing an invalid theme
This commit is contained in:
parent
cb311d32be
commit
5ae7e20514
2 changed files with 23 additions and 4 deletions
|
@ -503,9 +503,24 @@ export default class Application extends EventEmitter {
|
|||
}
|
||||
});
|
||||
|
||||
ipcMain.on('ensure-worker-window', () => {
|
||||
// TODO BG
|
||||
// this.windowManager.ensureWindow(WindowManager.MAIN_WINDOW)
|
||||
// Theme Error Handling
|
||||
|
||||
let userResetTheme = false;
|
||||
|
||||
ipcMain.on('encountered-theme-error', (event, { message, detail }) => {
|
||||
if (userResetTheme) return;
|
||||
|
||||
const buttonIndex = dialog.showMessageBox({
|
||||
type: 'warning',
|
||||
buttons: ['Reset Theme', 'Continue'],
|
||||
defaultId: 0,
|
||||
message,
|
||||
detail,
|
||||
});
|
||||
if (buttonIndex === 0) {
|
||||
userResetTheme = true;
|
||||
this.config.set('core.theme', '');
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.on('inline-style-parse', (event, { html, key }) => {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { ipcRenderer } from 'electron';
|
||||
import { Emitter } from 'event-kit';
|
||||
import path from 'path';
|
||||
import fs from 'fs-plus';
|
||||
|
@ -202,7 +203,10 @@ export default class ThemeManager {
|
|||
}
|
||||
console.error(message, { detail, dismissable: true });
|
||||
console.error(detail);
|
||||
throw error;
|
||||
|
||||
ipcRenderer.send('encountered-theme-error', { message, detail });
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue