Merge remote-tracking branch 'origin/wallet/sprint/17' into wallet/sprint/17

# Conflicts:
#	src/js/controllers/tab-scan.js
This commit is contained in:
Sebastiaan Pasma 2018-05-28 13:48:26 +02:00
commit 4c4c213786
20 changed files with 196 additions and 29 deletions

View file

@ -322,7 +322,6 @@ angular.module('copayApp.controllers').controller('amountController', function($
$scope.amountModel.amount = ($scope.amountModel.amount + digit).replace('..', '.');
checkFontSize();
$scope.processAmount();
navigator.vibrate(50);
};
$scope.pushOperator = function(operator) {
@ -358,7 +357,6 @@ angular.module('copayApp.controllers').controller('amountController', function($
$scope.amountModel.amount = $scope.alternativeAmount = $scope.globalResult = '';
$scope.allowSend = false;
checkFontSize();
navigator.vibrate(50);
};

View file

@ -205,6 +205,8 @@ angular.module('copayApp.controllers').controller('confirmController', function(
}
});
$scope.displayBalanceAsFiat = walletConfig.settings.priceDisplay === 'fiat';
});

View file

@ -4,7 +4,7 @@ angular.module('copayApp.controllers').controller('preferencesAbout',
function($scope, $window, appConfigService, gettextCatalog, externalLinkService, $ionicNavBarDelegate) {
$scope.title = gettextCatalog.getString('About') + ' ' + appConfigService.nameCase;
$scope.version = $window.version;
$scope.version = $window.fullVersion;
$scope.commitHash = $window.commitHash;
$scope.openExternalLink = function() {

View file

@ -13,6 +13,8 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
var currentAddressSocket = {};
var paymentSubscriptionObj = { op:"addr_sub" }
$scope.displayBalanceAsFiat = true;
$scope.requestSpecificAmount = function() {
$state.go('tabs.paymentRequest.amount', {
id: $scope.wallet.credentials.walletId,
@ -212,6 +214,10 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
if ($scope.wallet && walletId == $scope.wallet.id && type == 'NewIncomingTx') $scope.setAddress(true);
})
];
configService.whenAvailable(function(config) {
$scope.displayBalanceAsFiat = config.wallet.settings.priceDisplay === 'fiat';
});
});
$scope.$on("$ionicView.enter", function(event, data) {

View file

@ -108,6 +108,9 @@ angular.module('copayApp.controllers').controller('tabScanController', function(
function handleSuccessfulScan(contents){
$log.debug('Scan returned: "' + contents + '"');
scannerService.pausePreview();
// Sometimes (testing in Chrome, when reading QR Code) data is an object
// that has a string data.result.
contents = contents.result || contents;
incomingData.redir(contents);
}

View file

@ -72,15 +72,22 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
return item.network == 'livenet';
});
}
var walletList = [];
lodash.each(walletsToTransfer, function(v) {
var displayBalanceAsFiat =
v.status.alternativeBalanceAvailable &&
config.wallet.settings.priceDisplay === 'fiat';
walletList.push({
color: v.color,
name: v.name,
recipientType: 'wallet',
coin: v.coin,
network: v.network,
balanceString: v.cachedBalance,
balanceString: displayBalanceAsFiat ?
v.status.totalBalanceAlternative + ' ' + v.status.alternativeIsoCode :
v.cachedBalance,
getAddress: function(cb) {
walletService.getAddress(v, false, cb);
},

View file

@ -11,7 +11,8 @@ angular.module('copayApp.directives')
show: '=walletSelectorShow',
wallets: '=walletSelectorWallets',
selectedWallet: '=walletSelectorSelectedWallet',
onSelect: '=walletSelectorOnSelect'
onSelect: '=walletSelectorOnSelect',
displayBalanceAsFiat : '=walletSelectorDisplayBalanceAsFiat'
},
link: function(scope, element, attrs) {
scope.hide = function() {

View file

@ -44,6 +44,20 @@ angular.module('copayApp.services').factory('bitcoincomService', function($http,
href: 'http://tools.bitcoin.com'
};
var priceChartItem = {
name: 'pricechart',
title: 'Bitcoin Price Charts',
icon: 'icon-chart',
sref: 'tabs.pricechart',
};
var faucetItem = {
name: 'faucet',
title: 'Free Bitcoin Cash',
icon: 'icon-faucet',
href: 'https://free.bitcoin.com/'
};
var _getBitPay = function(endpoint) {
return {
method: 'GET',
@ -74,6 +88,8 @@ angular.module('copayApp.services').factory('bitcoincomService', function($http,
nextStepsService.register(newsItem);
nextStepsService.register(poolItem);
nextStepsService.register(toolsItem);
nextStepsService.register(priceChartItem);
nextStepsService.register(faucetItem);
};
register();

View file

@ -11,7 +11,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
root.redir = function(data, shapeshiftData) {
var originalAddress = null;
var noPrefixInAddress = 0;
if (data.toLowerCase().indexOf('bitcoin') < 0) {
noPrefixInAddress = 1;
}

View file

@ -3,17 +3,5 @@ angular.module('copayApp.services').factory('pricechartService', function($http,
var root = {};
var credentials = {};
var nextStepItem = {
name: 'pricechart',
title: 'Bitcoin Price Charts',
icon: 'icon-chart',
sref: 'tabs.pricechart',
};
var register = function() {
nextStepsService.register(nextStepItem);
};
register();
return root;
});

View file

@ -932,8 +932,17 @@ angular.module('copayApp.services')
x.txid = x.data ? x.data.txid : null;
x.types = [x.type];
if (x.data && x.data.amount)
if (x.data && x.data.amount) {
// Default to showing amount in crypto because we have that now
x.amountStr = txFormatService.formatAmountStr(x.wallet.coin, x.data.amount);
configService.whenAvailable(function(config) {
if (config.wallet.settings.priceDisplay === "fiat") {
txFormatService.formatAlternativeStr(x.wallet.coin, x.data.amount, function(formattedString) {
x.amountStr = formattedString;
});
}
});
}
x.action = function() {
// TODO?

View file

@ -69,7 +69,7 @@
}
&.icon-buy-bitcoin2 {
background-color: #494949;
border: 1px solid #faba13;
}
&.icon-reddit-white {
@ -83,6 +83,11 @@
background-color: #1da1f2;
background-size: 60%;
}
&.icon-faucet {
background-image: url('../img/icon-faucet.svg');
background-size: 70%;
}
}
}