Update dependencies

This commit is contained in:
Koitharu
2023-10-25 15:24:05 +03:00
parent 4bd7656681
commit 590120433c
24 changed files with 179 additions and 177 deletions

View File

@@ -106,7 +106,7 @@ class AniListRepository @Inject constructor(
}
override suspend fun unregister(mangaId: Long) {
return db.scrobblingDao.delete(ScrobblerService.ANILIST.id, mangaId)
return db.getScrobblingDao().delete(ScrobblerService.ANILIST.id, mangaId)
}
override fun logout() {
@@ -223,7 +223,7 @@ class AniListRepository @Inject constructor(
comment = json.getString("notes"),
rating = scoreFormat.normalize(json.getDouble("score").toFloat()),
)
db.scrobblingDao.upsert(entity)
db.getScrobblingDao().upsert(entity)
}
private fun ScrobblerManga(json: JSONObject): ScrobblerManga {

View File

@@ -29,7 +29,7 @@ class AniListScrobbler @Inject constructor(
status: ScrobblingStatus?,
comment: String?,
) {
val entity = db.scrobblingDao.find(scrobblerService.id, mangaId)
val entity = db.getScrobblingDao().find(scrobblerService.id, mangaId)
requireNotNull(entity) { "Scrobbling info for manga $mangaId not found" }
repository.updateRate(
rateId = entity.id,

View File

@@ -67,24 +67,24 @@ abstract class Scrobbler(
}
suspend fun scrobble(mangaId: Long, chapter: MangaChapter) {
val entity = db.scrobblingDao.find(scrobblerService.id, mangaId) ?: return
val entity = db.getScrobblingDao().find(scrobblerService.id, mangaId) ?: return
repository.updateRate(entity.id, entity.mangaId, chapter)
}
suspend fun getScrobblingInfoOrNull(mangaId: Long): ScrobblingInfo? {
val entity = db.scrobblingDao.find(scrobblerService.id, mangaId) ?: return null
val entity = db.getScrobblingDao().find(scrobblerService.id, mangaId) ?: return null
return entity.toScrobblingInfo()
}
abstract suspend fun updateScrobblingInfo(mangaId: Long, rating: Float, status: ScrobblingStatus?, comment: String?)
fun observeScrobblingInfo(mangaId: Long): Flow<ScrobblingInfo?> {
return db.scrobblingDao.observe(scrobblerService.id, mangaId)
return db.getScrobblingDao().observe(scrobblerService.id, mangaId)
.map { it?.toScrobblingInfo() }
}
fun observeAllScrobblingInfo(): Flow<List<ScrobblingInfo>> {
return db.scrobblingDao.observe(scrobblerService.id)
return db.getScrobblingDao().observe(scrobblerService.id)
.map { entities ->
coroutineScope {
entities.map {

View File

@@ -85,7 +85,7 @@ class MALRepository @Inject constructor(
}
override suspend fun unregister(mangaId: Long) {
return db.scrobblingDao.delete(ScrobblerService.MAL.id, mangaId)
return db.getScrobblingDao().delete(ScrobblerService.MAL.id, mangaId)
}
override suspend fun findManga(query: String, offset: Int): List<ScrobblerManga> {
@@ -176,7 +176,7 @@ class MALRepository @Inject constructor(
comment = json.getString("comments"),
rating = (json.getDouble("score").toFloat() / 10f).coerceIn(0f, 1f),
)
db.scrobblingDao.upsert(entity)
db.getScrobblingDao().upsert(entity)
}
override fun logout() {

View File

@@ -30,7 +30,7 @@ class MALScrobbler @Inject constructor(
status: ScrobblingStatus?,
comment: String?,
) {
val entity = db.scrobblingDao.find(scrobblerService.id, mangaId)
val entity = db.getScrobblingDao().find(scrobblerService.id, mangaId)
requireNotNull(entity) { "Scrobbling info for manga $mangaId not found" }
repository.updateRate(
rateId = entity.id,

View File

@@ -84,7 +84,7 @@ class ShikimoriRepository @Inject constructor(
}
override suspend fun unregister(mangaId: Long) {
return db.scrobblingDao.delete(ScrobblerService.SHIKIMORI.id, mangaId)
return db.getScrobblingDao().delete(ScrobblerService.SHIKIMORI.id, mangaId)
}
override fun logout() {
@@ -192,7 +192,7 @@ class ShikimoriRepository @Inject constructor(
comment = json.getString("text"),
rating = (json.getDouble("score").toFloat() / 10f).coerceIn(0f, 1f),
)
db.scrobblingDao.upsert(entity)
db.getScrobblingDao().upsert(entity)
}
private fun ScrobblerManga(json: JSONObject) = ScrobblerManga(

View File

@@ -31,7 +31,7 @@ class ShikimoriScrobbler @Inject constructor(
status: ScrobblingStatus?,
comment: String?,
) {
val entity = db.scrobblingDao.find(scrobblerService.id, mangaId)
val entity = db.getScrobblingDao().find(scrobblerService.id, mangaId)
requireNotNull(entity) { "Scrobbling info for manga $mangaId not found" }
repository.updateRate(
rateId = entity.id,