Fixes #945 Check image coordinates for direct Nearby uploads in locations that the user is not currently in (#2099)

* Add getGeolocation method to geolocation from file path

* Add geolocation check to receiveDirect method checks, means it will be checked durimg nearby direct uploads

* Create method body for geolocation and nearby place coordinate comparaison, this method will be filled on consequent commits

* Add a method to find location missmatch

* app/src/main/java/fr/free/nrw/commons/utils/ImageUtils.java

* Add if check to upload activity to detect pictures with wrong location, and save it to shared prefs

* Do not edit wikidata item if picture has wrong location info

* Add one more bitwise operand to possible warning reasons for wrong location case

* Add a bitwise variable for wrong locatio case

* Share nearby place location just like wikidataEntityId, so that we can compare

* Implement check image geolocation is different method by comparing nearby location and file EXIF geolocation

* Add Javadocs

* Remove logs

* Fix all taken on wrong phrases as taken at

* Fix typo on logs

* Simplify if logic

* Fix string issues
This commit is contained in:
neslihanturan 2018-12-16 14:26:44 +02:00 committed by Josephine Lim
parent 6754ce121c
commit 718ad3a12c
15 changed files with 161 additions and 54 deletions

View file

@ -2,4 +2,5 @@ package fr.free.nrw.commons.wikidata;
public class WikidataConstants {
public static final String WIKIDATA_ENTITY_ID_PREF = "WikiDataEntityId";
public static final String WIKIDATA_ITEM_LOCATION = "WikiDataItemLocation";
}

View file

@ -58,6 +58,11 @@ public class WikidataEditService {
return;
}
if (!(directPrefs.getBoolean("Picture_Has_Correct_Location",true))) {
Timber.d("Image location and nearby place location mismatched, so Wikidata item won't be edited");
return;
}
editWikidataProperty(wikidataEntityId, fileName);
}