mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
parent
c5b527f450
commit
96fbcb92e5
4 changed files with 11 additions and 6 deletions
|
|
@ -41,7 +41,8 @@ data class Contribution constructor(
|
|||
var dateModified: Date? = null,
|
||||
var hasInvalidLocation : Int = 0,
|
||||
var contentUri: Uri? = null,
|
||||
var countryCode : String? = null
|
||||
var countryCode : String? = null,
|
||||
var imageSHA1 : String? = null
|
||||
) : Parcelable {
|
||||
|
||||
fun completeWith(media: Media): Contribution {
|
||||
|
|
@ -52,7 +53,8 @@ data class Contribution constructor(
|
|||
item: UploadItem,
|
||||
sessionManager: SessionManager,
|
||||
depictedItems: List<DepictedItem>,
|
||||
categories: List<String>
|
||||
categories: List<String>,
|
||||
imageSHA1: String
|
||||
) : this(
|
||||
Media(
|
||||
formatCaptions(item.uploadMediaDetails),
|
||||
|
|
@ -67,7 +69,8 @@ data class Contribution constructor(
|
|||
dateCreatedSource = "",
|
||||
depictedItems = depictedItems,
|
||||
wikidataPlace = from(item.place),
|
||||
contentUri = item.contentUri
|
||||
contentUri = item.contentUri,
|
||||
imageSHA1 = imageSHA1
|
||||
)
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import fr.free.nrw.commons.upload.depicts.DepictsDao
|
|||
* The database for accessing the respective DAOs
|
||||
*
|
||||
*/
|
||||
@Database(entities = [Contribution::class, Depicts::class, UploadedStatus::class], version = 11, exportSchema = false)
|
||||
@Database(entities = [Contribution::class, Depicts::class, UploadedStatus::class], version = 12, exportSchema = false)
|
||||
@TypeConverters(Converters::class)
|
||||
abstract class AppDatabase : RoomDatabase() {
|
||||
abstract fun contributionDao(): ContributionDao
|
||||
|
|
|
|||
|
|
@ -147,8 +147,10 @@ public class UploadModel {
|
|||
public Observable<Contribution> buildContributions() {
|
||||
return Observable.fromIterable(items).map(item ->
|
||||
{
|
||||
String imageSHA1 = FileUtils.getSHA1(context.getContentResolver().openInputStream(item.getContentUri()));
|
||||
|
||||
final Contribution contribution = new Contribution(
|
||||
item, sessionManager, newListOf(selectedDepictions), newListOf(selectedCategories));
|
||||
item, sessionManager, newListOf(selectedDepictions), newListOf(selectedCategories), imageSHA1);
|
||||
|
||||
contribution.setHasInvalidLocation(item.hasInvalidLocation());
|
||||
|
||||
|
|
|
|||
|
|
@ -418,7 +418,7 @@ class UploadWorker(var appContext: Context, workerParams: WorkerParameters) :
|
|||
*/
|
||||
private fun saveIntoUploadedStatus(contribution: Contribution) {
|
||||
contribution.contentUri?.let {
|
||||
val imageSha1 = fileUtilsWrapper.getSHA1(appContext.contentResolver.openInputStream(it))
|
||||
val imageSha1 = contribution.imageSHA1.toString()
|
||||
val modifiedSha1 = fileUtilsWrapper.getSHA1(fileUtilsWrapper.getFileInputStream(contribution.localUri?.path))
|
||||
MainScope().launch {
|
||||
uploadedStatusDao.insertUploaded(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue