chore: fix conflict.

Signed-off-by: KaiserBh <kaiserbh@proton.me>
This commit is contained in:
KaiserBh
2023-12-29 01:12:23 +11:00
133 changed files with 1572 additions and 1218 deletions

View File

@ -1,6 +1,7 @@
plugins {
id("com.android.library")
kotlin("android")
kotlin("plugin.serialization")
}
android {
@ -18,6 +19,7 @@ dependencies {
implementation(platform(kotlinx.coroutines.bom))
implementation(kotlinx.bundles.coroutines)
implementation(kotlinx.bundles.serialization)
implementation(libs.unifile)

View File

@ -46,6 +46,8 @@ class FetchInterval(
}
internal fun calculateInterval(chapters: List<Chapter>, zone: ZoneId): Int {
val chapterWindow = if (chapters.size <= 8) 3 else 10
val uploadDates = chapters.asSequence()
.filter { it.dateUpload > 0L }
.sortedByDescending { it.dateUpload }
@ -55,7 +57,7 @@ class FetchInterval(
.atStartOfDay()
}
.distinct()
.take(10)
.take(chapterWindow)
.toList()
val fetchDates = chapters.asSequence()
@ -66,7 +68,7 @@ class FetchInterval(
.atStartOfDay()
}
.distinct()
.take(10)
.take(chapterWindow)
.toList()
val interval = when {

View File

@ -8,9 +8,9 @@ class DeleteTrack(
private val trackRepository: TrackRepository,
) {
suspend fun await(mangaId: Long, syncId: Long) {
suspend fun await(mangaId: Long, trackerId: Long) {
try {
trackRepository.delete(mangaId, syncId)
trackRepository.delete(mangaId, trackerId)
} catch (e: Exception) {
logcat(LogPriority.ERROR, e)
}

View File

@ -3,7 +3,7 @@ package tachiyomi.domain.track.model
data class Track(
val id: Long,
val mangaId: Long,
val syncId: Long,
val trackerId: Long,
val remoteId: Long,
val libraryId: Long?,
val title: String,

View File

@ -13,7 +13,7 @@ interface TrackRepository {
fun getTracksByMangaIdAsFlow(mangaId: Long): Flow<List<Track>>
suspend fun delete(mangaId: Long, syncId: Long)
suspend fun delete(mangaId: Long, trackerId: Long)
suspend fun insert(track: Track)

View File

@ -54,6 +54,21 @@ class FetchIntervalTest {
fetchInterval.calculateInterval(chapters, testZoneId) shouldBe 1
}
@Test
fun `returns interval based on smaller subset of recent chapters if very few chapters`() {
val oldChapters = (1..3).map {
chapterWithTime(chapter, (it * 7).days)
}
// Significant gap between chapters
val newChapters = (1..3).map {
chapterWithTime(chapter, oldChapters.lastUploadDate() + 365.days + (it * 7).days)
}
val chapters = oldChapters + newChapters
fetchInterval.calculateInterval(chapters, testZoneId) shouldBe 7
}
@Test
fun `returns interval of 7 days when multiple chapters in 1 day`() {
val chapters = (1..10).map {