diff --git a/README.md b/README.md index 38ccb3bc24976fa606c7faa606fb8a11bc045ac5..35e0f218036b0e250a3240169fb6023ee1e4445c 100644 --- a/README.md +++ b/README.md @@ -45,8 +45,13 @@ cordova emulate browser # Test on Android. Requires correct setup of the Android SDK. # Read more here: https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html cordova emulate android + ``` +Remember: If you upgrade cordova or change the package name of the app (in config.xml), +you should reset the platform, using `cordova platform remove android` and then `cordova platform add android` + + ### Connecting to a local server While developing, you will want to connect to a local instance of VIPSLogic. This is done by editing the property `CONST_URL_DOMAIN` in `/src/components/CommonUtilLocal.vue`. Set it to whatever domain name you wish (e.g. vipslogic-local.no) and then edit your `/etc/hosts` file to point this to the IP address 10.0.2.2, like this @@ -150,3 +155,20 @@ https://developer.android.com/guide/app-bundle https://developer.android.com/studio/publish#unknown-sources +## Building a production version (signing etc). +[Signing the app](https://cordova.apache.org/docs/en/latest/guide/platforms/android/#signing-an-app) + +For NIBIO, a signing key was originally created sometime in 2021, but it has been lost. After contacting Google Play Developer Support, we received instructions for how to generate a new key (example code): + +``` bash +keytool -genkeypair -alias upload -keyalg RSA -keysize 2048 -validity 9125 -keystore keystore.jks +``` + +...so we did this, and stored the keystore *securely* (in a dev project folder) + +We then extracted the PEM to send to Google (example code) + +``` bash +keytool -export -rfc -alias upload -file upload_certificate.pem -keystore keystore.jks + +``` \ No newline at end of file diff --git a/config.xml b/config.xml index cad0d71a6c91f4fd510646c766314afcaca2b31c..c44ee1fa0e40904358b3588e1daf26d0e1d19fee 100644 --- a/config.xml +++ b/config.xml @@ -1,9 +1,9 @@ <?xml version='1.0' encoding='utf-8'?> -<widget id="no.nibio.vips.observation" version="0.9.5" +<widget id="no.nibio.vips.observation" version="0.9.6" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0"> - <name>VIPS Field Observation App</name> + <name>VIPS_Field_Observation_App</name> <description>The Field Observation app for VIPS users. Build it with 'npm run build' before any cordova specific actions - so that vuejs can diff --git a/package.json b/package.json index 0f38a00959cbe5c1301dc3bbaa3a2512155a9527..50f4c9abab756be7d39367c216b97d34b807092d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vipsobservationapp", - "version": "0.9.5", + "version": "0.9.6", "private": true, "description": "The Field Pest Observation App for VIPS users", "author": "Tor-Einar Skog <tor-einar.skog@nibio.no>", diff --git a/src/components/CommonUtil.vue b/src/components/CommonUtil.vue index ecd966fd21c74117e2b1caddb1a29bcd2ec9ecf7..9f41a73fc51ef45ef5af9b4b63ae024e21afc2c2 100644 --- a/src/components/CommonUtil.vue +++ b/src/components/CommonUtil.vue @@ -75,6 +75,12 @@ CONST_FIELD_MANDATORY: '<font color=red>*</font>', + logInfo: function(message) { + if(CommonUtilLocal.CONST_DEBUG){ + CommonUtil.logInfo(message); + } + }, + setHeaderTitle: function (headerTitle) { document.getElementById("appHeader").innerHTML = headerTitle; } diff --git a/src/components/LoginSystem.vue b/src/components/LoginSystem.vue index 041e22d37d7698d70b3995bc06f74de6e9b6fd0c..ca72b13f101fc577d3501709d378610b4c3fa6c6 100644 --- a/src/components/LoginSystem.vue +++ b/src/components/LoginSystem.vue @@ -201,11 +201,34 @@ this.$router.push('/') } } + + this.createIndexedDB(); } ); // END inner fetch } }); // END outer fetch }, + createIndexedDB() { + // User is successfully logged in. We create the database (indexedDB) + // for storing images + + // Load the database, in case we need to create the schema + let dbRequest = indexedDB.open(CommonUtil.CONST_DB_NAME, CommonUtil.CONST_DB_VERSION); + + + dbRequest.onupgradeneeded = function (event) { + CommonUtil.logInfo("No/outdated IndexedDB database found. Updating schema."); + // Define the database schema here + let db = event.target.result; + if(!db.objectStoreNames.contains(CommonUtil.CONST_DB_ENTITY_PHOTO)) + { + let store = db.createObjectStore(CommonUtil.CONST_DB_ENTITY_PHOTO, {keypath: "fileName"}); + store.createIndex('observationId', 'observationId', {unique: false}); + store.createIndex('organismId', 'organismId', {unique: false}); + } + db.close(); + } + }, handleLogout() { this.$root.sharedState.uuid = ''; // remove global uuid for other (e.g. menu items etc) /** Remove stored data from app in local system - server data still preserve */ @@ -232,19 +255,22 @@ localStorage.removeItem(CommonUtil.CONST_STORAGE_VISIBILITY_POLYGON); /* Remove from IndexedDB */ - let dbRequest = null; - dbRequest = indexedDB.open(CommonUtil.CONST_DB_NAME, CommonUtil.CONST_DB_VERSION); + //let dbRequest = null; + /*dbRequest = indexedDB.open(CommonUtil.CONST_DB_NAME, CommonUtil.CONST_DB_VERSION); dbRequest.onsuccess = function (evt) { let db = evt.target.result; db.close(); } - + */ let delReq = indexedDB.deleteDatabase(CommonUtil.CONST_DB_NAME); + delReq.onsuccess = function() { + CommonUtil.logInfo("Database was successfully deleted!"); + } delReq.onerror = function () { - console.info('could not delete database'); + CommonUtil.logInfo('could not delete database'); } delReq.onblocked = function () { - console.info('delete DB not successful because of operation block'); + CommonUtil.logInfo('delete DB not successful because of operation block'); } } diff --git a/src/components/MapObservation.vue b/src/components/MapObservation.vue index 520bf79b3503d1b1431837e3cf5a8722932209ce..1ab37087155ae206a253b6bc44e369f19587578f 100644 --- a/src/components/MapObservation.vue +++ b/src/components/MapObservation.vue @@ -189,7 +189,7 @@ }, geolocationError(error) { - console.log('geolocation error : ' + geolocationError); + CommonUtil.logInfo('geolocation error : ' + geolocationError); }, /** Display of Map */ @@ -236,7 +236,7 @@ layer: 'topo4', matrixSet: 'EPSG:3857', }); - //console.info(options); + //CommonUtil.logInfo(options); // Need to force https on the tiles URL (bug in the service?) options.urls[0] = options.urls[0].replace("http","https"); diff --git a/src/components/MapPOI.vue b/src/components/MapPOI.vue index ba5724dc90325ba8f7ca20c985744b2cb03d674c..3e5189d2c1b6861e84bdc696eb24b7b5849c2ff4 100644 --- a/src/components/MapPOI.vue +++ b/src/components/MapPOI.vue @@ -319,10 +319,10 @@ }, geolocationOptions(options) { - console.log('geolocation options : ' + options); + CommonUtil.logInfo('geolocation options : ' + options); }, geolocationError(error) { - console.log('geolocation error : ' + geolocationError); + CommonUtil.logInfo('geolocation error : ' + geolocationError); }, geolocationSuccess(pos) { @@ -526,7 +526,7 @@ this.mapZoom = CommonUtil.CONST_GPS_OBSERVATION_ZOOM; this.poiTypes = CommonUtil.CONST_POI_TYPES; - //console.info(this.poiTypes); + //CommonUtil.logInfo(this.poiTypes); if (this.$route.params.pointOfInterestId) { this.getPointOfInterest(this.$route.params.pointOfInterestId); diff --git a/src/components/Observation.vue b/src/components/Observation.vue index 1e8e99c8a0098f532adc5fad4b4c4f1059ccb7a7..379bd0f73eeb232fb5ffc7466702c418988d75b7 100644 --- a/src/components/Observation.vue +++ b/src/components/Observation.vue @@ -239,11 +239,10 @@ cursor.delete(); cursor.continue(); } + } - - + db.close(); } - }, /** Validation on save */ validate() { @@ -345,7 +344,7 @@ /** Get related crop and crop list for a selected Observation */ getObservationCrops(jsonObservation) { - //console.info(jsonObservation); + //CommonUtil.logInfo(jsonObservation); let lstCrops = []; let lstCropIds = []; @@ -554,7 +553,7 @@ /** Save Observation */ saveObservation() { if (!this.validate()) {return false;} - //console.info("this.mapGeoinfo=" + this.mapGeoinfo); + //CommonUtil.logInfo("this.mapGeoinfo=" + this.mapGeoinfo); let This = this; @@ -578,7 +577,7 @@ this.observationForStore.isQuantified = this.observation.isQuantified; this.observationForStore.userId = this.observation.userId; this.observationForStore.geoinfo = JSON.stringify(this.mapGeoinfo); //this.observation.geoinfo; - //console.info("this.mapGeoinfo=" + this.mapGeoinfo + ". this.observationForStore.geoinfo=" + this.observationForStore.geoinfo); + //CommonUtil.logInfo("this.mapGeoinfo=" + this.mapGeoinfo + ". this.observationForStore.geoinfo=" + this.observationForStore.geoinfo); this.observationForStore.locationPointOfInterestId = this.observation.locationPointOfInterestId; this.observationForStore.broadcastMessage = this.observation.broadcastMessage; this.observationForStore.statusRemarks = this.observation.statusRemarks; @@ -608,7 +607,7 @@ jobservation.userId = localObservationForStore.userId; jobservation.geoinfo = localObservationForStore.geoinfo; - //console.info("this.mapGeoinfo=" + this.mapGeoinfo + ". jobservation.geoinfo=" + jobservation.geoinfo + ". localObservationForStore.geoinfo = " + localObservationForStore.geoinfo); + //CommonUtil.logInfo("this.mapGeoinfo=" + this.mapGeoinfo + ". jobservation.geoinfo=" + jobservation.geoinfo + ". localObservationForStore.geoinfo = " + localObservationForStore.geoinfo); jobservation.locationPointOfInterestId = localObservationForStore.locationPointOfInterestId; jobservation.broadcastMessage = localObservationForStore.broadcastMessage; jobservation.observationIllustrationSet = localObservationForStore.observationIllustrationSet; @@ -627,8 +626,8 @@ break; } } - /*console.info("Here are the observations:" + JSON.stringify(lstObservations)); - console.info(lstObservations);*/ + /*CommonUtil.logInfo("Here are the observations:" + JSON.stringify(lstObservations)); + CommonUtil.logInfo(lstObservations);*/ } else { this.observationForStore.observationId = this.getNewObservationId(lstObservations); @@ -637,11 +636,11 @@ } this.observationForStore.statusTypeId = CommonUtil.CONST_STATUS_PENDING; - //console.info("this.observationForStore=" + this.observationForStore); + //CommonUtil.logInfo("this.observationForStore=" + this.observationForStore); lstObservations.push(this.observationForStore); } localStorage.setItem(CommonUtil.CONST_STORAGE_OBSERVATION_LIST, JSON.stringify(lstObservations)); - //console.info("....and AFTER STORING: " + localStorage.getItem(CommonUtil.CONST_STORAGE_OBSERVATION_LIST)); + //CommonUtil.logInfo("....and AFTER STORING: " + localStorage.getItem(CommonUtil.CONST_STORAGE_OBSERVATION_LIST)); // Sync on save. saveObservation() is also called from the DELETE button this.$refs.sync.syncTwoWay(); this.$router.replace({path: '/'}); diff --git a/src/components/ObservationIllustration.vue b/src/components/ObservationIllustration.vue index cd805242688dc742b077b23aa7213cfe4147bed1..1cc694d4f2a3828b6453cabed03c96560b875c8c 100644 --- a/src/components/ObservationIllustration.vue +++ b/src/components/ObservationIllustration.vue @@ -60,7 +60,7 @@ imageBase64Data(newVal, oldVal) { // Check image size and compress to max 10MB if (newVal.length / 1024 ** 2 > this.maxImageSizeMB) { - console.info("Image is too big. Compressing"); + CommonUtil.logInfo("Image is too big. Compressing"); this.compressImage(); } } @@ -70,7 +70,7 @@ //https://ionicframework.com/blog/converting-a-base64-string-to-a-blob-in-javascript/ const base64Response = await fetch(this.imageBase64Data); const imageBlob = await base64Response.blob(); - //console.info(imageBlob); + //CommonUtil.logInfo(imageBlob); // https://github.com/Donaldcwl/browser-image-compression const blob = await imageCompression( imageBlob, @@ -90,7 +90,7 @@ const base64String = await convertBlobToBase64(blob); this.imageBase64Data = base64String; this.updateImageInIndexedDB(); - //console.info("New image size=" + this.imageBase64Data.length / 1024**2); + //CommonUtil.logInfo("New image size=" + this.imageBase64Data.length / 1024**2); }, handleDeleteImageRequest() { if (confirm(this.$i18n.t("photo.modal.deleteprompt"))) { @@ -118,17 +118,15 @@ objectstoreRequest.onsuccess = (event) => { let observationImage = event.target.result; if (observationImage) { - //console.info("Rendering image data for file " + observationImage.illustration.fileName); + //CommonUtil.logInfo("Rendering image data for file " + observationImage.illustration.fileName); this.imageBase64Data = observationImage.illustration.imageTextData; } else { - console.log('Image filename mentioned in Observation, but no image data found'); + CommonUtil.logInfo('Image filename mentioned in Observation, but no image data found'); } }; } - else { - // Pass?? - } + db.close(); } }, /** Remove the image data from IndexedDB */ @@ -140,6 +138,7 @@ let objectstore = transaction.objectStore(CommonUtil.CONST_DB_ENTITY_PHOTO); let objectStoreRequest = objectstore.delete(this.observationIllustration.observationIllustrationPK.fileName); this.propagateMetaDataDelete(); + db.close(); } }, updateImageInIndexedDB() { @@ -152,16 +151,17 @@ objectstoreRequest.onsuccess = (event) => { let observationImage = event.target.result; if (observationImage) { - //console.info("Rendering image data for file " + observationImage.illustration.fileName); + //CommonUtil.logInfo("Rendering image data for file " + observationImage.illustration.fileName); observationImage.illustration.imageTextData = this.imageBase64Data; transaction.objectStore(CommonUtil.CONST_DB_ENTITY_PHOTO).put(observationImage, observationImage.illustration.fileName).onsuccess = (event) => { - //console.info("Image data was successfully updated!"); + //CommonUtil.logInfo("Image data was successfully updated!"); }; } else { - console.log('Image filename mentioned in Observation, but no image data found'); + CommonUtil.logInfo('Image filename mentioned in Observation, but no image data found'); } }; + db.close(); } } }, diff --git a/src/components/ObservationIllustrationBoard.vue b/src/components/ObservationIllustrationBoard.vue index e90c35700cb5fc105023687faafe3b1cbf4e4ec0..02edd7b7d43dbc60c51c7abed8b9ad76665aae3f 100644 --- a/src/components/ObservationIllustrationBoard.vue +++ b/src/components/ObservationIllustrationBoard.vue @@ -91,7 +91,7 @@ /** Camera plugin Launcher */ launchCamera: function () { if (navigator.camera) { - console.info("The camera should launch now"); + CommonUtil.logInfo("The camera should launch now"); navigator.camera.getPicture(this.addIllustration, this.onFail, { quality: 50, destinationType: Camera.DestinationType.DATA_URL, //FILE_URI @@ -99,13 +99,13 @@ }); } else { - console.log('WARNING : Functional Cordova plugin needed to launch camera'); + CommonUtil.logInfo('WARNING : Functional Cordova plugin needed to launch camera'); } }, /** Image gallery launcher with same camera plugin */ launchGallery: function () { if (navigator.camera) { - console.info("Other photo location should launch now"); + CommonUtil.logInfo("Other photo location should launch now"); navigator.camera.getPicture(this.addIllustration, this.onFail, { quality: 50, sourceType: Camera.PictureSourceType.PHOTOLIBRARY, @@ -114,7 +114,7 @@ }); } else { - console.log('WARNING : Functional Cordova camera plugin needed to launch gallery'); + CommonUtil.logInfo('WARNING : Functional Cordova camera plugin needed to launch gallery'); } }, @@ -135,10 +135,6 @@ var objectStore = transaction.objectStore(CommonUtil.CONST_DB_ENTITY_PHOTO); // Finding an available filename var request = objectStore.getAllKeys().onsuccess = (event) => { - //console.info("All keys?"); - // Array(4) [ "20799_illustration.jpg", "20801_illustration.jpg", "20801_illustration_1.jpg", "20801_illustration_2.jpg" ] - //console.info(event.target.result); //DETTE funker!!! - var existingFileNames = event.target.result; var counter = 1; while (existingFileNames.indexOf(fileName) >= 0) { @@ -168,15 +164,18 @@ this.organizeIllustrationsForRendering(); // Need to do this to ensure the first image is rendered this.$emit("observationIllustrationSetUpdated", this.observationIllustrations); }; + }; // Add the component to the ObservationIllustrationBoard // Mark the observation as "InNeedOfSync" or similar... + db.close(); } }, onFail: function (message) { alert(message); + db.close(); }, fileNameExists: function (fileName) { @@ -207,7 +206,7 @@ // Copying to manipulate on instance this.observationIllustrations = this.initialObservationIllustrations; this.organizeIllustrationsForRendering(); - //console.info("ObservationIllustrationBoard mounted. ObservationId=" + this.observationId); + //CommonUtil.logInfo("ObservationIllustrationBoard mounted. ObservationId=" + this.observationId); }, watch: { initialObservationIllustrations: function (val) { diff --git a/src/components/Quantification.vue b/src/components/Quantification.vue index ba75b05763a0d157691f7e521dfdd671033653d7..446bb6802a293f4453269f73369b4e6165eeba33 100644 --- a/src/components/Quantification.vue +++ b/src/components/Quantification.vue @@ -69,9 +69,9 @@ } }, errorCaptured(err, vm, info) { - console.log('err : ' + err); - console.log('vm : ' + vm); - console.log('info : ' + info); + CommonUtil.logInfo('err : ' + err); + CommonUtil.logInfo('vm : ' + vm); + CommonUtil.logInfo('info : ' + info); }, mounted() { this.isMounted = true; @@ -88,7 +88,7 @@ } this.initQuantification(); - //console.info(this.observationDataSchema); + //CommonUtil.logInfo(this.observationDataSchema); }, diff --git a/src/components/Sync.vue b/src/components/Sync.vue index 854f4bdf994a66c7aac1f58515e7655e71e40673..b738f4a15158933842d3cb773573d681717b0d15 100644 --- a/src/components/Sync.vue +++ b/src/components/Sync.vue @@ -69,14 +69,6 @@ counterTwoWaySyncPOST: 0, }; }, - /* computed: { - testSync : function(){ - console.log('computed : msg 1 from parent for sync : '+this.isSyncNeeded); - return this.isSyncNeeded; - } - }, - */ - watch: { booIsSyncOneWayReady: { @@ -85,7 +77,7 @@ if (val) { /* Starting of Sync */ - console.log('----- SYNC ONE WAY STARTED -----'); + CommonUtil.logInfo('----- SYNC ONE WAY STARTED -----'); this.syncOneWay(); } if (typeof (booIsSyncOneWayReady) === undefined) { @@ -104,30 +96,14 @@ handler(val, oldVal) { if (val) { this.loading = true; - console.log('----- SYNC TWO WAY STARTED -----'); + CommonUtil.logInfo('----- SYNC TWO WAY STARTED -----'); this.syncTwoWayAtLogin(); this.loading = false; } } } - - /* - isSyncNeeded : - { - immediate : true, - handler (val, oldVal) - { - console.log('watch 1 - prop changed : newval : '+val+' - oldval : '+oldVal); - }, - } - */ }, - methods: { - testFunction() { - console.log('test child testFuntion'); - }, - /** One way Sync. Fetching the data from server and stored in local storage */ syncOneWay() { if (this.booIsSyncOneWayReady) { @@ -472,7 +448,7 @@ localStorage.setItem(CommonUtil.CONST_STORAGE_POI_LIST, JSON.stringify(lstPOI)); this.counterTwoWaySyncPOST = this.counterTwoWaySyncPOST + 1; - console.log('total number of upload : ' + totalTwoWaySyncPOST + ' ---- counter value : ' + this.counterTwoWaySyncPOST); + CommonUtil.logInfo('total number of upload : ' + totalTwoWaySyncPOST + ' ---- counter value : ' + this.counterTwoWaySyncPOST); if (this.counterTwoWaySyncPOST === totalTwoWaySyncPOST) { this.counterTwoWaySyncPOST = 0; @@ -590,7 +566,7 @@ if (lstObservationUpload && lstObservationUpload.length != 0) { lstObservationUpload.forEach(function (observation) { - //console.info("syncObservationSendPrepare:observation.geoinfo= " + observation.geoinfo); + //CommonUtil.logInfo("syncObservationSendPrepare:observation.geoinfo= " + observation.geoinfo); let observationForStore = {}; observationForStore.observationId = observation.observationId; @@ -671,19 +647,21 @@ transaction.oncomplete = function () { This.syncObservationPOST(observation, totalTwoWaySyncPOST); + } } else { This.syncObservationPOST(observation, totalTwoWaySyncPOST); + db.close(); } - + db.close(); } } }, /** Posting Observation data to VIPS server for sync */ syncObservationPOST(observation, totalTwoWaySyncPOST) { - //console.info("syncObservationPOST: observation.geoinfo=" + observation.geoinfo); + //CommonUtil.logInfo("syncObservationPOST: observation.geoinfo=" + observation.geoinfo); let This = this; //if(this.isSyncNeeded) { @@ -705,8 +683,8 @@ if (observation.deleted) { This.removeLocalObservation(observation.observationId); } - /*console.info("syncObservationPOST: jsonbody=" + jsonBody); - console.info("Sending observation");*/ + /*CommonUtil.logInfo("syncObservationPOST: jsonbody=" + jsonBody); + CommonUtil.logInfo("Sending observation");*/ fetch( This.CONST_URL_DOMAIN + CommonUtil.CONST_URL_SYNC_UPDATE_OBSERVATION, { @@ -721,7 +699,7 @@ .then(function (response) { if (response.status === 200) { - //console.info("Done POSTING") + //CommonUtil.logInfo("Done POSTING") } else { /** Even if the response is not success, still need to increase the counter, @@ -735,11 +713,6 @@ let updatedObservation = JSON.parse(data); - /*console.info("updatedObservation=(next line)") - console.info( updatedObservation); - console.info("observation=(next line)") - console.info( observation); - */ if (observation.observationId < 0) { let indexPosition = null; @@ -805,7 +778,7 @@ if (recFound) { delete illOld.uploaded; if (illOld.deleted) { - console.log('record to delete --- found'); + CommonUtil.logInfo('record to delete --- found'); } } }) @@ -816,7 +789,7 @@ localStorage.setItem(CommonUtil.CONST_STORAGE_OBSERVATION_LIST, JSON.stringify(lstObservations)); this.counterTwoWaySyncPOST = this.counterTwoWaySyncPOST + 1; - console.log('total number of upload : ' + totalTwoWaySyncPOST + ' ---- counter value : ' + this.counterTwoWaySyncPOST); + CommonUtil.logInfo('total number of upload : ' + totalTwoWaySyncPOST + ' ---- counter value : ' + this.counterTwoWaySyncPOST); if (this.counterTwoWaySyncPOST === totalTwoWaySyncPOST) { this.counterTwoWaySyncPOST = 0; this.getObservationsFromServerTwowaySync(totalTwoWaySyncPOST, updatedObservation); @@ -895,7 +868,7 @@ }); - //console.info(lstLocalObservations); + //CommonUtil.logInfo(lstLocalObservations); localStorage.setItem(CommonUtil.CONST_STORAGE_OBSERVATION_LIST, JSON.stringify(lstLocalObservations)); } else { @@ -982,6 +955,7 @@ else { alert("Photo part of IndexedDB not created. Please report this error."); } + db.close(); } }, @@ -1026,7 +1000,7 @@ } } } - + db.close(); } }, diff --git a/src/components/Visibility.vue b/src/components/Visibility.vue index 0e0a00968759ee00985dde53389ced6ce68e0577..0a84253cfec5423e75b66c86e16e6236d1a8c58b 100644 --- a/src/components/Visibility.vue +++ b/src/components/Visibility.vue @@ -95,7 +95,7 @@ case 4: break; default: - console.log('Selected option is beyond the range'); + CommonUtil.logInfo('Selected option is beyond the range'); } } diff --git a/src/components/Welcome.vue b/src/components/Welcome.vue index c8d9e846d28569317958d1087e9f31f5b0a3cc94..6303fb4300e020dad71eb58713fbcd9d830ae596 100644 --- a/src/components/Welcome.vue +++ b/src/components/Welcome.vue @@ -63,7 +63,7 @@ mounted() { //this.isMounted = true; //this.uuid = localStorage.getItem(localStorage.removeItem(CommonUtil.CONST_STORAGE_UUID)); - //console.log('uuid : '+this.uuid); + //CommonUtil.logInfo('uuid : '+this.uuid); } diff --git a/src/main.js b/src/main.js index f6b016e0a24ff4d2a53744ce5f92d227091ab26e..a099c0ed45f590d182bda93592d4ab3e7f8cc2fb 100644 --- a/src/main.js +++ b/src/main.js @@ -70,27 +70,10 @@ const init = () => { created() { CommonUtil.setHeaderTitle(this.$i18n.t("index.header")); - console.info("Vue is ready"); - console.info("User's preferred language is " + this.$i18n.locale); + CommonUtil.logInfo("Vue is ready"); + CommonUtil.logInfo("User's preferred language is " + this.$i18n.locale); // Are we logged in already? - // Load the database, in case we need to create the schema - let dbRequest = indexedDB.open(CommonUtil.CONST_DB_NAME, CommonUtil.CONST_DB_VERSION); - dbRequest.onsuccess = function (evt) { - console.info("IndexedDB contacted"); - // All good - } - - dbRequest.onupgradeneeded = function (event) { - console.info("No/outdated IndexedDB database found. Updating schema.") - // Define the database schema here - let db = event.target.result; - if(!db.objectStoreNames.contains(CommonUtil.CONST_DB_ENTITY_PHOTO)) - { - let store = db.createObjectStore(CommonUtil.CONST_DB_ENTITY_PHOTO, {keypath: "fileName"}); - store.createIndex('observationId', 'observationId', {unique: false}); - store.createIndex('organismId', 'organismId', {unique: false}); - } - } + } }); @@ -133,7 +116,7 @@ new Vue({ // Wait for the deviceready event to start the render document.addEventListener("deviceready", () => { // eslint-disable-next-line - console.log("Cordova ready, Render the App"); + CommonUtil.logInfo("Cordova ready, Render the App"); init(); });