Rework Auto Track on Mark as Read (#1365)
(cherry picked from commit c153ac01f545ce9259c58aa5d5f7223d2f8f628b) # Conflicts: # app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt
This commit is contained in:
parent
15f1ee2205
commit
14f6fd7908
@ -35,4 +35,6 @@ class TrackPreferences(
|
|||||||
fun anilistScoreType() = preferenceStore.getString("anilist_score_type", Anilist.POINT_10)
|
fun anilistScoreType() = preferenceStore.getString("anilist_score_type", Anilist.POINT_10)
|
||||||
|
|
||||||
fun autoUpdateTrack() = preferenceStore.getBoolean("pref_auto_update_manga_sync_key", true)
|
fun autoUpdateTrack() = preferenceStore.getBoolean("pref_auto_update_manga_sync_key", true)
|
||||||
|
|
||||||
|
fun autoUpdateTrackOnMarkRead() = preferenceStore.getBoolean("pref_auto_update_manga_on_mark_read", true)
|
||||||
}
|
}
|
||||||
|
@ -125,6 +125,10 @@ object SettingsTrackingScreen : SearchableSettings {
|
|||||||
pref = trackPreferences.autoUpdateTrack(),
|
pref = trackPreferences.autoUpdateTrack(),
|
||||||
title = stringResource(MR.strings.pref_auto_update_manga_sync),
|
title = stringResource(MR.strings.pref_auto_update_manga_sync),
|
||||||
),
|
),
|
||||||
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
|
pref = trackPreferences.autoUpdateTrackOnMarkRead(),
|
||||||
|
title = stringResource(MR.strings.pref_auto_update_manga_on_mark_read),
|
||||||
|
),
|
||||||
Preference.PreferenceGroup(
|
Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.services),
|
title = stringResource(MR.strings.services),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = persistentListOf(
|
||||||
|
@ -30,6 +30,7 @@ import eu.kanade.domain.source.service.SourcePreferences
|
|||||||
import eu.kanade.domain.track.interactor.AddTracks
|
import eu.kanade.domain.track.interactor.AddTracks
|
||||||
import eu.kanade.domain.track.interactor.TrackChapter
|
import eu.kanade.domain.track.interactor.TrackChapter
|
||||||
import eu.kanade.domain.track.model.toDomainTrack
|
import eu.kanade.domain.track.model.toDomainTrack
|
||||||
|
import eu.kanade.domain.track.service.TrackPreferences
|
||||||
import eu.kanade.domain.ui.UiPreferences
|
import eu.kanade.domain.ui.UiPreferences
|
||||||
import eu.kanade.presentation.manga.DownloadAction
|
import eu.kanade.presentation.manga.DownloadAction
|
||||||
import eu.kanade.presentation.manga.components.ChapterDownloadAction
|
import eu.kanade.presentation.manga.components.ChapterDownloadAction
|
||||||
@ -48,6 +49,7 @@ import eu.kanade.tachiyomi.source.online.all.MergedSource
|
|||||||
import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences
|
import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences
|
||||||
import eu.kanade.tachiyomi.util.chapter.getNextUnread
|
import eu.kanade.tachiyomi.util.chapter.getNextUnread
|
||||||
import eu.kanade.tachiyomi.util.removeCovers
|
import eu.kanade.tachiyomi.util.removeCovers
|
||||||
|
import eu.kanade.tachiyomi.util.system.toast
|
||||||
import exh.debug.DebugToggles
|
import exh.debug.DebugToggles
|
||||||
import exh.eh.EHentaiUpdateHelper
|
import exh.eh.EHentaiUpdateHelper
|
||||||
import exh.log.xLogD
|
import exh.log.xLogD
|
||||||
@ -145,6 +147,7 @@ class MangaScreenModel(
|
|||||||
private val isFromSource: Boolean,
|
private val isFromSource: Boolean,
|
||||||
val smartSearched: Boolean,
|
val smartSearched: Boolean,
|
||||||
private val libraryPreferences: LibraryPreferences = Injekt.get(),
|
private val libraryPreferences: LibraryPreferences = Injekt.get(),
|
||||||
|
private val trackPreferences: TrackPreferences = Injekt.get(),
|
||||||
readerPreferences: ReaderPreferences = Injekt.get(),
|
readerPreferences: ReaderPreferences = Injekt.get(),
|
||||||
uiPreferences: UiPreferences = Injekt.get(),
|
uiPreferences: UiPreferences = Injekt.get(),
|
||||||
private val trackerManager: TrackerManager = Injekt.get(),
|
private val trackerManager: TrackerManager = Injekt.get(),
|
||||||
@ -1272,6 +1275,14 @@ class MangaScreenModel(
|
|||||||
|
|
||||||
if (!shouldPromptTrackingUpdate) return@launchIO
|
if (!shouldPromptTrackingUpdate) return@launchIO
|
||||||
|
|
||||||
|
if (trackPreferences.autoUpdateTrackOnMarkRead().get()) {
|
||||||
|
trackChapter.await(context, mangaId, maxChapterNumber)
|
||||||
|
withUIContext {
|
||||||
|
context.toast(context.stringResource(MR.strings.trackers_updated_summary, maxChapterNumber.toInt()))
|
||||||
|
}
|
||||||
|
return@launchIO
|
||||||
|
}
|
||||||
|
|
||||||
val result = snackbarHostState.showSnackbar(
|
val result = snackbarHostState.showSnackbar(
|
||||||
message = context.stringResource(MR.strings.confirm_tracker_update, maxChapterNumber.toInt()),
|
message = context.stringResource(MR.strings.confirm_tracker_update, maxChapterNumber.toInt()),
|
||||||
actionLabel = context.stringResource(MR.strings.action_ok),
|
actionLabel = context.stringResource(MR.strings.action_ok),
|
||||||
|
@ -509,6 +509,7 @@
|
|||||||
<!-- Tracking section -->
|
<!-- Tracking section -->
|
||||||
<string name="tracking_guide">Tracking guide</string>
|
<string name="tracking_guide">Tracking guide</string>
|
||||||
<string name="pref_auto_update_manga_sync">Update progress after reading</string>
|
<string name="pref_auto_update_manga_sync">Update progress after reading</string>
|
||||||
|
<string name="pref_auto_update_manga_on_mark_read">Update progress when marked as read</string>
|
||||||
<string name="services">Trackers</string>
|
<string name="services">Trackers</string>
|
||||||
<string name="tracking_info">One-way sync to update the chapter progress in external tracker services. Set up tracking for individual entries from their tracking button.</string>
|
<string name="tracking_info">One-way sync to update the chapter progress in external tracker services. Set up tracking for individual entries from their tracking button.</string>
|
||||||
<string name="enhanced_services">Enhanced trackers</string>
|
<string name="enhanced_services">Enhanced trackers</string>
|
||||||
@ -739,6 +740,7 @@
|
|||||||
<string name="exclude_scanlators">Exclude scanlators</string>
|
<string name="exclude_scanlators">Exclude scanlators</string>
|
||||||
<string name="no_scanlators_found">No scanlators found</string>
|
<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">Update trackers to chapter %d?</string>
|
||||||
|
<string name="trackers_updated_summary">Trackers updated to chapter %d</string>
|
||||||
|
|
||||||
<!-- Tracking Screen -->
|
<!-- Tracking Screen -->
|
||||||
<string name="manga_tracking_tab">Tracking</string>
|
<string name="manga_tracking_tab">Tracking</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user