Add Old naming to REST interactions

This commit is contained in:
Syer10
2024-03-31 01:08:22 -04:00
parent 681f1531d3
commit ba68718627
68 changed files with 248 additions and 248 deletions

View File

@@ -6,7 +6,7 @@
package ca.gosyer.jui.domain.backup.interactor
import ca.gosyer.jui.domain.backup.service.BackupRepository
import ca.gosyer.jui.domain.backup.service.BackupRepositoryOld
import io.ktor.client.request.HttpRequestBuilder
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.singleOrNull
@@ -16,7 +16,7 @@ import org.lighthousegames.logging.logging
class ExportBackupFile
@Inject
constructor(
private val backupRepository: BackupRepository,
private val backupRepositoryOld: BackupRepositoryOld,
) {
suspend fun await(
block: HttpRequestBuilder.() -> Unit = {},
@@ -28,7 +28,7 @@ class ExportBackupFile
}
.singleOrNull()
fun asFlow(block: HttpRequestBuilder.() -> Unit = {}) = backupRepository.exportBackupFile(block)
fun asFlow(block: HttpRequestBuilder.() -> Unit = {}) = backupRepositoryOld.exportBackupFile(block)
companion object {
private val log = logging()

View File

@@ -6,7 +6,7 @@
package ca.gosyer.jui.domain.backup.interactor
import ca.gosyer.jui.domain.backup.service.BackupRepository
import ca.gosyer.jui.domain.backup.service.BackupRepositoryOld
import io.ktor.client.request.HttpRequestBuilder
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.singleOrNull
@@ -17,7 +17,7 @@ import org.lighthousegames.logging.logging
class ImportBackupFile
@Inject
constructor(
private val backupRepository: BackupRepository,
private val backupRepositoryOld: BackupRepositoryOld,
) {
suspend fun await(
file: Path,
@@ -33,7 +33,7 @@ class ImportBackupFile
fun asFlow(
file: Path,
block: HttpRequestBuilder.() -> Unit = {},
) = backupRepository.importBackupFile(BackupRepository.buildBackupFormData(file), block)
) = backupRepositoryOld.importBackupFile(BackupRepositoryOld.buildBackupFormData(file), block)
companion object {
private val log = logging()

View File

@@ -6,7 +6,7 @@
package ca.gosyer.jui.domain.backup.interactor
import ca.gosyer.jui.domain.backup.service.BackupRepository
import ca.gosyer.jui.domain.backup.service.BackupRepositoryOld
import io.ktor.client.request.HttpRequestBuilder
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.singleOrNull
@@ -17,7 +17,7 @@ import org.lighthousegames.logging.logging
class ValidateBackupFile
@Inject
constructor(
private val backupRepository: BackupRepository,
private val backupRepositoryOld: BackupRepositoryOld,
) {
suspend fun await(
file: Path,
@@ -33,7 +33,7 @@ class ValidateBackupFile
fun asFlow(
file: Path,
block: HttpRequestBuilder.() -> Unit = {},
) = backupRepository.validateBackupFile(BackupRepository.buildBackupFormData(file), block)
) = backupRepositoryOld.validateBackupFile(BackupRepositoryOld.buildBackupFormData(file), block)
companion object {
private val log = logging()

View File

@@ -25,7 +25,7 @@ import okio.FileSystem
import okio.Path
import okio.buffer
interface BackupRepository {
interface BackupRepositoryOld {
@Multipart
@POST("api/v1/backup/import/file")
fun importBackupFile(

View File

@@ -8,7 +8,7 @@ package ca.gosyer.jui.domain.category.interactor
import ca.gosyer.jui.domain.ServerListeners
import ca.gosyer.jui.domain.category.model.Category
import ca.gosyer.jui.domain.category.service.CategoryRepository
import ca.gosyer.jui.domain.category.service.CategoryRepositoryOld
import ca.gosyer.jui.domain.manga.model.Manga
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
@@ -20,7 +20,7 @@ import org.lighthousegames.logging.logging
class AddMangaToCategory
@Inject
constructor(
private val categoryRepository: CategoryRepository,
private val categoryRepositoryOld: CategoryRepositoryOld,
private val serverListeners: ServerListeners,
) {
suspend fun await(
@@ -49,7 +49,7 @@ class AddMangaToCategory
mangaId: Long,
categoryId: Long,
) = if (categoryId != 0L) {
categoryRepository.addMangaToCategory(mangaId, categoryId)
categoryRepositoryOld.addMangaToCategory(mangaId, categoryId)
.map { serverListeners.updateCategoryManga(categoryId) }
} else {
flow {
@@ -62,7 +62,7 @@ class AddMangaToCategory
manga: Manga,
category: Category,
) = if (category.id != 0L) {
categoryRepository.addMangaToCategory(manga.id, category.id)
categoryRepositoryOld.addMangaToCategory(manga.id, category.id)
.map { serverListeners.updateCategoryManga(category.id) }
} else {
flow {

View File

@@ -6,7 +6,7 @@
package ca.gosyer.jui.domain.category.interactor
import ca.gosyer.jui.domain.category.service.CategoryRepository
import ca.gosyer.jui.domain.category.service.CategoryRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
import me.tatarka.inject.annotations.Inject
@@ -15,7 +15,7 @@ import org.lighthousegames.logging.logging
class CreateCategory
@Inject
constructor(
private val categoryRepository: CategoryRepository,
private val categoryRepositoryOld: CategoryRepositoryOld,
) {
suspend fun await(
name: String,
@@ -27,7 +27,7 @@ class CreateCategory
}
.collect()
fun asFlow(name: String) = categoryRepository.createCategory(name)
fun asFlow(name: String) = categoryRepositoryOld.createCategory(name)
companion object {
private val log = logging()

View File

@@ -7,7 +7,7 @@
package ca.gosyer.jui.domain.category.interactor
import ca.gosyer.jui.domain.category.model.Category
import ca.gosyer.jui.domain.category.service.CategoryRepository
import ca.gosyer.jui.domain.category.service.CategoryRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
import me.tatarka.inject.annotations.Inject
@@ -16,7 +16,7 @@ import org.lighthousegames.logging.logging
class DeleteCategory
@Inject
constructor(
private val categoryRepository: CategoryRepository,
private val categoryRepositoryOld: CategoryRepositoryOld,
) {
suspend fun await(
categoryId: Long,
@@ -38,9 +38,9 @@ class DeleteCategory
}
.collect()
fun asFlow(categoryId: Long) = categoryRepository.deleteCategory(categoryId)
fun asFlow(categoryId: Long) = categoryRepositoryOld.deleteCategory(categoryId)
fun asFlow(category: Category) = categoryRepository.deleteCategory(category.id)
fun asFlow(category: Category) = categoryRepositoryOld.deleteCategory(category.id)
companion object {
private val log = logging()

View File

@@ -6,7 +6,7 @@
package ca.gosyer.jui.domain.category.interactor
import ca.gosyer.jui.domain.category.service.CategoryRepository
import ca.gosyer.jui.domain.category.service.CategoryRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.singleOrNull
@@ -16,7 +16,7 @@ import org.lighthousegames.logging.logging
class GetCategories
@Inject
constructor(
private val categoryRepository: CategoryRepository,
private val categoryRepositoryOld: CategoryRepositoryOld,
) {
suspend fun await(
dropDefault: Boolean = false,
@@ -29,7 +29,7 @@ class GetCategories
.singleOrNull()
fun asFlow(dropDefault: Boolean = false) =
categoryRepository.getCategories()
categoryRepositoryOld.getCategories()
.map { categories ->
if (dropDefault) {
categories.filterNot { it.name.equals("default", true) }

View File

@@ -6,7 +6,7 @@
package ca.gosyer.jui.domain.category.interactor
import ca.gosyer.jui.domain.category.service.CategoryRepository
import ca.gosyer.jui.domain.category.service.CategoryRepositoryOld
import ca.gosyer.jui.domain.manga.model.Manga
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.singleOrNull
@@ -16,7 +16,7 @@ import org.lighthousegames.logging.logging
class GetMangaCategories
@Inject
constructor(
private val categoryRepository: CategoryRepository,
private val categoryRepositoryOld: CategoryRepositoryOld,
) {
suspend fun await(
mangaId: Long,
@@ -38,9 +38,9 @@ class GetMangaCategories
}
.singleOrNull()
fun asFlow(mangaId: Long) = categoryRepository.getMangaCategories(mangaId)
fun asFlow(mangaId: Long) = categoryRepositoryOld.getMangaCategories(mangaId)
fun asFlow(manga: Manga) = categoryRepository.getMangaCategories(manga.id)
fun asFlow(manga: Manga) = categoryRepositoryOld.getMangaCategories(manga.id)
companion object {
private val log = logging()

View File

@@ -8,7 +8,7 @@ package ca.gosyer.jui.domain.category.interactor
import ca.gosyer.jui.domain.ServerListeners
import ca.gosyer.jui.domain.category.model.Category
import ca.gosyer.jui.domain.category.service.CategoryRepository
import ca.gosyer.jui.domain.category.service.CategoryRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.singleOrNull
import kotlinx.coroutines.flow.take
@@ -18,7 +18,7 @@ import org.lighthousegames.logging.logging
class GetMangaListFromCategory
@Inject
constructor(
private val categoryRepository: CategoryRepository,
private val categoryRepositoryOld: CategoryRepositoryOld,
private val serverListeners: ServerListeners,
) {
suspend fun await(
@@ -45,12 +45,12 @@ class GetMangaListFromCategory
fun asFlow(categoryId: Long) =
serverListeners.combineCategoryManga(
categoryRepository.getMangaFromCategory(categoryId),
categoryRepositoryOld.getMangaFromCategory(categoryId),
) { categoryId == it }
fun asFlow(category: Category) =
serverListeners.combineCategoryManga(
categoryRepository.getMangaFromCategory(category.id),
categoryRepositoryOld.getMangaFromCategory(category.id),
) { category.id == it }
companion object {

View File

@@ -7,7 +7,7 @@
package ca.gosyer.jui.domain.category.interactor
import ca.gosyer.jui.domain.category.model.Category
import ca.gosyer.jui.domain.category.service.CategoryRepository
import ca.gosyer.jui.domain.category.service.CategoryRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
import me.tatarka.inject.annotations.Inject
@@ -16,7 +16,7 @@ import org.lighthousegames.logging.logging
class ModifyCategory
@Inject
constructor(
private val categoryRepository: CategoryRepository,
private val categoryRepositoryOld: CategoryRepositoryOld,
) {
suspend fun await(
categoryId: Long,
@@ -45,7 +45,7 @@ class ModifyCategory
fun asFlow(
categoryId: Long,
name: String,
) = categoryRepository.modifyCategory(
) = categoryRepositoryOld.modifyCategory(
categoryId = categoryId,
name = name,
)
@@ -53,7 +53,7 @@ class ModifyCategory
fun asFlow(
category: Category,
name: String? = null,
) = categoryRepository.modifyCategory(
) = categoryRepositoryOld.modifyCategory(
categoryId = category.id,
name = name ?: category.name,
)

View File

@@ -8,7 +8,7 @@ package ca.gosyer.jui.domain.category.interactor
import ca.gosyer.jui.domain.ServerListeners
import ca.gosyer.jui.domain.category.model.Category
import ca.gosyer.jui.domain.category.service.CategoryRepository
import ca.gosyer.jui.domain.category.service.CategoryRepositoryOld
import ca.gosyer.jui.domain.manga.model.Manga
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
@@ -20,7 +20,7 @@ import org.lighthousegames.logging.logging
class RemoveMangaFromCategory
@Inject
constructor(
private val categoryRepository: CategoryRepository,
private val categoryRepositoryOld: CategoryRepositoryOld,
private val serverListeners: ServerListeners,
) {
suspend fun await(
@@ -49,7 +49,7 @@ class RemoveMangaFromCategory
mangaId: Long,
categoryId: Long,
) = if (categoryId != 0L) {
categoryRepository.removeMangaFromCategory(mangaId, categoryId)
categoryRepositoryOld.removeMangaFromCategory(mangaId, categoryId)
.map { serverListeners.updateCategoryManga(categoryId) }
} else {
flow {
@@ -62,7 +62,7 @@ class RemoveMangaFromCategory
manga: Manga,
category: Category,
) = if (category.id != 0L) {
categoryRepository.removeMangaFromCategory(manga.id, category.id)
categoryRepositoryOld.removeMangaFromCategory(manga.id, category.id)
.map { serverListeners.updateCategoryManga(category.id) }
} else {
flow {

View File

@@ -6,7 +6,7 @@
package ca.gosyer.jui.domain.category.interactor
import ca.gosyer.jui.domain.category.service.CategoryRepository
import ca.gosyer.jui.domain.category.service.CategoryRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
import me.tatarka.inject.annotations.Inject
@@ -15,7 +15,7 @@ import org.lighthousegames.logging.logging
class ReorderCategory
@Inject
constructor(
private val categoryRepository: CategoryRepository,
private val categoryRepositoryOld: CategoryRepositoryOld,
) {
suspend fun await(
to: Int,
@@ -31,7 +31,7 @@ class ReorderCategory
fun asFlow(
to: Int,
from: Int,
) = categoryRepository.reorderCategory(to, from)
) = categoryRepositoryOld.reorderCategory(to, from)
companion object {
private val log = logging()

View File

@@ -7,7 +7,7 @@
package ca.gosyer.jui.domain.category.interactor
import ca.gosyer.jui.domain.category.model.Category
import ca.gosyer.jui.domain.category.service.CategoryRepository
import ca.gosyer.jui.domain.category.service.CategoryRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.flow
@@ -17,7 +17,7 @@ import org.lighthousegames.logging.logging
class UpdateCategoryMeta
@Inject
constructor(
private val categoryRepository: CategoryRepository,
private val categoryRepositoryOld: CategoryRepositoryOld,
) {
suspend fun await(
category: Category,
@@ -35,7 +35,7 @@ class UpdateCategoryMeta
example: Int = category.meta.example,
) = flow {
if (example != category.meta.example) {
categoryRepository.updateCategoryMeta(
categoryRepositoryOld.updateCategoryMeta(
category.id,
"example",
example.toString(),

View File

@@ -18,7 +18,7 @@ import de.jensklingenberg.ktorfit.http.Path
import io.ktor.client.statement.HttpResponse
import kotlinx.coroutines.flow.Flow
interface CategoryRepository {
interface CategoryRepositoryOld {
@GET("api/v1/manga/{mangaId}/category/")
fun getMangaCategories(
@Path("mangaId") mangaId: Long,

View File

@@ -11,7 +11,7 @@ import ca.gosyer.jui.domain.chapter.model.Chapter
import ca.gosyer.jui.domain.chapter.model.ChapterBatchEditInput
import ca.gosyer.jui.domain.chapter.model.ChapterChange
import ca.gosyer.jui.domain.chapter.model.MangaChapterBatchEditInput
import ca.gosyer.jui.domain.chapter.service.ChapterRepository
import ca.gosyer.jui.domain.chapter.service.ChapterRepositoryOld
import ca.gosyer.jui.domain.manga.model.Manga
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
@@ -23,7 +23,7 @@ import kotlin.jvm.JvmName
class BatchUpdateChapter
@Inject
constructor(
private val chapterRepository: ChapterRepository,
private val chapterRepositoryOld: ChapterRepositoryOld,
private val serverListeners: ServerListeners,
) {
@JvmName("awaitChapters")
@@ -222,7 +222,7 @@ class BatchUpdateChapter
lastPageRead: Int? = null,
delete: Boolean? = null,
) = if (mangaId != null) {
chapterRepository.batchUpdateChapter(
chapterRepositoryOld.batchUpdateChapter(
mangaId,
MangaChapterBatchEditInput(
chapterIds = chapterIds,
@@ -235,7 +235,7 @@ class BatchUpdateChapter
),
)
} else {
chapterRepository.batchUpdateChapter(
chapterRepositoryOld.batchUpdateChapter(
ChapterBatchEditInput(
chapterIds = chapterIds,
change = ChapterChange(

View File

@@ -8,7 +8,7 @@ package ca.gosyer.jui.domain.chapter.interactor
import ca.gosyer.jui.domain.ServerListeners
import ca.gosyer.jui.domain.chapter.model.Chapter
import ca.gosyer.jui.domain.chapter.service.ChapterRepository
import ca.gosyer.jui.domain.chapter.service.ChapterRepositoryOld
import ca.gosyer.jui.domain.manga.model.Manga
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
@@ -19,7 +19,7 @@ import org.lighthousegames.logging.logging
class DeleteChapterDownload
@Inject
constructor(
private val chapterRepository: ChapterRepository,
private val chapterRepositoryOld: ChapterRepositoryOld,
private val serverListeners: ServerListeners,
) {
suspend fun await(
@@ -57,17 +57,17 @@ class DeleteChapterDownload
fun asFlow(
mangaId: Long,
index: Int,
) = chapterRepository.deleteChapterDownload(mangaId, index)
) = chapterRepositoryOld.deleteChapterDownload(mangaId, index)
.onEach { serverListeners.updateChapters(mangaId, index) }
fun asFlow(
manga: Manga,
index: Int,
) = chapterRepository.deleteChapterDownload(manga.id, index)
) = chapterRepositoryOld.deleteChapterDownload(manga.id, index)
.onEach { serverListeners.updateChapters(manga.id, index) }
fun asFlow(chapter: Chapter) =
chapterRepository.deleteChapterDownload(chapter.mangaId, chapter.index)
chapterRepositoryOld.deleteChapterDownload(chapter.mangaId, chapter.index)
.onEach { serverListeners.updateChapters(chapter.mangaId, chapter.index) }
companion object {

View File

@@ -8,7 +8,7 @@ package ca.gosyer.jui.domain.chapter.interactor
import ca.gosyer.jui.domain.ServerListeners
import ca.gosyer.jui.domain.chapter.model.Chapter
import ca.gosyer.jui.domain.chapter.service.ChapterRepository
import ca.gosyer.jui.domain.chapter.service.ChapterRepositoryOld
import ca.gosyer.jui.domain.manga.model.Manga
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.singleOrNull
@@ -19,7 +19,7 @@ import org.lighthousegames.logging.logging
class GetChapter
@Inject
constructor(
private val chapterRepository: ChapterRepository,
private val chapterRepositoryOld: ChapterRepositoryOld,
private val serverListeners: ServerListeners,
) {
suspend fun await(
@@ -61,7 +61,7 @@ class GetChapter
mangaId: Long,
index: Int,
) = serverListeners.combineChapters(
chapterRepository.getChapter(mangaId, index),
chapterRepositoryOld.getChapter(mangaId, index),
indexPredate = { id, chapterIndexes ->
id == mangaId && (chapterIndexes == null || index in chapterIndexes)
},
@@ -72,7 +72,7 @@ class GetChapter
manga: Manga,
index: Int,
) = serverListeners.combineChapters(
chapterRepository.getChapter(manga.id, index),
chapterRepositoryOld.getChapter(manga.id, index),
indexPredate = { id, chapterIndexes ->
id == manga.id && (chapterIndexes == null || index in chapterIndexes)
},
@@ -81,7 +81,7 @@ class GetChapter
fun asFlow(chapter: Chapter) =
serverListeners.combineChapters(
chapterRepository.getChapter(chapter.mangaId, chapter.index),
chapterRepositoryOld.getChapter(chapter.mangaId, chapter.index),
indexPredate = { id, chapterIndexes ->
id == chapter.mangaId && (chapterIndexes == null || chapter.index in chapterIndexes)
},

View File

@@ -7,7 +7,7 @@
package ca.gosyer.jui.domain.chapter.interactor
import ca.gosyer.jui.domain.chapter.model.Chapter
import ca.gosyer.jui.domain.chapter.service.ChapterRepository
import ca.gosyer.jui.domain.chapter.service.ChapterRepositoryOld
import ca.gosyer.jui.domain.manga.model.Manga
import io.ktor.client.request.HttpRequestBuilder
import kotlinx.coroutines.flow.catch
@@ -18,7 +18,7 @@ import org.lighthousegames.logging.logging
class GetChapterPage
@Inject
constructor(
private val chapterRepository: ChapterRepository,
private val chapterRepositoryOld: ChapterRepositoryOld,
) {
suspend fun await(
mangaId: Long,
@@ -63,20 +63,20 @@ class GetChapterPage
index: Int,
pageNum: Int,
block: HttpRequestBuilder.() -> Unit,
) = chapterRepository.getPage(mangaId, index, pageNum, block)
) = chapterRepositoryOld.getPage(mangaId, index, pageNum, block)
fun asFlow(
manga: Manga,
index: Int,
pageNum: Int,
block: HttpRequestBuilder.() -> Unit,
) = chapterRepository.getPage(manga.id, index, pageNum, block)
) = chapterRepositoryOld.getPage(manga.id, index, pageNum, block)
fun asFlow(
chapter: Chapter,
pageNum: Int,
block: HttpRequestBuilder.() -> Unit,
) = chapterRepository.getPage(chapter.mangaId, chapter.index, pageNum, block)
) = chapterRepositoryOld.getPage(chapter.mangaId, chapter.index, pageNum, block)
companion object {
private val log = logging()

View File

@@ -7,7 +7,7 @@
package ca.gosyer.jui.domain.chapter.interactor
import ca.gosyer.jui.domain.ServerListeners
import ca.gosyer.jui.domain.chapter.service.ChapterRepository
import ca.gosyer.jui.domain.chapter.service.ChapterRepositoryOld
import ca.gosyer.jui.domain.manga.model.Manga
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.singleOrNull
@@ -18,7 +18,7 @@ import org.lighthousegames.logging.logging
class GetChapters
@Inject
constructor(
private val chapterRepository: ChapterRepository,
private val chapterRepositoryOld: ChapterRepositoryOld,
private val serverListeners: ServerListeners,
) {
suspend fun await(
@@ -45,14 +45,14 @@ class GetChapters
fun asFlow(mangaId: Long) =
serverListeners.combineChapters(
chapterRepository.getChapters(mangaId),
chapterRepositoryOld.getChapters(mangaId),
indexPredate = { id, _ -> id == mangaId },
idPredate = { id, _ -> id == mangaId },
)
fun asFlow(manga: Manga) =
serverListeners.combineChapters(
chapterRepository.getChapters(manga.id),
chapterRepositoryOld.getChapters(manga.id),
indexPredate = { id, _ -> id == manga.id },
idPredate = { id, _ -> id == manga.id },
)

View File

@@ -7,7 +7,7 @@
package ca.gosyer.jui.domain.chapter.interactor
import ca.gosyer.jui.domain.ServerListeners
import ca.gosyer.jui.domain.chapter.service.ChapterRepository
import ca.gosyer.jui.domain.chapter.service.ChapterRepositoryOld
import ca.gosyer.jui.domain.manga.model.Manga
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.onEach
@@ -18,7 +18,7 @@ import org.lighthousegames.logging.logging
class RefreshChapters
@Inject
constructor(
private val chapterRepository: ChapterRepository,
private val chapterRepositoryOld: ChapterRepositoryOld,
private val serverListeners: ServerListeners,
) {
suspend fun await(
@@ -42,11 +42,11 @@ class RefreshChapters
.singleOrNull()
fun asFlow(mangaId: Long) =
chapterRepository.getChapters(mangaId, true)
chapterRepositoryOld.getChapters(mangaId, true)
.onEach { serverListeners.updateChapters(mangaId) }
fun asFlow(manga: Manga) =
chapterRepository.getChapters(manga.id, true)
chapterRepositoryOld.getChapters(manga.id, true)
.onEach { serverListeners.updateChapters(manga.id) }
companion object {

View File

@@ -8,7 +8,7 @@ package ca.gosyer.jui.domain.chapter.interactor
import ca.gosyer.jui.domain.ServerListeners
import ca.gosyer.jui.domain.chapter.model.Chapter
import ca.gosyer.jui.domain.chapter.service.ChapterRepository
import ca.gosyer.jui.domain.chapter.service.ChapterRepositoryOld
import ca.gosyer.jui.domain.manga.model.Manga
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
@@ -19,7 +19,7 @@ import org.lighthousegames.logging.logging
class UpdateChapterBookmarked
@Inject
constructor(
private val chapterRepository: ChapterRepository,
private val chapterRepositoryOld: ChapterRepositoryOld,
private val serverListeners: ServerListeners,
) {
suspend fun await(
@@ -61,7 +61,7 @@ class UpdateChapterBookmarked
mangaId: Long,
index: Int,
bookmarked: Boolean,
) = chapterRepository.updateChapter(
) = chapterRepositoryOld.updateChapter(
mangaId = mangaId,
chapterIndex = index,
bookmarked = bookmarked,
@@ -71,7 +71,7 @@ class UpdateChapterBookmarked
manga: Manga,
index: Int,
bookmarked: Boolean,
) = chapterRepository.updateChapter(
) = chapterRepositoryOld.updateChapter(
mangaId = manga.id,
chapterIndex = index,
bookmarked = bookmarked,
@@ -80,7 +80,7 @@ class UpdateChapterBookmarked
fun asFlow(
chapter: Chapter,
bookmarked: Boolean,
) = chapterRepository.updateChapter(
) = chapterRepositoryOld.updateChapter(
mangaId = chapter.mangaId,
chapterIndex = chapter.index,
bookmarked = bookmarked,

View File

@@ -8,7 +8,7 @@ package ca.gosyer.jui.domain.chapter.interactor
import ca.gosyer.jui.domain.ServerListeners
import ca.gosyer.jui.domain.chapter.model.Chapter
import ca.gosyer.jui.domain.chapter.service.ChapterRepository
import ca.gosyer.jui.domain.chapter.service.ChapterRepositoryOld
import ca.gosyer.jui.domain.manga.model.Manga
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
@@ -19,7 +19,7 @@ import org.lighthousegames.logging.logging
class UpdateChapterLastPageRead
@Inject
constructor(
private val chapterRepository: ChapterRepository,
private val chapterRepositoryOld: ChapterRepositoryOld,
private val serverListeners: ServerListeners,
) {
suspend fun await(
@@ -61,7 +61,7 @@ class UpdateChapterLastPageRead
mangaId: Long,
index: Int,
lastPageRead: Int,
) = chapterRepository.updateChapter(
) = chapterRepositoryOld.updateChapter(
mangaId = mangaId,
chapterIndex = index,
lastPageRead = lastPageRead,
@@ -71,7 +71,7 @@ class UpdateChapterLastPageRead
manga: Manga,
index: Int,
lastPageRead: Int,
) = chapterRepository.updateChapter(
) = chapterRepositoryOld.updateChapter(
mangaId = manga.id,
chapterIndex = index,
lastPageRead = lastPageRead,
@@ -80,7 +80,7 @@ class UpdateChapterLastPageRead
fun asFlow(
chapter: Chapter,
lastPageRead: Int,
) = chapterRepository.updateChapter(
) = chapterRepositoryOld.updateChapter(
mangaId = chapter.mangaId,
chapterIndex = chapter.index,
lastPageRead = lastPageRead,

View File

@@ -8,7 +8,7 @@ package ca.gosyer.jui.domain.chapter.interactor
import ca.gosyer.jui.domain.ServerListeners
import ca.gosyer.jui.domain.chapter.model.Chapter
import ca.gosyer.jui.domain.chapter.service.ChapterRepository
import ca.gosyer.jui.domain.chapter.service.ChapterRepositoryOld
import ca.gosyer.jui.domain.manga.model.Manga
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
@@ -19,7 +19,7 @@ import org.lighthousegames.logging.logging
class UpdateChapterMarkPreviousRead
@Inject
constructor(
private val chapterRepository: ChapterRepository,
private val chapterRepositoryOld: ChapterRepositoryOld,
private val serverListeners: ServerListeners,
) {
suspend fun await(
@@ -57,7 +57,7 @@ class UpdateChapterMarkPreviousRead
fun asFlow(
mangaId: Long,
index: Int,
) = chapterRepository.updateChapter(
) = chapterRepositoryOld.updateChapter(
mangaId = mangaId,
chapterIndex = index,
markPreviousRead = true,
@@ -66,14 +66,14 @@ class UpdateChapterMarkPreviousRead
fun asFlow(
manga: Manga,
index: Int,
) = chapterRepository.updateChapter(
) = chapterRepositoryOld.updateChapter(
mangaId = manga.id,
chapterIndex = index,
markPreviousRead = true,
).onEach { serverListeners.updateChapters(manga.id, index) }
fun asFlow(chapter: Chapter) =
chapterRepository.updateChapter(
chapterRepositoryOld.updateChapter(
mangaId = chapter.mangaId,
chapterIndex = chapter.index,
markPreviousRead = true,

View File

@@ -8,7 +8,7 @@ package ca.gosyer.jui.domain.chapter.interactor
import ca.gosyer.jui.domain.ServerListeners
import ca.gosyer.jui.domain.chapter.model.Chapter
import ca.gosyer.jui.domain.chapter.service.ChapterRepository
import ca.gosyer.jui.domain.chapter.service.ChapterRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.flow
@@ -18,7 +18,7 @@ import org.lighthousegames.logging.logging
class UpdateChapterMeta
@Inject
constructor(
private val chapterRepository: ChapterRepository,
private val chapterRepositoryOld: ChapterRepositoryOld,
private val serverListeners: ServerListeners,
) {
suspend fun await(
@@ -37,7 +37,7 @@ class UpdateChapterMeta
pageOffset: Int = chapter.meta.juiPageOffset,
) = flow {
if (pageOffset != chapter.meta.juiPageOffset) {
chapterRepository.updateChapterMeta(
chapterRepositoryOld.updateChapterMeta(
chapter.mangaId,
chapter.index,
"juiPageOffset",

View File

@@ -8,7 +8,7 @@ package ca.gosyer.jui.domain.chapter.interactor
import ca.gosyer.jui.domain.ServerListeners
import ca.gosyer.jui.domain.chapter.model.Chapter
import ca.gosyer.jui.domain.chapter.service.ChapterRepository
import ca.gosyer.jui.domain.chapter.service.ChapterRepositoryOld
import ca.gosyer.jui.domain.manga.model.Manga
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
@@ -19,7 +19,7 @@ import org.lighthousegames.logging.logging
class UpdateChapterRead
@Inject
constructor(
private val chapterRepository: ChapterRepository,
private val chapterRepositoryOld: ChapterRepositoryOld,
private val serverListeners: ServerListeners,
) {
suspend fun await(
@@ -61,7 +61,7 @@ class UpdateChapterRead
mangaId: Long,
index: Int,
read: Boolean,
) = chapterRepository.updateChapter(
) = chapterRepositoryOld.updateChapter(
mangaId = mangaId,
chapterIndex = index,
read = read,
@@ -71,7 +71,7 @@ class UpdateChapterRead
manga: Manga,
index: Int,
read: Boolean,
) = chapterRepository.updateChapter(
) = chapterRepositoryOld.updateChapter(
mangaId = manga.id,
chapterIndex = index,
read = read,
@@ -80,7 +80,7 @@ class UpdateChapterRead
fun asFlow(
chapter: Chapter,
read: Boolean,
) = chapterRepository.updateChapter(
) = chapterRepositoryOld.updateChapter(
mangaId = chapter.mangaId,
chapterIndex = chapter.index,
read = read,

View File

@@ -24,7 +24,7 @@ import io.ktor.client.request.HttpRequestBuilder
import io.ktor.client.statement.HttpResponse
import kotlinx.coroutines.flow.Flow
interface ChapterRepository {
interface ChapterRepositoryOld {
@GET("api/v1/manga/{mangaId}/chapters")
fun getChapters(
@Path("mangaId") mangaId: Long,

View File

@@ -7,7 +7,7 @@
package ca.gosyer.jui.domain.download.interactor
import ca.gosyer.jui.domain.download.model.DownloadEnqueue
import ca.gosyer.jui.domain.download.service.DownloadRepository
import ca.gosyer.jui.domain.download.service.DownloadRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
import me.tatarka.inject.annotations.Inject
@@ -16,7 +16,7 @@ import org.lighthousegames.logging.logging
class BatchChapterDownload
@Inject
constructor(
private val downloadRepository: DownloadRepository,
private val downloadRepositoryOld: DownloadRepositoryOld,
) {
suspend fun await(
chapterIds: List<Long>,
@@ -38,9 +38,9 @@ class BatchChapterDownload
}
.collect()
fun asFlow(chapterIds: List<Long>) = downloadRepository.batchDownload(DownloadEnqueue(chapterIds))
fun asFlow(chapterIds: List<Long>) = downloadRepositoryOld.batchDownload(DownloadEnqueue(chapterIds))
fun asFlow(vararg chapterIds: Long) = downloadRepository.batchDownload(DownloadEnqueue(chapterIds.asList()))
fun asFlow(vararg chapterIds: Long) = downloadRepositoryOld.batchDownload(DownloadEnqueue(chapterIds.asList()))
companion object {
private val log = logging()

View File

@@ -6,7 +6,7 @@
package ca.gosyer.jui.domain.download.interactor
import ca.gosyer.jui.domain.download.service.DownloadRepository
import ca.gosyer.jui.domain.download.service.DownloadRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
import me.tatarka.inject.annotations.Inject
@@ -15,7 +15,7 @@ import org.lighthousegames.logging.logging
class ClearDownloadQueue
@Inject
constructor(
private val downloadRepository: DownloadRepository,
private val downloadRepositoryOld: DownloadRepositoryOld,
) {
suspend fun await(onError: suspend (Throwable) -> Unit = {}) =
asFlow()
@@ -25,7 +25,7 @@ class ClearDownloadQueue
}
.collect()
fun asFlow() = downloadRepository.clearDownloadQueue()
fun asFlow() = downloadRepositoryOld.clearDownloadQueue()
companion object {
private val log = logging()

View File

@@ -7,7 +7,7 @@
package ca.gosyer.jui.domain.download.interactor
import ca.gosyer.jui.domain.chapter.model.Chapter
import ca.gosyer.jui.domain.download.service.DownloadRepository
import ca.gosyer.jui.domain.download.service.DownloadRepositoryOld
import ca.gosyer.jui.domain.manga.model.Manga
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
@@ -17,7 +17,7 @@ import org.lighthousegames.logging.logging
class QueueChapterDownload
@Inject
constructor(
private val downloadRepository: DownloadRepository,
private val downloadRepositoryOld: DownloadRepositoryOld,
) {
suspend fun await(
mangaId: Long,
@@ -54,14 +54,14 @@ class QueueChapterDownload
fun asFlow(
mangaId: Long,
index: Int,
) = downloadRepository.queueChapterDownload(mangaId, index)
) = downloadRepositoryOld.queueChapterDownload(mangaId, index)
fun asFlow(
manga: Manga,
index: Int,
) = downloadRepository.queueChapterDownload(manga.id, index)
) = downloadRepositoryOld.queueChapterDownload(manga.id, index)
fun asFlow(chapter: Chapter) = downloadRepository.queueChapterDownload(chapter.mangaId, chapter.index)
fun asFlow(chapter: Chapter) = downloadRepositoryOld.queueChapterDownload(chapter.mangaId, chapter.index)
companion object {
private val log = logging()

View File

@@ -7,7 +7,7 @@
package ca.gosyer.jui.domain.download.interactor
import ca.gosyer.jui.domain.chapter.model.Chapter
import ca.gosyer.jui.domain.download.service.DownloadRepository
import ca.gosyer.jui.domain.download.service.DownloadRepositoryOld
import ca.gosyer.jui.domain.manga.model.Manga
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
@@ -17,7 +17,7 @@ import org.lighthousegames.logging.logging
class ReorderChapterDownload
@Inject
constructor(
private val downloadRepository: DownloadRepository,
private val downloadRepositoryOld: DownloadRepositoryOld,
) {
suspend fun await(
mangaId: Long,
@@ -58,18 +58,18 @@ class ReorderChapterDownload
mangaId: Long,
index: Int,
to: Int,
) = downloadRepository.reorderChapterDownload(mangaId, index, to)
) = downloadRepositoryOld.reorderChapterDownload(mangaId, index, to)
fun asFlow(
manga: Manga,
index: Int,
to: Int,
) = downloadRepository.reorderChapterDownload(manga.id, index, to)
) = downloadRepositoryOld.reorderChapterDownload(manga.id, index, to)
fun asFlow(
chapter: Chapter,
to: Int,
) = downloadRepository.reorderChapterDownload(chapter.mangaId, chapter.index, to)
) = downloadRepositoryOld.reorderChapterDownload(chapter.mangaId, chapter.index, to)
companion object {
private val log = logging()

View File

@@ -6,7 +6,7 @@
package ca.gosyer.jui.domain.download.interactor
import ca.gosyer.jui.domain.download.service.DownloadRepository
import ca.gosyer.jui.domain.download.service.DownloadRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
import me.tatarka.inject.annotations.Inject
@@ -15,7 +15,7 @@ import org.lighthousegames.logging.logging
class StartDownloading
@Inject
constructor(
private val downloadRepository: DownloadRepository,
private val downloadRepositoryOld: DownloadRepositoryOld,
) {
suspend fun await(onError: suspend (Throwable) -> Unit = {}) =
asFlow()
@@ -25,7 +25,7 @@ class StartDownloading
}
.collect()
fun asFlow() = downloadRepository.startDownloading()
fun asFlow() = downloadRepositoryOld.startDownloading()
companion object {
private val log = logging()

View File

@@ -7,7 +7,7 @@
package ca.gosyer.jui.domain.download.interactor
import ca.gosyer.jui.domain.chapter.model.Chapter
import ca.gosyer.jui.domain.download.service.DownloadRepository
import ca.gosyer.jui.domain.download.service.DownloadRepositoryOld
import ca.gosyer.jui.domain.manga.model.Manga
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
@@ -17,7 +17,7 @@ import org.lighthousegames.logging.logging
class StopChapterDownload
@Inject
constructor(
private val downloadRepository: DownloadRepository,
private val downloadRepositoryOld: DownloadRepositoryOld,
) {
suspend fun await(
mangaId: Long,
@@ -54,14 +54,14 @@ class StopChapterDownload
fun asFlow(
mangaId: Long,
index: Int,
) = downloadRepository.stopChapterDownload(mangaId, index)
) = downloadRepositoryOld.stopChapterDownload(mangaId, index)
fun asFlow(
manga: Manga,
index: Int,
) = downloadRepository.stopChapterDownload(manga.id, index)
) = downloadRepositoryOld.stopChapterDownload(manga.id, index)
fun asFlow(chapter: Chapter) = downloadRepository.stopChapterDownload(chapter.mangaId, chapter.index)
fun asFlow(chapter: Chapter) = downloadRepositoryOld.stopChapterDownload(chapter.mangaId, chapter.index)
companion object {
private val log = logging()

View File

@@ -6,7 +6,7 @@
package ca.gosyer.jui.domain.download.interactor
import ca.gosyer.jui.domain.download.service.DownloadRepository
import ca.gosyer.jui.domain.download.service.DownloadRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
import me.tatarka.inject.annotations.Inject
@@ -15,7 +15,7 @@ import org.lighthousegames.logging.logging
class StopDownloading
@Inject
constructor(
private val downloadRepository: DownloadRepository,
private val downloadRepositoryOld: DownloadRepositoryOld,
) {
suspend fun await(onError: suspend (Throwable) -> Unit = {}) =
asFlow()
@@ -25,7 +25,7 @@ class StopDownloading
}
.collect()
fun asFlow() = downloadRepository.stopDownloading()
fun asFlow() = downloadRepositoryOld.stopDownloading()
companion object {
private val log = logging()

View File

@@ -17,7 +17,7 @@ import de.jensklingenberg.ktorfit.http.Path
import io.ktor.client.statement.HttpResponse
import kotlinx.coroutines.flow.Flow
interface DownloadRepository {
interface DownloadRepositoryOld {
@GET("api/v1/downloads/start")
fun startDownloading(): Flow<HttpResponse>

View File

@@ -6,7 +6,7 @@
package ca.gosyer.jui.domain.extension.interactor
import ca.gosyer.jui.domain.extension.service.ExtensionRepository
import ca.gosyer.jui.domain.extension.service.ExtensionRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.singleOrNull
import me.tatarka.inject.annotations.Inject
@@ -15,7 +15,7 @@ import org.lighthousegames.logging.logging
class GetExtensionList
@Inject
constructor(
private val extensionRepository: ExtensionRepository,
private val extensionRepositoryOld: ExtensionRepositoryOld,
) {
suspend fun await(onError: suspend (Throwable) -> Unit = {}) =
asFlow()
@@ -25,7 +25,7 @@ class GetExtensionList
}
.singleOrNull()
fun asFlow() = extensionRepository.getExtensionList()
fun asFlow() = extensionRepositoryOld.getExtensionList()
companion object {
private val log = logging()

View File

@@ -7,7 +7,7 @@
package ca.gosyer.jui.domain.extension.interactor
import ca.gosyer.jui.domain.extension.model.Extension
import ca.gosyer.jui.domain.extension.service.ExtensionRepository
import ca.gosyer.jui.domain.extension.service.ExtensionRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
import me.tatarka.inject.annotations.Inject
@@ -16,7 +16,7 @@ import org.lighthousegames.logging.logging
class InstallExtension
@Inject
constructor(
private val extensionRepository: ExtensionRepository,
private val extensionRepositoryOld: ExtensionRepositoryOld,
) {
suspend fun await(
extension: Extension,
@@ -28,7 +28,7 @@ class InstallExtension
}
.collect()
fun asFlow(extension: Extension) = extensionRepository.installExtension(extension.pkgName)
fun asFlow(extension: Extension) = extensionRepositoryOld.installExtension(extension.pkgName)
companion object {
private val log = logging()

View File

@@ -6,7 +6,7 @@
package ca.gosyer.jui.domain.extension.interactor
import ca.gosyer.jui.domain.extension.service.ExtensionRepository
import ca.gosyer.jui.domain.extension.service.ExtensionRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
import me.tatarka.inject.annotations.Inject
@@ -16,7 +16,7 @@ import org.lighthousegames.logging.logging
class InstallExtensionFile
@Inject
constructor(
private val extensionRepository: ExtensionRepository,
private val extensionRepositoryOld: ExtensionRepositoryOld,
) {
suspend fun await(
path: Path,
@@ -28,7 +28,7 @@ class InstallExtensionFile
}
.collect()
fun asFlow(path: Path) = extensionRepository.installExtension(ExtensionRepository.buildExtensionFormData(path))
fun asFlow(path: Path) = extensionRepositoryOld.installExtension(ExtensionRepositoryOld.buildExtensionFormData(path))
companion object {
private val log = logging()

View File

@@ -7,7 +7,7 @@
package ca.gosyer.jui.domain.extension.interactor
import ca.gosyer.jui.domain.extension.model.Extension
import ca.gosyer.jui.domain.extension.service.ExtensionRepository
import ca.gosyer.jui.domain.extension.service.ExtensionRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
import me.tatarka.inject.annotations.Inject
@@ -16,7 +16,7 @@ import org.lighthousegames.logging.logging
class UninstallExtension
@Inject
constructor(
private val extensionRepository: ExtensionRepository,
private val extensionRepositoryOld: ExtensionRepositoryOld,
) {
suspend fun await(
extension: Extension,
@@ -28,7 +28,7 @@ class UninstallExtension
}
.collect()
fun asFlow(extension: Extension) = extensionRepository.uninstallExtension(extension.pkgName)
fun asFlow(extension: Extension) = extensionRepositoryOld.uninstallExtension(extension.pkgName)
companion object {
private val log = logging()

View File

@@ -7,7 +7,7 @@
package ca.gosyer.jui.domain.extension.interactor
import ca.gosyer.jui.domain.extension.model.Extension
import ca.gosyer.jui.domain.extension.service.ExtensionRepository
import ca.gosyer.jui.domain.extension.service.ExtensionRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
import me.tatarka.inject.annotations.Inject
@@ -16,7 +16,7 @@ import org.lighthousegames.logging.logging
class UpdateExtension
@Inject
constructor(
private val extensionRepository: ExtensionRepository,
private val extensionRepositoryOld: ExtensionRepositoryOld,
) {
suspend fun await(
extension: Extension,
@@ -28,7 +28,7 @@ class UpdateExtension
}
.collect()
fun asFlow(extension: Extension) = extensionRepository.updateExtension(extension.pkgName)
fun asFlow(extension: Extension) = extensionRepositoryOld.updateExtension(extension.pkgName)
companion object {
private val log = logging()

View File

@@ -26,7 +26,7 @@ import kotlinx.coroutines.flow.Flow
import okio.FileSystem
import okio.buffer
interface ExtensionRepository {
interface ExtensionRepositoryOld {
@GET("api/v1/extension/list")
fun getExtensionList(): Flow<List<Extension>>

View File

@@ -6,7 +6,7 @@
package ca.gosyer.jui.domain.global.interactor
import ca.gosyer.jui.domain.global.service.GlobalRepository
import ca.gosyer.jui.domain.global.service.GlobalRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.singleOrNull
import me.tatarka.inject.annotations.Inject
@@ -15,7 +15,7 @@ import org.lighthousegames.logging.logging
class GetGlobalMeta
@Inject
constructor(
private val globalRepository: GlobalRepository,
private val globalRepositoryOld: GlobalRepositoryOld,
) {
suspend fun await(onError: suspend (Throwable) -> Unit = {}) =
asFlow()
@@ -25,7 +25,7 @@ class GetGlobalMeta
}
.singleOrNull()
fun asFlow() = globalRepository.getGlobalMeta()
fun asFlow() = globalRepositoryOld.getGlobalMeta()
companion object {
private val log = logging()

View File

@@ -7,7 +7,7 @@
package ca.gosyer.jui.domain.global.interactor
import ca.gosyer.jui.domain.global.model.GlobalMeta
import ca.gosyer.jui.domain.global.service.GlobalRepository
import ca.gosyer.jui.domain.global.service.GlobalRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.flow
@@ -17,7 +17,7 @@ import org.lighthousegames.logging.logging
class UpdateGlobalMeta
@Inject
constructor(
private val globalRepository: GlobalRepository,
private val globalRepositoryOld: GlobalRepositoryOld,
) {
suspend fun await(
globalMeta: GlobalMeta,
@@ -35,7 +35,7 @@ class UpdateGlobalMeta
example: Int = globalMeta.example,
) = flow {
if (example != globalMeta.example) {
globalRepository.updateGlobalMeta(
globalRepositoryOld.updateGlobalMeta(
"example",
example.toString(),
).collect()

View File

@@ -14,7 +14,7 @@ import de.jensklingenberg.ktorfit.http.PATCH
import io.ktor.client.statement.HttpResponse
import kotlinx.coroutines.flow.Flow
interface GlobalRepository {
interface GlobalRepositoryOld {
@GET("api/v1/meta")
fun getGlobalMeta(): Flow<GlobalMeta>

View File

@@ -7,7 +7,7 @@
package ca.gosyer.jui.domain.library.interactor
import ca.gosyer.jui.domain.ServerListeners
import ca.gosyer.jui.domain.library.service.LibraryRepository
import ca.gosyer.jui.domain.library.service.LibraryRepositoryOld
import ca.gosyer.jui.domain.manga.model.Manga
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.onEach
@@ -18,7 +18,7 @@ import org.lighthousegames.logging.logging
class AddMangaToLibrary
@Inject
constructor(
private val libraryRepository: LibraryRepository,
private val libraryRepositoryOld: LibraryRepositoryOld,
private val serverListeners: ServerListeners,
) {
suspend fun await(
@@ -42,11 +42,11 @@ class AddMangaToLibrary
.singleOrNull()
fun asFlow(mangaId: Long) =
libraryRepository.addMangaToLibrary(mangaId)
libraryRepositoryOld.addMangaToLibrary(mangaId)
.onEach { serverListeners.updateManga(mangaId) }
fun asFlow(manga: Manga) =
libraryRepository.addMangaToLibrary(manga.id)
libraryRepositoryOld.addMangaToLibrary(manga.id)
.onEach { serverListeners.updateManga(manga.id) }
companion object {

View File

@@ -7,7 +7,7 @@
package ca.gosyer.jui.domain.library.interactor
import ca.gosyer.jui.domain.ServerListeners
import ca.gosyer.jui.domain.library.service.LibraryRepository
import ca.gosyer.jui.domain.library.service.LibraryRepositoryOld
import ca.gosyer.jui.domain.manga.model.Manga
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.onEach
@@ -18,7 +18,7 @@ import org.lighthousegames.logging.logging
class RemoveMangaFromLibrary
@Inject
constructor(
private val libraryRepository: LibraryRepository,
private val libraryRepositoryOld: LibraryRepositoryOld,
private val serverListeners: ServerListeners,
) {
suspend fun await(
@@ -42,11 +42,11 @@ class RemoveMangaFromLibrary
.singleOrNull()
fun asFlow(mangaId: Long) =
libraryRepository.removeMangaFromLibrary(mangaId)
libraryRepositoryOld.removeMangaFromLibrary(mangaId)
.onEach { serverListeners.updateManga(mangaId) }
fun asFlow(manga: Manga) =
libraryRepository.removeMangaFromLibrary(manga.id)
libraryRepositoryOld.removeMangaFromLibrary(manga.id)
.onEach { serverListeners.updateManga(manga.id) }
companion object {

View File

@@ -12,7 +12,7 @@ import de.jensklingenberg.ktorfit.http.Path
import io.ktor.client.statement.HttpResponse
import kotlinx.coroutines.flow.Flow
interface LibraryRepository {
interface LibraryRepositoryOld {
@GET("api/v1/manga/{mangaId}/library")
fun addMangaToLibrary(
@Path("mangaId") mangaId: Long,

View File

@@ -8,7 +8,7 @@ package ca.gosyer.jui.domain.manga.interactor
import ca.gosyer.jui.domain.ServerListeners
import ca.gosyer.jui.domain.manga.model.Manga
import ca.gosyer.jui.domain.manga.service.MangaRepository
import ca.gosyer.jui.domain.manga.service.MangaRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.singleOrNull
import kotlinx.coroutines.flow.take
@@ -18,7 +18,7 @@ import org.lighthousegames.logging.logging
class GetManga
@Inject
constructor(
private val mangaRepository: MangaRepository,
private val mangaRepositoryOld: MangaRepositoryOld,
private val serverListeners: ServerListeners,
) {
suspend fun await(
@@ -45,12 +45,12 @@ class GetManga
fun asFlow(mangaId: Long) =
serverListeners.combineMangaUpdates(
mangaRepository.getManga(mangaId),
mangaRepositoryOld.getManga(mangaId),
) { mangaId in it }
fun asFlow(manga: Manga) =
serverListeners.combineMangaUpdates(
mangaRepository.getManga(manga.id),
mangaRepositoryOld.getManga(manga.id),
) { manga.id in it }
companion object {

View File

@@ -8,7 +8,7 @@ package ca.gosyer.jui.domain.manga.interactor
import ca.gosyer.jui.domain.ServerListeners
import ca.gosyer.jui.domain.manga.model.Manga
import ca.gosyer.jui.domain.manga.service.MangaRepository
import ca.gosyer.jui.domain.manga.service.MangaRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.singleOrNull
import kotlinx.coroutines.flow.take
@@ -18,7 +18,7 @@ import org.lighthousegames.logging.logging
class GetMangaFull
@Inject
constructor(
private val mangaRepository: MangaRepository,
private val mangaRepositoryOld: MangaRepositoryOld,
private val serverListeners: ServerListeners,
) {
suspend fun await(
@@ -45,12 +45,12 @@ class GetMangaFull
fun asFlow(mangaId: Long) =
serverListeners.combineMangaUpdates(
mangaRepository.getMangaFull(mangaId),
mangaRepositoryOld.getMangaFull(mangaId),
) { mangaId in it }
fun asFlow(manga: Manga) =
serverListeners.combineMangaUpdates(
mangaRepository.getMangaFull(manga.id),
mangaRepositoryOld.getMangaFull(manga.id),
) { manga.id in it }
companion object {

View File

@@ -8,7 +8,7 @@ package ca.gosyer.jui.domain.manga.interactor
import ca.gosyer.jui.domain.ServerListeners
import ca.gosyer.jui.domain.manga.model.Manga
import ca.gosyer.jui.domain.manga.service.MangaRepository
import ca.gosyer.jui.domain.manga.service.MangaRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.singleOrNull
@@ -19,7 +19,7 @@ import org.lighthousegames.logging.logging
class RefreshManga
@Inject
constructor(
private val mangaRepository: MangaRepository,
private val mangaRepositoryOld: MangaRepositoryOld,
private val serverListeners: ServerListeners,
) {
suspend fun await(
@@ -44,9 +44,9 @@ class RefreshManga
}
.singleOrNull()
fun asFlow(mangaId: Long) = mangaRepository.getManga(mangaId, true).onEach { serverListeners.updateManga(mangaId) }
fun asFlow(mangaId: Long) = mangaRepositoryOld.getManga(mangaId, true).onEach { serverListeners.updateManga(mangaId) }
fun asFlow(manga: Manga) = mangaRepository.getManga(manga.id, true).onEach { serverListeners.updateManga(manga.id) }
fun asFlow(manga: Manga) = mangaRepositoryOld.getManga(manga.id, true).onEach { serverListeners.updateManga(manga.id) }
companion object {
private val log = logging()

View File

@@ -8,7 +8,7 @@ package ca.gosyer.jui.domain.manga.interactor
import ca.gosyer.jui.domain.ServerListeners
import ca.gosyer.jui.domain.manga.model.Manga
import ca.gosyer.jui.domain.manga.service.MangaRepository
import ca.gosyer.jui.domain.manga.service.MangaRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.singleOrNull
@@ -19,7 +19,7 @@ import org.lighthousegames.logging.logging
class RefreshMangaFull
@Inject
constructor(
private val mangaRepository: MangaRepository,
private val mangaRepositoryOld: MangaRepositoryOld,
private val serverListeners: ServerListeners,
) {
suspend fun await(
@@ -44,9 +44,9 @@ class RefreshMangaFull
}
.singleOrNull()
fun asFlow(mangaId: Long) = mangaRepository.getMangaFull(mangaId, true).onEach { serverListeners.updateManga(mangaId) }
fun asFlow(mangaId: Long) = mangaRepositoryOld.getMangaFull(mangaId, true).onEach { serverListeners.updateManga(mangaId) }
fun asFlow(manga: Manga) = mangaRepository.getMangaFull(manga.id, true).onEach { serverListeners.updateManga(manga.id) }
fun asFlow(manga: Manga) = mangaRepositoryOld.getMangaFull(manga.id, true).onEach { serverListeners.updateManga(manga.id) }
companion object {
private val log = logging()

View File

@@ -8,7 +8,7 @@ package ca.gosyer.jui.domain.manga.interactor
import ca.gosyer.jui.domain.ServerListeners
import ca.gosyer.jui.domain.manga.model.Manga
import ca.gosyer.jui.domain.manga.service.MangaRepository
import ca.gosyer.jui.domain.manga.service.MangaRepositoryOld
import io.ktor.http.decodeURLQueryComponent
import io.ktor.http.encodeURLQueryComponent
import kotlinx.coroutines.flow.catch
@@ -20,7 +20,7 @@ import org.lighthousegames.logging.logging
class UpdateMangaMeta
@Inject
constructor(
private val mangaRepository: MangaRepository,
private val mangaRepositoryOld: MangaRepositoryOld,
private val serverListeners: ServerListeners,
) {
suspend fun await(
@@ -39,7 +39,7 @@ class UpdateMangaMeta
readerMode: String = manga.meta.juiReaderMode.decodeURLQueryComponent(),
) = flow {
if (readerMode.encodeURLQueryComponent() != manga.meta.juiReaderMode) {
mangaRepository.updateMangaMeta(
mangaRepositoryOld.updateMangaMeta(
manga.id,
"juiReaderMode",
readerMode,

View File

@@ -19,7 +19,7 @@ import io.ktor.client.statement.HttpResponse
import io.ktor.utils.io.ByteReadChannel
import kotlinx.coroutines.flow.Flow
interface MangaRepository {
interface MangaRepositoryOld {
@GET("api/v1/manga/{mangaId}/")
fun getManga(
@Path("mangaId") mangaId: Long,

View File

@@ -7,7 +7,7 @@
package ca.gosyer.jui.domain.source.interactor
import ca.gosyer.jui.domain.source.model.Source
import ca.gosyer.jui.domain.source.service.SourceRepository
import ca.gosyer.jui.domain.source.service.SourceRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.singleOrNull
import me.tatarka.inject.annotations.Inject
@@ -16,7 +16,7 @@ import org.lighthousegames.logging.logging
class GetFilterList
@Inject
constructor(
private val sourceRepository: SourceRepository,
private val sourceRepositoryOld: SourceRepositoryOld,
) {
suspend fun await(
source: Source,
@@ -43,12 +43,12 @@ class GetFilterList
fun asFlow(
source: Source,
reset: Boolean,
) = sourceRepository.getFilterList(source.id, reset)
) = sourceRepositoryOld.getFilterList(source.id, reset)
fun asFlow(
sourceId: Long,
reset: Boolean,
) = sourceRepository.getFilterList(sourceId, reset)
) = sourceRepositoryOld.getFilterList(sourceId, reset)
companion object {
private val log = logging()

View File

@@ -7,7 +7,7 @@
package ca.gosyer.jui.domain.source.interactor
import ca.gosyer.jui.domain.source.model.Source
import ca.gosyer.jui.domain.source.service.SourceRepository
import ca.gosyer.jui.domain.source.service.SourceRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.singleOrNull
import me.tatarka.inject.annotations.Inject
@@ -16,7 +16,7 @@ import org.lighthousegames.logging.logging
class GetLatestManga
@Inject
constructor(
private val sourceRepository: SourceRepository,
private val sourceRepositoryOld: SourceRepositoryOld,
) {
suspend fun await(
source: Source,
@@ -43,12 +43,12 @@ class GetLatestManga
fun asFlow(
source: Source,
page: Int,
) = sourceRepository.getLatestManga(source.id, page)
) = sourceRepositoryOld.getLatestManga(source.id, page)
fun asFlow(
sourceId: Long,
page: Int,
) = sourceRepository.getLatestManga(sourceId, page)
) = sourceRepositoryOld.getLatestManga(sourceId, page)
companion object {
private val log = logging()

View File

@@ -7,7 +7,7 @@
package ca.gosyer.jui.domain.source.interactor
import ca.gosyer.jui.domain.source.model.Source
import ca.gosyer.jui.domain.source.service.SourceRepository
import ca.gosyer.jui.domain.source.service.SourceRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.singleOrNull
import me.tatarka.inject.annotations.Inject
@@ -16,7 +16,7 @@ import org.lighthousegames.logging.logging
class GetPopularManga
@Inject
constructor(
private val sourceRepository: SourceRepository,
private val sourceRepositoryOld: SourceRepositoryOld,
) {
suspend fun await(
source: Source,
@@ -43,12 +43,12 @@ class GetPopularManga
fun asFlow(
source: Source,
page: Int,
) = sourceRepository.getPopularManga(source.id, page)
) = sourceRepositoryOld.getPopularManga(source.id, page)
fun asFlow(
sourceId: Long,
page: Int,
) = sourceRepository.getPopularManga(sourceId, page)
) = sourceRepositoryOld.getPopularManga(sourceId, page)
companion object {
private val log = logging()

View File

@@ -9,7 +9,7 @@ package ca.gosyer.jui.domain.source.interactor
import ca.gosyer.jui.domain.source.model.Source
import ca.gosyer.jui.domain.source.model.sourcefilters.SourceFilterChange
import ca.gosyer.jui.domain.source.model.sourcefilters.SourceFilterData
import ca.gosyer.jui.domain.source.service.SourceRepository
import ca.gosyer.jui.domain.source.service.SourceRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.singleOrNull
import me.tatarka.inject.annotations.Inject
@@ -18,7 +18,7 @@ import org.lighthousegames.logging.logging
class GetQuickSearchManga
@Inject
constructor(
private val sourceRepository: SourceRepository,
private val sourceRepositoryOld: SourceRepositoryOld,
) {
suspend fun await(
source: Source,
@@ -51,7 +51,7 @@ class GetQuickSearchManga
searchTerm: String?,
page: Int,
filters: List<SourceFilterChange>?,
) = sourceRepository.getQuickSearchResults(
) = sourceRepositoryOld.getQuickSearchResults(
source.id,
page,
SourceFilterData(
@@ -65,7 +65,7 @@ class GetQuickSearchManga
searchTerm: String?,
page: Int,
filters: List<SourceFilterChange>?,
) = sourceRepository.getQuickSearchResults(
) = sourceRepositoryOld.getQuickSearchResults(
sourceId,
page,
SourceFilterData(

View File

@@ -7,7 +7,7 @@
package ca.gosyer.jui.domain.source.interactor
import ca.gosyer.jui.domain.source.model.Source
import ca.gosyer.jui.domain.source.service.SourceRepository
import ca.gosyer.jui.domain.source.service.SourceRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.singleOrNull
import me.tatarka.inject.annotations.Inject
@@ -16,7 +16,7 @@ import org.lighthousegames.logging.logging
class GetSearchManga
@Inject
constructor(
private val sourceRepository: SourceRepository,
private val sourceRepositoryOld: SourceRepositoryOld,
) {
suspend fun await(
source: Source,
@@ -48,7 +48,7 @@ class GetSearchManga
source: Source,
searchTerm: String?,
page: Int,
) = sourceRepository.getSearchResults(
) = sourceRepositoryOld.getSearchResults(
source.id,
searchTerm?.ifBlank { null },
page,
@@ -58,7 +58,7 @@ class GetSearchManga
sourceId: Long,
searchTerm: String?,
page: Int,
) = sourceRepository.getSearchResults(
) = sourceRepositoryOld.getSearchResults(
sourceId,
searchTerm?.ifBlank { null },
page,

View File

@@ -6,7 +6,7 @@
package ca.gosyer.jui.domain.source.interactor
import ca.gosyer.jui.domain.source.service.SourceRepository
import ca.gosyer.jui.domain.source.service.SourceRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.singleOrNull
import me.tatarka.inject.annotations.Inject
@@ -15,7 +15,7 @@ import org.lighthousegames.logging.logging
class GetSourceList
@Inject
constructor(
private val sourceRepository: SourceRepository,
private val sourceRepositoryOld: SourceRepositoryOld,
) {
suspend fun await(onError: suspend (Throwable) -> Unit = {}) =
asFlow()
@@ -25,7 +25,7 @@ class GetSourceList
}
.singleOrNull()
fun asFlow() = sourceRepository.getSourceList()
fun asFlow() = sourceRepositoryOld.getSourceList()
companion object {
private val log = logging()

View File

@@ -7,7 +7,7 @@
package ca.gosyer.jui.domain.source.interactor
import ca.gosyer.jui.domain.source.model.Source
import ca.gosyer.jui.domain.source.service.SourceRepository
import ca.gosyer.jui.domain.source.service.SourceRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.singleOrNull
import me.tatarka.inject.annotations.Inject
@@ -16,7 +16,7 @@ import org.lighthousegames.logging.logging
class GetSourceSettings
@Inject
constructor(
private val sourceRepository: SourceRepository,
private val sourceRepositoryOld: SourceRepositoryOld,
) {
suspend fun await(
source: Source,
@@ -38,9 +38,9 @@ class GetSourceSettings
}
.singleOrNull()
fun asFlow(source: Source) = sourceRepository.getSourceSettings(source.id)
fun asFlow(source: Source) = sourceRepositoryOld.getSourceSettings(source.id)
fun asFlow(sourceId: Long) = sourceRepository.getSourceSettings(sourceId)
fun asFlow(sourceId: Long) = sourceRepositoryOld.getSourceSettings(sourceId)
companion object {
private val log = logging()

View File

@@ -8,7 +8,7 @@ package ca.gosyer.jui.domain.source.interactor
import ca.gosyer.jui.domain.source.model.Source
import ca.gosyer.jui.domain.source.model.sourcefilters.SourceFilterChange
import ca.gosyer.jui.domain.source.service.SourceRepository
import ca.gosyer.jui.domain.source.service.SourceRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
import kotlinx.serialization.encodeToString
@@ -19,7 +19,7 @@ import org.lighthousegames.logging.logging
class SetSourceFilter
@Inject
constructor(
private val sourceRepository: SourceRepository,
private val sourceRepositoryOld: SourceRepositoryOld,
) {
suspend fun await(
source: Source,
@@ -85,7 +85,7 @@ class SetSourceFilter
source: Source,
filterIndex: Int,
filter: Any,
) = sourceRepository.setFilter(
) = sourceRepositoryOld.setFilter(
source.id,
SourceFilterChange(filterIndex, filter),
)
@@ -94,7 +94,7 @@ class SetSourceFilter
sourceId: Long,
filterIndex: Int,
filter: Any,
) = sourceRepository.setFilter(
) = sourceRepositoryOld.setFilter(
sourceId,
SourceFilterChange(filterIndex, filter),
)
@@ -104,7 +104,7 @@ class SetSourceFilter
filterIndex: Int,
childFilterIndex: Int,
filter: Any,
) = sourceRepository.setFilter(
) = sourceRepositoryOld.setFilter(
source.id,
SourceFilterChange(filterIndex, Json.encodeToString(SourceFilterChange(childFilterIndex, filter))),
)
@@ -114,7 +114,7 @@ class SetSourceFilter
filterIndex: Int,
childFilterIndex: Int,
filter: Any,
) = sourceRepository.setFilter(
) = sourceRepositoryOld.setFilter(
sourceId,
SourceFilterChange(filterIndex, Json.encodeToString(SourceFilterChange(childFilterIndex, filter))),
)

View File

@@ -8,7 +8,7 @@ package ca.gosyer.jui.domain.source.interactor
import ca.gosyer.jui.domain.source.model.Source
import ca.gosyer.jui.domain.source.model.sourcepreference.SourcePreferenceChange
import ca.gosyer.jui.domain.source.service.SourceRepository
import ca.gosyer.jui.domain.source.service.SourceRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
import me.tatarka.inject.annotations.Inject
@@ -17,7 +17,7 @@ import org.lighthousegames.logging.logging
class SetSourceSetting
@Inject
constructor(
private val sourceRepository: SourceRepository,
private val sourceRepositoryOld: SourceRepositoryOld,
) {
suspend fun await(
source: Source,
@@ -49,7 +49,7 @@ class SetSourceSetting
source: Source,
settingIndex: Int,
setting: Any,
) = sourceRepository.setSourceSetting(
) = sourceRepositoryOld.setSourceSetting(
source.id,
SourcePreferenceChange(settingIndex, setting),
)
@@ -58,7 +58,7 @@ class SetSourceSetting
sourceId: Long,
settingIndex: Int,
setting: Any,
) = sourceRepository.setSourceSetting(
) = sourceRepositoryOld.setSourceSetting(
sourceId,
SourcePreferenceChange(settingIndex, setting),
)

View File

@@ -22,7 +22,7 @@ import de.jensklingenberg.ktorfit.http.Query
import io.ktor.client.statement.HttpResponse
import kotlinx.coroutines.flow.Flow
interface SourceRepository {
interface SourceRepositoryOld {
@GET("api/v1/source/list")
fun getSourceList(): Flow<List<Source>>

View File

@@ -6,7 +6,7 @@
package ca.gosyer.jui.domain.updates.interactor
import ca.gosyer.jui.domain.updates.service.UpdatesRepository
import ca.gosyer.jui.domain.updates.service.UpdatesRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.singleOrNull
import me.tatarka.inject.annotations.Inject
@@ -15,7 +15,7 @@ import org.lighthousegames.logging.logging
class GetRecentUpdates
@Inject
constructor(
private val updatesRepository: UpdatesRepository,
private val updatesRepositoryOld: UpdatesRepositoryOld,
) {
suspend fun await(
pageNum: Int,
@@ -27,7 +27,7 @@ class GetRecentUpdates
}
.singleOrNull()
fun asFlow(pageNum: Int) = updatesRepository.getRecentUpdates(pageNum)
fun asFlow(pageNum: Int) = updatesRepositoryOld.getRecentUpdates(pageNum)
companion object {
private val log = logging()

View File

@@ -7,7 +7,7 @@
package ca.gosyer.jui.domain.updates.interactor
import ca.gosyer.jui.domain.category.model.Category
import ca.gosyer.jui.domain.updates.service.UpdatesRepository
import ca.gosyer.jui.domain.updates.service.UpdatesRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
import me.tatarka.inject.annotations.Inject
@@ -16,7 +16,7 @@ import org.lighthousegames.logging.logging
class UpdateCategory
@Inject
constructor(
private val updatesRepository: UpdatesRepository,
private val updatesRepositoryOld: UpdatesRepositoryOld,
) {
suspend fun await(
categoryId: Long,
@@ -38,9 +38,9 @@ class UpdateCategory
}
.collect()
fun asFlow(categoryId: Long) = updatesRepository.updateCategory(categoryId)
fun asFlow(categoryId: Long) = updatesRepositoryOld.updateCategory(categoryId)
fun asFlow(category: Category) = updatesRepository.updateCategory(category.id)
fun asFlow(category: Category) = updatesRepositoryOld.updateCategory(category.id)
companion object {
private val log = logging()

View File

@@ -6,7 +6,7 @@
package ca.gosyer.jui.domain.updates.interactor
import ca.gosyer.jui.domain.updates.service.UpdatesRepository
import ca.gosyer.jui.domain.updates.service.UpdatesRepositoryOld
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
import me.tatarka.inject.annotations.Inject
@@ -15,7 +15,7 @@ import org.lighthousegames.logging.logging
class UpdateLibrary
@Inject
constructor(
private val updatesRepository: UpdatesRepository,
private val updatesRepositoryOld: UpdatesRepositoryOld,
) {
suspend fun await(onError: suspend (Throwable) -> Unit = {}) =
asFlow()
@@ -25,7 +25,7 @@ class UpdateLibrary
}
.collect()
fun asFlow() = updatesRepository.updateLibrary()
fun asFlow() = updatesRepositoryOld.updateLibrary()
companion object {
private val log = logging()

View File

@@ -15,7 +15,7 @@ import de.jensklingenberg.ktorfit.http.Path
import io.ktor.client.statement.HttpResponse
import kotlinx.coroutines.flow.Flow
interface UpdatesRepository {
interface UpdatesRepositoryOld {
@GET("api/v1/update/recentChapters/{pageNum}/")
fun getRecentUpdates(
@Path("pageNum") pageNum: Int,