Skip to content

Commit

Permalink
Merge branch 'development' of https://github.com/whitewhidow/quest-si…
Browse files Browse the repository at this point in the history
…denoder into main
  • Loading branch information
whitewhidow committed Dec 10, 2020
2 parents 0cca28b + 4ef600c commit 2a84ff1
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
15 changes: 15 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@ global.installedApps = []
const pkg = require('./package.json');
global.version = pkg.version

async function checkVersion() {
var fetch = require('node-fetch')
var compareVersions = require('compare-versions');
content = await fetch("https://api.github.com/repos/whitewhidow/quest-sidenoder/releases/latest")
remoteversion = JSON.parse(await content.text()).name;
console.log("Current version: "+pkg.version);
console.log("Github version: "+remoteversion);
if (compareVersions.compare(remoteversion, pkg.version, '=')) {
console.log("Using latest version");
} else {
console.log("requires update");
win.webContents.send('notify_update',{success:true, current: pkg.version, remote: remoteversion});
}
}


// if (pkg.version !== latestVersion) {
Expand Down Expand Up @@ -192,6 +206,7 @@ function createWindow () {

//tools.checkUpdateAvailable()

setTimeout(function(){ checkVersion(); }, 2000);
//

}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "sidenoder",
"version": "0.0.5-alpha",
"version": "0.0.6-alpha",
"description": "SideNoder",
"main": "main.js",
"dependencies": {
"adbkit": "^2.11.1",
"command-exists": "^1.2.9",
"compare-versions": "^3.6.0",
"electron-squirrel-startup": "^1.0.0",
"electron-twig": "^1.1.1",
"fix-path": "^3.0.0",
Expand Down
26 changes: 26 additions & 0 deletions views/layout.twig
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
<script>
const { ipcRenderer } = require('electron')
ipcRenderer.on('notify_update', (event, arg) => {
console.log("notify_update msg came ! ");
$('#updateModal').modal('show');
$("#updateModal > div > div > div.modal-body").html(`<b>sidenoder-${arg.remote}<b> is now available on github.<br><br>Please visit https://github.com/whitewhidow/quest-sidenoder/releases`)
});
ipcRenderer.on('ask_sideload', (event, arg) => {
console.log("ask_sideload msg came ! ");
console.log(arg)
Expand Down Expand Up @@ -388,6 +394,26 @@
</div>


<div class="modal fade" id="updateModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel"><i class="fa fa-upload" aria-hidden="true"></i> Update available</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
An update is available on github.
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">I Understand</button>
</div>
</div>
</div>
</div>




<!--
Expand Down

0 comments on commit 2a84ff1

Please sign in to comment.