also try to register handlers in non-cordova environments

This commit is contained in:
Matias Alejo Garcia 2015-06-26 05:42:39 -03:00
parent 7433b1b863
commit 38b8240341
1 changed files with 17 additions and 9 deletions

View File

@ -6,6 +6,15 @@ angular.element(document).ready(function() {
var startAngular = function() {
angular.bootstrap(document, ['copayApp']);
};
var handleBitcoinURI = function(url) {
if (!url) return;
setTimeout(function() {
window.location = '#/uri-payment/' + url;
}, 1000);
};
/* Cordova specific Init */
if (window.cordova !== undefined) {
@ -37,8 +46,7 @@ angular.element(document).ready(function() {
var loc = window.location;
if (loc.toString().match(/index\.html#\/$/)) {
navigator.app.exitApp();
}
else {
} else {
window.location = '#/cordova/walletHome';
}
}, false);
@ -53,13 +61,6 @@ angular.element(document).ready(function() {
navigator.splashscreen.hide();
}, 2000);
function handleBitcoinURI(url) {
if (!url) return;
setTimeout(function() {
window.location = '#/uri-payment/' + url;
}, 1000);
}
window.plugins.webintent.getUri(handleBitcoinURI);
window.plugins.webintent.onNewIntent(handleBitcoinURI);
window.handleOpenURL = handleBitcoinURI;
@ -67,6 +68,13 @@ angular.element(document).ready(function() {
startAngular();
}, false);
} else {
try {
window.handleOpenURL = handleBitcoinURI;
window.plugins.webintent.getUri(handleBitcoinURI);
window.plugins.webintent.onNewIntent(handleBitcoinURI);
} catch (e) {}
startAngular();
}