Migrate Updates screen to compose (#7534)

* Migrate Updates screen to compose

* Review Changes + Cleanup

Remove more unused stuff and show confirmation dialog when mass deleting chapters

* Review Changes 2 + Rebase
This commit is contained in:
AntsyLich
2022-07-18 08:17:40 +06:00
committed by GitHub
parent bdc5d557d1
commit d8fb6b893f
37 changed files with 1170 additions and 894 deletions

View File

@@ -0,0 +1,24 @@
package eu.kanade.domain.updates.interactor
import eu.kanade.domain.updates.model.UpdatesWithRelations
import eu.kanade.domain.updates.repository.UpdatesRepository
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.onEach
import java.util.Calendar
class GetUpdates(
private val repository: UpdatesRepository,
private val preferences: PreferencesHelper,
) {
fun subscribe(calendar: Calendar): Flow<List<UpdatesWithRelations>> = subscribe(calendar.time.time)
fun subscribe(after: Long): Flow<List<UpdatesWithRelations>> {
return repository.subscribeAll(after)
.onEach { updates ->
// Set unread chapter count for bottom bar badge
preferences.unreadUpdatesCount().set(updates.count { it.read.not() })
}
}
}

View File

@@ -0,0 +1,16 @@
package eu.kanade.domain.updates.model
import eu.kanade.domain.manga.model.MangaCover
data class UpdatesWithRelations(
val mangaId: Long,
val mangaTitle: String,
val chapterId: Long,
val chapterName: String,
val scanlator: String?,
val read: Boolean,
val bookmark: Boolean,
val sourceId: Long,
val dateFetch: Long,
val coverData: MangaCover,
)

View File

@@ -0,0 +1,9 @@
package eu.kanade.domain.updates.repository
import eu.kanade.domain.updates.model.UpdatesWithRelations
import kotlinx.coroutines.flow.Flow
interface UpdatesRepository {
fun subscribeAll(after: Long): Flow<List<UpdatesWithRelations>>
}