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() {
|
2015-04-17 12:23:40 -03:00
|
|
|
angular.bootstrap(document, ['copayApp']);
|
2015-04-13 10:37:42 -03:00
|
|
|
};
|
2015-06-26 05:42:39 -03:00
|
|
|
|
2016-06-10 12:08:27 -03:00
|
|
|
|
2016-06-11 13:52:44 -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")
|
|
|
|
|
}
|
2015-06-26 05:42:39 -03:00
|
|
|
};
|
|
|
|
|
|
2014-12-07 12:40:59 -03:00
|
|
|
/* Cordova specific Init */
|
2016-06-11 13:52:44 -03:00
|
|
|
if ('cordova' in window) {
|
|
|
|
|
|
|
|
|
|
window.handleOpenURL = handleOpenURL;
|
|
|
|
|
|
2014-12-07 12:40:59 -03:00
|
|
|
|
2014-11-25 15:09:36 -03:00
|
|
|
document.addEventListener('deviceready', function() {
|
2016-06-11 13:52:44 -03:00
|
|
|
|
2016-06-13 16:36:08 -03:00
|
|
|
window.open = cordova.InAppBrowser.open;
|
|
|
|
|
|
2016-06-11 13:52:44 -03:00
|
|
|
// 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();
|
2014-11-26 12:36:51 -03:00
|
|
|
}, false);
|
2016-05-23 12:16:27 -03:00
|
|
|
|
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
|
|
|
});
|