Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove legacyGetTranslations call #2499

Merged
merged 1 commit into from
Dec 10, 2023
Merged
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 @@ -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

Expand Down Expand Up @@ -68,7 +71,7 @@ class QuranDataProvider : ContentProvider() {
}

private fun availableTranslations(): List<LocalTranslation> {
return translationsDBAdapter.legacyGetTranslations()
return runBlocking { translationsDBAdapter.getTranslations().first() }
}

private fun getSuggestions(query: String): Cursor? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -33,11 +31,6 @@ class TranslationsDBAdapter @Inject constructor(
}
}

@WorkerThread
fun legacyGetTranslations(): List<LocalTranslation> {
return runBlocking { getTranslations().first() }
}

suspend fun translationsHash(): SparseArray<LocalTranslation> {
return withContext(Dispatchers.IO) {
val result = SparseArray<LocalTranslation>()
Expand Down