mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 14:53:59 +01:00 
			
		
		
		
	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:
		
							parent
							
								
									6754ce121c
								
							
						
					
					
						commit
						718ad3a12c
					
				
					 15 changed files with 161 additions and 54 deletions
				
			
		|  | @ -30,6 +30,7 @@ import static fr.free.nrw.commons.contributions.Contribution.SOURCE_CAMERA; | |||
| import static fr.free.nrw.commons.contributions.Contribution.SOURCE_GALLERY; | ||||
| import static fr.free.nrw.commons.upload.UploadService.EXTRA_SOURCE; | ||||
| import static fr.free.nrw.commons.wikidata.WikidataConstants.WIKIDATA_ENTITY_ID_PREF; | ||||
| import static fr.free.nrw.commons.wikidata.WikidataConstants.WIKIDATA_ITEM_LOCATION; | ||||
| 
 | ||||
| public class ContributionController { | ||||
| 
 | ||||
|  | @ -131,7 +132,7 @@ public class ContributionController { | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public void handleImagePicked(int requestCode, @Nullable Uri uri, boolean isDirectUpload, String wikiDataEntityId) { | ||||
|     public void handleImagePicked(int requestCode, @Nullable Uri uri, boolean isDirectUpload, String wikiDataEntityId, String wikidateItemLocation) { | ||||
|         FragmentActivity activity = fragment.getActivity(); | ||||
|         Timber.d("handleImagePicked() called with onActivityResult(). Boolean isDirectUpload: " + isDirectUpload + "String wikiDataEntityId: " + wikiDataEntityId); | ||||
|         Intent shareIntent = new Intent(activity, UploadActivity.class); | ||||
|  | @ -163,6 +164,7 @@ public class ContributionController { | |||
|         try { | ||||
|             if (wikiDataEntityId != null && !wikiDataEntityId.equals("")) { | ||||
|                 shareIntent.putExtra(WIKIDATA_ENTITY_ID_PREF, wikiDataEntityId); | ||||
|                 shareIntent.putExtra(WIKIDATA_ITEM_LOCATION, wikidateItemLocation); | ||||
|             } | ||||
|         } catch (SecurityException e) { | ||||
|             Timber.e(e, "Security Exception"); | ||||
|  |  | |||
|  | @ -255,11 +255,11 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment { | |||
|             if (requestCode == ContributionController.SELECT_FROM_CAMERA) { | ||||
|                 // If coming from camera, pass null as uri. Because camera photos get saved to a | ||||
|                 // fixed directory | ||||
|                 controller.handleImagePicked(requestCode, null, false, null); | ||||
|                 controller.handleImagePicked(requestCode, null, false, null, null); | ||||
|             } else if (requestCode == ContributionController.PICK_IMAGE_MULTIPLE) { | ||||
|                 handleMultipleImages(requestCode, data); | ||||
|             } else if (requestCode == ContributionController.SELECT_FROM_GALLERY){ | ||||
|                 controller.handleImagePicked(requestCode, data.getData(), false, null); | ||||
|                 controller.handleImagePicked(requestCode, data.getData(), false, null, null); | ||||
|             } | ||||
|         } else { | ||||
|             Timber.e("OnActivityResult() parameters: Req code: %d Result code: %d Data: %s", | ||||
|  | @ -319,7 +319,7 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment { | |||
|             Log.v("LOG_TAG", "Selected Images" + mArrayUri.size()); | ||||
|             controller.handleImagesPicked(requestCode, mArrayUri); | ||||
|         } else if(data.getData() != null) { | ||||
|             controller.handleImagePicked(SELECT_FROM_GALLERY, data.getData(), false, null); | ||||
|             controller.handleImagePicked(SELECT_FROM_GALLERY, data.getData(), false, null, null); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 neslihanturan
						neslihanturan