From 30240d30cd1aecc7076f51f5d6f61d5ac3f65e92 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Mon, 14 Nov 2016 17:51:15 -0300 Subject: [PATCH] Fix receive-tab for wallets not backed up --- src/js/controllers/tab-receive.js | 4 ++-- src/js/services/walletService.js | 15 +++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/js/controllers/tab-receive.js b/src/js/controllers/tab-receive.js index 04fc88728..ea8b9778a 100644 --- a/src/js/controllers/tab-receive.js +++ b/src/js/controllers/tab-receive.js @@ -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() { diff --git a/src/js/services/walletService.js b/src/js/services/walletService.js index deed238c9..3e5da9097 100644 --- a/src/js/services/walletService.js +++ b/src/js/services/walletService.js @@ -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); }); }); });