Merge pull request #316 from Afinogen/check-update

add check new app version
pull/317/head
Konstantin Sharlaimov 7 years ago committed by GitHub
commit 35eb73e5cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2250,5 +2250,17 @@
}, },
"portColumnSensors": { "portColumnSensors": {
"message": "Sensors" "message": "Sensors"
},
"appUpdateNotificationHeader": {
"message": "New Configurator version available."
},
"appUpdateNotificationDescription": {
"message": "Please visit the <a href=\"https://github.com/iNavFlight/inav-configurator/releases\" target=\"_blank\">website</a> to read the release notes and download."
},
"closeUpdateBtn": {
"message": "Close"
},
"downloadUpdatesBtn": {
"message": "Download new app"
} }
} }

@ -97,7 +97,8 @@ sources.js = [
'./js/serial_queue.js', './js/serial_queue.js',
'./js/msp_balanced_interval.js', './js/msp_balanced_interval.js',
'./tabs/advanced_tuning.js', './tabs/advanced_tuning.js',
'./js/peripherals.js' './js/peripherals.js',
'./js/appUpdater.js'
]; ];
sources.mapCss = [ sources.mapCss = [

@ -0,0 +1,40 @@
'use strict';
var appUpdater = appUpdater || {};
appUpdater.checkRelease = function (currVersion) {
var modalStart;
$.get('https://api.github.com/repos/iNavFlight/inav-configurator/releases', function (releaseData) {
GUI.log('Loaded release information from GitHub.');
//Git return sorted list, 0 - last release
if (semver.gt(releaseData[0].tag_name, currVersion)) {
GUI.log(releaseData[0].tag_name, chrome.runtime.getManifest().version);
GUI.log(currVersion);
//For download zip
// releaseData[0].assets.forEach(function(item, i) {
// if (str.indexOf(item.name) !== -1) {
// console.log(item);
// downloadUrl = item.browser_download_url;
// }
// });
GUI.log('New version aviable!');
modalStart = new jBox('Modal', {
width: 400,
height: 200,
animation: false,
closeOnClick: false,
closeOnEsc: true,
content: $('#appUpdateNotification')
}).open();
}
});
$('#update-notification-close').on('click', function () {
modalStart.close();
});
$('#update-notification-download').on('click', function () {
modalStart.close();
});
};

@ -1883,6 +1883,10 @@ select {
margin: 1em; margin: 1em;
} }
.modal__buttons--upbottom {
bottom: 22px;
}
.modal__button { .modal__button {
padding: 1em; padding: 1em;
text-align: center; text-align: center;
@ -1918,6 +1922,10 @@ select {
transition: all ease 0.2s; transition: all ease 0.2s;
} }
.modal__button--main--inline {
display: inline;
}
.modal__button--disabled { .modal__button--disabled {
cursor: default; cursor: default;
color: #fff; color: #fff;

@ -8,6 +8,16 @@
</head> </head>
<body> <body>
<div id="main-wrapper"> <div id="main-wrapper">
<div id="appUpdateNotification" class="is-hidden">
<div class="modal__content">
<h1 class="modal__title modal__title" data-i18n="appUpdateNotificationHeader"></h1>
<div class="modal__text" data-i18n="appUpdateNotificationDescription"></div>
</div>
<div class="modal__buttons modal__buttons--upbottom">
<a href="https://github.com/iNavFlight/inav-configurator/releases" target="_blank" id="update-notification-download" class="modal__button modal__button--main modal__button--main--inline" data-i18n="downloadUpdatesBtn"></a>
<a id="update-notification-close" class="modal__button modal__button--main modal__button--main--inline" data-i18n="closeUpdateBtn"></a>
</div>
</div>
<div class="headerbar"> <div class="headerbar">
<div id="logo"> <div id="logo">
<div class="logo_text"> <div class="logo_text">

@ -73,6 +73,9 @@ $(document).ready(function () {
} }
}); });
//set '1.8.0' for test
appUpdater.checkRelease(chrome.runtime.getManifest().version);
// log library versions in console to make version tracking easier // log library versions in console to make version tracking easier
console.log('Libraries: jQuery - ' + $.fn.jquery + ', d3 - ' + d3.version + ', three.js - ' + THREE.REVISION); console.log('Libraries: jQuery - ' + $.fn.jquery + ', d3 - ' + d3.version + ', three.js - ' + THREE.REVISION);

Loading…
Cancel
Save