|
|
|
@ -155,19 +155,6 @@ function initCordova() {
|
|
|
|
|
// Handle back button to close things
|
|
|
|
|
document.addEventListener("backbutton", handleBackButton, false);
|
|
|
|
|
document.addEventListener("deviceready", function () {
|
|
|
|
|
if (getStorage("wakelock") == "true") {
|
|
|
|
|
window.powerManagement.acquire(function () {
|
|
|
|
|
console.log("Info", 'Wakelock acquired');
|
|
|
|
|
}, function () {
|
|
|
|
|
console.log("Warn", 'Failed to acquire wakelock');
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
window.powerManagement.release(function () {
|
|
|
|
|
console.log("Info", 'Wakelock released');
|
|
|
|
|
}, function () {
|
|
|
|
|
console.log("Warn", 'Failed to release wakelock');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Make sure the status bar color is set properly
|
|
|
|
|
applyColorTheme();
|
|
|
|
@ -175,6 +162,24 @@ function initCordova() {
|
|
|
|
|
// start watching user position after everything's done, hopefully this will make it work
|
|
|
|
|
// with ios
|
|
|
|
|
setupPositionWatcher();
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
if (getStorage("wakelock") == "true") {
|
|
|
|
|
window.powerManagement.acquire(function () {
|
|
|
|
|
console.log("Info", 'Wakelock acquired');
|
|
|
|
|
}, function () {
|
|
|
|
|
console.log("Warn", 'Failed to acquire wakelock');
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
window.powerManagement.release(function () {
|
|
|
|
|
console.log("Info", 'Wakelock released');
|
|
|
|
|
}, function () {
|
|
|
|
|
console.log("Warn", 'Failed to release wakelock');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
console.log("Warn", 'Failed to configure wakelock', ex);
|
|
|
|
|
}
|
|
|
|
|
}, false);
|
|
|
|
|
openBrowser = function (url) {
|
|
|
|
|
cordova.InAppBrowser.open(url, '_blank', 'location=yes');
|
|
|
|
|