Minor cleanup

This commit is contained in:
Jobobby04 2022-10-18 17:52:47 -04:00
parent 49d5d797b3
commit 82793b7a41
4 changed files with 9 additions and 6 deletions

View File

@ -282,6 +282,7 @@ class PreMigrationController(bundle: Bundle? = null) :
val disabledSources = sourcePreferences.disabledSources().get()
.mapNotNull { it.toLongOrNull() }
val sources = sourceManager.getVisibleCatalogueSources()
.asSequence()
.filterIsInstance<HttpSource>()
.filter { it.lang in languages }
.sortedBy { "(${it.lang}) ${it.name}" }
@ -295,11 +296,14 @@ class PreMigrationController(bundle: Bundle? = null) :
),
)
}
.toList()
return sources
.filter { it.sourceEnabled }
.sortedBy { sourcesSaved.indexOf(it.source.id) } +
sources.filterNot { it.sourceEnabled }
.sortedBy { sourcesSaved.indexOf(it.source.id) }
.plus(
sources.filterNot { it.sourceEnabled },
)
}
fun isEnabled(

View File

@ -14,7 +14,7 @@ class MigratingManga(
parentContext: CoroutineContext,
val getManga: suspend (SearchResult.Result) -> Manga?,
val getChapterInfo: suspend (SearchResult.Result) -> ChapterInfo,
val getSourceName: (Manga) -> String?,
val getSourceName: (Manga) -> String,
) {
val migrationScope = CoroutineScope(parentContext + SupervisorJob() + Dispatchers.Default)

View File

@ -101,7 +101,7 @@ class MigrationProcessHolder(
}
if (resultManga != null) {
val (sourceName, latestChapter) = withIOContext {
val sourceNameAsync = async { migrateManga.getSourceName(resultManga).orEmpty() }
val sourceNameAsync = async { migrateManga.getSourceName(resultManga) }
val latestChapterAsync = async { migrateManga.getChapterInfo(searchResult as SearchResult.Result) }
sourceNameAsync.await() to latestChapterAsync.await()
}

View File

@ -166,7 +166,7 @@ class BrowserActionActivity : AppCompatActivity() {
// Rob demo credentials
.url("https://speech-to-text-demo.ng.bluemix.net/api/v1/credentials")
.build(),
).await().parseAs<JsonObject>()["token"]!!.jsonPrimitive.content
).await().parseAs<JsonObject>()["token"]!!.jsonPrimitive.content,
)
} catch (e: Exception) {
xLogE("Failed to get credentials", e)
@ -269,7 +269,6 @@ class BrowserActionActivity : AppCompatActivity() {
} catch (e: Exception) {
captchaSolveFail()
}
}
} else {
binding.webview.postDelayed(