Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,9 @@ class UploadMediaDetailFragment : UploadBaseFragment(), UploadMediaDetailsContra
return
}
presenter.fetchTitleAndDescription(indexOfFragment)
if (indexOfFragment > 0) {
presenter.checkImageQuality(indexOfFragment)
}
if (showNearbyFound) {
if (UploadActivity.nearbyPopupAnswers!!.containsKey(nearbyPlace!!)) {
val response = UploadActivity.nearbyPopupAnswers!![nearbyPlace!!]!!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ interface UploadMediaDetailsContract {
*/
fun checkImageQuality(uploadItem: UploadItem, index: Int)

/**
* Forces a check on the image quality for a specific fragment index
* * @param index Index of the UploadItem whose quality is to be checked
*/
fun checkImageQuality(index: Int)

/**
* Updates the image qualities stored in JSON, whenever an image is deleted
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,18 @@ class UploadMediaPresenter @Inject constructor(
}
}

/**
* Forces a check on the image quality for a specific fragment index
*
* @param index Index of the UploadItem whose quality is to be checked
*/
override fun checkImageQuality(index: Int) {
val uploadItems = repository.getUploads()
if (index in uploadItems.indices) {
checkImageQuality(uploadItems[index], index)
}
}

/**
* Updates the image qualities stored in JSON, whenever an image is deleted
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import fr.free.nrw.commons.upload.FileProcessor
import fr.free.nrw.commons.upload.FileUtilsWrapper
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.withContext
import kotlinx.coroutines.rx2.await
import timber.log.Timber
import java.io.FileNotFoundException
import java.io.IOException
Expand Down Expand Up @@ -82,7 +83,8 @@ class CustomSelectorUtils {
withContext(ioDispatcher) {
var result: ImageLoader.Result = ImageLoader.Result.FALSE
try {
if (mediaClient.checkFileExistsUsingSha(SHA1).blockingGet()) {
// Changed .blockingGet() to .await()
if (mediaClient.checkFileExistsUsingSha(SHA1).await()) {
result = ImageLoader.Result.TRUE
}
} catch (e: Exception) {
Expand Down
Loading