@@ -178,6 +178,8 @@ define(function (require, exports, module) {
178178 updateScheduled = true ;
179179 updatePendingRestart = true ;
180180 cachedUpdateDetails = updateDetails ;
181+ // Store in shared state so other windows know update is scheduled
182+ await window . electronAPI . setUpdateScheduled ( true ) ;
181183 showOrHideUpdateIcon ( ) ;
182184 Metrics . countEvent ( Metrics . EVENT_TYPE . UPDATES , 'scheduled' , Phoenix . platform ) ;
183185 updateTask . setSucceded ( ) ;
@@ -313,6 +315,8 @@ define(function (require, exports, module) {
313315 if ( ! updateScheduled ) {
314316 return ;
315317 }
318+ // Clear the scheduled flag in shared state
319+ await window . electronAPI . setUpdateScheduled ( false ) ;
316320 console . log ( "Installing update at quit time" ) ;
317321 return new Promise ( resolve => {
318322 let dialog ;
@@ -442,7 +446,7 @@ define(function (require, exports, module) {
442446 } ) ;
443447 }
444448
445- AppInit . appReady ( function ( ) {
449+ AppInit . appReady ( async function ( ) {
446450 if ( ! window . __ELECTRON__ || Phoenix . isTestWindow ) {
447451 return ;
448452 }
@@ -451,6 +455,29 @@ define(function (require, exports, module) {
451455 console . error ( "App updates not yet implemented on this platform in Electron builds!" ) ;
452456 return ;
453457 }
458+ // Check if another window already scheduled an update (multi-window state persistence)
459+ // This ensures the quit handler is registered in this window too
460+ try {
461+ const isUpdateScheduled = await window . electronAPI . getUpdateScheduled ( ) ;
462+ if ( isUpdateScheduled ) {
463+ updateScheduled = true ;
464+ updatePendingRestart = true ;
465+ // Create task in success state (update ready, waiting for restart)
466+ updateTask = TaskManager . addNewTask ( Strings . UPDATE_DONE , Strings . UPDATE_RESTART_INSTALL ,
467+ `<i class="fa-solid fa-cogs"></i>` , {
468+ noSpinnerNotification : true ,
469+ onSelect : function ( ) {
470+ Dialogs . showInfoDialog ( Strings . UPDATE_READY_RESTART_TITLE ,
471+ Strings . UPDATE_READY_RESTART_INSTALL_MESSAGE ) ;
472+ }
473+ } ) ;
474+ updateTask . setSucceded ( ) ;
475+ Phoenix . app . registerQuitTimeAppUpdateHandler ( quitTimeAppUpdateHandler ) ;
476+ console . log ( "Update was scheduled in another window, registering quit handler" ) ;
477+ }
478+ } catch ( e ) {
479+ console . error ( "Error checking shared state for update state:" , e ) ;
480+ }
454481 $ ( "#update-notification" ) . click ( ( ) => {
455482 checkForUpdates ( ) ;
456483 } ) ;
0 commit comments