mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 14:53:59 +01:00 
			
		
		
		
	clear the cache for a item when a wikiItem is updated.
This commit is contained in:
		
							parent
							
								
									5985e9ad9c
								
							
						
					
					
						commit
						7aaf9cb59a
					
				
					 1 changed files with 12 additions and 2 deletions
				
			
		|  | @ -30,6 +30,7 @@ import fr.free.nrw.commons.customselector.database.UploadedStatus | ||||||
| import fr.free.nrw.commons.customselector.database.UploadedStatusDao | import fr.free.nrw.commons.customselector.database.UploadedStatusDao | ||||||
| import fr.free.nrw.commons.di.ApplicationlessInjection | import fr.free.nrw.commons.di.ApplicationlessInjection | ||||||
| import fr.free.nrw.commons.media.MediaClient | import fr.free.nrw.commons.media.MediaClient | ||||||
|  | import fr.free.nrw.commons.nearby.PlacesRepository | ||||||
| import fr.free.nrw.commons.theme.BaseActivity | import fr.free.nrw.commons.theme.BaseActivity | ||||||
| import fr.free.nrw.commons.upload.FileUtilsWrapper | import fr.free.nrw.commons.upload.FileUtilsWrapper | ||||||
| import fr.free.nrw.commons.upload.StashUploadResult | import fr.free.nrw.commons.upload.StashUploadResult | ||||||
|  | @ -74,6 +75,9 @@ class UploadWorker( | ||||||
|     @Inject |     @Inject | ||||||
|     lateinit var fileUtilsWrapper: FileUtilsWrapper |     lateinit var fileUtilsWrapper: FileUtilsWrapper | ||||||
| 
 | 
 | ||||||
|  |     @Inject | ||||||
|  |     lateinit var placesRepository: PlacesRepository | ||||||
|  | 
 | ||||||
|     private val processingUploadsNotificationTag = BuildConfig.APPLICATION_ID + " : upload_tag" |     private val processingUploadsNotificationTag = BuildConfig.APPLICATION_ID + " : upload_tag" | ||||||
| 
 | 
 | ||||||
|     private val processingUploadsNotificationId = 101 |     private val processingUploadsNotificationId = 101 | ||||||
|  | @ -379,7 +383,7 @@ class UploadWorker( | ||||||
|                                 saveCompletedContribution(contribution, uploadResult) |                                 saveCompletedContribution(contribution, uploadResult) | ||||||
|                             } else { |                             } else { | ||||||
|                                 Timber.d( |                                 Timber.d( | ||||||
|                                     "WikiDataEdit not required, making wikidata edit", |                                     "WikiDataEdit required, making wikidata edit", | ||||||
|                                 ) |                                 ) | ||||||
|                                 makeWikiDataEdit(uploadResult, contribution) |                                 makeWikiDataEdit(uploadResult, contribution) | ||||||
|                             } |                             } | ||||||
|  | @ -476,7 +480,13 @@ class UploadWorker( | ||||||
|                 } catch (exception: Exception) { |                 } catch (exception: Exception) { | ||||||
|                     Timber.e(exception) |                     Timber.e(exception) | ||||||
|                 } |                 } | ||||||
| 
 |                 withContext(Dispatchers.IO) { | ||||||
|  |                     val place = placesRepository.fetchPlace(wikiDataPlace.id); | ||||||
|  |                     Timber.d("Clearing cache for place: $place") | ||||||
|  |                     if (null != place) { | ||||||
|  |                         placesRepository.deletePlace(place); | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
|                 withContext(Dispatchers.Main) { |                 withContext(Dispatchers.Main) { | ||||||
|                     wikidataEditService.handleImageClaimResult( |                     wikidataEditService.handleImageClaimResult( | ||||||
|                         contribution.wikidataPlace, |                         contribution.wikidataPlace, | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Christo Joby Antony
						Christo Joby Antony