Add API to control online search
This commit is contained in:
+1
-1
@@ -21,7 +21,7 @@ import kotlinx.coroutines.flow.map
|
||||
class FakeAppRepository(private val context: Context, private val fakePackages: Int) : SearchableRepository<Application> {
|
||||
|
||||
|
||||
override fun search(query: String): Flow<ImmutableList<Application>> {
|
||||
override fun search(query: String, allowNetwork: Boolean): Flow<ImmutableList<Application>> {
|
||||
return if (query.isEmpty()) {
|
||||
buildList {
|
||||
repeat(fakePackages) {
|
||||
|
||||
@@ -29,8 +29,6 @@ import org.apache.commons.text.similarity.FuzzyScore
|
||||
import java.util.Locale
|
||||
|
||||
interface AppRepository : SearchableRepository<Application> {
|
||||
override fun search(query: String): Flow<ImmutableList<Application>>
|
||||
|
||||
fun findMany(): Flow<ImmutableList<Application>>
|
||||
}
|
||||
|
||||
@@ -197,7 +195,7 @@ internal class AppRepositoryImpl(
|
||||
return installedApps.map { it.toImmutableList() }
|
||||
}
|
||||
|
||||
override fun search(query: String): Flow<ImmutableList<LauncherApp>> {
|
||||
override fun search(query: String, allowNetwork: Boolean): Flow<ImmutableList<LauncherApp>> {
|
||||
return installedApps.map { apps ->
|
||||
withContext(Dispatchers.Default) {
|
||||
val appResults = mutableListOf<LauncherApp>()
|
||||
|
||||
Reference in New Issue
Block a user