Wallet/src/js/init.js

39 lines
852 B
JavaScript
Raw Normal View History

2014-03-14 17:38:27 -03:00
'use strict';
2014-04-30 12:25:33 -03:00
2014-03-14 17:38:27 -03:00
angular.element(document).ready(function() {
2015-01-03 13:59:18 -03:00
2015-04-13 10:37:42 -03:00
// Run copayApp after device is ready.
var startAngular = function() {
angular.bootstrap(document, ['copayApp']);
2015-04-13 10:37:42 -03:00
};
2016-06-10 12:08:27 -03:00
function handleOpenURL(url) {
if ('cordova' in window) {
console.log('DEEP LINK:' + url);
cordova.fireDocumentEvent('handleopenurl', {
url: url
});
} else {
console.log("ERROR: Cannont handle open URL in non-cordova apps")
}
};
/* Cordova specific Init */
if ('cordova' in window) {
window.handleOpenURL = handleOpenURL;
2014-11-25 15:09:36 -03:00
document.addEventListener('deviceready', function() {
// Create a sticky event for handling the app being opened via a custom URL
cordova.addStickyDocumentEventHandler('handleopenurl');
2015-04-13 10:37:42 -03:00
startAngular();
}, false);
2014-11-25 15:09:36 -03:00
} else {
2015-04-13 10:37:42 -03:00
startAngular();
2014-11-25 15:09:36 -03:00
}
2014-03-14 17:38:27 -03:00
});