@@ -64,9 +64,9 @@ let microbreakWins = null
6464let breakWins = null
6565let preferencesWin = null
6666let welcomeWin = null
67- let contributorPreferencesWindow = null
68- let syncPreferencesWindow = null
69- let myStretchlyWindow = null
67+ let contributorPreferencesWin = null
68+ let syncPreferencesWin = null
69+ let myStretchlyWin = null
7070let settings
7171let pausedForSuspendOrLock = false
7272let nextIdea = null
@@ -297,8 +297,8 @@ async function initialize (isAppStart = true) {
297297 if ( welcomeWin ) {
298298 welcomeWin . webContents . send ( 'renderSettings' , await settingsToSend ( ) )
299299 }
300- if ( contributorPreferencesWindow ) {
301- contributorPreferencesWindow . webContents . send ( 'renderSettings' , await settingsToSend ( ) )
300+ if ( contributorPreferencesWin ) {
301+ contributorPreferencesWin . webContents . send ( 'renderSettings' , await settingsToSend ( ) )
302302 }
303303 globalShortcut . unregisterAll ( )
304304
@@ -544,7 +544,8 @@ function startProcessWin () {
544544 planVersionCheck ( )
545545 return
546546 }
547- const modalPath = join ( 'file://' , __dirname , '/process.html' )
547+ const modalPath = 'file://' + join ( __dirname , '/process.html' )
548+
548549 processWin = new BrowserWindow ( {
549550 show : false ,
550551 backgroundThrottling : false ,
@@ -553,15 +554,15 @@ function startProcessWin () {
553554 sandbox : false
554555 }
555556 } )
556- processWin . loadURL ( modalPath )
557- processWin . once ( 'ready-to-show' , ( ) => {
557+ processWin . webContents . loadURL ( modalPath )
558+ processWin . webContents . once ( 'ready-to-show' , ( ) => {
558559 planVersionCheck ( )
559560 } )
560561}
561562
562563function createWelcomeWindow ( isAppStart = true ) {
563564 if ( settings . get ( 'isFirstRun' ) && isAppStart ) {
564- const modalPath = join ( 'file://' , __dirname , '/welcome.html' )
565+ const modalPath = 'file://' + join ( __dirname , '/welcome.html' )
565566 welcomeWin = new BrowserWindow ( {
566567 x : displaysX ( - 1 , 1000 ) ,
567568 y : displaysY ( - 1 , 750 ) ,
@@ -575,9 +576,9 @@ function createWelcomeWindow (isAppStart = true) {
575576 sandbox : false
576577 }
577578 } )
578- welcomeWin . loadURL ( modalPath )
579+ welcomeWin . webContents . loadURL ( modalPath )
579580 if ( welcomeWin ) {
580- welcomeWin . on ( 'closed' , ( ) => {
581+ welcomeWin . webContents . on ( 'closed' , ( ) => {
581582 welcomeWin = null
582583 } )
583584 }
@@ -588,12 +589,12 @@ function createWelcomeWindow (isAppStart = true) {
588589}
589590
590591function createContributorSettingsWindow ( ) {
591- if ( contributorPreferencesWindow ) {
592- contributorPreferencesWindow . show ( )
592+ if ( contributorPreferencesWin ) {
593+ contributorPreferencesWin . show ( )
593594 return
594595 }
595- const modalPath = join ( 'file://' , __dirname , '/contributor-preferences.html' )
596- contributorPreferencesWindow = new BrowserWindow ( {
596+ const modalPath = 'file://' + join ( __dirname , '/contributor-preferences.html' )
597+ contributorPreferencesWin = new BrowserWindow ( {
597598 x : displaysX ( - 1 , 735 ) ,
598599 y : displaysY ( ) ,
599600 width : 735 ,
@@ -605,25 +606,25 @@ function createContributorSettingsWindow () {
605606 sandbox : false
606607 }
607608 } )
608- contributorPreferencesWindow . loadURL ( modalPath )
609- if ( contributorPreferencesWindow ) {
610- contributorPreferencesWindow . on ( 'closed' , ( ) => {
611- contributorPreferencesWindow = null
609+ contributorPreferencesWin . webContents . loadURL ( modalPath )
610+ if ( contributorPreferencesWin ) {
611+ contributorPreferencesWin . webContents . on ( 'closed' , ( ) => {
612+ contributorPreferencesWin = null
612613 } )
613614 }
614615 setTimeout ( ( ) => {
615- contributorPreferencesWindow . center ( )
616+ contributorPreferencesWin . center ( )
616617 } , 0 )
617618}
618619
619620function createSyncPreferencesWindow ( ) {
620- if ( syncPreferencesWindow ) {
621- syncPreferencesWindow . show ( )
621+ if ( syncPreferencesWin ) {
622+ syncPreferencesWin . show ( )
622623 return
623624 }
624625
625626 const syncPreferencesUrl = 'https://my.stretchly.net/app/v1/sync'
626- syncPreferencesWindow = new BrowserWindow ( {
627+ syncPreferencesWin = new BrowserWindow ( {
627628 autoHideMenuBar : true ,
628629 width : 1000 ,
629630 height : 700 ,
@@ -636,16 +637,16 @@ function createSyncPreferencesWindow () {
636637 sandbox : false
637638 }
638639 } )
639- syncPreferencesWindow . webContents . openDevTools ( )
640- syncPreferencesWindow . loadURL ( syncPreferencesUrl )
641- if ( syncPreferencesWindow ) {
642- syncPreferencesWindow . on ( 'closed' , ( ) => {
643- syncPreferencesWindow = null
640+ syncPreferencesWin . webContents . openDevTools ( )
641+ syncPreferencesWin . webContents . loadURL ( syncPreferencesUrl )
642+ if ( syncPreferencesWin ) {
643+ syncPreferencesWin . webContents . on ( 'closed' , ( ) => {
644+ syncPreferencesWin = null
644645 } )
645646 }
646647
647648 setTimeout ( ( ) => {
648- syncPreferencesWindow . center ( )
649+ syncPreferencesWin . center ( )
649650 } , 0 )
650651}
651652
@@ -713,7 +714,7 @@ function startMicrobreak () {
713714 breakPlanner . postponesNumber < postponesLimit && postponesLimit > 0
714715 const showBreaksAsRegularWindows = settings . get ( 'showBreaksAsRegularWindows' )
715716
716- const modalPath = join ( 'file://' , __dirname , '/microbreak.html' )
717+ const modalPath = 'file://' + join ( __dirname , '/microbreak.html' )
717718 microbreakWins = [ ]
718719
719720 const idea = nextIdea || ( settings . get ( 'ideas' ) ? microbreakIdeas . randomElement : [ '' ] )
@@ -862,7 +863,7 @@ function startBreak () {
862863 breakPlanner . postponesNumber < postponesLimit && postponesLimit > 0
863864 const showBreaksAsRegularWindows = settings . get ( 'showBreaksAsRegularWindows' )
864865
865- const modalPath = join ( 'file://' , __dirname , '/break.html' )
866+ const modalPath = 'file://' + join ( __dirname , '/break.html' )
866867 breakWins = [ ]
867868
868869 const defaultNextIdea = settings . get ( 'ideas' ) ? breakIdeas . randomElement : [ '' , '' ]
@@ -1160,7 +1161,7 @@ function createPreferencesWindow () {
11601161 preferencesWin . show ( )
11611162 return
11621163 }
1163- const modalPath = join ( 'file://' , __dirname , '/preferences.html' )
1164+ const modalPath = 'file://' + join ( __dirname , '/preferences.html' )
11641165 const maxHeight = screen
11651166 . getDisplayNearestPoint ( screen . getCursorScreenPoint ( ) )
11661167 . workAreaSize . height * 0.9
@@ -1178,8 +1179,8 @@ function createPreferencesWindow () {
11781179 sandbox : false
11791180 }
11801181 } )
1181- preferencesWin . loadURL ( modalPath )
1182- preferencesWin . on ( 'closed' , ( ) => {
1182+ preferencesWin . webContents . loadURL ( modalPath )
1183+ preferencesWin . webContents . on ( 'closed' , ( ) => {
11831184 preferencesWin = null
11841185 } )
11851186 setTimeout ( ( ) => {
@@ -1546,12 +1547,12 @@ ipcMain.on('open-contributor-preferences', function () {
15461547} )
15471548
15481549ipcMain . on ( 'open-contributor-auth' , function ( event , provider ) {
1549- if ( myStretchlyWindow ) {
1550- myStretchlyWindow . show ( )
1550+ if ( myStretchlyWin ) {
1551+ myStretchlyWin . show ( )
15511552 return
15521553 }
15531554 const myStretchlyUrl = `https://my.stretchly.net/app/v1?provider=${ provider } `
1554- myStretchlyWindow = new BrowserWindow ( {
1555+ myStretchlyWin = new BrowserWindow ( {
15551556 autoHideMenuBar : false ,
15561557 width : 1000 ,
15571558 height : 700 ,
@@ -1564,15 +1565,15 @@ ipcMain.on('open-contributor-auth', function (event, provider) {
15641565 sandbox : false
15651566 }
15661567 } )
1567- myStretchlyWindow . webContents . openDevTools ( )
1568- myStretchlyWindow . loadURL ( myStretchlyUrl )
1569- if ( myStretchlyWindow ) {
1570- myStretchlyWindow . on ( 'closed' , ( ) => {
1571- myStretchlyWindow = null
1568+ myStretchlyWin . webContents . openDevTools ( )
1569+ myStretchlyWin . webContents . loadURL ( myStretchlyUrl )
1570+ if ( myStretchlyWin ) {
1571+ myStretchlyWin . webContents . on ( 'closed' , ( ) => {
1572+ myStretchlyWin = null
15721573 } )
15731574 }
15741575 setTimeout ( ( ) => {
1575- myStretchlyWindow . center ( )
1576+ myStretchlyWin . center ( )
15761577 } , 0 )
15771578} )
15781579
0 commit comments