feat: add a way to reset last sync.

This commit is contained in:
kaiserbh 2024-01-22 01:11:38 +11:00
parent dd1a9a7216
commit bde81f67f2
2 changed files with 21 additions and 1 deletions

View File

@ -24,6 +24,7 @@ import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow import cafe.adriel.voyager.navigator.currentOrThrow
import eu.kanade.domain.base.BasePreferences import eu.kanade.domain.base.BasePreferences
import eu.kanade.domain.extension.interactor.TrustExtension import eu.kanade.domain.extension.interactor.TrustExtension
import eu.kanade.domain.sync.SyncPreferences
import eu.kanade.presentation.more.settings.Preference import eu.kanade.presentation.more.settings.Preference
import eu.kanade.presentation.more.settings.screen.advanced.ClearDatabaseScreen import eu.kanade.presentation.more.settings.screen.advanced.ClearDatabaseScreen
import eu.kanade.presentation.more.settings.screen.debug.DebugInfoScreen import eu.kanade.presentation.more.settings.screen.debug.DebugInfoScreen
@ -124,6 +125,7 @@ object SettingsAdvancedScreen : SearchableSettings {
getNetworkGroup(networkPreferences = networkPreferences), getNetworkGroup(networkPreferences = networkPreferences),
getLibraryGroup(), getLibraryGroup(),
getExtensionsGroup(basePreferences = basePreferences), getExtensionsGroup(basePreferences = basePreferences),
getSyncGroup(),
) )
} }
@ -384,4 +386,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

@ -1,4 +1,3 @@
package eu.kanade.presentation.more.settings.screen.data package eu.kanade.presentation.more.settings.screen.data
import android.content.Context import android.content.Context