2014-08-01 06:03:11 -07:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
document.addEventListener("deviceready", onDeviceReady, false);
|
|
|
|
|
|
|
|
function onDeviceReady() {
|
|
|
|
setTimeout(function(){ navigator.splashscreen.hide(); }, 2000);
|
|
|
|
|
|
|
|
document.addEventListener("menubutton", function() {
|
|
|
|
var nav = document.getElementsByTagName('nav')[0];
|
|
|
|
if (!nav) return;
|
|
|
|
|
|
|
|
var menu = nav.getElementsByTagName('section')[0].getElementsByTagName('a')[0];
|
|
|
|
if (menu.offsetParent) menu.click();
|
|
|
|
|
|
|
|
}, false);
|
2014-08-15 07:34:43 -07:00
|
|
|
|
|
|
|
|
|
|
|
function handleBitcoinURI(url) {
|
|
|
|
if (!url) return;
|
|
|
|
|
|
|
|
var body = document.getElementsByTagName('nav')[0];
|
|
|
|
var $rootScope = angular.element(body).scope();
|
2014-08-15 13:33:15 -07:00
|
|
|
$rootScope.pendingPayment = new bitcore.BIP21(url);
|
2014-08-15 07:34:43 -07:00
|
|
|
|
|
|
|
// Redirect or reload controller (if already there)
|
|
|
|
window.location = ($rootScope.wallet ? '#!/send' : '#!/open') + '?r=' + Math.random();
|
|
|
|
}
|
|
|
|
|
|
|
|
window.plugins.webintent.getUri(handleBitcoinURI);
|
|
|
|
window.plugins.webintent.onNewIntent(handleBitcoinURI);
|
2014-09-03 08:04:14 -07:00
|
|
|
window.handleOpenURL = handleBitcoinURI;
|
2014-08-01 06:03:11 -07:00
|
|
|
}
|