gap reached message

This commit is contained in:
Javier 2016-11-17 13:17:28 -03:00
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;