Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds Google Drive–backed cloud synchronization for diary entries, including manual sync from the entries UI, configurable sync settings (enable/disable, auto-sync toggle, sync path), and platform-specific auto-sync starters.
Changes:
- Added common sync engine (
performCloudSync) with encoding/decoding and Drive folder/path handling. - Implemented platform-specific
startAutoSyncfor Android/JVM/Wasm and wired auto-sync startup fromEntriesScreen. - Extended settings/preferences + updated Settings/Entries UI to configure and trigger sync with status dialogs.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| composeApp/src/commonMain/kotlin/io/github/smiling_pixel/sync/SyncManager.kt | Implements Google Drive sync workflow, conflict checks, and entry serialization helpers. |
| composeApp/src/commonMain/kotlin/io/github/smiling_pixel/sync/AutoSync.kt | Declares the expect API for platform-specific auto-sync. |
| composeApp/src/androidMain/kotlin/io/github/smiling_pixel/sync/AutoSync.android.kt | Adds Android background periodic auto-sync loop. |
| composeApp/src/jvmMain/kotlin/io/github/smiling_pixel/sync/AutoSync.jvm.kt | Adds JVM background periodic auto-sync loop. |
| composeApp/src/wasmJsMain/kotlin/io/github/smiling_pixel/sync/AutoSync.wasmJs.kt | Provides Wasm no-op/unsupported auto-sync implementation. |
| composeApp/src/commonMain/kotlin/io/github/smiling_pixel/preference/SettingsRepository.kt | Extends settings contract with cloud sync + auto-sync + path. |
| composeApp/src/nonWebMain/kotlin/io/github/smiling_pixel/preference/DataStoreSettingsRepository.kt | Persists new cloud sync settings in DataStore for non-web targets. |
| composeApp/src/wasmJsMain/kotlin/io/github/smiling_pixel/preference/SettingsRepository.wasmJs.kt | Persists new cloud sync settings in localStorage for Wasm/JS. |
| composeApp/src/commonMain/kotlin/io/github/smiling_pixel/screens/SettingsScreen.kt | Adds UI to connect to Drive and configure cloud sync settings. |
| composeApp/src/commonMain/kotlin/io/github/smiling_pixel/screens/EntriesScreen.kt | Adds manual sync FAB + dialogs and starts auto-sync on screen load. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
composeApp/src/commonMain/kotlin/io/github/smiling_pixel/sync/SyncManager.kt
Show resolved
Hide resolved
composeApp/src/androidMain/kotlin/io/github/smiling_pixel/sync/AutoSync.android.kt
Show resolved
Hide resolved
composeApp/src/commonMain/kotlin/io/github/smiling_pixel/screens/EntriesScreen.kt
Show resolved
Hide resolved
composeApp/src/jvmMain/kotlin/io/github/smiling_pixel/sync/AutoSync.jvm.kt
Show resolved
Hide resolved
composeApp/src/androidMain/kotlin/io/github/smiling_pixel/sync/AutoSync.android.kt
Show resolved
Hide resolved
composeApp/src/commonMain/kotlin/io/github/smiling_pixel/sync/SyncManager.kt
Show resolved
Hide resolved
composeApp/src/commonMain/kotlin/io/github/smiling_pixel/sync/SyncManager.kt
Show resolved
Hide resolved
Comment on lines
8
to
11
| import kotlinx.datetime.TimeZone | ||
| import kotlinx.datetime.toLocalDateTime | ||
| import kotlinx.datetime.LocalDate | ||
| import androidx.compose.runtime.collectAsState |
There was a problem hiding this comment.
kotlinx.datetime.LocalDate is imported but not used in this file. Please remove the unused import to keep the file warning-free (and avoid failures if warnings-as-errors/linting is enabled).
composeApp/src/commonMain/kotlin/io/github/smiling_pixel/screens/EntriesScreen.kt
Show resolved
Hide resolved
composeApp/src/jvmMain/kotlin/io/github/smiling_pixel/sync/AutoSync.jvm.kt
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a comprehensive cloud synchronization feature for diary entries, enabling users to sync their data with Google Drive. The sync can be triggered manually from the UI or automatically at regular intervals, and users can configure sync preferences in the settings screen. The implementation includes cross-platform support for auto-sync, robust conflict resolution logic, and user feedback on sync status.
The most important changes are:
Cloud Sync Core Logic:
performCloudSyncfunction inSyncManager.ktthat handles uploading, downloading, and conflict resolution of diary entries between local storage and Google Drive, including utility functions for encoding/decoding entries and managing folders.SyncResultdata class to summarize sync outcomes (uploaded, downloaded, unchanged entries).Auto Sync Infrastructure:
startAutoSyncfunctions for Android and JVM, which periodically trigger synchronization in the background if enabled in settings. [1] [2] [3]User Interface Enhancements:
EntriesScreen, allowing users to trigger and monitor sync operations from the main UI. [1] [2]SettingsScreento allow users to enable/disable cloud sync and auto-sync, specify the cloud sync path, and view connection status to Google Drive. [1] [2] [3] [4]Settings & Preferences:
SettingsRepositoryinterface to support cloud sync preferences (isCloudSyncEnabled,isAutoSyncEnabled,cloudSyncPath) and their corresponding setters.Codebase & Import Updates:
These changes collectively provide robust, user-configurable cloud synchronization for diary entries, improving data safety and accessibility across devices.