mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-26 10:58:24 +01:00
Automatically set tracker as completed after reading the last chapter (#6289)
* Automatically set tracker as completed after reading the last chapter. * use integer value in comparison * also set `started_reading` date * don't use source manga's status * remove useless line
This commit is contained in:
parent
12bd7268d2
commit
a9d2741e6a
@ -147,8 +147,16 @@ class Anilist(private val context: Context, id: Int) : TrackService(id) {
|
||||
}
|
||||
|
||||
if (track.status != COMPLETED) {
|
||||
if (track.status != REPEATING && didReadChapter) {
|
||||
track.status = READING
|
||||
if (didReadChapter) {
|
||||
if (track.last_chapter_read.toInt() == track.total_chapters && track.total_chapters > 0) {
|
||||
track.status = COMPLETED
|
||||
track.finished_reading_date = System.currentTimeMillis()
|
||||
} else if (track.status != REPEATING) {
|
||||
track.status = READING
|
||||
if (track.last_chapter_read == 1F) {
|
||||
track.started_reading_date = System.currentTimeMillis()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,11 @@ class Bangumi(private val context: Context, id: Int) : TrackService(id) {
|
||||
override suspend fun update(track: Track, didReadChapter: Boolean): Track {
|
||||
if (track.status != COMPLETED) {
|
||||
if (didReadChapter) {
|
||||
track.status = READING
|
||||
if (track.last_chapter_read.toInt() == track.total_chapters && track.total_chapters > 0) {
|
||||
track.status = COMPLETED
|
||||
} else {
|
||||
track.status = READING
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,15 @@ class Kitsu(private val context: Context, id: Int) : TrackService(id) {
|
||||
override suspend fun update(track: Track, didReadChapter: Boolean): Track {
|
||||
if (track.status != COMPLETED) {
|
||||
if (didReadChapter) {
|
||||
track.status = READING
|
||||
if (track.last_chapter_read.toInt() == track.total_chapters && track.total_chapters > 0) {
|
||||
track.status = COMPLETED
|
||||
track.finished_reading_date = System.currentTimeMillis()
|
||||
} else {
|
||||
track.status = READING
|
||||
if (track.last_chapter_read == 1F) {
|
||||
track.started_reading_date = System.currentTimeMillis()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,11 @@ class Komga(private val context: Context, id: Int) : TrackService(id), EnhancedT
|
||||
override suspend fun update(track: Track, didReadChapter: Boolean): Track {
|
||||
if (track.status != COMPLETED) {
|
||||
if (didReadChapter) {
|
||||
track.status = READING
|
||||
if (track.last_chapter_read.toInt() == track.total_chapters && track.total_chapters > 0) {
|
||||
track.status = COMPLETED
|
||||
} else {
|
||||
track.status = READING
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,8 +76,16 @@ class MyAnimeList(private val context: Context, id: Int) : TrackService(id) {
|
||||
|
||||
override suspend fun update(track: Track, didReadChapter: Boolean): Track {
|
||||
if (track.status != COMPLETED) {
|
||||
if (track.status != REREADING && didReadChapter) {
|
||||
track.status = READING
|
||||
if (didReadChapter) {
|
||||
if (track.last_chapter_read.toInt() == track.total_chapters && track.total_chapters > 0) {
|
||||
track.status = COMPLETED
|
||||
track.finished_reading_date = System.currentTimeMillis()
|
||||
} else if (track.status != REREADING) {
|
||||
track.status = READING
|
||||
if (track.last_chapter_read == 1F) {
|
||||
track.started_reading_date = System.currentTimeMillis()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,8 +46,12 @@ class Shikimori(private val context: Context, id: Int) : TrackService(id) {
|
||||
|
||||
override suspend fun update(track: Track, didReadChapter: Boolean): Track {
|
||||
if (track.status != COMPLETED) {
|
||||
if (track.status != REPEATING && didReadChapter) {
|
||||
track.status = READING
|
||||
if (didReadChapter) {
|
||||
if (track.last_chapter_read.toInt() == track.total_chapters && track.total_chapters > 0) {
|
||||
track.status = COMPLETED
|
||||
} else if (track.status != REPEATING) {
|
||||
track.status = READING
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user