Automatic Lint

This commit is contained in:
Syer10
2022-12-27 21:39:44 +00:00
parent 9e9242cf52
commit 63e1eda265
21 changed files with 32 additions and 36 deletions

View File

@@ -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()
}
}
}

View File

@@ -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)

View File

@@ -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)

View File

@@ -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 {

View File

@@ -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")

View File

@@ -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)

View File

@@ -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 }

View File

@@ -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 }
)

View File

@@ -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)

View File

@@ -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(

View File

@@ -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(

View File

@@ -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(

View File

@@ -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(

View File

@@ -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(

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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()
}

View File

@@ -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()
}

View File

@@ -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(