Skip to content

Commit 3dbe5cc

Browse files
committed
fix(Service): Apply Google login fix for all services
1 parent ad3bb11 commit 3dbe5cc

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/models/ServiceBrowserView.ts

+13
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { IPC } from '../features/todos/constants';
1313
import { getRecipeDirectory, loadRecipeConfig } from '../helpers/recipe-helpers';
1414
import { isMac } from '../environment';
1515
import { isValidExternalURL } from '../helpers/url-helpers';
16+
import userAgent from '../helpers/userAgent-helpers';
1617

1718
const debug = require('debug')('Franz:Models:ServiceBrowserView');
1819

@@ -220,6 +221,8 @@ export class ServiceBrowserView {
220221
});
221222

222223
this.webContents.on('will-navigate', (...args) => {
224+
this.gmailLoginHack(args[1]);
225+
223226
if (typeof this.recipe.eventWillNavigate === 'function') {
224227
this.recipe.eventWillNavigate(this, ...args);
225228
}
@@ -228,6 +231,8 @@ export class ServiceBrowserView {
228231
this.webContents.on('did-navigate', (...args) => {
229232
didLoad(true);
230233

234+
this.gmailLoginHack(args[1]);
235+
231236
if (typeof this.recipe.eventDidLoad === 'function') {
232237
this.recipe.eventDidLoad(this, ...args);
233238
}
@@ -484,6 +489,14 @@ export class ServiceBrowserView {
484489
}
485490
}
486491

492+
gmailLoginHack(url) {
493+
if (url.startsWith('https://accounts.google.com')) {
494+
this.webContents.setUserAgent(userAgent(true));
495+
} else {
496+
this.webContents.setUserAgent(userAgent(false));
497+
}
498+
}
499+
487500
get webContents() {
488501
return this.view.webContents;
489502
}

0 commit comments

Comments
 (0)