Merge pull request #185 from cmgustavo/ref/design-52

Bug fixes
This commit is contained in:
Gustavo Maximiliano Cortez 2016-09-23 18:08:50 -03:00 committed by GitHub
commit fe3de5a548
5 changed files with 16 additions and 21 deletions

View File

@ -5,6 +5,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
var isChromeApp = platformInfo.isChromeApp; var isChromeApp = platformInfo.isChromeApp;
$scope.isWallet = $stateParams.isWallet; $scope.isWallet = $stateParams.isWallet;
$scope.toAmount = $stateParams.toAmount;
$scope.toAddress = $stateParams.toAddress; $scope.toAddress = $stateParams.toAddress;
$scope.toName = $stateParams.toName; $scope.toName = $stateParams.toName;
$scope.toEmail = $stateParams.toEmail; $scope.toEmail = $stateParams.toEmail;
@ -16,15 +17,15 @@ angular.module('copayApp.controllers').controller('confirmController', function(
}); });
var initConfirm = function() { var initConfirm = function() {
if ($stateParams.paypro) { if ($scope.paypro) {
return setFromPayPro($stateParams.paypro, function(err) { return setFromPayPro($scope.paypro, function(err) {
if (err && !isChromeApp) { if (err && !isChromeApp) {
popupService.showAlert(gettext('Could not fetch payment')); popupService.showAlert(gettext('Could not fetch payment'));
} }
}); });
} }
// TODO (URL , etc) // TODO (URL , etc)
if (!$stateParams.toAddress || !$stateParams.toAmount) { if (!$scope.toAddress || !$scope.toAmount) {
$log.error('Bad params at amount') $log.error('Bad params at amount')
throw ('bad params'); throw ('bad params');
} }
@ -34,7 +35,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
var config = configService.getSync().wallet; var config = configService.getSync().wallet;
$scope.feeLevel = config.settings ? config.settings.feeLevel : ''; $scope.feeLevel = config.settings ? config.settings.feeLevel : '';
var amount = $scope.toAmount = parseInt($stateParams.toAmount); $scope.toAmount = parseInt($scope.toAmount);
$scope.amountStr = txFormatService.formatAmountStr($scope.toAmount); $scope.amountStr = txFormatService.formatAmountStr($scope.toAmount);
var networkName = (new bitcore.Address($scope.toAddress)).network.name; var networkName = (new bitcore.Address($scope.toAddress)).network.name;
@ -55,7 +56,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
$log.error(err); $log.error(err);
} else { } else {
if (!status.availableBalanceSat) $log.debug('No balance available in: ' + w.name); if (!status.availableBalanceSat) $log.debug('No balance available in: ' + w.name);
if (status.availableBalanceSat > amount) filteredWallets.push(w); if (status.availableBalanceSat > $scope.toAmount) filteredWallets.push(w);
} }
if (++index == wallets.length) { if (++index == wallets.length) {
@ -70,7 +71,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
}); });
}); });
txFormatService.formatAlternativeStr(amount, function(v) { txFormatService.formatAlternativeStr($scope.toAmount, function(v) {
$scope.alternativeAmountStr = v; $scope.alternativeAmountStr = v;
}); });
@ -146,12 +147,13 @@ angular.module('copayApp.controllers').controller('confirmController', function(
return cb(true); return cb(true);
} }
$stateParams.toAmount = paypro.amount; $scope.toAmount = paypro.amount;
$stateParams.toAddress = paypro.toAddress; $scope.toAddress = paypro.toAddress;
$stateParams.description = paypro.memo; $scope.description = paypro.memo;
$stateParams.paypro = null; $scope.paypro = null;
$scope._paypro = paypro; $scope._paypro = paypro;
return initConfirm(); return initConfirm();
}); });
}; };

View File

@ -3,7 +3,7 @@
angular.module('copayApp.controllers').controller('txStatusController', function($scope, $timeout, $state, $ionicHistory, $log, addressbookService) { angular.module('copayApp.controllers').controller('txStatusController', function($scope, $timeout, $state, $ionicHistory, $log, addressbookService) {
if ($scope.cb) $timeout($scope.cb, 100); if ($scope.cb) $timeout($scope.cb, 100);
$scope.fromSendTab = $ionicHistory.viewHistory().backView.stateName === "tabs.send.amount"; $scope.fromSendTab = $ionicHistory.viewHistory().backView.stateName === "tabs.send.amount" || "tabs.send";
$scope.cancel = function() { $scope.cancel = function() {
$scope.txStatusModal.hide(); $scope.txStatusModal.hide();

View File

@ -47,7 +47,7 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
}, 1); }, 1);
}; };
$scope.$on("$ionicView.enter", function(event, data) { $scope.$on("$ionicView.beforeEnter", function(event, data) {
if (!$scope.isCordova) $scope.checkTips(); if (!$scope.isCordova) $scope.checkTips();
$scope.wallets = profileService.getWallets({ $scope.wallets = profileService.getWallets({
onlyComplete: true onlyComplete: true

View File

@ -86,7 +86,7 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
}); });
}; };
$scope.$on("$ionicView.enter", function(event, data){ $scope.$on("$ionicView.beforeEnter", function(event, data){
$scope.formData = { search: null }; $scope.formData = { search: null };
updateList(); updateList();
}); });

View File

@ -1,6 +1,6 @@
'use strict'; 'use strict';
angular.module('copayApp.services').factory('incomingData', function($log, $ionicModal, $ionicHistory, $state, $window, $timeout, bitcore) { angular.module('copayApp.services').factory('incomingData', function($log, $ionicModal, $state, $window, $timeout, bitcore) {
var root = {}; var root = {};
@ -26,7 +26,6 @@ angular.module('copayApp.services').factory('incomingData', function($log, $ioni
// data extensions for Payment Protocol with non-backwards-compatible request // data extensions for Payment Protocol with non-backwards-compatible request
if ((/^bitcoin:\?r=[\w+]/).exec(data)) { if ((/^bitcoin:\?r=[\w+]/).exec(data)) {
data = decodeURIComponent(data.replace('bitcoin:?r=', '')); data = decodeURIComponent(data.replace('bitcoin:?r=', ''));
$ionicHistory.removeBackView();
$state.go('tabs.send'); $state.go('tabs.send');
$timeout(function() { $timeout(function() {
$state.transitionTo('tabs.send.confirm', {paypro: data}); $state.transitionTo('tabs.send.confirm', {paypro: data});
@ -46,7 +45,6 @@ angular.module('copayApp.services').factory('incomingData', function($log, $ioni
var amount = parsed.amount ? parsed.amount : ''; var amount = parsed.amount ? parsed.amount : '';
$ionicHistory.removeBackView();
$state.go('tabs.send'); $state.go('tabs.send');
$timeout(function() { $timeout(function() {
if (parsed.r) { if (parsed.r) {
@ -63,7 +61,6 @@ angular.module('copayApp.services').factory('incomingData', function($log, $ioni
// Plain URL // Plain URL
} else if (/^https?:\/\//.test(data)) { } else if (/^https?:\/\//.test(data)) {
$ionicHistory.removeBackView();
$state.go('tabs.send'); $state.go('tabs.send');
$timeout(function() { $timeout(function() {
$state.transitionTo('tabs.send.confirm', {paypro: data}); $state.transitionTo('tabs.send.confirm', {paypro: data});
@ -72,14 +69,12 @@ angular.module('copayApp.services').factory('incomingData', function($log, $ioni
// Plain Address // Plain Address
} else if (bitcore.Address.isValid(data, 'livenet')) { } else if (bitcore.Address.isValid(data, 'livenet')) {
$ionicHistory.removeBackView();
$state.go('tabs.send'); $state.go('tabs.send');
$timeout(function() { $timeout(function() {
$state.transitionTo('tabs.send.amount', {toAddress: data}); $state.transitionTo('tabs.send.amount', {toAddress: data});
}, 100); }, 100);
return true; return true;
} else if (bitcore.Address.isValid(data, 'testnet')) { } else if (bitcore.Address.isValid(data, 'testnet')) {
$ionicHistory.removeBackView();
$state.go('tabs.send'); $state.go('tabs.send');
$timeout(function() { $timeout(function() {
$state.transitionTo('tabs.send.amount', {toAddress: data}); $state.transitionTo('tabs.send.amount', {toAddress: data});
@ -94,7 +89,6 @@ angular.module('copayApp.services').factory('incomingData', function($log, $ioni
// Join // Join
} else if (data && data.match(/^copay:[0-9A-HJ-NP-Za-km-z]{70,80}$/)) { } else if (data && data.match(/^copay:[0-9A-HJ-NP-Za-km-z]{70,80}$/)) {
$ionicHistory.removeBackView();
$state.go('tabs.home'); $state.go('tabs.home');
$timeout(function() { $timeout(function() {
$state.transitionTo('tabs.add.join', {url: data}); $state.transitionTo('tabs.add.join', {url: data});
@ -103,7 +97,6 @@ angular.module('copayApp.services').factory('incomingData', function($log, $ioni
// Old join // Old join
} else if (data && data.match(/^[0-9A-HJ-NP-Za-km-z]{70,80}$/)) { } else if (data && data.match(/^[0-9A-HJ-NP-Za-km-z]{70,80}$/)) {
$ionicHistory.removeBackView();
$state.go('tabs.home'); $state.go('tabs.home');
$timeout(function() { $timeout(function() {
$state.transitionTo('tabs.add.join', {url: data}); $state.transitionTo('tabs.add.join', {url: data});