Repository navigation
refactor: Added ability to inject custom directory for DataStoreFile - #612
Michael Artes (asmeili) wants to merge 10 commits into
Conversation
|
Hi Muzahidul Islam (@muzahidul-opti), could you please review this PR and let me know if any changes are required? |
|
lgtm |
Sure, we will review it. |
|
Hi Muzahidul Islam (@muzahidul-opti), are there any updates on this? |
Muzahidul Islam (muzahidul-opti)
left a comment
There was a problem hiding this comment.
Looks good to me, CI failing could you please fix it?
|
Hi Muzahidul Islam (@muzahidul-opti), I fixed the build issue. Could you approve the CI runs to verify? |
|
Hi Raju Ahmed (@raju-opti), could you take a look at this PR and approve the CI runs? |
|
Thanks for the review! I've merged the latest master into the branch, which should take care of the testThreadSafe failure (it's in LruCacheTests, unrelated to this change, looks flaky). The remaining failures don't seem fixable from my side as a fork PR. Could you check again Muzahidul Islam (@muzahidul-opti)? |
…ultEventDispatcher (#668) * refactor: Added optional directory parameter to DataStoreFile * refactor: Added ability to inject file data store directory into DefaultEventDispatcher * test: Added test for DataStoreFile custom directory * refactor: Updated to syntax supported by Swift 5.8 and lower * Fixed build issues * Fixed failing test * [FSSDK-12251] fix: keep custom data store directory API source-compatible Rework #612 so it adds API without breaking 6.x users: - Restore `DataStoreType.file` (no associated value) so `.file` and `==` keep compiling - Keep `DataStoreFile.init(storeName:async:)` designated so subclasses can call super.init - Expose the directory via new convenience inits on DataStoreFile and DefaultEventDispatcher (new designated inits on open classes are flagged by diagnose-api-breaking-changes) - Add a test for the dispatcher custom-directory path Co-authored-by: artesmichael <michael.artes@icloud.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [FSSDK-12251] fix: create custom data store directory if missing Application Support isn't guaranteed to exist on iOS, and Data.write doesn't create parent directories, so writes failed and saveItem swallowed the error, silently dropping queued events. Resolve the directory with url(for:in:appropriateFor:create: true). If creation fails, the store keeps its default location. Tests no longer pre-create the directory; add a test against a directory that doesn't exist yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: artesmichael <michael.artes@icloud.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
Hi Michael Artes (@asmeili), thank you for this contribution, and apologies for the long wait. Since this is a fork PR, CI couldn't run on it, so we carried your changes through an internal PR instead: #668. It's merged and released in 6.0.1. Closing this PR as superseded by #668. Thanks again for the fix. |
Summary
DataStoreFileto allow for injection of customFileManager.SearchPathDirectoryDefaultEventDispatcherto allow for injection of customFileManager.SearchPathDirectoryforDataStoreType.fileUsers have been raising the issue that they see these technical files inside of their
Filesapp, because the directory forDataStoreFiledefaults to.documentsDirectory, which is visible to users. This change allows us to update the directory to.applicationSupportDirectoryinDefaultEventDispatcherusingDataStoreType.file(directory: .applicationSupportDirectory)and inDefaultDatafileHandlerby overridingopen func createDataStore(sdkKey: String) -> OPTDataStore.Test plan
DataStoreFileIssues