mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
refactor(library): Remove unnecessary lazy
This commit is contained in:
parent
e52ee9289f
commit
0374942a34
1 changed files with 4 additions and 11 deletions
|
@ -1563,16 +1563,10 @@ class LibraryPresenter(
|
|||
Random(cal.time.time)
|
||||
}
|
||||
|
||||
val recentManga by lazy {
|
||||
runBlocking {
|
||||
RecentsPresenter.getRecentManga(true).map { it.first }
|
||||
}
|
||||
}
|
||||
val libraryManga by lazy { runBlocking { getLibraryManga.await() } }
|
||||
preferences.librarySearchSuggestion().set(
|
||||
when (val value = random.nextInt(0, 5)) {
|
||||
randomSource -> {
|
||||
val distinctSources = libraryManga.distinctBy { it.source }
|
||||
val distinctSources = getLibraryManga.await().distinctBy { it.source }
|
||||
val randomSource =
|
||||
sourceManager.get(
|
||||
distinctSources.randomOrNull(random)?.source ?: 0L,
|
||||
|
@ -1580,12 +1574,11 @@ class LibraryPresenter(
|
|||
randomSource?.chopByWords(30)
|
||||
}
|
||||
randomTitle -> {
|
||||
libraryManga.randomOrNull(random)?.title?.chopByWords(30)
|
||||
getLibraryManga.await().randomOrNull(random)?.title?.chopByWords(30)
|
||||
}
|
||||
in randomTags -> {
|
||||
val tags = recentManga.map {
|
||||
it.genre.orEmpty().split(",").map(String::trim)
|
||||
}
|
||||
val tags = RecentsPresenter.getRecentManga(true)
|
||||
.map { it.first.genre.orEmpty().split(",").map(String::trim) }
|
||||
.flatten()
|
||||
.filter { it.isNotBlank() }
|
||||
val distinctTags = tags.distinct()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue