mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-11-02 15:53:55 +01:00
replace MainScope with coroutineScope for database operations
This commit is contained in:
parent
249ed1c8dc
commit
61d5010900
2 changed files with 4 additions and 4 deletions
|
|
@ -17,7 +17,7 @@ import fr.free.nrw.commons.utils.CustomSelectorUtils
|
|||
import fr.free.nrw.commons.utils.CustomSelectorUtils.Companion.checkWhetherFileExistsOnCommonsUsingSHA1
|
||||
import kotlinx.coroutines.CoroutineDispatcher
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.MainScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import java.util.Calendar
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
|
@ -65,7 +65,7 @@ class ImageLoader
|
|||
/**
|
||||
* Coroutine Scope.
|
||||
*/
|
||||
private val scope: CoroutineScope = MainScope()
|
||||
private val scope: CoroutineScope = CoroutineScope(Dispatchers.IO)
|
||||
|
||||
/**
|
||||
* Query image and setUp the view.
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@ import fr.free.nrw.commons.upload.UploadProgressActivity
|
|||
import fr.free.nrw.commons.upload.UploadResult
|
||||
import fr.free.nrw.commons.wikidata.WikidataEditService
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.MainScope
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import timber.log.Timber
|
||||
|
|
@ -534,7 +534,7 @@ class UploadWorker(
|
|||
contribution.contentUri?.let {
|
||||
val imageSha1 = contribution.imageSHA1.toString()
|
||||
val modifiedSha1 = fileUtilsWrapper.getSHA1(fileUtilsWrapper.getFileInputStream(contribution.localUri?.path))
|
||||
MainScope().launch {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
uploadedStatusDao.insertUploaded(
|
||||
UploadedStatus(
|
||||
imageSha1,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue