commit
543e832a1f
2 changed files with 47 additions and 3 deletions
|
|
@ -6,7 +6,6 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
||||||
var CONTACTS_SHOW_LIMIT;
|
var CONTACTS_SHOW_LIMIT;
|
||||||
var currentContactsPage;
|
var currentContactsPage;
|
||||||
|
|
||||||
$scope.hasFunds = false;
|
|
||||||
|
|
||||||
var updateList = function() {
|
var updateList = function() {
|
||||||
CONTACTS_SHOW_LIMIT = 10;
|
CONTACTS_SHOW_LIMIT = 10;
|
||||||
|
|
@ -105,11 +104,56 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var updateHasFunds = function() {
|
||||||
|
$scope.hasFunds = null;
|
||||||
|
|
||||||
|
var wallets = profileService.getWallets({
|
||||||
|
onlyComplete: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!wallets || !wallets.length) {
|
||||||
|
$scope.hasFunds = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var index = 0;
|
||||||
|
lodash.each(wallets, function(w) {
|
||||||
|
walletService.getStatus(w, {}, function(err, status) {
|
||||||
|
++index;
|
||||||
|
if (err || !status) {
|
||||||
|
$log.error(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status.availableBalanceSat) {
|
||||||
|
$scope.hasFunds = true;
|
||||||
|
}
|
||||||
|
if (index == wallets.length) {
|
||||||
|
$scope.hasFunds = $scope.hasFunds || false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||||
$scope.formData = {
|
$scope.formData = {
|
||||||
search: null
|
search: null
|
||||||
};
|
};
|
||||||
updateList();
|
updateList();
|
||||||
|
updateHasFunds();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// This could probably be enhanced refactoring the routes abstract states
|
||||||
|
$scope.createWallet = function() {
|
||||||
|
$state.go('tabs.home').then(function() {
|
||||||
|
$state.go('tabs.add.create-personal');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.buyBitcoin = function() {
|
||||||
|
$state.go('tabs.home').then(function() {
|
||||||
|
$state.go('tabs.buyandsell.glidera');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,8 @@
|
||||||
<div class="zero-state-description" ng-show="hasWallets" translate>To get started, buy bitcoin or share your address. You can receive bitcoin from any wallet or service.</div>
|
<div class="zero-state-description" ng-show="hasWallets" translate>To get started, buy bitcoin or share your address. You can receive bitcoin from any wallet or service.</div>
|
||||||
<div class="zero-state-description" ng-show="!hasWallets" translate>To get started, you'll need to create a bitcoin wallet and get some bitcoin.</div>
|
<div class="zero-state-description" ng-show="!hasWallets" translate>To get started, you'll need to create a bitcoin wallet and get some bitcoin.</div>
|
||||||
<div class="zero-state-cta">
|
<div class="zero-state-cta">
|
||||||
<button class="button button-standard button-primary" ui-sref="tabs.buyandsell.glidera" ng-show="hasWallets">Buy Bitcoin</button>
|
<button class="button button-standard button-primary" ng-click="buyBitcoin()" ng-show="hasWallets">Buy Bitcoin</button>
|
||||||
<button class="button button-standard button-primary" ui-sref="tabs.add.create-personal" ng-show="!hasWallets">Create bitcoin wallet</button>
|
<button class="button button-standard button-primary" ng-click="createWallet()" ng-show="!hasWallets">Create bitcoin wallet</button>
|
||||||
<button class="button button-standard button-secondary" ui-sref="tabs.receive" ng-show="hasWallets">Show bitcoin address</button>
|
<button class="button button-standard button-secondary" ui-sref="tabs.receive" ng-show="hasWallets">Show bitcoin address</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue