Merge pull request #4966 from cmgustavo/feat/uri-handler-macos

URI handler support for macOS
This commit is contained in:
Matias Alejo Garcia 2016-11-02 17:32:24 -03:00 committed by GitHub
commit 21e54829a6
6 changed files with 29 additions and 17 deletions

View file

@ -224,7 +224,15 @@ module.exports = function(grunt) {
buildDir: './webkitbuilds',
version: '0.16.0',
macIcns: './resources/<%= pkg.name %>/mac/app.icns',
exeIco: './www/img/app/logo.ico'
exeIco: './www/img/app/logo.ico',
macPlist: {
'CFBundleURLTypes': [
{
'CFBundleURLName' : 'URI Handler',
'CFBundleURLSchemes' : ['bitcoin', '<%= pkg.name %>']
}
]
}
},
src: ['./package.json', './www/**/*']
},
@ -254,6 +262,7 @@ module.exports = function(grunt) {
grunt.registerTask('translate', ['nggettext_extract']);
grunt.registerTask('desktop', ['prod', 'nwjs', 'copy:linux', 'compress:linux']);
grunt.registerTask('macos', ['prod', 'nwjs', 'exec:macos']);
grunt.registerTask('macos-debug', ['default', 'nwjs']);
grunt.registerTask('chrome', ['exec:chrome']);
grunt.registerTask('wp', ['prod', 'exec:wp']);
grunt.registerTask('wp-copy', ['default', 'exec:wpcopy']);

View file

@ -4,6 +4,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
var cachedTxp = {};
var isChromeApp = platformInfo.isChromeApp;
var countDown = null;
$scope.isCordova = platformInfo.isCordova;
$ionicConfig.views.swipeBackEnabled(false);
$scope.$on("$ionicView.beforeEnter", function(event, data) {
@ -30,9 +31,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
$log.error('Bad params at amount');
throw ('bad params');
}
$scope.isCordova = platformInfo.isCordova;
$scope.hasClick = platformInfo.hasClick;
$scope.data = {};
var config = configService.getSync().wallet;
$scope.feeLevel = config.settings && config.settings.feeLevel ? config.settings.feeLevel : 'normal';

View file

@ -902,7 +902,6 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
.run(function($rootScope, $state, $location, $log, $timeout, $ionicHistory, $ionicPlatform, $window, lodash, platformInfo, profileService, uxLanguage, gettextCatalog, openURLService, storageService, scannerService) {
uxLanguage.init();
openURLService.init();
$ionicPlatform.ready(function() {
if (platformInfo.isCordova) {
@ -995,6 +994,11 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
scannerService.gentleInitialize();
$state.go('tabs.home');
}
// After everything have been loaded, initialize handler URL
$timeout(function() {
openURLService.init();
}, 1000);
});
});

View file

@ -40,7 +40,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
// data extensions for Payment Protocol with non-backwards-compatible request
if ((/^bitcoin:\?r=[\w+]/).exec(data)) {
data = decodeURIComponent(data.replace('bitcoin:?r=', ''));
$state.go('tabs.send').then(function() {
$state.go('tabs.send', {}, {'reload': true, 'notify': $state.current.name == 'tabs.send' ? false : true}).then(function() {
$state.transitionTo('tabs.send.confirm', {paypro: data});
});
return true;
@ -62,7 +62,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
handlePayPro(details);
});
} else {
$state.go('tabs.send');
$state.go('tabs.send', {}, {'reload': true, 'notify': $state.current.name == 'tabs.send' ? false : true});
// Timeout is required to enable the "Back" button
$timeout(function() {
if (amount) {
@ -70,7 +70,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
} else {
$state.transitionTo('tabs.send.amount', {toAddress: addr});
}
});
}, 100);
}
return true;
@ -102,7 +102,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
var secret = getParameterByName('secret', data);
var email = getParameterByName('email', data);
var otp = getParameterByName('otp', data);
$state.go('tabs.home').then(function() {
$state.go('tabs.home', {}, {'reload': true, 'notify': $state.current.name == 'tabs.home' ? false : true}).then(function() {
$state.transitionTo('tabs.bitpayCardIntro', {
secret: secret,
email: email,
@ -113,14 +113,14 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
// Join
} else if (data && data.match(/^copay:[0-9A-HJ-NP-Za-km-z]{70,80}$/)) {
$state.go('tabs.home').then(function() {
$state.go('tabs.home', {}, {'reload': true, 'notify': $state.current.name == 'tabs.home' ? false : true}).then(function() {
$state.transitionTo('tabs.add.join', {url: data});
});
return true;
// Old join
} else if (data && data.match(/^[0-9A-HJ-NP-Za-km-z]{70,80}$/)) {
$state.go('tabs.home').then(function() {
$state.go('tabs.home', {}, {'reload': true, 'notify': $state.current.name == 'tabs.home' ? false : true}).then(function() {
$state.transitionTo('tabs.add.join', {url: data});
});
return true;
@ -136,7 +136,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
};
function goToAmountPage(toAddress) {
$state.go('tabs.send');
$state.go('tabs.send', {}, {'reload': true, 'notify': $state.current.name == 'tabs.send' ? false : true});
$timeout(function() {
$state.transitionTo('tabs.send.amount', {toAddress: toAddress});
}, 100);
@ -150,7 +150,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
paypro: payProDetails
};
scannerService.pausePreview();
$state.go('tabs.send').then(function() {
$state.go('tabs.send', {}, {'reload': true, 'notify': $state.current.name == 'tabs.send' ? false : true}).then(function() {
$timeout(function() {
$state.transitionTo('tabs.send.confirm', stateParams);
});

View file

@ -8,9 +8,10 @@ angular.module('copayApp.services').factory('openURLService', function($rootScop
// Stop it from caching the first view as one to return when the app opens
$ionicHistory.nextViewOptions({
historyRoot: true,
disableBack: true,
disableBack: false,
disableAnimation: true
});
var url = args.url;
if (!url) {
$log.error('No url provided');

View file

@ -7,7 +7,7 @@
</ion-nav-back-button>
</ion-nav-bar>
<ion-content ng-class="{'slide-to-pay': !hasClick && !insuffientFunds && !noMatchingWallet}">
<ion-content ng-class="{'slide-to-pay': isCordova && !insuffientFunds && !noMatchingWallet}">
<div class="list">
<div class="item head">
<div class="sending-label">
@ -79,13 +79,13 @@
</div>
<click-to-accept
ng-click="approve(statusChangeHandler)"
ng-if="hasClick && wallets[0]"
ng-if="!isCordova && wallets[0]"
click-send-status="sendStatus">
Click to pay
</click-to-accept>
</ion-content>
<slide-to-accept
ng-if="!hasClick && wallets[0]"
ng-if="isCordova && wallets[0]"
slide-on-confirm="onConfirm()"
slide-send-status="sendStatus">
Slide to pay