From f5b10cd07f294a569ef5417ca487a5cf3baf8e69 Mon Sep 17 00:00:00 2001 From: KaiserBh Date: Fri, 12 Jan 2024 02:01:15 +1100 Subject: [PATCH] feat: add a way to reset last_sync_timestamp. --- .../settings/screen/SettingsAdvancedScreen.kt | 21 +++++++++++++++++++ .../commonMain/resources/MR/base/strings.xml | 3 +++ 2 files changed, 24 insertions(+) diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt index 4b8f2b9d7..833a4a1a2 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt @@ -63,6 +63,7 @@ import tachiyomi.core.util.lang.launchNonCancellable import tachiyomi.core.util.lang.withUIContext import tachiyomi.core.util.system.logcat import tachiyomi.domain.manga.interactor.ResetViewerFlags +import tachiyomi.domain.sync.SyncPreferences import tachiyomi.i18n.MR import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.presentation.core.util.collectAsState @@ -142,6 +143,7 @@ object SettingsAdvancedScreen : SearchableSettings { getNetworkGroup(networkPreferences = networkPreferences), getLibraryGroup(), getExtensionsGroup(basePreferences = basePreferences), + getSyncGroup(), ), ) } @@ -404,4 +406,23 @@ object SettingsAdvancedScreen : SearchableSettings { ), ) } + + @Composable + private fun getSyncGroup(): Preference.PreferenceGroup { + val context = LocalContext.current + val syncPreferences = remember { Injekt.get() } + return Preference.PreferenceGroup( + title = stringResource(MR.strings.label_sync), + preferenceItems = persistentListOf( + Preference.PreferenceItem.TextPreference( + title = stringResource(MR.strings.pref_reset_sync_timestamp), + subtitle = stringResource(MR.strings.pref_reset_sync_timestamp_subtitle), + onClick = { + syncPreferences.lastSyncTimestamp().set(0) + context.toast(MR.strings.success_reset_sync_timestamp) + }, + ), + ), + ) + } } diff --git a/i18n/src/commonMain/resources/MR/base/strings.xml b/i18n/src/commonMain/resources/MR/base/strings.xml index e0ba8bec1..1b6df365e 100644 --- a/i18n/src/commonMain/resources/MR/base/strings.xml +++ b/i18n/src/commonMain/resources/MR/base/strings.xml @@ -561,6 +561,9 @@ Sync Automatic Synchronization Synchronization frequency + Reset last sync timestamp + Reset the last sync timestamp to force a full sync + Last sync timestamp reset SyncYomi Done in %1$s Last Synchronization: %1$s