mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-21 20:27:06 +03:00
Fix more TypeReference issues and cleanup
Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com>
This commit is contained in:
parent
233af962cd
commit
1ea107226c
19 changed files with 74 additions and 92 deletions
|
@ -57,6 +57,7 @@ import mihon.domain.extensionrepo.manga.interactor.GetMangaExtensionRepoCount
|
|||
import mihon.domain.extensionrepo.manga.interactor.ReplaceMangaExtensionRepo
|
||||
import mihon.domain.extensionrepo.manga.interactor.UpdateMangaExtensionRepo
|
||||
import mihon.domain.extensionrepo.manga.repository.MangaExtensionRepoRepository
|
||||
import mihon.domain.extensionrepo.service.ExtensionRepoService
|
||||
import tachiyomi.data.category.anime.AnimeCategoryRepositoryImpl
|
||||
import tachiyomi.data.category.manga.MangaCategoryRepositoryImpl
|
||||
import tachiyomi.data.entries.anime.AnimeRepositoryImpl
|
||||
|
@ -343,6 +344,8 @@ class DomainModule : InjektModule {
|
|||
addFactory { TrustAnimeExtension(get()) }
|
||||
addFactory { TrustMangaExtension(get()) }
|
||||
|
||||
addFactory { ExtensionRepoService(get(), get()) }
|
||||
|
||||
addSingletonFactory<AnimeExtensionRepoRepository> { AnimeExtensionRepoRepositoryImpl(get()) }
|
||||
addFactory { GetAnimeExtensionRepo(get()) }
|
||||
addFactory { GetAnimeExtensionRepoCount(get()) }
|
||||
|
|
|
@ -618,7 +618,7 @@ object Migrations {
|
|||
coroutineScope.launchIO {
|
||||
for ((index, source) in sourcePreferences.animeExtensionRepos().get().withIndex()) {
|
||||
try {
|
||||
animeExtensionRepoRepository.upsertRepository(
|
||||
animeExtensionRepoRepository.upsertRepo(
|
||||
source,
|
||||
"Repo #${index + 1}",
|
||||
null,
|
||||
|
@ -635,7 +635,7 @@ object Migrations {
|
|||
|
||||
for ((index, source) in sourcePreferences.mangaExtensionRepos().get().withIndex()) {
|
||||
try {
|
||||
mangaExtensionRepoRepository.upsertRepository(
|
||||
mangaExtensionRepoRepository.upsertRepo(
|
||||
source,
|
||||
"Repo #${index + 1}",
|
||||
null,
|
||||
|
|
|
@ -19,11 +19,11 @@ class AnimeExtensionRepoRepositoryImpl(
|
|||
return handler.awaitList { extension_reposQueries.findAll(::mapExtensionRepo) }
|
||||
}
|
||||
|
||||
override suspend fun getRepository(baseUrl: String): ExtensionRepo? {
|
||||
override suspend fun getRepo(baseUrl: String): ExtensionRepo? {
|
||||
return handler.awaitOneOrNull { extension_reposQueries.findOne(baseUrl, ::mapExtensionRepo) }
|
||||
}
|
||||
|
||||
override suspend fun getRepositoryBySigningKeyFingerprint(fingerprint: String): ExtensionRepo? {
|
||||
override suspend fun getRepoBySigningKeyFingerprint(fingerprint: String): ExtensionRepo? {
|
||||
return handler.awaitOneOrNull {
|
||||
extension_reposQueries.findOneBySigningKeyFingerprint(fingerprint, ::mapExtensionRepo)
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ class AnimeExtensionRepoRepositoryImpl(
|
|||
return handler.subscribeToOne { extension_reposQueries.count() }.map { it.toInt() }
|
||||
}
|
||||
|
||||
override suspend fun insertRepository(
|
||||
override suspend fun insertRepo(
|
||||
baseUrl: String,
|
||||
name: String,
|
||||
shortName: String?,
|
||||
|
@ -47,7 +47,7 @@ class AnimeExtensionRepoRepositoryImpl(
|
|||
}
|
||||
}
|
||||
|
||||
override suspend fun upsertRepository(
|
||||
override suspend fun upsertRepo(
|
||||
baseUrl: String,
|
||||
name: String,
|
||||
shortName: String?,
|
||||
|
@ -61,7 +61,7 @@ class AnimeExtensionRepoRepositoryImpl(
|
|||
}
|
||||
}
|
||||
|
||||
override suspend fun replaceRepository(newRepo: ExtensionRepo) {
|
||||
override suspend fun replaceRepo(newRepo: ExtensionRepo) {
|
||||
handler.await {
|
||||
extension_reposQueries.replace(
|
||||
newRepo.baseUrl,
|
||||
|
@ -73,7 +73,7 @@ class AnimeExtensionRepoRepositoryImpl(
|
|||
}
|
||||
}
|
||||
|
||||
override suspend fun deleteRepository(baseUrl: String) {
|
||||
override suspend fun deleteRepo(baseUrl: String) {
|
||||
return handler.await { extension_reposQueries.delete(baseUrl) }
|
||||
}
|
||||
|
||||
|
|
|
@ -19,11 +19,11 @@ class MangaExtensionRepoRepositoryImpl(
|
|||
return handler.awaitList { extension_reposQueries.findAll(::mapExtensionRepo) }
|
||||
}
|
||||
|
||||
override suspend fun getRepository(baseUrl: String): ExtensionRepo? {
|
||||
override suspend fun getRepo(baseUrl: String): ExtensionRepo? {
|
||||
return handler.awaitOneOrNull { extension_reposQueries.findOne(baseUrl, ::mapExtensionRepo) }
|
||||
}
|
||||
|
||||
override suspend fun getRepositoryBySigningKeyFingerprint(fingerprint: String): ExtensionRepo? {
|
||||
override suspend fun getRepoBySigningKeyFingerprint(fingerprint: String): ExtensionRepo? {
|
||||
return handler.awaitOneOrNull {
|
||||
extension_reposQueries.findOneBySigningKeyFingerprint(fingerprint, ::mapExtensionRepo)
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ class MangaExtensionRepoRepositoryImpl(
|
|||
return handler.subscribeToOne { extension_reposQueries.count() }.map { it.toInt() }
|
||||
}
|
||||
|
||||
override suspend fun insertRepository(
|
||||
override suspend fun insertRepo(
|
||||
baseUrl: String,
|
||||
name: String,
|
||||
shortName: String?,
|
||||
|
@ -47,7 +47,7 @@ class MangaExtensionRepoRepositoryImpl(
|
|||
}
|
||||
}
|
||||
|
||||
override suspend fun upsertRepository(
|
||||
override suspend fun upsertRepo(
|
||||
baseUrl: String,
|
||||
name: String,
|
||||
shortName: String?,
|
||||
|
@ -61,7 +61,7 @@ class MangaExtensionRepoRepositoryImpl(
|
|||
}
|
||||
}
|
||||
|
||||
override suspend fun replaceRepository(newRepo: ExtensionRepo) {
|
||||
override suspend fun replaceRepo(newRepo: ExtensionRepo) {
|
||||
handler.await {
|
||||
extension_reposQueries.replace(
|
||||
newRepo.baseUrl,
|
||||
|
@ -73,7 +73,7 @@ class MangaExtensionRepoRepositoryImpl(
|
|||
}
|
||||
}
|
||||
|
||||
override suspend fun deleteRepository(baseUrl: String) {
|
||||
override suspend fun deleteRepo(baseUrl: String) {
|
||||
return handler.await { extension_reposQueries.delete(baseUrl) }
|
||||
}
|
||||
|
||||
|
|
|
@ -1,37 +1,30 @@
|
|||
package mihon.domain.extensionrepo.anime.interactor
|
||||
|
||||
import eu.kanade.tachiyomi.network.NetworkHelper
|
||||
import logcat.LogPriority
|
||||
import mihon.domain.extensionrepo.anime.repository.AnimeExtensionRepoRepository
|
||||
import mihon.domain.extensionrepo.exception.SaveExtensionRepoException
|
||||
import mihon.domain.extensionrepo.model.ExtensionRepo
|
||||
import mihon.domain.extensionrepo.service.ExtensionRepoService
|
||||
import okhttp3.OkHttpClient
|
||||
import tachiyomi.core.common.util.system.logcat
|
||||
|
||||
class CreateAnimeExtensionRepo(
|
||||
private val extensionRepoRepository: AnimeExtensionRepoRepository,
|
||||
private val networkHelper: NetworkHelper,
|
||||
private val repository: AnimeExtensionRepoRepository,
|
||||
private val service: ExtensionRepoService,
|
||||
) {
|
||||
private val repoRegex = """^https://.*/index\.min\.json$""".toRegex()
|
||||
|
||||
private val client: OkHttpClient
|
||||
get() = networkHelper.client
|
||||
|
||||
private val extensionRepoService = ExtensionRepoService(client)
|
||||
|
||||
suspend fun await(repoUrl: String): Result {
|
||||
if (!repoUrl.matches(repoRegex)) {
|
||||
return Result.InvalidUrl
|
||||
}
|
||||
|
||||
val baseUrl = repoUrl.removeSuffix("/index.min.json")
|
||||
return extensionRepoService.fetchRepoDetails(baseUrl)?.let { insert(it) } ?: Result.InvalidUrl
|
||||
return service.fetchRepoDetails(baseUrl)?.let { insert(it) } ?: Result.InvalidUrl
|
||||
}
|
||||
|
||||
private suspend fun insert(repo: ExtensionRepo): Result {
|
||||
return try {
|
||||
extensionRepoRepository.insertRepository(
|
||||
repository.insertRepo(
|
||||
repo.baseUrl,
|
||||
repo.name,
|
||||
repo.shortName,
|
||||
|
@ -57,12 +50,11 @@ class CreateAnimeExtensionRepo(
|
|||
*/
|
||||
@Suppress("ReturnCount")
|
||||
private suspend fun handleInsertionError(repo: ExtensionRepo): Result {
|
||||
val repoExists = extensionRepoRepository.getRepository(repo.baseUrl)
|
||||
val repoExists = repository.getRepo(repo.baseUrl)
|
||||
if (repoExists != null) {
|
||||
return Result.RepoAlreadyExists
|
||||
}
|
||||
val matchingFingerprintRepo =
|
||||
extensionRepoRepository.getRepositoryBySigningKeyFingerprint(repo.signingKeyFingerprint)
|
||||
val matchingFingerprintRepo = repository.getRepoBySigningKeyFingerprint(repo.signingKeyFingerprint)
|
||||
if (matchingFingerprintRepo != null) {
|
||||
return Result.DuplicateFingerprint(matchingFingerprintRepo, repo)
|
||||
}
|
||||
|
|
|
@ -3,9 +3,9 @@ package mihon.domain.extensionrepo.anime.interactor
|
|||
import mihon.domain.extensionrepo.anime.repository.AnimeExtensionRepoRepository
|
||||
|
||||
class DeleteAnimeExtensionRepo(
|
||||
private val extensionRepoRepository: AnimeExtensionRepoRepository,
|
||||
private val repository: AnimeExtensionRepoRepository,
|
||||
) {
|
||||
suspend fun await(baseUrl: String) {
|
||||
extensionRepoRepository.deleteRepository(baseUrl)
|
||||
repository.deleteRepo(baseUrl)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,9 +5,9 @@ import mihon.domain.extensionrepo.anime.repository.AnimeExtensionRepoRepository
|
|||
import mihon.domain.extensionrepo.model.ExtensionRepo
|
||||
|
||||
class GetAnimeExtensionRepo(
|
||||
private val extensionRepoRepository: AnimeExtensionRepoRepository,
|
||||
private val repository: AnimeExtensionRepoRepository,
|
||||
) {
|
||||
fun subscribeAll(): Flow<List<ExtensionRepo>> = extensionRepoRepository.subscribeAll()
|
||||
fun subscribeAll(): Flow<List<ExtensionRepo>> = repository.subscribeAll()
|
||||
|
||||
suspend fun getAll(): List<ExtensionRepo> = extensionRepoRepository.getAll()
|
||||
suspend fun getAll(): List<ExtensionRepo> = repository.getAll()
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package mihon.domain.extensionrepo.anime.interactor
|
|||
import mihon.domain.extensionrepo.anime.repository.AnimeExtensionRepoRepository
|
||||
|
||||
class GetAnimeExtensionRepoCount(
|
||||
private val extensionRepoRepository: AnimeExtensionRepoRepository,
|
||||
private val repository: AnimeExtensionRepoRepository,
|
||||
) {
|
||||
fun subscribe() = extensionRepoRepository.getCount()
|
||||
fun subscribe() = repository.getCount()
|
||||
}
|
||||
|
|
|
@ -4,9 +4,9 @@ import mihon.domain.extensionrepo.anime.repository.AnimeExtensionRepoRepository
|
|||
import mihon.domain.extensionrepo.model.ExtensionRepo
|
||||
|
||||
class ReplaceAnimeExtensionRepo(
|
||||
private val extensionRepoRepository: AnimeExtensionRepoRepository,
|
||||
private val repository: AnimeExtensionRepoRepository,
|
||||
) {
|
||||
suspend fun await(repo: ExtensionRepo) {
|
||||
extensionRepoRepository.replaceRepository(repo)
|
||||
repository.replaceRepo(repo)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package mihon.domain.extensionrepo.anime.interactor
|
||||
|
||||
import eu.kanade.tachiyomi.network.NetworkHelper
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.awaitAll
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
|
@ -9,25 +8,23 @@ import mihon.domain.extensionrepo.model.ExtensionRepo
|
|||
import mihon.domain.extensionrepo.service.ExtensionRepoService
|
||||
|
||||
class UpdateAnimeExtensionRepo(
|
||||
private val extensionRepoRepository: AnimeExtensionRepoRepository,
|
||||
networkService: NetworkHelper,
|
||||
private val repository: AnimeExtensionRepoRepository,
|
||||
private val service: ExtensionRepoService,
|
||||
) {
|
||||
|
||||
private val extensionRepoService = ExtensionRepoService(networkService.client)
|
||||
|
||||
suspend fun awaitAll() = coroutineScope {
|
||||
extensionRepoRepository.getAll()
|
||||
repository.getAll()
|
||||
.map { async { await(it) } }
|
||||
.awaitAll()
|
||||
}
|
||||
|
||||
suspend fun await(repo: ExtensionRepo) {
|
||||
val newRepo = extensionRepoService.fetchRepoDetails(repo.baseUrl) ?: return
|
||||
val newRepo = service.fetchRepoDetails(repo.baseUrl) ?: return
|
||||
if (
|
||||
repo.signingKeyFingerprint.startsWith("NOFINGERPRINT") ||
|
||||
repo.signingKeyFingerprint == newRepo.signingKeyFingerprint
|
||||
) {
|
||||
extensionRepoRepository.upsertRepository(newRepo)
|
||||
repository.upsertRepo(newRepo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,13 +9,13 @@ interface AnimeExtensionRepoRepository {
|
|||
|
||||
suspend fun getAll(): List<ExtensionRepo>
|
||||
|
||||
suspend fun getRepository(baseUrl: String): ExtensionRepo?
|
||||
suspend fun getRepo(baseUrl: String): ExtensionRepo?
|
||||
|
||||
suspend fun getRepositoryBySigningKeyFingerprint(fingerprint: String): ExtensionRepo?
|
||||
suspend fun getRepoBySigningKeyFingerprint(fingerprint: String): ExtensionRepo?
|
||||
|
||||
fun getCount(): Flow<Int>
|
||||
|
||||
suspend fun insertRepository(
|
||||
suspend fun insertRepo(
|
||||
baseUrl: String,
|
||||
name: String,
|
||||
shortName: String?,
|
||||
|
@ -23,7 +23,7 @@ interface AnimeExtensionRepoRepository {
|
|||
signingKeyFingerprint: String,
|
||||
)
|
||||
|
||||
suspend fun upsertRepository(
|
||||
suspend fun upsertRepo(
|
||||
baseUrl: String,
|
||||
name: String,
|
||||
shortName: String?,
|
||||
|
@ -31,8 +31,8 @@ interface AnimeExtensionRepoRepository {
|
|||
signingKeyFingerprint: String,
|
||||
)
|
||||
|
||||
suspend fun upsertRepository(repo: ExtensionRepo) {
|
||||
upsertRepository(
|
||||
suspend fun upsertRepo(repo: ExtensionRepo) {
|
||||
upsertRepo(
|
||||
baseUrl = repo.baseUrl,
|
||||
name = repo.name,
|
||||
shortName = repo.shortName,
|
||||
|
@ -41,7 +41,7 @@ interface AnimeExtensionRepoRepository {
|
|||
)
|
||||
}
|
||||
|
||||
suspend fun replaceRepository(newRepo: ExtensionRepo)
|
||||
suspend fun replaceRepo(newRepo: ExtensionRepo)
|
||||
|
||||
suspend fun deleteRepository(baseUrl: String)
|
||||
suspend fun deleteRepo(baseUrl: String)
|
||||
}
|
||||
|
|
|
@ -10,28 +10,23 @@ import okhttp3.OkHttpClient
|
|||
import tachiyomi.core.common.util.system.logcat
|
||||
|
||||
class CreateMangaExtensionRepo(
|
||||
private val extensionRepoRepository: MangaExtensionRepoRepository,
|
||||
private val networkHelper: NetworkHelper,
|
||||
private val repository: MangaExtensionRepoRepository,
|
||||
private val service: ExtensionRepoService,
|
||||
) {
|
||||
private val repoRegex = """^https://.*/index\.min\.json$""".toRegex()
|
||||
|
||||
private val client: OkHttpClient
|
||||
get() = networkHelper.client
|
||||
|
||||
private val extensionRepoService = ExtensionRepoService(client)
|
||||
|
||||
suspend fun await(repoUrl: String): Result {
|
||||
if (!repoUrl.matches(repoRegex)) {
|
||||
return Result.InvalidUrl
|
||||
}
|
||||
|
||||
val baseUrl = repoUrl.removeSuffix("/index.min.json")
|
||||
return extensionRepoService.fetchRepoDetails(baseUrl)?.let { insert(it) } ?: Result.InvalidUrl
|
||||
return service.fetchRepoDetails(baseUrl)?.let { insert(it) } ?: Result.InvalidUrl
|
||||
}
|
||||
|
||||
private suspend fun insert(repo: ExtensionRepo): Result {
|
||||
return try {
|
||||
extensionRepoRepository.insertRepository(
|
||||
repository.insertRepo(
|
||||
repo.baseUrl,
|
||||
repo.name,
|
||||
repo.shortName,
|
||||
|
@ -57,12 +52,11 @@ class CreateMangaExtensionRepo(
|
|||
*/
|
||||
@Suppress("ReturnCount")
|
||||
private suspend fun handleInsertionError(repo: ExtensionRepo): Result {
|
||||
val repoExists = extensionRepoRepository.getRepository(repo.baseUrl)
|
||||
val repoExists = repository.getRepo(repo.baseUrl)
|
||||
if (repoExists != null) {
|
||||
return Result.RepoAlreadyExists
|
||||
}
|
||||
val matchingFingerprintRepo =
|
||||
extensionRepoRepository.getRepositoryBySigningKeyFingerprint(repo.signingKeyFingerprint)
|
||||
val matchingFingerprintRepo = repository.getRepoBySigningKeyFingerprint(repo.signingKeyFingerprint)
|
||||
if (matchingFingerprintRepo != null) {
|
||||
return Result.DuplicateFingerprint(matchingFingerprintRepo, repo)
|
||||
}
|
||||
|
|
|
@ -3,9 +3,9 @@ package mihon.domain.extensionrepo.manga.interactor
|
|||
import mihon.domain.extensionrepo.manga.repository.MangaExtensionRepoRepository
|
||||
|
||||
class DeleteMangaExtensionRepo(
|
||||
private val extensionRepoRepository: MangaExtensionRepoRepository,
|
||||
private val repository: MangaExtensionRepoRepository,
|
||||
) {
|
||||
suspend fun await(baseUrl: String) {
|
||||
extensionRepoRepository.deleteRepository(baseUrl)
|
||||
repository.deleteRepo(baseUrl)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,9 +5,9 @@ import mihon.domain.extensionrepo.manga.repository.MangaExtensionRepoRepository
|
|||
import mihon.domain.extensionrepo.model.ExtensionRepo
|
||||
|
||||
class GetMangaExtensionRepo(
|
||||
private val extensionRepoRepository: MangaExtensionRepoRepository,
|
||||
private val repository: MangaExtensionRepoRepository,
|
||||
) {
|
||||
fun subscribeAll(): Flow<List<ExtensionRepo>> = extensionRepoRepository.subscribeAll()
|
||||
fun subscribeAll(): Flow<List<ExtensionRepo>> = repository.subscribeAll()
|
||||
|
||||
suspend fun getAll(): List<ExtensionRepo> = extensionRepoRepository.getAll()
|
||||
suspend fun getAll(): List<ExtensionRepo> = repository.getAll()
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package mihon.domain.extensionrepo.manga.interactor
|
|||
import mihon.domain.extensionrepo.manga.repository.MangaExtensionRepoRepository
|
||||
|
||||
class GetMangaExtensionRepoCount(
|
||||
private val extensionRepoRepository: MangaExtensionRepoRepository,
|
||||
private val repository: MangaExtensionRepoRepository,
|
||||
) {
|
||||
fun subscribe() = extensionRepoRepository.getCount()
|
||||
fun subscribe() = repository.getCount()
|
||||
}
|
||||
|
|
|
@ -4,9 +4,9 @@ import mihon.domain.extensionrepo.manga.repository.MangaExtensionRepoRepository
|
|||
import mihon.domain.extensionrepo.model.ExtensionRepo
|
||||
|
||||
class ReplaceMangaExtensionRepo(
|
||||
private val extensionRepoRepository: MangaExtensionRepoRepository,
|
||||
private val repository: MangaExtensionRepoRepository,
|
||||
) {
|
||||
suspend fun await(repo: ExtensionRepo) {
|
||||
extensionRepoRepository.replaceRepository(repo)
|
||||
repository.replaceRepo(repo)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package mihon.domain.extensionrepo.manga.interactor
|
||||
|
||||
import eu.kanade.tachiyomi.network.NetworkHelper
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.awaitAll
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
|
@ -9,25 +8,23 @@ import mihon.domain.extensionrepo.model.ExtensionRepo
|
|||
import mihon.domain.extensionrepo.service.ExtensionRepoService
|
||||
|
||||
class UpdateMangaExtensionRepo(
|
||||
private val extensionRepoRepository: MangaExtensionRepoRepository,
|
||||
networkService: NetworkHelper,
|
||||
private val repository: MangaExtensionRepoRepository,
|
||||
private val service: ExtensionRepoService,
|
||||
) {
|
||||
|
||||
private val extensionRepoService = ExtensionRepoService(networkService.client)
|
||||
|
||||
suspend fun awaitAll() = coroutineScope {
|
||||
extensionRepoRepository.getAll()
|
||||
repository.getAll()
|
||||
.map { async { await(it) } }
|
||||
.awaitAll()
|
||||
}
|
||||
|
||||
suspend fun await(repo: ExtensionRepo) {
|
||||
val newRepo = extensionRepoService.fetchRepoDetails(repo.baseUrl) ?: return
|
||||
val newRepo = service.fetchRepoDetails(repo.baseUrl) ?: return
|
||||
if (
|
||||
repo.signingKeyFingerprint.startsWith("NOFINGERPRINT") ||
|
||||
repo.signingKeyFingerprint == newRepo.signingKeyFingerprint
|
||||
) {
|
||||
extensionRepoRepository.upsertRepository(newRepo)
|
||||
repository.upsertRepo(newRepo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,13 +9,13 @@ interface MangaExtensionRepoRepository {
|
|||
|
||||
suspend fun getAll(): List<ExtensionRepo>
|
||||
|
||||
suspend fun getRepository(baseUrl: String): ExtensionRepo?
|
||||
suspend fun getRepo(baseUrl: String): ExtensionRepo?
|
||||
|
||||
suspend fun getRepositoryBySigningKeyFingerprint(fingerprint: String): ExtensionRepo?
|
||||
suspend fun getRepoBySigningKeyFingerprint(fingerprint: String): ExtensionRepo?
|
||||
|
||||
fun getCount(): Flow<Int>
|
||||
|
||||
suspend fun insertRepository(
|
||||
suspend fun insertRepo(
|
||||
baseUrl: String,
|
||||
name: String,
|
||||
shortName: String?,
|
||||
|
@ -23,7 +23,7 @@ interface MangaExtensionRepoRepository {
|
|||
signingKeyFingerprint: String,
|
||||
)
|
||||
|
||||
suspend fun upsertRepository(
|
||||
suspend fun upsertRepo(
|
||||
baseUrl: String,
|
||||
name: String,
|
||||
shortName: String?,
|
||||
|
@ -31,8 +31,8 @@ interface MangaExtensionRepoRepository {
|
|||
signingKeyFingerprint: String,
|
||||
)
|
||||
|
||||
suspend fun upsertRepository(repo: ExtensionRepo) {
|
||||
upsertRepository(
|
||||
suspend fun upsertRepo(repo: ExtensionRepo) {
|
||||
upsertRepo(
|
||||
baseUrl = repo.baseUrl,
|
||||
name = repo.name,
|
||||
shortName = repo.shortName,
|
||||
|
@ -41,7 +41,7 @@ interface MangaExtensionRepoRepository {
|
|||
)
|
||||
}
|
||||
|
||||
suspend fun replaceRepository(newRepo: ExtensionRepo)
|
||||
suspend fun replaceRepo(newRepo: ExtensionRepo)
|
||||
|
||||
suspend fun deleteRepository(baseUrl: String)
|
||||
suspend fun deleteRepo(baseUrl: String)
|
||||
}
|
||||
|
|
|
@ -14,10 +14,9 @@ import uy.kohesive.injekt.injectLazy
|
|||
|
||||
class ExtensionRepoService(
|
||||
private val client: OkHttpClient,
|
||||
private val json: Json,
|
||||
) {
|
||||
|
||||
private val json: Json by injectLazy()
|
||||
|
||||
@Suppress("TooGenericExceptionCaught")
|
||||
suspend fun fetchRepoDetails(
|
||||
repo: String,
|
||||
|
|
Loading…
Reference in a new issue