gap reached message

This commit is contained in:
Javier 2016-11-17 13:17:28 -03:00
parent 84a49cd239
commit eed409b097
3 changed files with 42 additions and 5 deletions

View File

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('addressesController', function($scope, $stateParams, $state, $timeout, $ionicScrollDelegate, configService, popupService, gettextCatalog, ongoingProcess, lodash, profileService, walletService, bwcError) {
angular.module('copayApp.controllers').controller('addressesController', function($scope, $stateParams, $state, $timeout, $ionicScrollDelegate, configService, popupService, gettextCatalog, ongoingProcess, lodash, profileService, walletService) {
var UNUSED_ADDRESS_LIMIT = 5;
var BALANCE_ADDRESS_LIMIT = 5;
var config;
@ -10,6 +10,7 @@ angular.module('copayApp.controllers').controller('addressesController', functio
var unitDecimals;
var withBalance;
$scope.showInfo = false;
$scope.showMore = false;
$scope.wallet = profileService.getWallet($stateParams.walletId);
function init() {
@ -60,11 +61,17 @@ angular.module('copayApp.controllers').controller('addressesController', functio
};
$scope.newAddress = function() {
if ($scope.gapReached) return;
ongoingProcess.set('generatingNewAddress', true);
walletService.getAddress($scope.wallet, true, function(err, addr) {
if (err) {
ongoingProcess.set('generatingNewAddress', false);
return popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err));
$scope.gapReached = true;
$timeout(function() {
$scope.$digest();
});
return;
}
walletService.getMainAddresses($scope.wallet, {
@ -97,6 +104,13 @@ angular.module('copayApp.controllers').controller('addressesController', functio
});
};
$scope.readMore = function() {
$timeout(function() {
$scope.showMore = !$scope.showMore;
$ionicScrollDelegate.resize();
});
};
$scope.$on("$ionicView.beforeEnter", function(event, data) {
config = configService.getSync().wallet.settings;
unitToSatoshi = config.unitToSatoshi;

View File

@ -73,6 +73,23 @@
margin-right: 2px;
}
}
.box-error {
padding: 25px;
background-color: #E65555;
color: #F4F4F4;
h5 {
margin: 5px;
color: #F4F4F4;
text-align: center;
font-weight: bold;
}
a {
font-weight: bold;
color: #F4F4F4;
cursor: pointer;
cursor: hand;
}
}
.item-note {
color: $light-gray;
}

View File

@ -6,19 +6,19 @@
</ion-nav-bar>
<ion-content>
<div class="addr-list list">
<div class="addr-list">
<div class="text-center padding size-42">
<i class="icon ion-ios-ionic-outline"></i>
</div>
<div class="addr-explanation">
<div class="addr-description">
<div class="addr-description" translate>
Each bitcoin wallet can generate billions of addresses from your 12-word backup. A new address is automatically generated and shown each time your recive a payment. <a ng-click="showInformation()" ng-if="!showInfo" translate>Why?</a>
</div>
</div>
<div class="addr-explanation" ng-if="showInfo">
<div class="addr-description">
<div class="addr-description" translate>
It's a good idea to avoid reusing addresses-this both protects your privacy and keeps your bitcoins secure against hypothetical attacks by quantum computers. <a ng-click="showInformation()" translate>Hide</a>
</div>
</div>
@ -30,6 +30,12 @@
</div>
<div ng-if="latestUnused[0]">
<div class="box-error" ng-if="gapReached">
<h5 translate>Unused Addresses Limit</h5>
<p translate>The maximum number of consecutive unused addresses (20) has been reached. When one of your unused addresses receives a payment, a new address will be generated and shown in your Receive tab. <a ng-click="readMore()" ng-if="!showMore" translate>Read more</a></p>
<p ng-if="showMore" translate>The restore process will stop when 20 addresses are generated in a row which contain no funds. To safely generate more addresses, make a payment to one of the unused addresses which has already been generated. <a ng-click="readMore()" translate>Read less</a></p>
</div>
<div class="item" ng-repeat="u in latestUnused track by $index">
{{u.address}}
<div class="addr-path">