From 9b748f733434701c0d891621dd7eb50b31d78b45 Mon Sep 17 00:00:00 2001 From: Koitharu Date: Thu, 14 Jul 2022 14:12:47 +0300 Subject: [PATCH 1/3] Update parsers and version --- app/build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 8f93fe769..ca3c34cc6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -14,8 +14,8 @@ android { applicationId 'org.koitharu.kotatsu' minSdkVersion 21 targetSdkVersion 32 - versionCode 415 - versionName '3.4.3' + versionCode 416 + versionName '3.4.4' generatedDensities = [] testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -76,7 +76,7 @@ afterEvaluate { } } dependencies { - implementation('com.github.nv95:kotatsu-parsers:2d1907569b') { + implementation('com.github.nv95:kotatsu-parsers:67f6af63f8') { exclude group: 'org.json', module: 'json' } From 91b17ef4a2fd751f46fb5a9ebf9732c159f08c27 Mon Sep 17 00:00:00 2001 From: Koitharu Date: Thu, 14 Jul 2022 14:23:04 +0300 Subject: [PATCH 2/3] Fix global search parallelism --- .../search/ui/multi/MultiSearchViewModel.kt | 40 +++++++++---------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/org/koitharu/kotatsu/search/ui/multi/MultiSearchViewModel.kt b/app/src/main/java/org/koitharu/kotatsu/search/ui/multi/MultiSearchViewModel.kt index 617352978..b2ababf6d 100644 --- a/app/src/main/java/org/koitharu/kotatsu/search/ui/multi/MultiSearchViewModel.kt +++ b/app/src/main/java/org/koitharu/kotatsu/search/ui/multi/MultiSearchViewModel.kt @@ -89,26 +89,25 @@ class MultiSearchViewModel( } } - private suspend fun searchImpl(q: String) { + private suspend fun searchImpl(q: String) = coroutineScope { val sources = settings.getMangaSources(includeHidden = false) val dispatcher = Dispatchers.Default.limitedParallelism(MAX_PARALLELISM) - val deferredList = coroutineScope { - sources.map { source -> - async(dispatcher) { - runCatching { - val list = MangaRepository(source).getList(offset = 0, query = q) - .toUi(ListMode.GRID) - if (list.isNotEmpty()) { - MultiSearchListModel(source, list.size > MIN_HAS_MORE_ITEMS, list) - } else { - null - } - }.onFailure { - it.printStackTraceDebug() + val deferredList = sources.map { source -> + async(dispatcher) { + runCatching { + val list = MangaRepository(source).getList(offset = 0, query = q) + .toUi(ListMode.GRID) + if (list.isNotEmpty()) { + MultiSearchListModel(source, list.size > MIN_HAS_MORE_ITEMS, list) + } else { + null } + }.onFailure { + it.printStackTraceDebug() } } } + val errors = ArrayList() for (deferred in deferredList) { deferred.await() @@ -120,13 +119,12 @@ class MultiSearchViewModel( errors.add(it) } } - if (listData.value.isNotEmpty()) { - return - } - when (errors.size) { - 0 -> Unit - 1 -> throw errors[0] - else -> throw CompositeException(errors) + if (listData.value.isEmpty()) { + when (errors.size) { + 0 -> Unit + 1 -> throw errors[0] + else -> throw CompositeException(errors) + } } } } \ No newline at end of file From 2d4c1b751e44b76fd50395f4a1909961162c5b1f Mon Sep 17 00:00:00 2001 From: Koitharu Date: Thu, 14 Jul 2022 14:48:26 +0300 Subject: [PATCH 3/3] Update dependencies --- app/build.gradle | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index ca3c34cc6..daa6a7d41 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -76,11 +76,11 @@ afterEvaluate { } } dependencies { - implementation('com.github.nv95:kotatsu-parsers:67f6af63f8') { + implementation('com.github.nv95:kotatsu-parsers:6af8cec134') { exclude group: 'org.json', module: 'json' } - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.3' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4' implementation 'androidx.core:core-ktx:1.8.0' implementation 'androidx.activity:activity-ktx:1.5.0' @@ -116,21 +116,21 @@ dependencies { implementation 'com.davemorrissey.labs:subsampling-scale-image-view-androidx:3.10.0' implementation 'com.github.solkin:disk-lru-cache:1.4' - implementation 'ch.acra:acra-mail:5.9.3' - implementation 'ch.acra:acra-dialog:5.9.3' + implementation 'ch.acra:acra-mail:5.9.5' + implementation 'ch.acra:acra-dialog:5.9.5' - debugImplementation 'org.jsoup:jsoup:1.15.1' + debugImplementation 'org.jsoup:jsoup:1.15.2' debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.9.1' testImplementation 'junit:junit:4.13.2' - testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.3' + testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4' androidTestImplementation 'androidx.test:runner:1.4.0' androidTestImplementation 'androidx.test:rules:1.4.0' androidTestImplementation 'androidx.test:core-ktx:1.4.0' androidTestImplementation 'androidx.test.ext:junit-ktx:1.1.3' - androidTestImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.3' + androidTestImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4' androidTestImplementation 'io.insert-koin:koin-test:3.2.0' androidTestImplementation 'io.insert-koin:koin-test-junit4:3.2.0'