Add last update time to Updates Tab (closes #5466)

Co-authored-by: datreesezcup <datreesezcup@users.noreply.github.com>
This commit is contained in:
arkon
2022-08-29 14:57:25 -04:00
parent 8a3a7418d0
commit 43c195e14a
6 changed files with 41 additions and 2 deletions

View File

@@ -68,6 +68,7 @@ import logcat.LogPriority
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import java.io.File
import java.util.Date
import java.util.concurrent.CopyOnWriteArrayList
import java.util.concurrent.atomic.AtomicBoolean
import java.util.concurrent.atomic.AtomicInteger
@@ -225,6 +226,11 @@ class LibraryUpdateService(
updateJob?.cancel()
ioScope?.cancel()
// If this is a chapter update; set the last update time to now
if (target == Target.CHAPTERS) {
preferences.libraryUpdateLastTimestamp().set(Date().time)
}
// Update favorite manga
val categoryId = intent.getLongExtra(KEY_CATEGORY, -1L)
addMangaToQueue(categoryId)

View File

@@ -219,6 +219,7 @@ class PreferencesHelper(val context: Context) {
fun removeExcludeCategories() = flowPrefs.getStringSet("remove_exclude_categories", emptySet())
fun libraryUpdateInterval() = flowPrefs.getInt("pref_library_update_interval_key", 24)
fun libraryUpdateLastTimestamp() = flowPrefs.getLong("library_update_last_timestamp", 0L)
fun libraryUpdateDeviceRestriction() = flowPrefs.getStringSet("library_update_restriction", setOf(DEVICE_ONLY_ON_WIFI))
fun libraryUpdateMangaRestriction() = flowPrefs.getStringSet("library_update_manga_restriction", setOf(MANGA_HAS_UNREAD, MANGA_NON_COMPLETED, MANGA_NON_READ))