Add ability to mark items to always keep them downloaded#75
Conversation
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
There was a problem hiding this comment.
Pull Request Overview
This PR adds the ability to mark items to keep them offline by introducing a new Boolean property ("keepOffline") across metadata types, updating the item’s content policy, and adding corresponding database and UI handling logic.
- Added the "keepOffline" flag to Realm, Sendable, and protocol definitions.
- Implemented tests, database manager extensions, and Item extensions facilitating the toggling and setting of the offline flag.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/NextcloudFileProviderKitTests/FilesDatabaseManagerTests.swift | Adds a test to verify keepOffline behavior via the database manager. |
| Sources/NextcloudFileProviderKit/Metadata/SendableItemMetadata.swift | Introduces the keepOffline property and propagates it in initializers. |
| Sources/NextcloudFileProviderKit/Metadata/RealmItemMetadata.swift | Adds a persisted keepOffline property to the Realm metadata object. |
| Sources/NextcloudFileProviderKit/Metadata/ItemMetadata.swift | Updates the protocol to include the keepOffline property. |
| Sources/NextcloudFileProviderKit/Item/Item.swift | Updates contentPolicy and introduces a computed keepOffline property based on metadata. |
| Sources/NextcloudFileProviderKit/Item/Item+KeepOffline.swift | Provides functions to toggle and set the keepOffline flag on items with proper file provider manager handling. |
| Sources/NextcloudFileProviderKit/Database/FilesDatabaseManager.swift | Adds errorCode definitions and an error domain for offline operations. |
| Sources/NextcloudFileProviderKit/Database/FilesDatabaseManager+KeepOffline.swift | Implements the database update logic for the keepOffline flag with detailed logging and error handling. |
Comments suppressed due to low confidence (2)
Sources/NextcloudFileProviderKit/Database/FilesDatabaseManager+KeepOffline.swift:28
- Consider adding tests to verify that this error branch is executed when the provided metadata is not found in the database.
guard let result = itemMetadatas.where({ $0.ocId == metadata.ocId }).first else {
Sources/NextcloudFileProviderKit/Database/FilesDatabaseManager+KeepOffline.swift:15
- [nitpick] Consider refining the formatting of the multiline error message for unsupported system versions to improve its clarity and consistency.
guard #available(macOS 13.0, iOS 16.0, visionOS 1.0) else {
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #75 +/- ##
==========================================
- Coverage 81.20% 81.07% -0.13%
==========================================
Files 60 62 +2
Lines 13293 13507 +214
==========================================
+ Hits 10794 10951 +157
- Misses 2499 2556 +57 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…if keepOffline is true Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
No description provided.