mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-22 12:48:15 +03:00
Rework Auto Track on Mark as Read
Co-authored-by: Roshan Varughese <40583749+Animeboynz@users.noreply.github.com>
This commit is contained in:
parent
fa3622ecc0
commit
7303c4c50d
5 changed files with 30 additions and 1 deletions
|
@ -42,4 +42,6 @@ class TrackPreferences(
|
|||
"show_next_episode_airing_time",
|
||||
true,
|
||||
)
|
||||
|
||||
fun autoUpdateTrackOnMarkRead() = preferenceStore.getBoolean("pref_auto_update_manga_on_mark_read", true)
|
||||
}
|
||||
|
|
|
@ -145,6 +145,10 @@ object SettingsTrackingScreen : SearchableSettings {
|
|||
pref = trackPreferences.showNextEpisodeAiringTime(),
|
||||
title = stringResource(MR.strings.pref_show_next_episode_airing_time),
|
||||
),
|
||||
Preference.PreferenceItem.SwitchPreference(
|
||||
pref = trackPreferences.autoUpdateTrackOnMarkRead(),
|
||||
title = stringResource(MR.strings.pref_auto_update_manga_on_mark_read),
|
||||
),
|
||||
Preference.PreferenceGroup(
|
||||
title = stringResource(MR.strings.services),
|
||||
preferenceItems = persistentListOf(
|
||||
|
|
|
@ -36,6 +36,7 @@ import eu.kanade.tachiyomi.ui.player.settings.PlayerPreferences
|
|||
import eu.kanade.tachiyomi.util.AniChartApi
|
||||
import eu.kanade.tachiyomi.util.episode.getNextUnseen
|
||||
import eu.kanade.tachiyomi.util.removeCovers
|
||||
import eu.kanade.tachiyomi.util.system.toast
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.collections.immutable.toImmutableList
|
||||
import kotlinx.coroutines.async
|
||||
|
@ -739,6 +740,14 @@ class AnimeScreenModel(
|
|||
|
||||
if (!shouldPromptTrackingUpdate) return@launchIO
|
||||
|
||||
if (trackPreferences.autoUpdateTrackOnMarkRead().get()) {
|
||||
trackEpisode.await(context, animeId, maxEpisodeNumber)
|
||||
withUIContext {
|
||||
context.toast(context.stringResource(MR.strings.trackers_updated_summary_anime, maxEpisodeNumber.toInt()))
|
||||
}
|
||||
return@launchIO
|
||||
}
|
||||
|
||||
val result = snackbarHostState.showSnackbar(
|
||||
message = context.stringResource(MR.strings.confirm_tracker_update_anime, maxEpisodeNumber.toInt()),
|
||||
actionLabel = context.stringResource(MR.strings.action_ok),
|
||||
|
|
|
@ -39,6 +39,7 @@ import eu.kanade.tachiyomi.source.MangaSource
|
|||
import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences
|
||||
import eu.kanade.tachiyomi.util.chapter.getNextUnread
|
||||
import eu.kanade.tachiyomi.util.removeCovers
|
||||
import eu.kanade.tachiyomi.util.system.toast
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.collections.immutable.toImmutableList
|
||||
import kotlinx.coroutines.async
|
||||
|
@ -93,8 +94,8 @@ class MangaScreenModel(
|
|||
private val mangaId: Long,
|
||||
private val isFromSource: Boolean,
|
||||
private val libraryPreferences: LibraryPreferences = Injekt.get(),
|
||||
readerPreferences: ReaderPreferences = Injekt.get(),
|
||||
private val trackPreferences: TrackPreferences = Injekt.get(),
|
||||
readerPreferences: ReaderPreferences = Injekt.get(),
|
||||
private val trackerManager: TrackerManager = Injekt.get(),
|
||||
private val trackChapter: TrackChapter = Injekt.get(),
|
||||
private val downloadManager: MangaDownloadManager = Injekt.get(),
|
||||
|
@ -759,6 +760,15 @@ class MangaScreenModel(
|
|||
val maxChapterNumber = chapters.maxOf { it.chapterNumber }
|
||||
val shouldPromptTrackingUpdate = tracks.any { track -> maxChapterNumber > track.lastChapterRead }
|
||||
if (!shouldPromptTrackingUpdate) return@launchIO
|
||||
|
||||
if (trackPreferences.autoUpdateTrackOnMarkRead().get()) {
|
||||
trackChapter.await(context, mangaId, maxChapterNumber)
|
||||
withUIContext {
|
||||
context.toast(context.stringResource(MR.strings.trackers_updated_summary_manga, maxChapterNumber.toInt()))
|
||||
}
|
||||
return@launchIO
|
||||
}
|
||||
|
||||
val result = snackbarHostState.showSnackbar(
|
||||
message = context.stringResource(MR.strings.confirm_tracker_update, maxChapterNumber.toInt()),
|
||||
actionLabel = context.stringResource(MR.strings.action_ok),
|
||||
|
|
|
@ -649,6 +649,9 @@
|
|||
<string name="no_scanlators_found">No scanlators found</string>
|
||||
<string name="confirm_tracker_update">Update trackers to chapter %d?</string>
|
||||
<string name="confirm_tracker_update_anime">Update trackers to episode %d?</string>
|
||||
<string name="trackers_updated_summary_manga">Trackers updated to chapter %d</string>
|
||||
<string name="trackers_updated_summary_anime">Trackers updated to episode %d</string>
|
||||
|
||||
<string name="manga_tracking_tab">Tracking</string>
|
||||
<string name="add_tracking">Add tracking</string>
|
||||
<string name="unread">Unread</string>
|
||||
|
@ -975,6 +978,7 @@
|
|||
<string name="auto_download_while_watching">Auto download while watching</string>
|
||||
<string name="download_ahead_info_anime">Only works on entries in library and if the current episode plus the next one are already downloaded</string>
|
||||
<string name="pref_auto_update_manga_sync">Update progress after reading/watching</string>
|
||||
<string name="pref_auto_update_manga_on_mark_read">Update progress when marked as read</string>
|
||||
<string name="pref_track_on_add_library">Open track menu on adding to library</string>
|
||||
<string name="pref_show_next_episode_airing_time">Show next episode\'s airing time </string>
|
||||
<string name="pref_backup_flags_summary">What information to include in the backup file</string>
|
||||
|
|
Loading…
Reference in a new issue