Fix receive-tab for wallets not backed up

This commit is contained in:
Gustavo Maximiliano Cortez 2016-11-14 17:51:15 -03:00
parent 0a7ba4bd02
commit 30240d30cd
No known key found for this signature in database
GPG Key ID: 15EDAD8D9F2EB1AF
2 changed files with 9 additions and 10 deletions

View File

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('tabReceiveController', function($rootScope, $scope, $timeout, $log, $ionicModal, $state, $ionicHistory, storageService, platformInfo, walletService, profileService, configService, lodash, gettextCatalog, popupService) {
angular.module('copayApp.controllers').controller('tabReceiveController', function($rootScope, $scope, $timeout, $log, $ionicModal, $state, $ionicHistory, storageService, platformInfo, walletService, profileService, configService, lodash, gettextCatalog, popupService, bwcError) {
var listeners = [];
$scope.isCordova = platformInfo.isCordova;
@ -20,7 +20,7 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
$scope.generatingAddress = true;
walletService.getAddress($scope.wallet, forceNew, function(err, addr) {
$scope.generatingAddress = false;
if (err) popupService.showAlert(gettextCatalog.getString('Error'), err);
if (err) popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err));
$scope.addr = addr;
if ($scope.walletAddrs[$scope.wallet.id]) $scope.walletAddrs[$scope.wallet.id] = addr;
$timeout(function() {

View File

@ -779,15 +779,14 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
if (!forceNew && addr) return cb(null, addr);
root.isReady(wallet, function(err) {
if (err) return cb(err);
if (!wallet.isComplete())
return cb('WALLET_NOT_COMPLETE');
createAddress(wallet, function(err, _addr) {
if (err) return cb(err, addr);
storageService.storeLastAddress(wallet.id, _addr, function() {
if (err) return cb(err);
return cb(null, _addr);
});
createAddress(wallet, function(err, _addr) {
if (err) return cb(err, addr);
storageService.storeLastAddress(wallet.id, _addr, function() {
if (err) return cb(err);
return cb(null, _addr);
});
});
});