Improve updates check

This commit is contained in:
Nick Denry 2020-05-18 17:33:56 +03:00
parent 36a8923e82
commit 5c042b5995
1 changed files with 6 additions and 4 deletions

View File

@ -9,12 +9,14 @@ angApp.controller('DefaultController', function($scope, $timeout, $http, AppInfo
url: $scope.appInfo.APP_RELEASES_CHECK_URL, url: $scope.appInfo.APP_RELEASES_CHECK_URL,
method: 'GET' method: 'GET'
}).then((response) => { }).then((response) => {
let releaseVersion = response.data[0].tag_name let releaseTag = response.data[0].tag_name
if (releaseVersion == $scope.appInfo.APP_VERSION) { let releaseVersion = parseInt(releaseTag.replace(/v|\./g, ''))
$scope.checkingForUpdate = 'latest' let appVersion = parseInt($scope.appInfo.APP_VERSION.replace(/v|\./g, ''))
if (appVersion < releaseVersion ) {
$scope.checkingForUpdate = 'updateAvailable'
} }
else { else {
$scope.checkingForUpdate = 'updateAvailable' $scope.checkingForUpdate = 'latest'
} }
}, (error) => { }, (error) => {
$scope.checkingForUpdate = 'checkErr' $scope.checkingForUpdate = 'checkErr'