mirror of https://github.com/BTCPrivate/copay.git
prelim incoming data menu component
This commit is contained in:
parent
c2641a1102
commit
cc7311d169
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
};
|
||||
});
|
|
@ -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;
|
||||
});
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
</head>
|
||||
<body>
|
||||
|
||||
<ion-nav-view></ion-nav-view>
|
||||
<ion-nav-view>
|
||||
<incoming-data-menu></incoming-data-menu>
|
||||
</ion-nav-view>
|
||||
|
||||
<script src="lib/ionic.bundle.min.js"></script>
|
||||
<script src="lib/angular.js"></script>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
ng-click="hide()">
|
||||
</div>
|
||||
<div class="bp-action-sheet__sheet" ng-class="{'slide-up': show}">
|
||||
<img class="back-arrow" src="img/icon-back-arrow.svg" ng-click="hide()">
|
||||
<div class="header">Send from</div>
|
||||
<!-- <img class="back-arrow" src="img/icon-back-arrow.svg" ng-click="hide()">
|
||||
<div class="header">Send from</div> -->
|
||||
<ng-transclude></ng-transclude>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<action-sheet
|
||||
action-sheet-show="showMenu">
|
||||
hi
|
||||
</action-sheet>
|
|
@ -1,4 +1,6 @@
|
|||
<action-sheet action-sheet-show="show" class="wallet-selector">
|
||||
<img class="back-arrow" src="img/icon-back-arrow.svg" ng-click="hide()">
|
||||
<div class="header">Send from</div>
|
||||
<a
|
||||
ng-repeat="w in wallets track by $index"
|
||||
class="item item-icon-left item-big-icon-left item-icon-right wallet"
|
||||
|
|
|
@ -42,4 +42,5 @@
|
|||
</div>
|
||||
</div>
|
||||
</ion-content>
|
||||
|
||||
</ion-view>
|
||||
|
|
Loading…
Reference in New Issue