Fix a few stray references to BrowserWindow

This commit is contained in:
Ben Gotow 2022-08-08 20:30:24 -05:00
parent ad30bcf641
commit c6f5a164ec
2 changed files with 14 additions and 9 deletions

View file

@ -107,7 +107,7 @@ class PreferencesAccountDetails extends Component<
this.props.onAccountUpdated(this.props.account, this.state.account); this.props.onAccountUpdated(this.props.account, this.state.account);
}; };
_setState = (updates, callback = () => { }) => { _setState = (updates, callback = () => {}) => {
const account = Object.assign(this.state.account.clone(), updates); const account = Object.assign(this.state.account.clone(), updates);
this.setState({ account }, callback); this.setState({ account }, callback);
}; };
@ -169,20 +169,20 @@ class PreferencesAccountDetails extends Component<
ipcRenderer.send('command', 'application:show-contacts', {}); ipcRenderer.send('command', 'application:show-contacts', {});
}; };
_onSetColor = (colorChanged) => { _onSetColor = colorChanged => {
// TODO: Ensure that the account color is updated in all places where it is displayed: // TODO: Ensure that the account color is updated in all places where it is displayed:
// - internal_packages/composer/lib/account-contict-field.tsx // - internal_packages/composer/lib/account-contict-field.tsx
// - internal_packages/contacts/lib/ContactsList.tsx // - internal_packages/contacts/lib/ContactsList.tsx
// - internal_packages/preferecnes/lib/preferences-account-list.tsx // - internal_packages/preferecnes/lib/preferences-account-list.tsx
// - internal/packages/thread-list/lib/thread-lib-participants.tsx // - internal/packages/thread-list/lib/thread-lib-participants.tsx
// - src/components/outline-view.tsx // - src/components/outline-view.tsx
this._setState(colorChanged) this._setState(colorChanged);
} };
_onResetColor = () => { _onResetColor = () => {
this.state.account.color = ''; this.state.account.color = '';
this._saveChanges(); this._saveChanges();
} };
_onContactSupport = () => { _onContactSupport = () => {
shell.openExternal('https://support.getmailspring.com/hc/en-us/requests/new'); shell.openExternal('https://support.getmailspring.com/hc/en-us/requests/new');
@ -216,7 +216,7 @@ class PreferencesAccountDetails extends Component<
AppEnv.showErrorDialog({ title: 'Error', message: `Could not retrieve sync logs. ${err}` }); AppEnv.showErrorDialog({ title: 'Error', message: `Could not retrieve sync logs. ${err}` });
return; return;
} }
const { BrowserWindow } = require('electron'); const { BrowserWindow } = require('@electron/remote');
const win = new BrowserWindow({ const win = new BrowserWindow({
width: 800, width: 800,
height: 600, height: 600,

View file

@ -105,7 +105,7 @@ export class MailsyncProcess extends EventEmitter {
_showStatusWindow(mode) { _showStatusWindow(mode) {
if (this._win) return; if (this._win) return;
const { BrowserWindow } = require('electron'); const { BrowserWindow } = require('@electron/remote');
this._win = new BrowserWindow({ this._win = new BrowserWindow({
width: 350, width: 350,
height: 108, height: 108,
@ -117,7 +117,12 @@ export class MailsyncProcess extends EventEmitter {
maximizable: false, maximizable: false,
closable: false, closable: false,
fullscreenable: false, fullscreenable: false,
webPreferences: { nodeIntegration: false, javascript: false, contextIsolation: false, enableRemoteModule: true }, webPreferences: {
nodeIntegration: false,
javascript: false,
contextIsolation: false,
enableRemoteModule: true,
},
}); });
this._win.setContentSize(350, 90); this._win.setContentSize(350, 90);
this._win.once('ready-to-show', () => { this._win.once('ready-to-show', () => {
@ -330,7 +335,7 @@ export class MailsyncProcess extends EventEmitter {
console.log(`Sending to mailsync ${this.account ? this.account.id : '?'}`, json); console.log(`Sending to mailsync ${this.account ? this.account.id : '?'}`, json);
const msg = `${JSON.stringify(json)}\n`; const msg = `${JSON.stringify(json)}\n`;
try { try {
this._proc.stdin.write(msg, 'UTF8'); this._proc.stdin.write(msg, 'utf-8');
} catch (error) { } catch (error) {
if (error && error.message.includes('socket has been ended')) { if (error && error.message.includes('socket has been ended')) {
// The process probably already exited and we missed it somehow, // The process probably already exited and we missed it somehow,