From 3bb23fbaf207b7ea43f72586dfe13923a337d682 Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Fri, 14 Jun 2019 01:05:05 -0600 Subject: [PATCH] Make Munzee capture work (close #20) --- package.json | 79 +++++++++++++++++++++++---------------------- www/js/home.js | 5 ++- www/js/map.js | 31 +++++++++++------- www/pages/home.html | 4 +-- 4 files changed, 66 insertions(+), 53 deletions(-) diff --git a/package.json b/package.json index c3ee6c6..8e0f22b 100644 --- a/package.json +++ b/package.json @@ -1,42 +1,43 @@ { - "name": "com.netsyms.terranquest.TerranQuest", - "displayName": "TerranQuest", - "version": "2.0.0", - "description": "", - "main": "www/index.html", - "window": { - "icon": "www/img/logo.png" + "name": "com.netsyms.terranquest.TerranQuest", + "displayName": "TerranQuest", + "version": "2.0.0", + "description": "", + "main": "www/index.html", + "window": { + "icon": "www/img/logo.png" + }, + "author": "Netsyms Technologies", + "license": "MPL-2.0", + "dependencies": { + "cordova-browser": "^6.0.0", + "cordova-plugin-app-version": "^0.1.9", + "cordova-plugin-geolocation": "^4.0.1", + "cordova-plugin-headercolor": "^1.0.0", + "cordova-plugin-inappbrowser": "^3.0.0", + "cordova-plugin-splashscreen": "^5.0.2", + "cordova-plugin-statusbar": "^2.4.2", + "cordova-plugin-transparent-status-bar": "git+https://github.com/manugando/cordova-plugin-transparent-status-bar.git", + "cordova-plugin-whitelist": "^1.3.3", + "phonegap-plugin-barcodescanner": "^8.0.1" + }, + "cordova": { + "plugins": { + "cordova-plugin-whitelist": {}, + "phonegap-plugin-barcodescanner": { + "ANDROID_SUPPORT_V4_VERSION": "27.+" + }, + "cordova-plugin-statusbar": {}, + "cordova-plugin-headercolor": {}, + "cordova-plugin-app-version": {}, + "cordova-plugin-inappbrowser": {}, + "cordova-plugin-transparent-status-bar": {}, + "cordova-plugin-geolocation": {}, + "cordova-plugin-splashscreen": {} }, - "author": "Netsyms Technologies", - "license": "MPL-2.0", - "dependencies": { - "cordova-android": "^8.0.0", - "cordova-plugin-app-version": "^0.1.9", - "cordova-plugin-geolocation": "^4.0.1", - "cordova-plugin-headercolor": "^1.0.0", - "cordova-plugin-inappbrowser": "^3.0.0", - "cordova-plugin-splashscreen": "^5.0.2", - "cordova-plugin-statusbar": "^2.4.2", - "cordova-plugin-transparent-status-bar": "git+https://github.com/manugando/cordova-plugin-transparent-status-bar.git", - "cordova-plugin-whitelist": "^1.3.3", - "phonegap-plugin-barcodescanner": "^8.0.1" - }, - "cordova": { - "plugins": { - "cordova-plugin-whitelist": {}, - "phonegap-plugin-barcodescanner": { - "ANDROID_SUPPORT_V4_VERSION": "27.+" - }, - "cordova-plugin-statusbar": {}, - "cordova-plugin-headercolor": {}, - "cordova-plugin-app-version": {}, - "cordova-plugin-inappbrowser": {}, - "cordova-plugin-transparent-status-bar": {}, - "cordova-plugin-geolocation": {}, - "cordova-plugin-splashscreen": {} - }, - "platforms": [ - "android" - ] - } + "platforms": [ + "android", + "browser" + ] + } } \ No newline at end of file diff --git a/www/js/home.js b/www/js/home.js index 3b08280..161fa5b 100644 --- a/www/js/home.js +++ b/www/js/home.js @@ -51,7 +51,10 @@ function scanCode() { callAPI("code", { username: localStorage.getItem("username"), password: localStorage.getItem("password"), - code: text + code: text, + latitude: playerPosition.coords.latitude, + longitude: playerPosition.coords.longitude, + accuracy: playerPosition.coords.accuracy }, function (resp) { if (resp.item == "" && resp.munzee == "") { app.dialog.alert("You didn't find anything new.", ""); diff --git a/www/js/map.js b/www/js/map.js index 909709d..9d4fc2f 100644 --- a/www/js/map.js +++ b/www/js/map.js @@ -7,6 +7,14 @@ var gotfirstfix = false; +var playerPosition = { + coords: { + latitude: 0.0, + longitude: 0.0, + accuracy: 999999 + } +}; + var geoerrorcount = 0; var gamemaptype = "mapbox"; @@ -29,19 +37,20 @@ watchLocation(function (position) { animateMapIn(position.coords.latitude, position.coords.longitude, 16, position.coords.heading); gotfirstfix = true; } + playerPosition = position; }, function (error) { geoerrorcount++; console.log("Geolocation error #" + geoerrorcount + ": ", error); // Stop showing error toasts if they're happening a lot - if (geoerrorcount > 3) { - return; - } - app.toast.show({ - text: ' ' + error, - position: "bottom", - destroyOnClose: true, - closeTimeout: 1000 * 4 - }); +// if (geoerrorcount > 3) { +// return; +// } +// app.toast.show({ +// text: ' ' + error, +// position: "bottom", +// destroyOnClose: true, +// closeTimeout: 1000 * 4 +// }); }); function setMapHeading(heading) { @@ -58,7 +67,7 @@ function updatePlaceLayer(latitude, longitude) { password: localStorage.getItem("password"), latitude: latitude, longitude: longitude, - radius: 0.5 + radius: 1 }, function (data) { map.updatePlaceLayer(data); }); @@ -72,4 +81,4 @@ function animateMapIn(latitude, longitude, zoom, heading) { heading = 0; } map.animateMapIn(latitude, longitude, zoom, heading); -} \ No newline at end of file +} diff --git a/www/pages/home.html b/www/pages/home.html index 9503d6a..59390ed 100644 --- a/www/pages/home.html +++ b/www/pages/home.html @@ -158,8 +158,8 @@