adding spinner

This commit is contained in:
Javier 2015-10-02 13:24:43 -03:00
parent df45a22f18
commit 9438683db1
2 changed files with 51 additions and 20 deletions

View File

@ -7,6 +7,20 @@
<div class="content p20v" ng-controller="paperWalletController as paperWallet">
<div class="row">
<div class="large-12 medium-12 columns">
<div class="onGoingProcess" ng-show="paperWallet.scanning">
<div class="onGoingProcess-content" ng-style="{'background-color':index.backgroundColor}">
<div class="spinner">
<div class="rect1"></div>
<div class="rect2"></div>
<div class="rect3"></div>
<div class="rect4"></div>
<div class="rect5"></div>
</div>
<span translate>Scanning wallet funds...</span>
</div>
</div>
<div class="text-warning size-14 m20b" ng-show="paperWallet.error">
<i class="fi-alert size-12"></i>
<span translate>{{paperWallet.error}}</span>
@ -31,11 +45,22 @@
</div>
<div class="row">
<div class="large-12 medium-12 columns" ng-show="paperWallet.balance">
<button ng-style="{'background-color':index.backgroundColor}" class="button black round expand" ng-click="paperWallet.transaction()" translate>sweep wallet</button>
<span>Funds will be transfered to the wallet: {{index.alias}} </span>
<button
ng-style="{'background-color':index.backgroundColor}"
class="button black round expand"
ng-click="paperWallet.transaction()"
translate>sweep wallet
</button>
<span>Funds will be transfered to the wallet: {{index.alias || index.walletName}} </span>
</div>
<div class="large-12 medium-12 columns" ng-show="!paperWallet.balance" >
<button ng-style="{'background-color':index.backgroundColor}" class="button black round expand" ng-click="paperWallet.createTx(privateKey, passphrase)" translate>Scan Wallet Funds</button>
<button
ng-disabled="paperWallet.scanning || !privateKey"
ng-style="{'background-color':index.backgroundColor}"
class="button black round expand"
ng-click="paperWallet.createTx(privateKey, passphrase)"
translate>Scan Wallet Funds
</button>
</div>
</div>
</div>

View File

@ -1,6 +1,5 @@
angular.module('copayApp.controllers').controller('paperWalletController',
function($scope, $http, $timeout, profileService, go, addressService) {
function($scope, $http, $timeout, $rootScope, profileService, go, addressService, isCordova, gettext) {
self = this;
var fc = profileService.focusedClient;
var rawTx;
@ -10,17 +9,26 @@ angular.module('copayApp.controllers').controller('paperWalletController',
}
self.createTx = function(privateKey, passphrase) {
if (!privateKey) self.error = "Enter privateKey or scann for one";
self.getRawTx(privateKey, passphrase, function(err, rawtx, utxos) {
if (err) self.error = err.toString();
else {
self.balance = (utxos / 1e8).toFixed(8);
rawTx = rawtx;
}
$timeout(function() {
$scope.$apply();
}, 1);
});
self.error = null;
self.scanning = true;
$timeout(function() {
self.getRawTx(privateKey, passphrase, function(err, rawtx, utxos) {
self.scanning = false;
if (err)
self.error = err.toString();
else {
self.balance = (utxos / 1e8).toFixed(8);
rawTx = rawtx;
}
$timeout(function() {
$scope.$apply();
}, 1);
});
}, 100);
};
self.getRawTx = function(privateKey, passphrase, cb) {
@ -58,12 +66,11 @@ angular.module('copayApp.controllers').controller('paperWalletController',
};
self.transaction = function() {
self.doTransaction(rawTx).then(function(err, response) {
self.goHome();
},
function(err) {
self.error = err;
self.error = err.toString();
});
};
@ -76,5 +83,4 @@ angular.module('copayApp.controllers').controller('paperWalletController',
rawtx: rawTx
});
};
});
});