2016-10-13 18:29:03 -04:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
angular.module('copayApp.directives')
|
2016-10-18 18:06:50 -04:00
|
|
|
.directive('incomingDataMenu', function($timeout, $rootScope, $state, externalLinkService) {
|
2016-10-13 18:29:03 -04:00
|
|
|
return {
|
|
|
|
|
restrict: 'E',
|
|
|
|
|
templateUrl: 'views/includes/incomingDataMenu.html',
|
|
|
|
|
link: function(scope, element, attrs) {
|
2016-10-14 16:03:53 -04:00
|
|
|
$rootScope.$on('incomingDataMenu.showMenu', function(event, data) {
|
2016-10-14 15:21:16 -04:00
|
|
|
$timeout(function() {
|
2016-10-18 15:45:09 -04:00
|
|
|
scope.data = data.data;
|
|
|
|
|
scope.type = data.type;
|
2016-10-14 15:21:16 -04:00
|
|
|
scope.showMenu = true;
|
2016-10-18 15:45:09 -04:00
|
|
|
|
2016-10-18 18:39:23 -04:00
|
|
|
console.log('scope.type', scope.type);
|
|
|
|
|
if(scope.type === 'url') {
|
|
|
|
|
console.log('scope.data', scope.data);
|
|
|
|
|
console.log('scope.data.indexOf("https://")', scope.data.indexOf('https://'));
|
|
|
|
|
if(scope.data.indexOf('https://') === 0) {
|
|
|
|
|
scope.https = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-18 15:45:09 -04:00
|
|
|
console.log('data', data);
|
2016-10-14 15:21:16 -04:00
|
|
|
});
|
2016-10-14 10:33:36 -04:00
|
|
|
});
|
2016-10-14 15:54:20 -04:00
|
|
|
scope.hide = function() {
|
|
|
|
|
scope.showMenu = false;
|
2016-10-18 17:13:42 -04:00
|
|
|
$rootScope.$broadcast('incomingDataMenu.menuHidden');
|
2016-10-14 15:54:20 -04:00
|
|
|
};
|
2016-10-18 18:06:50 -04:00
|
|
|
scope.goToUrl = function(url){
|
|
|
|
|
externalLinkService.open(url);
|
|
|
|
|
};
|
2016-10-18 16:12:31 -04:00
|
|
|
scope.sendPaymentToAddress = function(bitcoinAddress) {
|
2016-10-18 17:13:42 -04:00
|
|
|
scope.showMenu = false;
|
2016-10-18 17:23:43 -04:00
|
|
|
$state.go('tabs.send').then(function() {
|
2016-10-18 17:38:47 -04:00
|
|
|
$timeout(function() {
|
|
|
|
|
$state.transitionTo('tabs.send.amount', {toAddress: bitcoinAddress});
|
|
|
|
|
}, 50);
|
2016-10-18 17:23:43 -04:00
|
|
|
});
|
2016-10-18 16:12:31 -04:00
|
|
|
};
|
2016-10-18 16:36:47 -04:00
|
|
|
scope.addToAddressBook = function(bitcoinAddress) {
|
2016-10-18 17:13:42 -04:00
|
|
|
scope.showMenu = false;
|
2016-10-18 16:36:47 -04:00
|
|
|
$timeout(function() {
|
2016-10-18 17:23:43 -04:00
|
|
|
$state.go('tabs.send').then(function() {
|
2016-10-18 17:38:47 -04:00
|
|
|
$timeout(function() {
|
|
|
|
|
$state.transitionTo('tabs.send.addressbook', {addressbookEntry: bitcoinAddress});
|
|
|
|
|
}, 10);
|
2016-10-18 17:13:42 -04:00
|
|
|
});
|
2016-10-18 16:36:47 -04:00
|
|
|
}, 100);
|
|
|
|
|
};
|
2016-10-13 18:29:03 -04:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
});
|