diff --git a/src/js/controllers/confirm.js b/src/js/controllers/confirm.js index 465257e7c..350f58277 100644 --- a/src/js/controllers/confirm.js +++ b/src/js/controllers/confirm.js @@ -160,10 +160,13 @@ angular.module('copayApp.controllers').controller('confirmController', function( $log.debug('Fetch PayPro Request...', uri); ongoingProcess.set('fetchingPayPro', true); + //debugger; + var uri = 'https://bitpay.com/i/NhjqGZo1RNoHxiHxK7VBuM'; + uri = 'https://test.bitpay.com:443/i/LCy5Y7hxmEbkprAK27odAU'; wallet.fetchPayPro({ payProUrl: uri, }, function(err, paypro) { - + console.log('paypro', paypro); ongoingProcess.set('fetchingPayPro', false); if (err) { diff --git a/src/js/controllers/tab-scan.js b/src/js/controllers/tab-scan.js index 3d95c3a25..941fd4237 100644 --- a/src/js/controllers/tab-scan.js +++ b/src/js/controllers/tab-scan.js @@ -11,6 +11,10 @@ angular.module('copayApp.controllers').controller('tabScanController', function( }; $scope.scannerStates = scannerStates; + $timeout(function() { + $scope.showActionSheet = true; + }, 2000); + function _updateCapabilities(){ var capabilities = scannerService.getCapabilities(); $scope.scannerIsAvailable = capabilities.isAvailable; diff --git a/src/js/directives/incomingDataMenu.js b/src/js/directives/incomingDataMenu.js new file mode 100644 index 000000000..0b2e7e3f6 --- /dev/null +++ b/src/js/directives/incomingDataMenu.js @@ -0,0 +1,16 @@ +'use strict'; + +angular.module('copayApp.directives') + .directive('incomingDataMenu', function($timeout) { + return { + restrict: 'E', + templateUrl: 'views/includes/incomingDataMenu.html', + link: function(scope, element, attrs) { + console.log('incomingDataMenu constructed'); + $timeout(function() { + scope.showMenu = true; + }, 5000); + + } + }; + }); diff --git a/src/js/services/incomingData.js b/src/js/services/incomingData.js index fc363590c..0c4954660 100644 --- a/src/js/services/incomingData.js +++ b/src/js/services/incomingData.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.services').factory('incomingData', function($log, $ionicModal, $state, $window, $timeout, bitcore) { +angular.module('copayApp.services').factory('incomingData', function($log, $ionicModal, $state, $window, $timeout, bitcore, profileService, popupService, ongoingProcess, platformInfo, gettextCatalog) { var root = {}; @@ -61,12 +61,20 @@ angular.module('copayApp.services').factory('incomingData', function($log, $ioni // Plain URL } else if (/^https?:\/\//.test(data)) { - $state.go('tabs.send'); - $timeout(function() { - $state.transitionTo('tabs.send.confirm', {paypro: data}); - }, 100); - return true; + console.log('in here brah'); + getPayProDetails(data, function(err, details) { + if(err) { + console.log('getPayProDetails err', err); + return; + } + console.log('paypro details', details); + $state.go('tabs.send'); + $timeout(function() { + $state.transitionTo('tabs.send.confirm', {paypro: data}); + }, 100); + return true; + }); // Plain Address } else if (bitcore.Address.isValid(data, 'livenet')) { $state.go('tabs.send'); @@ -108,5 +116,59 @@ angular.module('copayApp.services').factory('incomingData', function($log, $ioni }; + function getPayProDetails(uri, cb) { + if (!cb) cb = function() {}; + + var wallet = profileService.getWallets({ + onlyComplete: true + })[0]; + + if (!wallet) return cb(); + + if (platformInfo.isChromeApp) { + popupService.showAlert(gettextCatalog.getString('Payment Protocol not supported on Chrome App')); + return cb(true); + } + + $log.debug('Fetch PayPro Request...', uri); + + ongoingProcess.set('fetchingPayPro', true); + //debugger; + // uri = 'https://bitpay.com/i/NhjqGZo1RNoHxiHxK7VBuM'; + // uri = 'https://test.bitpay.com:443/i/LCy5Y7hxmEbkprAK27odAU'; + wallet.fetchPayPro({ + payProUrl: uri, + }, function(err, paypro) { + console.log('paypro', paypro); + ongoingProcess.set('fetchingPayPro', false); + + if (err) { + $log.warn('Could not fetch payment request:', err); + var msg = err.toString(); + if (msg.match('HTTP')) { + msg = gettextCatalog.getString('Could not fetch payment information'); + } + popupService.showAlert(msg); + return cb(true); + } + + if (!paypro.verified) { + $log.warn('Failed to verify payment protocol signatures'); + popupService.showAlert(gettextCatalog.getString('Payment Protocol Invalid')); + return cb(true); + } + + // $scope.toAmount = paypro.amount; + // $scope.toAddress = paypro.toAddress; + // $scope.description = paypro.memo; + // $scope.paypro = null; + // + // $scope._paypro = paypro; + + //return initConfirm(); + cb(null, paypro); + }); + }; + return root; }); diff --git a/www/index.html b/www/index.html index fe0611bae..431e8033b 100644 --- a/www/index.html +++ b/www/index.html @@ -12,7 +12,9 @@ - + + + diff --git a/www/views/includes/actionSheet.html b/www/views/includes/actionSheet.html index df159bc2b..c4b955fc7 100644 --- a/www/views/includes/actionSheet.html +++ b/www/views/includes/actionSheet.html @@ -4,7 +4,7 @@ ng-click="hide()">
- -
Send from
+
diff --git a/www/views/includes/incomingDataMenu.html b/www/views/includes/incomingDataMenu.html new file mode 100644 index 000000000..04a249d80 --- /dev/null +++ b/www/views/includes/incomingDataMenu.html @@ -0,0 +1,4 @@ + + hi + diff --git a/www/views/includes/walletSelector.html b/www/views/includes/walletSelector.html index ba97edad0..42ec0d772 100644 --- a/www/views/includes/walletSelector.html +++ b/www/views/includes/walletSelector.html @@ -1,4 +1,6 @@ + +
Send from
+