Update popup
This commit is contained in:
parent
2c2c21bcdf
commit
d65e4401dd
4 changed files with 71 additions and 17 deletions
|
|
@ -56,7 +56,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
||||||
$scope.newReleaseNotes = newReleaseData.releaseNotes;
|
$scope.newReleaseNotes = newReleaseData.releaseNotes;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
function onEnter(event, data) {
|
function onEnter(event, data) {
|
||||||
$ionicNavBarDelegate.showBar(true);
|
$ionicNavBarDelegate.showBar(true);
|
||||||
|
|
@ -108,13 +108,13 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
}, 10);
|
}, 10);
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
function onLeave (event, data) {
|
function onLeave (event, data) {
|
||||||
lodash.each(listeners, function(x) {
|
lodash.each(listeners, function(x) {
|
||||||
x();
|
x();
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
$scope.createdWithinPastDay = function(time) {
|
$scope.createdWithinPastDay = function(time) {
|
||||||
return timeService.withinPastDay(time);
|
return timeService.withinPastDay(time);
|
||||||
|
|
@ -123,16 +123,10 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
||||||
$scope.startFreshSend = function() {
|
$scope.startFreshSend = function() {
|
||||||
sendFlowService.clear();
|
sendFlowService.clear();
|
||||||
$state.go('tabs.send');
|
$state.go('tabs.send');
|
||||||
}
|
};
|
||||||
|
|
||||||
$scope.openExternalLink = function() {
|
$scope.showUpdatePopup = function() {
|
||||||
var url = 'https://github.com/Bitcoin-com/Wallet/releases/latest';
|
latestReleaseService.showUpdatePopup();
|
||||||
var optIn = true;
|
|
||||||
var title = gettextCatalog.getString('Update Available');
|
|
||||||
var message = gettextCatalog.getString('An update to this app is available. For your security, please update to the latest version.');
|
|
||||||
var okText = gettextCatalog.getString('View Update');
|
|
||||||
var cancelText = gettextCatalog.getString('Go Back');
|
|
||||||
externalLinkService.open(url, optIn, title, message, okText, cancelText);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.openBannerUrl = function() {
|
$scope.openBannerUrl = function() {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
angular.module('copayApp.services')
|
angular.module('copayApp.services')
|
||||||
.factory('latestReleaseService', function latestReleaseServiceFactory($log, $http, configService, platformInfo) {
|
.factory('latestReleaseService', function latestReleaseServiceFactory($log, $http, $ionicPopup, configService, externalLinkService, gettextCatalog, platformInfo) {
|
||||||
|
|
||||||
var root = {};
|
var root = {};
|
||||||
|
|
||||||
|
|
@ -65,7 +65,7 @@ angular.module('copayApp.services')
|
||||||
function verifyTagFormat(tag) {
|
function verifyTagFormat(tag) {
|
||||||
var regex = /^v?\d+\.\d+(\.\d+)?(-rc\d)?$/i;
|
var regex = /^v?\d+\.\d+(\.\d+)?(-rc\d)?$/i;
|
||||||
return regex.exec(tag);
|
return regex.exec(tag);
|
||||||
};
|
}
|
||||||
|
|
||||||
function formatTagNumber(tag) {
|
function formatTagNumber(tag) {
|
||||||
var label = false;
|
var label = false;
|
||||||
|
|
@ -79,9 +79,9 @@ angular.module('copayApp.services')
|
||||||
major: +(formattedNumber[0]?+formattedNumber[0]:0),
|
major: +(formattedNumber[0]?+formattedNumber[0]:0),
|
||||||
minor: +(formattedNumber[1]?+formattedNumber[1]:0),
|
minor: +(formattedNumber[1]?+formattedNumber[1]:0),
|
||||||
patch: +(formattedNumber[2]?+formattedNumber[2]:0),
|
patch: +(formattedNumber[2]?+formattedNumber[2]:0),
|
||||||
label: label /* XX SP: 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) */
|
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) {
|
function requestLatestRelease(releaseURL, cb) {
|
||||||
|
|
@ -99,6 +99,56 @@ angular.module('copayApp.services')
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
return cb('Cannot get the release information: ' + err);
|
return cb('Cannot get the release information: ' + err);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
root.showUpdatePopup = function () {
|
||||||
|
var buttons = [{
|
||||||
|
text: "GitHub",
|
||||||
|
type: 'button-positive',
|
||||||
|
onTap: function () {
|
||||||
|
var url = 'https://github.com/Bitcoin-com/Wallet/releases/latest';
|
||||||
|
externalLinkService.open(url, false);
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
|
||||||
|
if (platformInfo.isAndroid) {
|
||||||
|
buttons.unshift({
|
||||||
|
text: "Google Play Store",
|
||||||
|
type: 'button-positive',
|
||||||
|
onTap: function () {
|
||||||
|
var url = 'https://play.google.com/store/apps/details?id=com.bitcoin.mwallet';
|
||||||
|
externalLinkService.open(url, false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (platformInfo.isIOS) {
|
||||||
|
buttons.unshift({
|
||||||
|
text: "App Store",
|
||||||
|
type: 'button-positive',
|
||||||
|
onTap: function () {
|
||||||
|
var url = 'https://itunes.apple.com/app/bitcoin-com-wallet/id1383072453';
|
||||||
|
externalLinkService.open(url, false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buttons.length === 1) { // There is only one source to download (probably on desktop, so open GitHub release page..)
|
||||||
|
buttons[0].onTap();
|
||||||
|
} else {
|
||||||
|
buttons.push({
|
||||||
|
text: gettextCatalog.getString('Go Back'),
|
||||||
|
type: 'button-positive',
|
||||||
|
onTap: function () {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$ionicPopup.show({
|
||||||
|
title: gettextCatalog.getString('Update Available'),
|
||||||
|
subTitle: gettextCatalog.getString('An update to this app is available. For your security, please update to the latest version.'),
|
||||||
|
cssClass: 'popup-update',
|
||||||
|
buttons: buttons
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
|
|
|
||||||
|
|
@ -195,3 +195,13 @@
|
||||||
top:11px;
|
top:11px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.popup-update {
|
||||||
|
.popup-buttons {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.popup-buttons .button{
|
||||||
|
display:block;
|
||||||
|
min-width: 100% !important;
|
||||||
|
margin-top: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
<div class="item release-notes" ng-if="newReleaseNotes"><span ng-bind-html="newReleaseNotes"></span></div>
|
<div class="item release-notes" ng-if="newReleaseNotes"><span ng-bind-html="newReleaseNotes"></span></div>
|
||||||
|
|
||||||
|
|
||||||
<div class="button" ng-click="openExternalLink()">
|
<div class="button" ng-click="showUpdatePopup()">
|
||||||
<span translate>Download</span>
|
<span translate>Download</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue