Update libraries, some lints (#4099)

* Update some plugins

* Fix some miscellaneous lints
This commit is contained in:
Taco
2020-12-08 22:21:08 -05:00
committed by GitHub
parent 08ab7f6aa0
commit c2b8fea291
31 changed files with 42 additions and 59 deletions

View File

@@ -41,8 +41,8 @@ abstract class AbstractBackupManager(protected val context: Context) {
internal fun restoreChapterFetchObservable(source: Source, manga: Manga, chapters: List<Chapter>): Observable<Pair<List<Chapter>, List<Chapter>>> {
return source.fetchChapterList(manga)
.map { syncChaptersWithSource(databaseHelper, it, manga, source) }
.doOnNext { pair ->
if (pair.first.isNotEmpty()) {
.doOnNext { (first) ->
if (first.isNotEmpty()) {
chapters.forEach { it.manga_id = manga.id }
updateChapters(chapters)
}

View File

@@ -11,7 +11,6 @@ import eu.kanade.tachiyomi.data.track.TrackManager
import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.util.chapter.NoChaptersException
import kotlinx.coroutines.Job
import okio.source
import rx.Observable
import uy.kohesive.injekt.injectLazy
import java.io.File

View File

@@ -128,7 +128,7 @@ class DownloadCache(
.orEmpty()
.associate { it.name to SourceDirectory(it) }
.mapNotNullKeys { entry ->
onlineSources.find { provider.getSourceDirName(it).toLowerCase() == entry.key?.toLowerCase() }?.id
onlineSources.find { provider.getSourceDirName(it).equals(entry.key, ignoreCase = true) }?.id
}
rootDir.files = sourceDirs

View File

@@ -89,8 +89,8 @@ class DownloadPendingDeleter(context: Context) {
}
lastAddedEntry = null
return entries.associate { entry ->
entry.manga.toModel() to entry.chapters.map { it.toModel() }
return entries.associate { (chapters, manga) ->
manga.toModel() to chapters.map { it.toModel() }
}
}

View File

@@ -165,8 +165,7 @@ class LibraryUpdateNotifier(private val context: Context) {
// Per-manga notification
if (!preferences.hideNotificationContent()) {
updates.forEach {
val (manga, chapters) = it
updates.forEach { (manga, chapters) ->
notify(manga.id.hashCode(), createNewChaptersNotification(manga, chapters))
}
}

View File

@@ -275,7 +275,7 @@ class LibraryUpdateService(
Pair(emptyList(), emptyList())
}
// Filter out mangas without new chapters (or failed).
.filter { pair -> pair.first.isNotEmpty() }
.filter { (first) -> first.isNotEmpty() }
.doOnNext {
if (manga.shouldDownloadNewChapters(db, preferences)) {
downloadChapters(manga, it.first)
@@ -317,7 +317,7 @@ class LibraryUpdateService(
)
}
}
.map { manga -> manga.first }
.map { (first) -> first }
}
private fun downloadChapters(manga: Manga, chapters: List<Chapter>) {

View File

@@ -149,13 +149,9 @@ class MyAnimeList(private val context: Context, id: Int) : TrackService(id) {
private fun saveCSRF(csrf: String) = preferences.trackToken(this).set(csrf)
private fun checkCookies(): Boolean {
var ckCount = 0
val url = BASE_URL.toHttpUrlOrNull()!!
for (ck in networkService.cookieManager.get(url)) {
if (ck.name == USER_SESSION_COOKIE || ck.name == LOGGED_IN_COOKIE) {
ckCount++
}
}
val ckCount = networkService.cookieManager.get(url).count {
it.name == USER_SESSION_COOKIE || it.name == LOGGED_IN_COOKIE }
return ckCount == 2
}