Fix Get Started message. Fix when tx is empty. Enable keyboard accessory bar for iOS
This commit is contained in:
parent
13d85c193d
commit
2e9b9d7443
5 changed files with 37 additions and 25 deletions
|
|
@ -6,15 +6,12 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
|
||||||
$scope.dateRange = { value: 'last30Days'};
|
$scope.dateRange = { value: 'last30Days'};
|
||||||
$scope.network = bitpayCardService.getEnvironment();
|
$scope.network = bitpayCardService.getEnvironment();
|
||||||
|
|
||||||
var getFromCache = function(cb) {
|
var getFromCache = function() {
|
||||||
$scope.loadingCache = true;
|
|
||||||
bitpayCardService.getBitpayDebitCardsHistory($scope.cardId, function(err, data) {
|
bitpayCardService.getBitpayDebitCardsHistory($scope.cardId, function(err, data) {
|
||||||
$scope.loadingCache = false;
|
if (err || lodash.isEmpty(data)) return;
|
||||||
if (err || lodash.isEmpty(data)) return cb();
|
|
||||||
$scope.historyCached = true;
|
$scope.historyCached = true;
|
||||||
self.bitpayCardTransactionHistory = data.transactions;
|
self.bitpayCardTransactionHistory = data.transactions;
|
||||||
self.bitpayCardCurrentBalance = data.balance;
|
self.bitpayCardCurrentBalance = data.balance;
|
||||||
return cb();
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -43,18 +40,28 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var setGetStarted = function() {
|
||||||
|
var dateRange = setDateRange('all');
|
||||||
|
bitpayCardService.getHistory($scope.cardId, dateRange, function(err, history) {
|
||||||
|
if (lodash.isEmpty(history.transactionList)) self.getStarted = true;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
this.update = function() {
|
this.update = function() {
|
||||||
var dateRange = setDateRange($scope.dateRange.value);
|
var dateRange = setDateRange($scope.dateRange.value);
|
||||||
|
|
||||||
$scope.loadingHistory = true;
|
$scope.loadingHistory = true;
|
||||||
bitpayCardService.getHistory($scope.cardId, dateRange, function(err, history) {
|
bitpayCardService.getHistory($scope.cardId, dateRange, function(err, history) {
|
||||||
$scope.loadingHistory = false;
|
$scope.loadingHistory = false;
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
$log.error(err);
|
$log.error(err);
|
||||||
$scope.error = gettextCatalog.getString('Could not get transactions');
|
$scope.error = gettextCatalog.getString('Could not get transactions');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (lodash.isEmpty(history.transactionList)) setGetStarted();
|
||||||
|
|
||||||
var txs = lodash.clone(history.txs);
|
var txs = lodash.clone(history.txs);
|
||||||
for (var i = 0; i < txs.length; i++) {
|
for (var i = 0; i < txs.length; i++) {
|
||||||
txs[i] = _getMerchantInfo(txs[i]);
|
txs[i] = _getMerchantInfo(txs[i]);
|
||||||
|
|
@ -114,11 +121,13 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
|
||||||
$state.go('tabs.home');
|
$state.go('tabs.home');
|
||||||
popupService.showAlert(null, msg);
|
popupService.showAlert(null, msg);
|
||||||
} else {
|
} else {
|
||||||
getFromCache(function() {
|
getFromCache();
|
||||||
self.update();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$scope.$on("$ionicView.afterEnter", function(event, data) {
|
||||||
|
self.update();
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ angular.module('copayApp.controllers').controller('bitpayCardIntroController', f
|
||||||
|
|
||||||
var checkOtp = function(obj, cb) {
|
var checkOtp = function(obj, cb) {
|
||||||
if (obj.otp) {
|
if (obj.otp) {
|
||||||
var msg = gettextCatalog.getString('Enter Two Factor for BitPay Cards');
|
var msg = gettextCatalog.getString('Enter Two Factor for BitPay Card');
|
||||||
popupService.showPrompt(null, msg, null, function(res) {
|
popupService.showPrompt(null, msg, null, function(res) {
|
||||||
cb(res);
|
cb(res);
|
||||||
});
|
});
|
||||||
|
|
@ -27,7 +27,7 @@ angular.module('copayApp.controllers').controller('bitpayCardIntroController', f
|
||||||
popupService.showAlert(null, err);
|
popupService.showAlert(null, err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var title = gettextCatalog.getString('Add BitPay Cards?');
|
var title = gettextCatalog.getString('Add BitPay Card?');
|
||||||
var msg = gettextCatalog.getString('Would you like to add this account ({{email}}) to your wallet?', {email: obj.email});
|
var msg = gettextCatalog.getString('Would you like to add this account ({{email}}) to your wallet?', {email: obj.email});
|
||||||
var ok = gettextCatalog.getString('Add cards');
|
var ok = gettextCatalog.getString('Add cards');
|
||||||
var cancel = gettextCatalog.getString('Go back');
|
var cancel = gettextCatalog.getString('Go back');
|
||||||
|
|
|
||||||
|
|
@ -905,7 +905,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
screen.lockOrientation('portrait');
|
screen.lockOrientation('portrait');
|
||||||
|
|
||||||
if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
|
if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
|
||||||
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
|
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(false);
|
||||||
cordova.plugins.Keyboard.disableScroll(true);
|
cordova.plugins.Keyboard.disableScroll(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,22 +39,25 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="m10t text-center padding"
|
class="m10t text-center padding ng-hide"
|
||||||
ng-if="!loadingCache && !loadingHistory && !bitpayCard.bitpayCardTransactionHistory[0] && !error">
|
ng-show="bitpayCard.getStarted">
|
||||||
<i class="icon ion-ios-arrow-thin-up size-24"></i>
|
<i class="icon ion-ios-arrow-thin-up size-24"></i>
|
||||||
<h1>Get started</h1>
|
<h1>Get started</h1>
|
||||||
<h4>Your BitPay Card is ready. Add funds to your card to start using your card at stores and ATMs worldwide.</h4>
|
<h4>Your BitPay Card is ready. Add funds to your card to start using your card at stores and ATMs worldwide.</h4>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="list" ng-if="bitpayCard.bitpayCardTransactionHistory[0] && !error">
|
<div class="list" ng-show="!bitpayCard.getStarted">
|
||||||
<div class="item item-divider">
|
<label class="item item-input item-select">
|
||||||
<select class="select-style" ng-model="dateRange.value" ng-change="bitpayCard.update()">
|
<div class="input-label" translate>
|
||||||
<option value="last30Days">Recent Activity</option>
|
Activity
|
||||||
<option value="lastMonth">Last Month</option>
|
</div>
|
||||||
<option value="all">All Activity</option>
|
<select ng-model="dateRange.value" ng-change="bitpayCard.update()">
|
||||||
</select>
|
<option value="last30Days" selected translate>Recent</option>
|
||||||
</div>
|
<option value="lastMonth" translate>Last Month</option>
|
||||||
<div
|
<option value="all" translate>All</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<div ng-if="bitpayCard.bitpayCardTransactionHistory[0]"
|
||||||
ng-repeat="tx in bitpayCard.bitpayCardTransactionHistory | orderBy: ['pending','-timestamp']"
|
ng-repeat="tx in bitpayCard.bitpayCardTransactionHistory | orderBy: ['pending','-timestamp']"
|
||||||
class="item row">
|
class="item row">
|
||||||
<div class="col col-10">
|
<div class="col col-10">
|
||||||
|
|
@ -78,14 +81,14 @@
|
||||||
<img ng-show="!tx.pending" ng-src="img/check.svg" width="14">
|
<img ng-show="!tx.pending" ng-src="img/check.svg" width="14">
|
||||||
<img ng-show="tx.pending" ng-src="img/sync.svg" width="14">
|
<img ng-show="tx.pending" ng-src="img/sync.svg" width="14">
|
||||||
</div>
|
</div>
|
||||||
<div class="col col-25 text-right size-12 text-gray">
|
<div class="col text-right size-12 text-gray">
|
||||||
<div class="size-14"
|
<div class="size-14"
|
||||||
ng-class="{
|
ng-class="{
|
||||||
'text-success': tx.amount.indexOf('-') == -1 && !tx.pending,
|
'text-success': tx.amount.indexOf('-') == -1 && !tx.pending,
|
||||||
'text-gray': tx.amount.indexOf('-') == -1 && tx.pending}">
|
'text-gray': tx.amount.indexOf('-') == -1 && tx.pending}">
|
||||||
{{tx.amount | currency:'$':2 }}
|
{{tx.amount | currency:'$':2 }}
|
||||||
</div>
|
</div>
|
||||||
<time ng-if="!tx.pending">{{tx.timestamp | amCalendar}}</time>
|
<time ng-if="!tx.pending">{{tx.timestamp | amTimeAgo}}</time>
|
||||||
<span ng-if="tx.pending" class="tu" translate>Pending</span>
|
<span ng-if="tx.pending" class="tu" translate>Pending</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@
|
||||||
<div class="bg icon-bitpay-card"></div>
|
<div class="bg icon-bitpay-card"></div>
|
||||||
</i>
|
</i>
|
||||||
<h2>BitPay Visa® Card</h2>
|
<h2>BitPay Visa® Card</h2>
|
||||||
<p translate>Add your cards</p>
|
<p translate>Add your card</p>
|
||||||
<i class="icon bp-arrow-right"></i>
|
<i class="icon bp-arrow-right"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue