Cleanup some unneeded lambas

This commit is contained in:
Jobobby04 2020-12-13 23:29:57 -05:00
parent 1d55a1bec4
commit 3d5952ebbd
4 changed files with 8 additions and 8 deletions

View File

@ -284,7 +284,7 @@ class LibraryUpdateService(
val trackingExtra = intent.getStringExtra(KEY_GROUP_EXTRA)?.toIntOrNull() ?: -1
libraryManga.filter {
val loggedServices = trackManager.services.filter { it.isLogged }
val status: String = {
val status: String = run {
val tracks = db.getTracks(it).executeAsBlocking()
val track = tracks.find { track ->
loggedServices.any { it.id == track?.sync_id }
@ -295,7 +295,7 @@ class LibraryUpdateService(
} else {
"not tracked"
}
}()
}
trackManager.mapTrackingOrder(status, applicationContext) == trackingExtra
}
}

View File

@ -69,10 +69,10 @@ class MergedSource : SuspendHttpSource() {
val mergedManga = db.getManga(manga.url, id).await() ?: throw Exception("merged manga not in db")
val mangaReferences = mergedManga.id?.let { withContext(Dispatchers.IO) { db.getMergedMangaReferences(it).await() } } ?: throw Exception("merged manga id is null")
if (mangaReferences.isEmpty()) throw IllegalArgumentException("Manga references are empty, info unavailable, merge is likely corrupted")
if (mangaReferences.size == 1 || {
if (mangaReferences.size == 1 || run {
val mangaReference = mangaReferences.firstOrNull()
mangaReference == null || (mangaReference.mangaSourceId == MERGED_SOURCE_ID)
}()
}
) throw IllegalArgumentException("Manga references contain only the merged reference, merge is likely corrupted")
emit(

View File

@ -684,7 +684,7 @@ class LibraryPresenter(
libraryManga.forEach { libraryItem ->
when (groupType) {
LibraryGroup.BY_TRACK_STATUS -> {
val status: String = {
val status: String = run {
val tracks = db.getTracks(libraryItem.manga).executeAsBlocking()
val track = tracks.find { track ->
loggedServices.any { it.id == track?.sync_id }
@ -695,7 +695,7 @@ class LibraryPresenter(
} else {
"not tracked"
}
}()
}
val group = grouping.find { it.first == trackManager.mapTrackingOrder(status, context).toString() }
if (group != null) {
map[group.second]?.plusAssign(libraryItem) ?: map.put(group.second, mutableListOf(libraryItem))

View File

@ -35,7 +35,7 @@ object SettingsSearchHelper {
* All subclasses of `SettingsController` should be listed here, in order to have their preferences searchable.
*/
// SY -->
private val settingControllersList: List<KClass<out SettingsController>> = {
private val settingControllersList: List<KClass<out SettingsController>> = run {
val controllers = mutableListOf(
SettingsAdvancedController::class,
SettingsBackupController::class,
@ -55,7 +55,7 @@ object SettingsSearchHelper {
controllers += SettingsEhController::class
}
controllers
}()
}
// SY <--
/**