BitPay card. Fix initial wallet home
This commit is contained in:
parent
6816f9a496
commit
894223a47f
9 changed files with 211 additions and 209 deletions
|
|
@ -5,8 +5,7 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
|
|||
var self = this;
|
||||
var client;
|
||||
|
||||
var network = 'livenet';
|
||||
self.sandbox = network == 'testnet' ? true : false;
|
||||
self.sandbox = bitpayCardService.getEnvironment() == 'testnet' ? true : false;
|
||||
|
||||
if (platformInfo.isCordova && StatusBar.isVisible) {
|
||||
StatusBar.backgroundColorByHexString("#293C92");
|
||||
|
|
@ -71,7 +70,6 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
|
|||
this.update = function() {
|
||||
var dateRange = setDateRange($scope.dateRange);
|
||||
self.loadingSession = true;
|
||||
bitpayCardService.setCredentials(network);
|
||||
bitpayCardService.isAuthenticated(function(err, bpSession) {
|
||||
self.loadingSession = false;
|
||||
if (err) {
|
||||
|
|
@ -110,14 +108,16 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
|
|||
$scope.dateRange = 'last30Days';
|
||||
self.update();
|
||||
|
||||
self.allWallets = profileService.getWallets(network);
|
||||
client = profileService.focusedClient;
|
||||
|
||||
if (!client) return;
|
||||
var network = bitpayCardService.getEnvironment();
|
||||
self.allWallets = profileService.getWallets({
|
||||
network: network,
|
||||
n: 1,
|
||||
onlyComplete: true
|
||||
});
|
||||
|
||||
if (lodash.isEmpty(self.allWallets)) return;
|
||||
|
||||
if (client.credentials.network != network) return;
|
||||
client = self.allWallets[0];
|
||||
|
||||
if (client.credentials.n > 1)
|
||||
self.isMultisigWallet = true;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('bitpayCardConfirmationController', function($scope, $timeout, go, bitpayCardService) {
|
||||
angular.module('copayApp.controllers').controller('bitpayCardConfirmationController', function($scope, $timeout, $location, bitpayCardService) {
|
||||
|
||||
$scope.ok = function() {
|
||||
bitpayCardService.logout(function() {
|
||||
go.path('bitpayCard');
|
||||
$location.path('/bitpayCard/main');
|
||||
});
|
||||
$scope.cancel();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
|||
function($rootScope, $timeout, $scope, $state, lodash, profileService, walletService, configService, txFormatService, $ionicModal, $log, platformInfo) {
|
||||
var self = this;
|
||||
|
||||
self.glideraEnabled = configService.getSync().glidera.enabled;
|
||||
self.setWallets = function() {
|
||||
$scope.wallets = profileService.getWallets();
|
||||
};
|
||||
|
||||
|
||||
var setPendingTxps = function(txps) {
|
||||
|
|
@ -108,7 +110,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
|||
if (err) {
|
||||
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (status.pendingTxps && status.pendingTxps[0]) {
|
||||
var txps = lodash.filter($scope.txps, function(x) {
|
||||
return x.walletId != wallet.id;
|
||||
|
|
@ -136,14 +138,13 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
|||
c1();
|
||||
});
|
||||
|
||||
var config = configService.getSync().wallet;
|
||||
|
||||
var GLIDERA_LOCK_TIME = 6 * 60 * 60;
|
||||
|
||||
var glideraActive = true; // TODO TODO TODO
|
||||
// isGlidera flag is a security measure so glidera status is not
|
||||
// only determined by the tx.message
|
||||
$scope.openTxpModal = function(tx) {
|
||||
var config = configService.getSync().wallet;
|
||||
var scope = $rootScope.$new(true);
|
||||
scope.tx = tx;
|
||||
scope.wallet = tx.wallet;
|
||||
|
|
@ -159,12 +160,12 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
|||
});
|
||||
};
|
||||
|
||||
$scope.init = function() {
|
||||
configService.whenAvailable(function() {
|
||||
var config = configService.getSync();
|
||||
var isWindowsPhoneApp = platformInfo.isWP && isCordova;
|
||||
var glideraEnabled = config.glidera.enabled;
|
||||
var coinbaseEnabled = config.coinbase.enabled;
|
||||
var isWindowsPhoneApp = platformInfo.isWP && isCordova;
|
||||
$scope.buyAndSellEnabled = !isWindowsPhoneApp && (glideraEnabled || coinbaseEnabled);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue