BitPay Card uses popupServices

This commit is contained in:
Gustavo Maximiliano Cortez 2016-08-31 09:55:11 -03:00
commit 748c28b235
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
2 changed files with 10 additions and 42 deletions

View file

@ -31,11 +31,6 @@
<span ng-show="!bitpayCard.bitpayCardTwoFactorPending">Login to your account</span>
<span ng-show="bitpayCard.bitpayCardTwoFactorPending">2-Step Verification</span>
</h4>
<div class="box-notification error"
ng-show="bitpayCard.error"
ng-click="bitpayCard.error = null">
{{bitpayCard.error}}
</div>
<form
ng-show="!bitpayCard.bitpayCardTwoFactorPending"
@ -121,14 +116,9 @@
<option value="all">All Activity</option>
</select>
<div class="box-notification error"
ng-show="bitpayCard.error">
{{bitpayCard.error}}
</div>
<div
class="oh pr m20t text-gray size-12 text-center"
ng-show="!bitpayCard.error && !bitpayCard.bitpayCardTransactionHistory[0] &&
ng-show="!bitpayCard.bitpayCardTransactionHistory[0] &&
!bitpayCard.bitpayCardInvoiceHistory[0] && !loadingHistory">
No transactions yet
</div>
@ -176,11 +166,6 @@
</div>
<div ng-show="bitpayCard.bitpayCardAuthenticated && !bitpayCard.visaCardActivated && addFunds">
<div class="box-notification error"
ng-show="bitpayCard.error"
ng-click="bitpayCard.error = null">
{{bitpayCard.error}}
</div>
<form
name="createInvoiceForm"
ng-submit="bitpayCard.sendFunds()"
@ -215,7 +200,7 @@
<div class="col">
<button class="button button-block button-stable"
type="button"
ng-click="addFunds = false; bitpayCard.error = null">
ng-click="addFunds = false">
Cancel
</button>
</div>

View file

@ -1,14 +1,10 @@
'use strict';
angular.module('copayApp.controllers').controller('bitpayCardController', function($scope, $rootScope, $timeout, $log, $ionicModal, lodash, bitpayCardService, configService, profileService, walletService, ongoingProcess, pbkdf2Service, moment, platformInfo) {
angular.module('copayApp.controllers').controller('bitpayCardController', function($scope, $timeout, $log, lodash, bitpayCardService, configService, profileService, walletService, ongoingProcess, pbkdf2Service, moment, popupService) {
var self = this;
var wallet;
if (platformInfo.isCordova && StatusBar.isVisible) {
StatusBar.backgroundColorByHexString("#293C92");
}
$scope.$on('Wallet/Changed', function(event, w) {
if (lodash.isEmpty(w)) {
$log.debug('No wallet provided');
@ -87,7 +83,7 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
bitpayCardService.transactionHistory(dateRange, function(err, history) {
$scope.loadingHistory = false;
if (err) {
self.error = 'Error getting transactions';
popupService.showAler(gettextCatalog.getString('Error'), gettextCatalog.getString('Getting transactions'));
return;
}
@ -120,13 +116,11 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
};
this.sendFunds = function() {
self.error = null;
if (lodash.isEmpty(wallet)) return;
if (!wallet.canSign() && !wallet.isPrivKeyExternal()) {
$log.info('No signing proposal: No private key');
self.error = bwcError.msg('MISSING_PRIVATE_KEY');
popupService.showAler(gettextCatalog.getString('Error'), bwcError.msg('MISSING_PRIVATE_KEY'));
return;
}
@ -146,10 +140,7 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
bitpayCardService.topUp(dataSrc, function(err, invoiceId) {
if (err) {
ongoingProcess.set('Processing Transaction...', false);
self.error = bwcError.msg(err);
$timeout(function() {
$scope.$digest();
});
popupService.showAler(gettextCatalog.getString('Error'), bwcError.msg(err));
return;
}
@ -178,18 +169,12 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
walletService.createTx(wallet, txp, function(err, createdTxp) {
if (err) {
self.error = bwcError.msg(err);
$timeout(function() {
$scope.$digest();
});
popupService.showAler(gettextCatalog.getString('Error'), bwcError.msg(err));
return;
}
walletService.publishAndSign(wallet, createdTxp, function(err, tx) {
if (err) {
self.error = err;
$timeout(function() {
$scope.$digest();
});
popupService.showAler(gettextCatalog.getString('Error'), bwcError.msg(err));
return;
}
self.update();
@ -205,7 +190,6 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
};
this.authenticate = function() {
self.error = null;
var data = {
emailAddress : $scope.email,
@ -219,7 +203,7 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
bitpayCardService.authenticate(data, function(err, auth) {
self.authenticating = false;
if (err && err.data && err.data.error && !err.data.error.twoFactorPending) {
self.error = err.statusText || err.data.error || 'Authentiation error';
popupService.showAler(gettextCatalog.getString('Error'), err.statusText || err.data.error || 'Authentiation error');
return;
}
@ -231,7 +215,6 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
};
this.authenticate2FA = function() {
self.error = null;
var data = {
twoFactorCode : $scope.twoFactorCode
@ -241,7 +224,7 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
bitpayCardService.authenticate2FA(data, function(err, auth) {
self.authenticating = false;
if (err) {
self.error = 'Authentiation error';
popupService.showAler(gettextCatalog.getString('Error'), gettextCatalog.getString('Authentiation error'));
return;
}