Merge pull request #426 from msalcala11/sendStyling

Send view styling and wallet switcher
This commit is contained in:
Matias Alejo Garcia 2016-10-13 10:45:22 -03:00 committed by GitHub
commit 89d207d364
14 changed files with 359 additions and 94 deletions

View file

@ -40,6 +40,8 @@ angular.module('copayApp.controllers').controller('confirmController', function(
$scope.toAmount = parseInt($scope.toAmount);
$scope.amountStr = txFormatService.formatAmountStr($scope.toAmount);
$scope.displayAmount = getDisplayAmount($scope.amountStr);
$scope.displayUnit = getDisplayUnit($scope.amountStr);
var networkName = (new bitcore.Address($scope.toAddress)).network.name;
$scope.network = networkName;
@ -65,6 +67,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
if (err || !status) {
$log.error(err);
} else {
w.status = status;
if (!status.availableBalanceSat) $log.debug('No balance available in: ' + w.name);
if (status.availableBalanceSat > $scope.toAmount) {
filteredWallets.push(w);
@ -75,6 +78,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
if (++index == wallets.length) {
if (!lodash.isEmpty(filteredWallets)) {
$scope.wallets = lodash.clone(filteredWallets);
setWallet($scope.wallets[0]);
} else {
if (!enoughFunds)
@ -108,6 +112,14 @@ angular.module('copayApp.controllers').controller('confirmController', function(
setWallet(wallet, true);
});
$scope.showWalletSelector = function() {
$scope.showWallets = true;
};
$scope.onWalletSelect = function(wallet) {
setWallet(wallet);
};
$scope.showDescriptionPopup = function() {
var message = gettextCatalog.getString('Add description');
@ -123,6 +135,14 @@ angular.module('copayApp.controllers').controller('confirmController', function(
});
};
function getDisplayAmount(amountStr) {
return amountStr.split(' ')[0];
}
function getDisplayUnit(amountStr) {
return amountStr.split(' ')[1];
}
var setFromPayPro = function(uri, cb) {
if (!cb) cb = function() {};

View file

@ -0,0 +1,18 @@
'use strict';
angular.module('copayApp.directives')
.directive('actionSheet', function() {
return {
restrict: 'E',
templateUrl: 'views/includes/actionSheet.html',
transclude: true,
scope: {
show: '=actionSheetShow',
},
link: function(scope, element, attrs) {
scope.hide = function() {
scope.show = false;
};
}
};
});

View file

@ -0,0 +1,27 @@
'use strict';
angular.module('copayApp.directives')
.directive('walletSelector', function($timeout) {
return {
restrict: 'E',
templateUrl: 'views/includes/walletSelector.html',
transclude: true,
scope: {
show: '=walletSelectorShow',
wallets: '=walletSelectorWallets',
selectedWallet: '=walletSelectorSelectedWallet',
onSelect: '=walletSelectorOnSelect'
},
link: function(scope, element, attrs) {
scope.hide = function() {
scope.show = false;
};
scope.selectWallet = function(wallet) {
$timeout(function() {
scope.hide();
}, 100);
scope.onSelect(wallet);
};
}
};
});