feat: add a way to reset last_sync_timestamp.

This commit is contained in:
KaiserBh 2024-01-12 02:01:15 +11:00
parent 6d0dbf1c56
commit f5b10cd07f
2 changed files with 24 additions and 0 deletions

View File

@ -63,6 +63,7 @@ import tachiyomi.core.util.lang.launchNonCancellable
import tachiyomi.core.util.lang.withUIContext import tachiyomi.core.util.lang.withUIContext
import tachiyomi.core.util.system.logcat import tachiyomi.core.util.system.logcat
import tachiyomi.domain.manga.interactor.ResetViewerFlags import tachiyomi.domain.manga.interactor.ResetViewerFlags
import tachiyomi.domain.sync.SyncPreferences
import tachiyomi.i18n.MR import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.collectAsState import tachiyomi.presentation.core.util.collectAsState
@ -142,6 +143,7 @@ object SettingsAdvancedScreen : SearchableSettings {
getNetworkGroup(networkPreferences = networkPreferences), getNetworkGroup(networkPreferences = networkPreferences),
getLibraryGroup(), getLibraryGroup(),
getExtensionsGroup(basePreferences = basePreferences), 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<SyncPreferences>() }
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)
},
),
),
)
}
} }

View File

@ -561,6 +561,9 @@
<string name="pref_sync_service_category">Sync</string> <string name="pref_sync_service_category">Sync</string>
<string name="pref_sync_automatic_category">Automatic Synchronization</string> <string name="pref_sync_automatic_category">Automatic Synchronization</string>
<string name="pref_sync_interval">Synchronization frequency</string> <string name="pref_sync_interval">Synchronization frequency</string>
<string name="pref_reset_sync_timestamp">Reset last sync timestamp</string>
<string name="pref_reset_sync_timestamp_subtitle">Reset the last sync timestamp to force a full sync</string>
<string name="success_reset_sync_timestamp">Last sync timestamp reset</string>
<string name="syncyomi">SyncYomi</string> <string name="syncyomi">SyncYomi</string>
<string name="sync_completed_message">Done in %1$s</string> <string name="sync_completed_message">Done in %1$s</string>
<string name="last_synchronization">Last Synchronization: %1$s</string> <string name="last_synchronization">Last Synchronization: %1$s</string>