Merge pull request #3 from cmgustavo/javier/feat/paperWallet-02

Disable button while sending funds - Fix conflicts
This commit is contained in:
javierbitpay 2015-10-02 16:14:21 -03:00
commit bb209459bd
2 changed files with 17 additions and 7 deletions

View file

@ -5,7 +5,7 @@
</div> </div>
<div class="content p20v" ng-controller="paperWalletController as paperWallet"> <div class="content p20v" ng-controller="paperWalletController as paperWallet">
<div class="onGoingProcess" ng-show="paperWallet.scanning"> <div class="onGoingProcess" ng-show="paperWallet.scanning || paperWallet.sending">
<div class="onGoingProcess-content" ng-style="{'background-color':index.backgroundColor}"> <div class="onGoingProcess-content" ng-style="{'background-color':index.backgroundColor}">
<div class="spinner"> <div class="spinner">
<div class="rect1"></div> <div class="rect1"></div>
@ -14,7 +14,8 @@
<div class="rect4"></div> <div class="rect4"></div>
<div class="rect5"></div> <div class="rect5"></div>
</div> </div>
<span translate>Scanning wallet funds...</span> <span ng-show="paperWallet.scanning" translate>Scanning wallet funds...</span>
<span ng-show="paperWallet.sending" translate>Sending funds...</span>
</div> </div>
</div> </div>
<div class="box-notification text-warning" ng-show="paperWallet.error"> <div class="box-notification text-warning" ng-show="paperWallet.error">
@ -56,10 +57,11 @@
</div> </div>
<button <button
ng-disabled="paperWallet.sending"
ng-style="{'background-color':index.backgroundColor}" ng-style="{'background-color':index.backgroundColor}"
class="button black round expand" class="button black round expand"
ng-click="paperWallet.transaction()" ng-click="paperWallet.transaction()"
translate>sweep wallet translate>Sweep Wallet
</button> </button>
<div class="text-center"> <div class="text-center">
<div class="size-12 text-gray" translate>Funds will be transfered to</div> <div class="size-12 text-gray" translate>Funds will be transfered to</div>

View file

@ -1,10 +1,9 @@
angular.module('copayApp.controllers').controller('paperWalletController', angular.module('copayApp.controllers').controller('paperWalletController',
function($scope, $http, $timeout, $rootScope, profileService, go, addressService, isCordova, gettext, bitcore) { function($scope, $http, $timeout, profileService, go, addressService, isCordova, bitcore) {
self = this; self = this;
var fc = profileService.focusedClient; var fc = profileService.focusedClient;
var rawTx; var rawTx;
self.isCordova = isCordova;
if (isCordova) self.message = "Decrypting a paper wallet could take around 5 minutes on this device. please be patient and keep the app open."
self.onQrCodeScanned = function(data) { self.onQrCodeScanned = function(data) {
$scope.privateKey = data; $scope.privateKey = data;
@ -81,12 +80,21 @@ angular.module('copayApp.controllers').controller('paperWalletController',
}; };
self.transaction = function() { self.transaction = function() {
self.doTransaction(rawTx).then(function(err, response) { self.error = null;
self.sending = true;
$timeout(function() {
self.doTransaction(rawTx).then(function(err, response) {
self.sending = false;
self.goHome(); self.goHome();
}, },
function(err) { function(err) {
self.sending = false;
self.error = err.toString(); self.error = err.toString();
$timeout(function() {
$scope.$apply();
}, 1);
}); });
}, 100);
}; };
self.goHome = function() { self.goHome = function() {