Fix critical app extension link handling bugs#73
Open
mattrighetti wants to merge 2 commits into
Open
Conversation
- Fix stale externalCache causing links to be lost after first extension use - processExternalLinks now reads fresh from disk via getCache() on each call - No longer relies on unreliable notification-based cache clearing - Explicitly calls dropCache() + persistCache() after batch insert - Process external links on cold launch - Added direct call to processExternalLinks() in scene(_:willConnectTo:) - Previously only processed on background-to-foreground transitions - Links saved while app was closed would be lost until next background/foreground cycle - Fix persistCache/getCache encoding mismatch - persistCache now encodes Array(externalCache.values) instead of dictionary - Consistent with how getCache() and add() decode the file as an array - Prevent crashes in AddToUlryActionViewController - Replaced force unwraps on extensionContext and attachments with guard let - Gracefully completes request if extension input is missing - Fix appendingPathExtension → appendingPathComponent in +URL.swift - Correct method for appending path components (subdirectories) - Previously would have added .folder to filenames instead of creating directories
…sion queue - ExtensionsAddLinkRequestsManager now uses UserDefaults(suiteName:) instead of a manually coordinated plist file - Removed: externalCache lazy var, getCache, dropCache, persistCache, NSFileCoordinator, PropertyListEncoder/Decoder, NSObject inheritance, and the notification-based remove mechanism - Added: pendingLinks computed property (reads fresh each time), clearAll() - SceneDelegate.processExternalLinks updated to use new API - Deleted Shared/Utils/+URL.swift — storeURL helper is now unused
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
Fixes multiple critical bugs in the app extension link saving flow that were causing links to be silently lost or dropped after first use.
Issues Fixed
externalCachelazy var was frozen in memory after first load, causing subsequent links saved via extension to be silently dropped when the app processed thempersistCachewas encoding as dictionary butgetCache/addwere decoding as array, risking data corruptionKey Changes
SceneDelegate.processExternalLinks()now reads fresh from disk on each call instead of using the stale lazyexternalCacheprocessExternalLinks()during scene initialization to handle cold launchesdropCache()+persistCache()instead of relying on notification matchingAddToUlryActionViewControllernow gracefully handles missing extension inputs+URL.swiftto use correct path component method