Fix Get Started message. Fix when tx is empty. Enable keyboard accessory bar for iOS

This commit is contained in:
Gustavo Maximiliano Cortez 2016-10-16 21:22:54 -03:00
parent 13d85c193d
commit 2e9b9d7443
No known key found for this signature in database
GPG Key ID: 15EDAD8D9F2EB1AF
5 changed files with 37 additions and 25 deletions

View File

@ -6,15 +6,12 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
$scope.dateRange = { value: 'last30Days'};
$scope.network = bitpayCardService.getEnvironment();
var getFromCache = function(cb) {
$scope.loadingCache = true;
var getFromCache = function() {
bitpayCardService.getBitpayDebitCardsHistory($scope.cardId, function(err, data) {
$scope.loadingCache = false;
if (err || lodash.isEmpty(data)) return cb();
if (err || lodash.isEmpty(data)) return;
$scope.historyCached = true;
self.bitpayCardTransactionHistory = data.transactions;
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() {
var dateRange = setDateRange($scope.dateRange.value);
$scope.loadingHistory = true;
bitpayCardService.getHistory($scope.cardId, dateRange, function(err, history) {
$scope.loadingHistory = false;
if (err) {
$log.error(err);
$scope.error = gettextCatalog.getString('Could not get transactions');
return;
}
if (lodash.isEmpty(history.transactionList)) setGetStarted();
var txs = lodash.clone(history.txs);
for (var i = 0; i < txs.length; i++) {
txs[i] = _getMerchantInfo(txs[i]);
@ -114,11 +121,13 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
$state.go('tabs.home');
popupService.showAlert(null, msg);
} else {
getFromCache(function() {
self.update();
});
getFromCache();
}
});
$scope.$on("$ionicView.afterEnter", function(event, data) {
self.update();
});
});

View File

@ -3,7 +3,7 @@ angular.module('copayApp.controllers').controller('bitpayCardIntroController', f
var checkOtp = function(obj, cb) {
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) {
cb(res);
});
@ -27,7 +27,7 @@ angular.module('copayApp.controllers').controller('bitpayCardIntroController', f
popupService.showAlert(null, err);
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 ok = gettextCatalog.getString('Add cards');
var cancel = gettextCatalog.getString('Go back');

View File

@ -905,7 +905,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
screen.lockOrientation('portrait');
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);
}

View File

@ -39,22 +39,25 @@
</div>
<div
class="m10t text-center padding"
ng-if="!loadingCache && !loadingHistory && !bitpayCard.bitpayCardTransactionHistory[0] && !error">
class="m10t text-center padding ng-hide"
ng-show="bitpayCard.getStarted">
<i class="icon ion-ios-arrow-thin-up size-24"></i>
<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>
</div>
<div class="list" ng-if="bitpayCard.bitpayCardTransactionHistory[0] && !error">
<div class="item item-divider">
<select class="select-style" ng-model="dateRange.value" ng-change="bitpayCard.update()">
<option value="last30Days">Recent Activity</option>
<option value="lastMonth">Last Month</option>
<option value="all">All Activity</option>
</select>
</div>
<div
<div class="list" ng-show="!bitpayCard.getStarted">
<label class="item item-input item-select">
<div class="input-label" translate>
Activity
</div>
<select ng-model="dateRange.value" ng-change="bitpayCard.update()">
<option value="last30Days" selected translate>Recent</option>
<option value="lastMonth" translate>Last Month</option>
<option value="all" translate>All</option>
</select>
</label>
<div ng-if="bitpayCard.bitpayCardTransactionHistory[0]"
ng-repeat="tx in bitpayCard.bitpayCardTransactionHistory | orderBy: ['pending','-timestamp']"
class="item row">
<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/sync.svg" width="14">
</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"
ng-class="{
'text-success': tx.amount.indexOf('-') == -1 && !tx.pending,
'text-gray': tx.amount.indexOf('-') == -1 && tx.pending}">
{{tx.amount | currency:'$':2 }}
</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>
</div>
</div>

View File

@ -109,7 +109,7 @@
<div class="bg icon-bitpay-card"></div>
</i>
<h2>BitPay Visa&reg; Card</h2>
<p translate>Add your cards</p>
<p translate>Add your card</p>
<i class="icon bp-arrow-right"></i>
</a>
</div>