prelim logic to conditionally display incoming data menu based on the source

This commit is contained in:
Marty Alcala 2016-10-20 12:53:35 -04:00
parent 890dadade0
commit 78c9ac2484
2 changed files with 31 additions and 20 deletions

View File

@ -61,7 +61,7 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
$scope.openScanner = function() {
$state.go('tabs.scan');
}
};
$scope.showMore = function() {
currentContactsPage++;

View File

@ -47,6 +47,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
}
data = sanitizeUri(data);
//data = 'msEVvmpiFEtXv3MdsFLUYMbnNLeNYrqBEA';
// BIP21
if (bitcore.URI.isValid(data)) {
@ -90,30 +91,32 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
$state.transitionTo('tabs.send.confirm', stateParams);
return true;
});
// Plain Address
// Plain Address
} else if (bitcore.Address.isValid(data, 'livenet')) {
root.showMenu({data: data, type: 'bitcoinAddress'});
//root.showMenu({data: data, type: 'bitcoinAddress'});
goToAmountPage(data);
} else if (bitcore.Address.isValid(data, 'testnet')) {
root.showMenu({data: data, type: 'bitcoinAddress'});
// Protocol
} else if (data && data.indexOf($window.appConfig.name + '://glidera') === 0) {
return $state.go('uriglidera', {url: data});
//root.showMenu({data: data, type: 'bitcoinAddress'});
goToAmountPage(data);
// Protocol
} else if (data && data.indexOf($window.appConfig.name + '://glidera') === 0) {
return $state.go('uriglidera', {url: data});
} else if (data && data.indexOf($window.appConfig.name + '://coinbase') === 0) {
return $state.go('uricoinbase', {url: data});
return $state.go('uricoinbase', {url: data});
// BitPayCard Authentication
} else if (data && data.indexOf($window.appConfig.name + '://') === 0) {
var secret = getParameterByName('secret', data);
var email = getParameterByName('email', data);
var otp = getParameterByName('otp', data);
$state.go('tabs.home').then(function() {
$state.transitionTo('tabs.bitpayCardIntro', {
secret: secret,
email: email,
otp: otp
// BitPayCard Authentication
} else if (data && data.indexOf($window.appConfig.name + '://') === 0) {
var secret = getParameterByName('secret', data);
var email = getParameterByName('email', data);
var otp = getParameterByName('otp', data);
$state.go('tabs.home').then(function() {
$state.transitionTo('tabs.bitpayCardIntro', {
secret: secret,
email: email,
otp: otp
});
});
});
return true;
return true;
// Join
} else if (data && data.match(/^copay:[0-9A-HJ-NP-Za-km-z]{70,80}$/)) {
@ -173,5 +176,13 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
});
}
function goToAmountPage(toAddress) {
console.log('goToAmountPage called', toAddress);
$state.go('tabs.send');
$timeout(function() {
$state.transitionTo('tabs.send.amount', {toAddress: toAddress});
}, 100);
}
return root;
});