@@ -13,6 +13,7 @@ import { IPC } from '../features/todos/constants';
13
13
import { getRecipeDirectory , loadRecipeConfig } from '../helpers/recipe-helpers' ;
14
14
import { isMac } from '../environment' ;
15
15
import { isValidExternalURL } from '../helpers/url-helpers' ;
16
+ import userAgent from '../helpers/userAgent-helpers' ;
16
17
17
18
const debug = require ( 'debug' ) ( 'Franz:Models:ServiceBrowserView' ) ;
18
19
@@ -220,6 +221,8 @@ export class ServiceBrowserView {
220
221
} ) ;
221
222
222
223
this . webContents . on ( 'will-navigate' , ( ...args ) => {
224
+ this . gmailLoginHack ( args [ 1 ] ) ;
225
+
223
226
if ( typeof this . recipe . eventWillNavigate === 'function' ) {
224
227
this . recipe . eventWillNavigate ( this , ...args ) ;
225
228
}
@@ -228,6 +231,8 @@ export class ServiceBrowserView {
228
231
this . webContents . on ( 'did-navigate' , ( ...args ) => {
229
232
didLoad ( true ) ;
230
233
234
+ this . gmailLoginHack ( args [ 1 ] ) ;
235
+
231
236
if ( typeof this . recipe . eventDidLoad === 'function' ) {
232
237
this . recipe . eventDidLoad ( this , ...args ) ;
233
238
}
@@ -484,6 +489,14 @@ export class ServiceBrowserView {
484
489
}
485
490
}
486
491
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
+
487
500
get webContents ( ) {
488
501
return this . view . webContents ;
489
502
}
0 commit comments