refactor latestReleaseService to new format
This commit is contained in:
parent
70663492eb
commit
828cb927dc
1 changed files with 30 additions and 19 deletions
|
|
@ -1,10 +1,23 @@
|
|||
'use strict';
|
||||
angular.module('copayApp.services')
|
||||
.factory('latestReleaseService', function latestReleaseServiceFactory($log, $http, $ionicPopup, configService, externalLinkService, gettextCatalog, platformInfo) {
|
||||
|
||||
var root = {};
|
||||
(function() {
|
||||
|
||||
root.checkLatestRelease = function(cb) {
|
||||
angular
|
||||
.module('bitcoincom.services')
|
||||
.factory('latestReleaseService', latestReleaseService);
|
||||
|
||||
function latestReleaseService($log, $http, $ionicPopup, configService, externalLinkService, gettextCatalog, platformInfo) {
|
||||
|
||||
var service = {
|
||||
// Functions
|
||||
checkLatestRelease: checkLatestRelease,
|
||||
requestLatestRelease: requestLatestRelease,
|
||||
showUpdatePopup: showUpdatePopup
|
||||
};
|
||||
|
||||
return service;
|
||||
|
||||
function checkLatestRelease(cb) {
|
||||
var releaseURL = configService.getDefaults().release.url;
|
||||
|
||||
requestLatestRelease(releaseURL, function (err, releaseData) {
|
||||
|
|
@ -45,7 +58,6 @@ angular.module('copayApp.services')
|
|||
|
||||
$log.debug('A new version is available: ' + latestVersion);
|
||||
|
||||
//
|
||||
var releaseNotes = false;
|
||||
if (releaseData.body) {
|
||||
var releaseLines = releaseData.body.split('\n');
|
||||
|
|
@ -82,7 +94,7 @@ angular.module('copayApp.services')
|
|||
label: label /* XX SP: Maybe we can use this in a later stage (with for example 1.0.0-rc2 the value will be "rc2" and false if there is no label) */
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function requestLatestRelease(releaseURL, cb) {
|
||||
$log.debug('Retrieving latest release information...');
|
||||
|
|
@ -101,7 +113,7 @@ angular.module('copayApp.services')
|
|||
});
|
||||
}
|
||||
|
||||
root.showUpdatePopup = function () {
|
||||
function showUpdatePopup() {
|
||||
var buttons = [];
|
||||
|
||||
if (!platformInfo.isIOS) { // There is no GitHub-release for iPhone
|
||||
|
|
@ -163,7 +175,6 @@ angular.module('copayApp.services')
|
|||
buttons: buttons
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return root;
|
||||
});
|
||||
}
|
||||
}
|
||||
})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue