File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ const updateOverlay_el = document . getElementById ( 'updateOverlay' ) ;
2+ const startUpdateButton_el = document . getElementById ( 'startUpdateButton' ) ;
3+ const quitUpdateButton_el = document . getElementById ( 'quitUpdateButton' ) ;
4+ const updateControlDiv_el = document . getElementById ( 'updateControlDiv' ) ;
5+
16api . autoUpdaterCallback ( ( status ) => {
27 console . log ( status ) ;
8+ if ( status === 'Update Available' ) {
9+ updateOverlay_el . style . display = 'flex' ;
10+ }
11+ if ( status === 'Update Downloaded' ) {
12+ updateControlDiv_el . style . display = 'grid' ;
13+ }
14+ } ) ;
15+
16+ startUpdateButton_el . addEventListener ( 'click' , ( ) => {
17+ api . restartAndUpdate ( ) ;
18+ } ) ;
19+
20+ quitUpdateButton_el . addEventListener ( 'click' , ( ) => {
21+ api . closeApp ( ) ;
322} ) ;
Original file line number Diff line number Diff line change 77 < link rel ="stylesheet " href ="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css ">
88 </ head >
99 < body >
10+ < div id ="updateOverlay " class ="overlay " style ="display: none; ">
11+ < div class ="stop-container " style ="text-align: center; ">
12+ < div style ="display: grid ">
13+ < h2 > Update Available!</ h2 >
14+ </ div >
15+ < div id ="updateControlDiv " style ="display: none; grid-template-columns: 1fr 1fr; grid-gap: 5px; ">
16+ < button id ="startUpdateButton " class ="input-button "> Update</ button >
17+ < button id ="quitUpdateButton " class ="input-button "> Quit</ button >
18+ </ div >
19+ </ div >
20+ </ div >
21+
22+
1023 < div id ="loopbackOverlay " class ="overlay " style ="display: none; ">
1124 < div class ="loopback-container " style ="text-align: center; ">
1225 < div style ="display: grid ">
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ const createWindow = () => {
5252 owner : 'programmingKyle' ,
5353 repo : 'zerocraft-sync' ,
5454 } ) ;
55- autoUpdater . checkForUpdates ( ) ;
55+ autoUpdater . checkForUpdatesAndNotify ( ) ;
5656 }
5757 } ) ;
5858} ;
@@ -89,7 +89,11 @@ autoUpdater.on('update-not-available', () => {
8989
9090autoUpdater . on ( 'update-downloaded' , ( ) => {
9191 mainWindow . webContents . send ( 'auto-updater-callback' , 'Update Downloaded' ) ;
92- ensureSafeQuitAndInstall ( )
92+ //ensureSafeQuitAndInstall();
93+ } ) ;
94+
95+ ipcMain . handle ( 'restart-and-update' , ( ) => {
96+ ensureSafeQuitAndInstall ( ) ;
9397} ) ;
9498
9599function ensureSafeQuitAndInstall ( ) {
Original file line number Diff line number Diff line change @@ -27,4 +27,6 @@ contextBridge.exposeInMainWorld('api', {
2727 callback ( status ) ;
2828 } ) ;
2929 } ,
30+
31+ restartAndUpdate : ( ) => ipcRenderer . invoke ( 'restart-and-update' ) ,
3032} ) ;
You can’t perform that action at this time.
0 commit comments