Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add cross device sync #40

Closed
wants to merge 208 commits into from
Closed
Show file tree
Hide file tree
Changes from 194 commits
Commits
Show all changes
208 commits
Select commit Hold shift + click to select a range
84eb68e
Split sync feature part 1
AriaMoradi Jul 6, 2023
bb89e9f
rename self hosted to SyncYomi
AriaMoradi Jul 6, 2023
7331819
apply review pointers
AriaMoradi Jul 6, 2023
75b9871
fix remember stuff
AriaMoradi Jul 6, 2023
877bf72
fix: fix not restoring categories etc.
kaiserbh Jul 7, 2023
878f709
feat: syncyomi uses same internal logic as well now.
kaiserbh Jul 7, 2023
a2a1201
refactor SyncYomiService
AriaMoradi Jul 7, 2023
6d9f74d
liner run
AriaMoradi Jul 7, 2023
a1e9d34
merge backup and sync screens
AriaMoradi Jul 7, 2023
425260b
rename SettingsBackupScreen
AriaMoradi Jul 7, 2023
5e02eda
fix labels
AriaMoradi Jul 11, 2023
1af1ce9
Merge branch 'master' into sync-part-1
AriaMoradi Jul 11, 2023
a036e49
refactor: don't need device id.
kaiserbh Jul 14, 2023
a512508
refactor: removed no used anymore.
kaiserbh Jul 14, 2023
93f3dd3
refactor: removed no used anymore.
kaiserbh Jul 14, 2023
4db4dd2
refactor: removed no used anymore.
kaiserbh Jul 14, 2023
c81400c
refactor: use Uri instead of syncHolder
kaiserbh Jul 14, 2023
92b1025
Merge branch 'master' into sync-part-1
kaiserbh Jul 14, 2023
abe6920
Merge branch 'master' into sync-part-1
kaiserbh Jul 16, 2023
70452ac
fix:conflict.
kaiserbh Aug 2, 2023
536c5fa
fix:conflict.
kaiserbh Aug 2, 2023
645505e
feat: added google drive service.
kaiserbh Aug 2, 2023
96a767a
refactor: refactor merging logic tidy up.
kaiserbh Aug 3, 2023
fdc85bd
bugfix: Since syncing is cross-device we need to take read status fro…
kaiserbh Aug 3, 2023
c4dc2c8
Merge branch 'master' into sync-part-final
kaiserbh Aug 3, 2023
bedfbf3
Merge branch 'master' into sync-part-final
kaiserbh Aug 13, 2023
1fcfd27
Merge branch 'master' into sync-part-final
kaiserbh Aug 22, 2023
1993928
Added exceptions in Google Sync process so that it fails correctly an…
undefiened Aug 26, 2023
d229010
Merge branch 'master' into sync-part-final
kaiserbh Aug 27, 2023
569db9e
Using a proper constant instead of val
undefiened Aug 27, 2023
2289fb9
Fixed identation of the REDIRECT_URI constant
undefiened Aug 27, 2023
30af850
Merge pull request #5 from undefiened/sync-part-final
kaiserbh Aug 27, 2023
e547981
Merge branch 'master' into sync-part-final
kaiserbh Aug 27, 2023
a84a396
refactor: Improve toast error messages for Google Drive sync data purge
kaiserbh Aug 27, 2023
4c1f94a
Merge remote-tracking branch 'origin/sync-part-final' into sync-part-…
kaiserbh Aug 27, 2023
10cb900
Merge branch 'master' into sync-part-final
kaiserbh Sep 1, 2023
2eef0dd
chore: merge upstream.
kaiserbh Sep 24, 2023
cd57253
Merge branch 'master' into sync-part-final
kaiserbh Sep 25, 2023
ef6da09
chore: merge upstream.
kaiserbh Oct 11, 2023
2747e15
refactor: remove private as it's used by sync.
kaiserbh Oct 11, 2023
6c4f118
refactor: make sure the read status is taken from backup.
kaiserbh Oct 11, 2023
010352f
refactor: remove private as it's used by syncManager as well.
kaiserbh Oct 11, 2023
75162fb
refactor: Use the new class backupCreator and backupRestorer instead …
kaiserbh Oct 11, 2023
a8bb397
Merge branch 'sync-part-final' of github.com:KaiserBh/tachiyomi into …
kaiserbh Oct 11, 2023
fd63383
fix: conflict.
kaiserbh Oct 23, 2023
ad17884
chore: use the new function format to map the manga.
kaiserbh Oct 23, 2023
c0d4359
refactor: remove the none/off choice default to google drive.
kaiserbh Oct 23, 2023
69669bc
Revert "refactor: remove the none/off choice default to google drive."
kaiserbh Oct 23, 2023
d0eaf5e
chore: merge upstream.
kaiserbh Nov 9, 2023
df546ca
refactor: lint.
kaiserbh Nov 9, 2023
bdf6839
chore: lint.
kaiserbh Nov 9, 2023
67b93bb
chore: lint.
kaiserbh Nov 9, 2023
dac701b
refactor: use relativeTimeSpanString
kaiserbh Nov 13, 2023
a08a815
Refactor: Replace Certain SyncPreferences with appStateKey
kaiserbh Nov 14, 2023
0016f1e
fix: merge conflict.
kaiserbh Nov 14, 2023
38609e8
chore: lint.
kaiserbh Nov 14, 2023
7ef188e
refactor: remove empty file
kaiserbh Nov 14, 2023
19227d6
refactor: remove getInstant and decodeSyncBackup
kaiserbh Nov 14, 2023
71872ea
refactor: clean up.
kaiserbh Nov 14, 2023
dac08ba
refactor: Move SyncData to SyncService.kt
kaiserbh Nov 14, 2023
846a11a
chore: update import!
kaiserbh Nov 14, 2023
d73f535
chore: update import!
kaiserbh Nov 14, 2023
6d54953
Merge branch 'master' into sync-part-final
kaiserbh Nov 17, 2023
25285e7
Merge branch 'master' into sync-part-final
kaiserbh Nov 18, 2023
383bfc5
refactor: Make sure to remove trim '/'
kaiserbh Nov 18, 2023
be36380
fix: upstream conflict.
kaiserbh Nov 19, 2023
1c52a05
fix: upstream conflict.
kaiserbh Nov 19, 2023
1a18537
chore: lint
kaiserbh Nov 19, 2023
389336b
refactor: move it into it's own function and use data and storage label.
kaiserbh Nov 19, 2023
d17aa20
refactor: use by remember and private the functions.
kaiserbh Nov 19, 2023
235b03b
refactor: remove the random delay!
kaiserbh Nov 19, 2023
44946d1
refactor: remove not needed old broken sources
kaiserbh Nov 19, 2023
14bc550
refactor: write into cache instead of file.
kaiserbh Nov 19, 2023
90cceeb
refactor: localized
kaiserbh Nov 19, 2023
9768416
refactor: remove the redundant syncPrefs
kaiserbh Nov 19, 2023
655594e
refactor: remove kotlinter.
kaiserbh Nov 19, 2023
389d40a
Merge branch 'master' of https://github.com/tachiyomiorg/tachiyomi in…
kaiserbh Nov 19, 2023
3839d58
chore: lint
kaiserbh Nov 19, 2023
d180d1d
fix: upstream conflict.
kaiserbh Nov 20, 2023
b3ee510
refactor: add group category for sync.
kaiserbh Nov 20, 2023
2a69a1e
Merge branch 'master' of https://github.com/tachiyomiorg/tachiyomi in…
kaiserbh Nov 22, 2023
adf1f87
fix: Timeout issue for people running reverse proxy.
kaiserbh Nov 22, 2023
73130bc
chore: merge upstream changes.
kaiserbh Nov 29, 2023
c75bf56
Merge branch 'master' into sync-part-final
kaiserbh Dec 2, 2023
2884ad4
Merge branch 'master' into sync-part-final
kaiserbh Dec 4, 2023
4b9ccb9
chore: merge upstream changes.
kaiserbh Dec 5, 2023
2ed1579
Merge branch 'sync-part-final' of github.com:KaiserBh/tachiyomi into …
kaiserbh Dec 5, 2023
3532074
Merge branch 'master' into sync-part-final
kaiserbh Dec 14, 2023
18fb63c
chore: merge upstream.
kaiserbh Dec 19, 2023
a462b40
refactor: added isSync to MangaRestorer
kaiserbh Dec 19, 2023
7cee828
refactor: fixed imports.
kaiserbh Dec 19, 2023
040c7a0
chore: Ktlint
kaiserbh Dec 19, 2023
cc5e140
chore: set foreground service type for SyncDataJob
kaiserbh Dec 20, 2023
178b002
feat: added triggers for syncing.
kaiserbh Dec 20, 2023
2f2eed0
chore: Ktlint
kaiserbh Dec 20, 2023
80570a8
chore: merge upstream changes.
kaiserbh Dec 28, 2023
fbf8c46
refactor: tidy up and fix upstream conflicts.
kaiserbh Dec 28, 2023
309bfd1
refactor: SyncManager uses them as well can't be private.
kaiserbh Dec 28, 2023
6677c90
chore: ktlint
kaiserbh Dec 28, 2023
ae8b1d8
refactor: clean up comparison.
kaiserbh Dec 28, 2023
8ba133a
chore: fix conflict.
kaiserbh Dec 28, 2023
4a2cf78
chore: ktlint
kaiserbh Dec 28, 2023
f1f07c1
refactor: wording.
kaiserbh Dec 28, 2023
4396c01
feat: Add on create so it just does it once when app launches.
kaiserbh Dec 28, 2023
0d117b8
feat: Add trigger to sync before library update.
kaiserbh Dec 28, 2023
37033cb
chore: ktlint.
kaiserbh Dec 28, 2023
440b624
refactor: Ktlint and replace enum.values with Enum.entries.
kaiserbh Dec 28, 2023
c456ca9
refactor: Ktlint and replace enum.values with Enum.entries.
kaiserbh Dec 28, 2023
080192a
revert: comparison clean up, simple equality check makes the restore …
kaiserbh Dec 28, 2023
5dbeda6
Revert "chore: ktlint"
kaiserbh Dec 28, 2023
646ec0c
refactor
kaiserbh Dec 28, 2023
57f9aed
Merge branch 'master' into sync-part-final
kaiserbh Dec 28, 2023
8cd7774
chore: lint
kaiserbh Dec 28, 2023
5426af8
Merge branch 'sync-part-final' into feat/add-sync-triggers-experimental
kaiserbh Dec 28, 2023
cf58a6d
chore: merge upstream.
kaiserbh Dec 30, 2023
6466bf0
chore: ktlint
kaiserbh Dec 30, 2023
ea536b0
chore: fix build error.
kaiserbh Dec 30, 2023
b62fa6e
fix: sync marking chapter unread when we do library update before syn…
kaiserbh Dec 30, 2023
01f06ff
Merge branch 'sync-part-final' into feat/add-sync-triggers-experimental
kaiserbh Dec 30, 2023
632df4c
refactor: Maybe the categories is fine since it's user who makes it u…
kaiserbh Dec 30, 2023
dce1e85
Revert "refactor: Maybe the categories is fine since it's user who ma…
kaiserbh Dec 30, 2023
85165aa
refactor: Maybe the categories is fine since it's user who makes it u…
kaiserbh Dec 30, 2023
ec0a0ff
Merge branch 'sync-part-final' into feat/add-sync-triggers-experimental
kaiserbh Dec 30, 2023
0a6d376
fix: proguard removing the RestoreOptions class.
kaiserbh Dec 30, 2023
e0e4333
chore: merge upstream.
kaiserbh Jan 1, 2024
fa5210a
refactor: remove proguard rules for keeping the class.
kaiserbh Jan 1, 2024
977b55d
chore: Ktlint.
kaiserbh Jan 1, 2024
7bd9c2f
Merge branch 'master' into sync-part-final
kaiserbh Jan 2, 2024
227d723
chore: merge upstream
kaiserbh Jan 3, 2024
b987e12
refactor: flipped the function names.
kaiserbh Jan 4, 2024
c6a147b
Merge branch 'sync-part-final' into feat/add-sync-triggers-experimental
kaiserbh Jan 4, 2024
2e56863
Merge branch 'master' into sync-part-final
kaiserbh Jan 6, 2024
39d5714
feat: Implemented Lock Mechanism for Synchronization.
kaiserbh Jan 6, 2024
eb5b161
feat: Enhanced SyncYomi with Robust Locking Mechanism
kaiserbh Jan 6, 2024
0e3c958
feat: Added PATCH HTTP Method to Network Utility
kaiserbh Jan 6, 2024
efb8d61
chore: ktlint.
kaiserbh Jan 6, 2024
aba86a4
Merge branch 'master' of https://github.com/tachiyomiorg/tachiyomi in…
kaiserbh Jan 6, 2024
95b294e
chore: merge upstream
kaiserbh Jan 6, 2024
4f2f9be
chore: ktlint err
kaiserbh Jan 6, 2024
2186c11
Merge branch 'sync-part-final' into feat/add-sync-triggers-experimental
kaiserbh Jan 6, 2024
1bbdfff
Merge branch 'master' into sync-part-final
kaiserbh Jan 6, 2024
aa3899e
chore: upstream changes
kaiserbh Jan 6, 2024
ae3dacf
Merge branch 'sync-part-final' into feat/add-sync-triggers-experimental
kaiserbh Jan 6, 2024
6e5d67b
chore: ktlint
kaiserbh Jan 6, 2024
3eaa2b0
Merge branch 'sync-part-final' into feat/add-sync-triggers-experimental
kaiserbh Jan 6, 2024
b4ac725
Merge branch 'master' into sync-part-final
kaiserbh Jan 7, 2024
39e3b35
Merge branch 'master' into sync-part-final
kaiserbh Jan 7, 2024
e1eb2e3
refactor: extend logcat to include tag.
kaiserbh Jan 7, 2024
86a21e2
Merge branch 'sync-part-final' of github.com:KaiserBh/tachiyomi into …
kaiserbh Jan 7, 2024
35ce19d
feat: Refactor merge logic with composite keys and debugging logs
kaiserbh Jan 7, 2024
db4ec11
feat(SyncManager): implement timestamp optimization in sync process
kaiserbh Jan 7, 2024
edfc61a
chore: ktlint
kaiserbh Jan 7, 2024
6bba0e6
Merge branch 'sync-part-final' into feat/add-sync-triggers-experimental
kaiserbh Jan 7, 2024
3c95d3a
Merge branch 'master' into sync-part-final
kaiserbh Jan 8, 2024
9859a3d
Merge branch 'sync-part-final' into feat/add-sync-triggers-experimental
kaiserbh Jan 8, 2024
f3c2c13
refactor: composite keys.
kaiserbh Jan 9, 2024
803f531
Merge branch 'sync-part-final' into feat/add-sync-triggers-experimental
kaiserbh Jan 9, 2024
97cf79f
Merge branch 'master' of https://github.com/tachiyomiorg/tachiyomi in…
kaiserbh Jan 9, 2024
882cee3
Merge branch 'sync-part-final' into feat/add-sync-triggers-experimental
kaiserbh Jan 9, 2024
b23c100
refactor(GoogleDrive): Use gson to encode the syncData.
kaiserbh Jan 9, 2024
5b2bbb1
refactor(GoogleDrive): Use gson to encode the syncData.
kaiserbh Jan 9, 2024
14e0151
refactor(GoogleDrive): clean up some stuff.
kaiserbh Jan 10, 2024
0366de2
refactor(GoogleDrive): use context.stringResource
kaiserbh Jan 10, 2024
9a53f4c
refactor(GoogleDrive): update strings.xml
kaiserbh Jan 10, 2024
e04d191
refactor(GoogleDrive): add more logging, also use appdata folder.
kaiserbh Jan 10, 2024
a13e731
refactor(GoogleDrive): update backoff delay.
kaiserbh Jan 10, 2024
d1a55ed
chore: Ktlint
kaiserbh Jan 10, 2024
8f6fa1f
Merge branch 'sync-part-final' into feat/add-sync-triggers-experimental
kaiserbh Jan 10, 2024
646ceaf
refactor: add more debugging logs.
kaiserbh Jan 10, 2024
3c73891
chore(R8): Keep the backup models.
kaiserbh Jan 10, 2024
6237fef
Merge branch 'sync-part-final' into feat/add-sync-triggers-experimental
kaiserbh Jan 10, 2024
7f77422
revert: remove gson for now.
kaiserbh Jan 10, 2024
542ad22
chore: lint
kaiserbh Jan 10, 2024
205d343
chore: lint
kaiserbh Jan 10, 2024
f02a9de
fix: decoding and encoding.
kaiserbh Jan 10, 2024
dd301c4
Merge branch 'sync-part-final' into feat/add-sync-triggers-experimental
kaiserbh Jan 10, 2024
6d0dbf1
refactor
kaiserbh Jan 10, 2024
3464262
Merge branch 'sync-part-final' into feat/add-sync-triggers-experimental
kaiserbh Jan 10, 2024
f5b10cd
feat: add a way to reset last_sync_timestamp.
kaiserbh Jan 11, 2024
9593e72
Merge remote-tracking branch 'origin/sync-part-final' into feat/add-s…
kaiserbh Jan 11, 2024
2f9f673
feat: add backupSource, backupPref, and "SY" backupSavedSearches.
kaiserbh Jan 11, 2024
d407d69
chore: lint
kaiserbh Jan 11, 2024
b13e335
refactor: clean up comment docs, outdated.
kaiserbh Jan 11, 2024
00ef1ea
Merge branch 'sync-part-final' into feat/add-sync-triggers-experimental
kaiserbh Jan 11, 2024
4bc99f8
Merge branch 'feat/add-sync-triggers-experimental' of github.com:Kais…
kaiserbh Jan 12, 2024
2c84e8f
Merge branch 'master' into sync-part-final
kaiserbh Jan 12, 2024
89c5779
Merge branch 'master' of https://github.com/tachiyomiorg/tachiyomi in…
kaiserbh Jan 13, 2024
ffe6efd
feat(sync): Allow to choose what to sync.
kaiserbh Jan 13, 2024
f51f94d
chore: merge changes from upstream.
kaiserbh Jan 13, 2024
47a6bd7
chore: merge changes from upstream and fix conflicts.
kaiserbh Jan 16, 2024
fd1da7d
chore: ktlint
kaiserbh Jan 16, 2024
4ed8d71
chore: use mihon icon.
kaiserbh Jan 16, 2024
7d97e9c
Merge branch 'main' of https://github.com/mihonapp/mihon into feat/ad…
kaiserbh Jan 18, 2024
9bf1b37
chore: Ktlint
kaiserbh Jan 18, 2024
7b3a586
chore: review pointers.
kaiserbh Jan 20, 2024
bc326f8
refactor: fix up the sync triggers, and update imports.
kaiserbh Jan 20, 2024
dbc6dac
refactor: update imports
kaiserbh Jan 20, 2024
8680565
Merge branch 'main' of https://github.com/mihonapp/mihon into feat/ad…
kaiserbh Jan 25, 2024
624d65d
refactor: add more error guard for gdrive.
kaiserbh Jan 25, 2024
c262c7a
chore: update to match upstream and fix conflict.
kaiserbh Feb 1, 2024
842c7d3
refactor: update imports.
kaiserbh Feb 1, 2024
e454e27
Merge branch 'main' of https://github.com/mihonapp/mihon into feat/ad…
kaiserbh Feb 5, 2024
6a09aca
chore: fix some of detekt error.
kaiserbh Feb 5, 2024
574887a
refactor: add breaks and max retries.
kaiserbh Feb 6, 2024
57e6bf1
Merge branch 'main' of https://github.com/mihonapp/mihon into feat/ad…
kaiserbh Feb 18, 2024
157a996
feat: db changes to accommodate new syncing logic.
kaiserbh Feb 23, 2024
7c85f50
refactor: Use the new powerful versioning system.
kaiserbh Feb 23, 2024
ed2b7df
chore: detekt auto fix.
kaiserbh Feb 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,9 @@ dependencies {
// For detecting memory leaks; see https://square.github.io/leakcanary/
// debugImplementation(libs.leakcanary.android)
implementation(libs.leakcanary.plumber)

implementation(libs.google.api.services.drive)
implementation(libs.google.api.client.oauth)
}

androidComponents {
Expand Down
6 changes: 6 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,9 @@
# Firebase
-keep class com.google.firebase.installations.** { *; }
-keep interface com.google.firebase.installations.** { *; }

# Google Drive
-keep class com.google.api.services.** { *; }

# Google OAuth
-keep class com.google.api.client.** { *; }
14 changes: 14 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,20 @@
<data android:host="shikimori-auth" />
</intent-filter>
</activity>
<activity
android:name=".ui.setting.track.GoogleDriveLoginActivity"
android:label="GoogleDrive"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:scheme="eu.kanade.google.oauth" />
</intent-filter>
</activity>

<receiver
android:name=".data.notification.NotificationReceiver"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/assets/client_secrets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"installed":{"client_id":"1046609911130-tbp79niehhuii976ekep1us06e9a8lne.apps.googleusercontent.com","project_id":"tachiyomi","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs"}}
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ fun Chapter.toDbChapter(): DbChapter = ChapterImpl().also {
it.date_upload = dateUpload
it.chapter_number = chapterNumber.toFloat()
it.source_order = sourceOrder.toInt()
it.last_modified = lastModifiedAt
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ fun LibraryToolbar(
onClickRefresh: () -> Unit,
onClickGlobalUpdate: () -> Unit,
onClickOpenRandomManga: () -> Unit,
onClickSyncNow: () -> Unit,
searchQuery: String?,
onSearchQueryChange: (String?) -> Unit,
scrollBehavior: TopAppBarScrollBehavior?,
Expand All @@ -56,6 +57,7 @@ fun LibraryToolbar(
onClickRefresh = onClickRefresh,
onClickGlobalUpdate = onClickGlobalUpdate,
onClickOpenRandomManga = onClickOpenRandomManga,
onClickSyncNow = onClickSyncNow,
scrollBehavior = scrollBehavior,
)
}
Expand All @@ -70,6 +72,7 @@ private fun LibraryRegularToolbar(
onClickRefresh: () -> Unit,
onClickGlobalUpdate: () -> Unit,
onClickOpenRandomManga: () -> Unit,
onClickSyncNow: () -> Unit,
scrollBehavior: TopAppBarScrollBehavior?,
) {
val pillAlpha = if (isSystemInDarkTheme()) 0.12f else 0.08f
Expand Down Expand Up @@ -115,6 +118,10 @@ private fun LibraryRegularToolbar(
title = stringResource(MR.strings.action_open_random_manga),
onClick = onClickOpenRandomManga,
),
AppBar.OverflowAction(
title = stringResource(MR.strings.sync_library),
onClick = onClickSyncNow,
),
),
)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,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
Expand Down Expand Up @@ -124,6 +125,7 @@ object SettingsAdvancedScreen : SearchableSettings {
getNetworkGroup(networkPreferences = networkPreferences),
getLibraryGroup(),
getExtensionsGroup(basePreferences = basePreferences),
getSyncGroup(),
)
}

Expand Down Expand Up @@ -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)
},
),
),
)
}
}
Loading