Welcome to mirror list, hosted at ThFree Co, Russian Federation.

appUpdater.js « js - github.com/iNavFlight/inav-configurator.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 74044ef224582740c00964b6415f8cd7bd8eb679 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
'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

        let newVersion = releaseData[0].tag_name;
        let newPrerelase = releaseData[0].prerelease;

        if (newPrerelase == false && semver.gt(newVersion, currVersion)) {
            GUI.log(newVersion, chrome.runtime.getManifest().version);
            GUI.log(currVersion);

            GUI.log('New version available!');
            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();
    });
};