This repository has been archived by the owner on Mar 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #651 from OpenBazaar/fixAutoUpdate
Patch for Auto Update
- Loading branch information
Showing
9 changed files
with
171 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import $ from 'jquery'; | ||
import { ipcRenderer } from 'electron'; | ||
import app from '../app'; | ||
import Dialog from '../views/modals/Dialog'; | ||
|
||
let statusMsg; | ||
let removeStatusMsgTimout; | ||
|
||
export function showUpdateStatus(status = '', type = 'message') { | ||
clearTimeout(removeStatusMsgTimout); | ||
|
||
if (!statusMsg) { | ||
statusMsg = app.statusBar.pushMessage({ | ||
msg: status, | ||
type, | ||
duration: 9999999999, | ||
}); | ||
} else { | ||
statusMsg.update(status); | ||
} | ||
|
||
// updates may arrive multiple times, manually remove the message when no new message | ||
// arrives for 6 seconds | ||
removeStatusMsgTimout = setTimeout(() => { | ||
statusMsg.remove(); | ||
statusMsg = null; | ||
}, 6000); | ||
|
||
return statusMsg; | ||
} | ||
|
||
let updateReadyDialog; | ||
|
||
export function updateReady(opts = {}) { | ||
if (updateReadyDialog) updateReadyDialog.close(); | ||
|
||
let displayData = ''; | ||
$.each(opts, (key, val) => { | ||
displayData += `<b>${key}:</b> <br>${val}<br>`; | ||
}); | ||
|
||
updateReadyDialog = new Dialog({ | ||
title: app.polyglot.t('update.ready.title'), | ||
message: `${app.polyglot.t('update.ready.msg')}<br><br>${displayData}`, | ||
buttons: [{ | ||
text: app.polyglot.t('update.install'), | ||
fragment: 'installUpdate', | ||
}, { | ||
text: app.polyglot.t('update.cancel'), | ||
fragment: 'cancelInstall', | ||
}], | ||
}).on('click-installUpdate', () => ipcRenderer.send('installUpdate')) | ||
.on('click-cancelInstall', () => updateReadyDialog.close()) | ||
.render() | ||
.open(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters