Conversation
- Add Retrofit dependencies for API communication - Create NotallyApi interface for sync endpoints - Implement SyncWorker for background synchronization - Add Cloud Sync section in Settings with Backend URL input - Add preferences for backendUrl and lastSync timestamp - Integrate WorkManager for scheduling sync tasks - Map data models between Room entities and API DTOs
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThis pull request introduces remote data synchronization to the application. It adds Retrofit and OkHttp networking dependencies, creates a remote API interface with three sync endpoints, implements a background WorkManager-based sync worker with bidirectional synchronization logic, extends user preferences with backend URL and sync timestamp storage, and integrates cloud sync controls into the settings UI. Changes
Sequence DiagramsequenceDiagram
participant User as User/UI
participant SettingsFragment as SettingsFragment
participant WorkManager as WorkManager
participant SyncWorker as SyncWorker
participant RemoteAPI as Remote API
participant LocalDB as Local Database
User->>SettingsFragment: Enter backend URL or tap Sync Now
SettingsFragment->>WorkManager: Enqueue SyncWorker with backend URL
WorkManager->>SyncWorker: Start sync task
SyncWorker->>RemoteAPI: registerDevice()
RemoteAPI-->>SyncWorker: Device registered
SyncWorker->>RemoteAPI: pullChanges(lastSync timestamp)
RemoteAPI-->>SyncWorker: Return remote notes & timestamp
SyncWorker->>LocalDB: Convert & upsert pulled notes
LocalDB-->>SyncWorker: Success
SyncWorker->>LocalDB: Query notes modified since lastSync
LocalDB-->>SyncWorker: Local changes
SyncWorker->>RemoteAPI: pushChanges(local notes & labels)
RemoteAPI-->>SyncWorker: Sync response with new timestamp
SyncWorker->>LocalDB: Update lastSync timestamp
LocalDB-->>SyncWorker: Success
SyncWorker-->>WorkManager: Sync complete
WorkManager-->>SettingsFragment: Notify sync result
Estimated Code Review Effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly Related PRs
Poem
✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.