diff --git a/app/src/main/java/com/quran/labs/androidquran/data/QuranDataProvider.kt b/app/src/main/java/com/quran/labs/androidquran/data/QuranDataProvider.kt index d40a2b34ef..e8785b7c20 100644 --- a/app/src/main/java/com/quran/labs/androidquran/data/QuranDataProvider.kt +++ b/app/src/main/java/com/quran/labs/androidquran/data/QuranDataProvider.kt @@ -19,6 +19,9 @@ import com.quran.labs.androidquran.database.TranslationsDBAdapter import com.quran.labs.androidquran.util.QuranFileUtils import com.quran.labs.androidquran.util.QuranUtils import com.quran.mobile.translation.model.LocalTranslation +import kotlinx.coroutines.MainScope +import kotlinx.coroutines.flow.first +import kotlinx.coroutines.runBlocking import timber.log.Timber import javax.inject.Inject @@ -68,7 +71,7 @@ class QuranDataProvider : ContentProvider() { } private fun availableTranslations(): List { - return translationsDBAdapter.legacyGetTranslations() + return runBlocking { translationsDBAdapter.getTranslations().first() } } private fun getSuggestions(query: String): Cursor? { diff --git a/app/src/main/java/com/quran/labs/androidquran/database/TranslationsDBAdapter.kt b/app/src/main/java/com/quran/labs/androidquran/database/TranslationsDBAdapter.kt index 342313ea0a..b21b1ca33a 100644 --- a/app/src/main/java/com/quran/labs/androidquran/database/TranslationsDBAdapter.kt +++ b/app/src/main/java/com/quran/labs/androidquran/database/TranslationsDBAdapter.kt @@ -2,7 +2,6 @@ package com.quran.labs.androidquran.database import android.content.Context import android.util.SparseArray -import androidx.annotation.WorkerThread import com.quran.labs.androidquran.dao.translation.TranslationItem import com.quran.labs.androidquran.util.QuranFileUtils import com.quran.mobile.di.qualifier.ApplicationContext @@ -13,7 +12,6 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.map -import kotlinx.coroutines.runBlocking import kotlinx.coroutines.withContext import javax.inject.Inject import javax.inject.Singleton @@ -33,11 +31,6 @@ class TranslationsDBAdapter @Inject constructor( } } - @WorkerThread - fun legacyGetTranslations(): List { - return runBlocking { getTranslations().first() } - } - suspend fun translationsHash(): SparseArray { return withContext(Dispatchers.IO) { val result = SparseArray()