mirror of
https://github.com/Suwayomi/TachideskJUI.git
synced 2025-12-10 06:42:05 +01:00
Automatic Lint
This commit is contained in:
@@ -28,23 +28,23 @@ class ServerListeners @Inject constructor() {
|
||||
private fun <T> Flow<T>.startWith(value: T) = onStart { emit(value) }
|
||||
|
||||
private val mangaListener = MutableSharedFlow<List<Long>>(
|
||||
extraBufferCapacity = Channel.UNLIMITED,
|
||||
extraBufferCapacity = Channel.UNLIMITED
|
||||
)
|
||||
|
||||
private val chapterIndexesListener = MutableSharedFlow<Pair<Long, List<Int>?>>(
|
||||
extraBufferCapacity = Channel.UNLIMITED,
|
||||
extraBufferCapacity = Channel.UNLIMITED
|
||||
)
|
||||
|
||||
private val chapterIdsListener = MutableSharedFlow<Pair<Long?, List<Long>>>(
|
||||
extraBufferCapacity = Channel.UNLIMITED,
|
||||
extraBufferCapacity = Channel.UNLIMITED
|
||||
)
|
||||
|
||||
private val categoryMangaListener = MutableSharedFlow<Long>(
|
||||
extraBufferCapacity = Channel.UNLIMITED,
|
||||
extraBufferCapacity = Channel.UNLIMITED
|
||||
)
|
||||
|
||||
private val extensionListener = MutableSharedFlow<List<String>>(
|
||||
extraBufferCapacity = Channel.UNLIMITED,
|
||||
extraBufferCapacity = Channel.UNLIMITED
|
||||
)
|
||||
|
||||
fun <T> combineMangaUpdates(flow: Flow<T>, predate: (suspend (List<Long>) -> Boolean)? = null) =
|
||||
@@ -127,4 +127,4 @@ class ServerListeners @Inject constructor() {
|
||||
companion object {
|
||||
private val log = logging()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import org.lighthousegames.logging.logging
|
||||
|
||||
class AddMangaToCategory @Inject constructor(
|
||||
private val categoryRepository: CategoryRepository,
|
||||
private val serverListeners: ServerListeners,
|
||||
private val serverListeners: ServerListeners
|
||||
) {
|
||||
|
||||
suspend fun await(mangaId: Long, categoryId: Long, onError: suspend (Throwable) -> Unit = {}) = asFlow(mangaId, categoryId)
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.lighthousegames.logging.logging
|
||||
|
||||
class GetMangaListFromCategory @Inject constructor(
|
||||
private val categoryRepository: CategoryRepository,
|
||||
private val serverListeners: ServerListeners,
|
||||
private val serverListeners: ServerListeners
|
||||
) {
|
||||
|
||||
suspend fun await(categoryId: Long, onError: suspend (Throwable) -> Unit = {}) = asFlow(categoryId)
|
||||
|
||||
@@ -19,8 +19,8 @@ import org.lighthousegames.logging.logging
|
||||
|
||||
class RemoveMangaFromCategory @Inject constructor(
|
||||
private val categoryRepository: CategoryRepository,
|
||||
private val serverListeners: ServerListeners,
|
||||
) {
|
||||
private val serverListeners: ServerListeners
|
||||
) {
|
||||
|
||||
suspend fun await(mangaId: Long, categoryId: Long, onError: suspend (Throwable) -> Unit = {}) = asFlow(mangaId, categoryId)
|
||||
.catch {
|
||||
|
||||
@@ -22,7 +22,7 @@ import kotlin.jvm.JvmName
|
||||
|
||||
class BatchUpdateChapter @Inject constructor(
|
||||
private val chapterRepository: ChapterRepository,
|
||||
private val serverListeners: ServerListeners,
|
||||
private val serverListeners: ServerListeners
|
||||
) {
|
||||
|
||||
@JvmName("awaitChapters")
|
||||
|
||||
@@ -18,7 +18,7 @@ import org.lighthousegames.logging.logging
|
||||
|
||||
class DeleteChapterDownload @Inject constructor(
|
||||
private val chapterRepository: ChapterRepository,
|
||||
private val serverListeners: ServerListeners,
|
||||
private val serverListeners: ServerListeners
|
||||
) {
|
||||
|
||||
suspend fun await(mangaId: Long, index: Int, onError: suspend (Throwable) -> Unit = {}) = asFlow(mangaId, index)
|
||||
|
||||
@@ -18,7 +18,7 @@ import org.lighthousegames.logging.logging
|
||||
|
||||
class GetChapter @Inject constructor(
|
||||
private val chapterRepository: ChapterRepository,
|
||||
private val serverListeners: ServerListeners,
|
||||
private val serverListeners: ServerListeners
|
||||
) {
|
||||
|
||||
suspend fun await(mangaId: Long, index: Int, onError: suspend (Throwable) -> Unit = {}) = asFlow(mangaId, index)
|
||||
@@ -47,7 +47,7 @@ class GetChapter @Inject constructor(
|
||||
|
||||
fun asFlow(mangaId: Long, index: Int) = serverListeners.combineChapters(
|
||||
chapterRepository.getChapter(mangaId, index),
|
||||
indexPredate = { id, chapterIndexes ->
|
||||
indexPredate = { id, chapterIndexes ->
|
||||
id == mangaId && (chapterIndexes == null || index in chapterIndexes)
|
||||
},
|
||||
idPredate = { id, _ -> id == mangaId }
|
||||
@@ -55,7 +55,7 @@ class GetChapter @Inject constructor(
|
||||
|
||||
fun asFlow(manga: Manga, index: Int) = serverListeners.combineChapters(
|
||||
chapterRepository.getChapter(manga.id, index),
|
||||
indexPredate = { id, chapterIndexes ->
|
||||
indexPredate = { id, chapterIndexes ->
|
||||
id == manga.id && (chapterIndexes == null || index in chapterIndexes)
|
||||
},
|
||||
idPredate = { id, _ -> id == manga.id }
|
||||
@@ -63,7 +63,7 @@ class GetChapter @Inject constructor(
|
||||
|
||||
fun asFlow(chapter: Chapter) = serverListeners.combineChapters(
|
||||
chapterRepository.getChapter(chapter.mangaId, chapter.index),
|
||||
indexPredate = { id, chapterIndexes ->
|
||||
indexPredate = { id, chapterIndexes ->
|
||||
id == chapter.mangaId && (chapterIndexes == null || chapter.index in chapterIndexes)
|
||||
},
|
||||
idPredate = { id, _ -> id == chapter.mangaId }
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.lighthousegames.logging.logging
|
||||
|
||||
class GetChapters @Inject constructor(
|
||||
private val chapterRepository: ChapterRepository,
|
||||
private val serverListeners: ServerListeners,
|
||||
private val serverListeners: ServerListeners
|
||||
) {
|
||||
|
||||
suspend fun await(mangaId: Long, onError: suspend (Throwable) -> Unit = {}) = asFlow(mangaId)
|
||||
@@ -38,13 +38,13 @@ class GetChapters @Inject constructor(
|
||||
|
||||
fun asFlow(mangaId: Long) = serverListeners.combineChapters(
|
||||
chapterRepository.getChapters(mangaId),
|
||||
indexPredate = { id, _ -> id == mangaId },
|
||||
indexPredate = { id, _ -> id == mangaId },
|
||||
idPredate = { id, _ -> id == mangaId }
|
||||
)
|
||||
|
||||
fun asFlow(manga: Manga) = serverListeners.combineChapters(
|
||||
chapterRepository.getChapters(manga.id),
|
||||
indexPredate = { id, _ -> id == manga.id },
|
||||
indexPredate = { id, _ -> id == manga.id },
|
||||
idPredate = { id, _ -> id == manga.id }
|
||||
)
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.lighthousegames.logging.logging
|
||||
|
||||
class RefreshChapters @Inject constructor(
|
||||
private val chapterRepository: ChapterRepository,
|
||||
private val serverListeners: ServerListeners,
|
||||
private val serverListeners: ServerListeners
|
||||
) {
|
||||
|
||||
suspend fun await(mangaId: Long, onError: suspend (Throwable) -> Unit = {}) = asFlow(mangaId)
|
||||
|
||||
@@ -18,7 +18,7 @@ import org.lighthousegames.logging.logging
|
||||
|
||||
class UpdateChapterBookmarked @Inject constructor(
|
||||
private val chapterRepository: ChapterRepository,
|
||||
private val serverListeners: ServerListeners,
|
||||
private val serverListeners: ServerListeners
|
||||
) {
|
||||
|
||||
suspend fun await(
|
||||
|
||||
@@ -18,7 +18,7 @@ import org.lighthousegames.logging.logging
|
||||
|
||||
class UpdateChapterLastPageRead @Inject constructor(
|
||||
private val chapterRepository: ChapterRepository,
|
||||
private val serverListeners: ServerListeners,
|
||||
private val serverListeners: ServerListeners
|
||||
) {
|
||||
|
||||
suspend fun await(
|
||||
|
||||
@@ -18,7 +18,7 @@ import org.lighthousegames.logging.logging
|
||||
|
||||
class UpdateChapterMarkPreviousRead @Inject constructor(
|
||||
private val chapterRepository: ChapterRepository,
|
||||
private val serverListeners: ServerListeners,
|
||||
private val serverListeners: ServerListeners
|
||||
) {
|
||||
|
||||
suspend fun await(
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.lighthousegames.logging.logging
|
||||
|
||||
class UpdateChapterMeta @Inject constructor(
|
||||
private val chapterRepository: ChapterRepository,
|
||||
private val serverListeners: ServerListeners,
|
||||
private val serverListeners: ServerListeners
|
||||
) {
|
||||
|
||||
suspend fun await(
|
||||
|
||||
@@ -18,7 +18,7 @@ import org.lighthousegames.logging.logging
|
||||
|
||||
class UpdateChapterRead @Inject constructor(
|
||||
private val chapterRepository: ChapterRepository,
|
||||
private val serverListeners: ServerListeners,
|
||||
private val serverListeners: ServerListeners
|
||||
) {
|
||||
|
||||
suspend fun await(
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.lighthousegames.logging.logging
|
||||
|
||||
class AddMangaToLibrary @Inject constructor(
|
||||
private val libraryRepository: LibraryRepository,
|
||||
private val serverListeners: ServerListeners,
|
||||
private val serverListeners: ServerListeners
|
||||
) {
|
||||
|
||||
suspend fun await(mangaId: Long, onError: suspend (Throwable) -> Unit = {}) = asFlow(mangaId)
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.lighthousegames.logging.logging
|
||||
|
||||
class RemoveMangaFromLibrary @Inject constructor(
|
||||
private val libraryRepository: LibraryRepository,
|
||||
private val serverListeners: ServerListeners,
|
||||
private val serverListeners: ServerListeners
|
||||
) {
|
||||
|
||||
suspend fun await(mangaId: Long, onError: suspend (Throwable) -> Unit = {}) = asFlow(mangaId)
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.lighthousegames.logging.logging
|
||||
|
||||
class GetManga @Inject constructor(
|
||||
private val mangaRepository: MangaRepository,
|
||||
private val serverListeners: ServerListeners,
|
||||
private val serverListeners: ServerListeners
|
||||
) {
|
||||
|
||||
suspend fun await(mangaId: Long, onError: suspend (Throwable) -> Unit = {}) = asFlow(mangaId)
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.lighthousegames.logging.logging
|
||||
|
||||
class GetMangaFull @Inject constructor(
|
||||
private val mangaRepository: MangaRepository,
|
||||
private val serverListeners: ServerListeners,
|
||||
private val serverListeners: ServerListeners
|
||||
) {
|
||||
|
||||
suspend fun await(mangaId: Long, onError: suspend (Throwable) -> Unit = {}) = asFlow(mangaId)
|
||||
|
||||
@@ -18,7 +18,7 @@ import org.lighthousegames.logging.logging
|
||||
|
||||
class RefreshManga @Inject constructor(
|
||||
private val mangaRepository: MangaRepository,
|
||||
private val serverListeners: ServerListeners,
|
||||
private val serverListeners: ServerListeners
|
||||
) {
|
||||
|
||||
suspend fun await(mangaId: Long, onError: suspend (Throwable) -> Unit = {}) = asFlow(mangaId)
|
||||
@@ -40,11 +40,9 @@ class RefreshManga @Inject constructor(
|
||||
fun asFlow(mangaId: Long) =
|
||||
mangaRepository.getManga(mangaId, true).onEach { serverListeners.updateManga(mangaId) }
|
||||
|
||||
|
||||
fun asFlow(manga: Manga) =
|
||||
mangaRepository.getManga(manga.id, true).onEach { serverListeners.updateManga(manga.id) }
|
||||
|
||||
|
||||
companion object {
|
||||
private val log = logging()
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import org.lighthousegames.logging.logging
|
||||
|
||||
class RefreshMangaFull @Inject constructor(
|
||||
private val mangaRepository: MangaRepository,
|
||||
private val serverListeners: ServerListeners,
|
||||
private val serverListeners: ServerListeners
|
||||
) {
|
||||
|
||||
suspend fun await(mangaId: Long, onError: suspend (Throwable) -> Unit = {}) = asFlow(mangaId)
|
||||
@@ -40,11 +40,9 @@ class RefreshMangaFull @Inject constructor(
|
||||
fun asFlow(mangaId: Long) =
|
||||
mangaRepository.getMangaFull(mangaId, true).onEach { serverListeners.updateManga(mangaId) }
|
||||
|
||||
|
||||
fun asFlow(manga: Manga) =
|
||||
mangaRepository.getMangaFull(manga.id, true).onEach { serverListeners.updateManga(manga.id) }
|
||||
|
||||
|
||||
companion object {
|
||||
private val log = logging()
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.lighthousegames.logging.logging
|
||||
|
||||
class UpdateMangaMeta @Inject constructor(
|
||||
private val mangaRepository: MangaRepository,
|
||||
private val serverListeners: ServerListeners,
|
||||
private val serverListeners: ServerListeners
|
||||
) {
|
||||
|
||||
suspend fun await(
|
||||
|
||||
Reference in New Issue
Block a user