Sync instances to App Groups container for Share Extension#628
Open
tillkruss wants to merge 1 commit intofeature/share-extfrom
Open
Sync instances to App Groups container for Share Extension#628tillkruss wants to merge 1 commit intofeature/share-extfrom
tillkruss wants to merge 1 commit intofeature/share-extfrom
Conversation
@cloudstorage wraps NSUbiquitousKeyValueStore and cannot be pointed at an app group container. Instead, mirror `instances` into the shared UserDefaults (group.com.ruddarr) so the Share Extension can read them: - Add com.apple.security.application-groups entitlement to the main app - Add ShareExtension/ShareExtension.entitlements with the same entitlement and wire it into the Xcode project (CODE_SIGN_ENTITLEMENTS for both configs) - Add AppSettings.syncInstancesToAppGroup() and call it from saveInstance(), deleteInstance(), and on app launch (WithAppStateModifier) - Observe NSUbiquitousKeyValueStore.didChangeExternallyNotification to also propagate iCloud syncs from other devices into the shared container Closes the TODO in ShareExtension/README.md. https://claude.ai/code/session_01VsmqhzkysTDdfwKPpdt7Fb
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.
Summary
Enable the Share Extension to access the configured instances by syncing them to a shared App Groups container. This allows the Share Extension to read instance data from the main app without requiring direct access to the main app's UserDefaults.
Key Changes
syncInstancesToAppGroup()method that encodes instances and writes them to the shared App Groups UserDefaultssyncInstancesToAppGroup()whenever instances are added or deleted to keep the shared container in syncgroup.com.ruddarr) to both main app and Share Extension targetsCODE_SIGN_ENTITLEMENTSsetting to ShareExtension build targetssyncInstancesToAppGroup()during app initialization to ensure Share Extension has access to instances on first launchImplementation Details
UserDefaults(suiteName:)with thegroup.com.ruddarrsuite name to access the shared containerhttps://claude.ai/code/session_01VsmqhzkysTDdfwKPpdt7Fb