mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
correction
This commit is contained in:
parent
36bfeacb18
commit
0aed032bc4
3 changed files with 6 additions and 9 deletions
|
|
@ -34,14 +34,12 @@ class ContributionsLocalDataSource @Inject constructor(
|
|||
* @param uri
|
||||
* @return
|
||||
*/
|
||||
fun getContributionWithFileName(uri: String): Contribution? {
|
||||
val contributionWithUri = contributionDao.getContributionWithTitle(
|
||||
uri
|
||||
)
|
||||
if (!contributionWithUri.isEmpty()) {
|
||||
fun getContributionWithFileName(uri: String): Contribution {
|
||||
val contributionWithUri = contributionDao.getContributionWithTitle(uri)
|
||||
if (contributionWithUri.isNotEmpty()) {
|
||||
return contributionWithUri[0]
|
||||
}
|
||||
return null
|
||||
throw IllegalArgumentException("Contribution not found for URI: $uri")
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
package fr.free.nrw.commons.contributions
|
||||
|
||||
import fr.free.nrw.commons.utils.ImageUtils
|
||||
import androidx.work.ExistingWorkPolicy
|
||||
import fr.free.nrw.commons.MediaDataExtractor
|
||||
import fr.free.nrw.commons.di.CommonsApplicationModule
|
||||
import fr.free.nrw.commons.repository.UploadRepository
|
||||
import fr.free.nrw.commons.upload.worker.WorkRequestHelper.Companion.makeOneTimeWorkRequest
|
||||
import fr.free.nrw.commons.utils.ImageUtils
|
||||
import io.reactivex.Scheduler
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import timber.log.Timber
|
||||
|
|
@ -39,7 +39,6 @@ class ContributionsPresenter @Inject internal constructor(
|
|||
|
||||
override fun getContributionsWithTitle(title: String): Contribution {
|
||||
return contributionsRepository.getContributionWithFileName(title)
|
||||
?: throw IllegalArgumentException("Contribution not found for title: $title")
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class ContributionsRepository @Inject constructor(private val localDataSource: C
|
|||
* @param fileName
|
||||
* @return
|
||||
*/
|
||||
fun getContributionWithFileName(fileName: String): Contribution? {
|
||||
fun getContributionWithFileName(fileName: String): Contribution {
|
||||
return localDataSource.getContributionWithFileName(fileName)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue