Fix feels://subscribe deep link on cold launch via app.open()
When XCUITest calls app.open(url), the app relaunches (cold launch) and onOpenURL doesn't fire reliably. Capture the URL from launch options in AppDelegate and check it on appear with a short delay to ensure the view hierarchy is ready for sheet presentation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -63,9 +63,7 @@ struct FeelsApp: App {
|
||||
.environmentObject(iapManager)
|
||||
}
|
||||
.onOpenURL { url in
|
||||
if url.scheme == "feels" && url.host == "subscribe" {
|
||||
showSubscriptionFromWidget = true
|
||||
}
|
||||
handleDeepLink(url)
|
||||
}
|
||||
.alert("Data Storage Unavailable",
|
||||
isPresented: $showStorageFallbackAlert) {
|
||||
@@ -77,6 +75,12 @@ struct FeelsApp: App {
|
||||
if SharedModelContainer.isUsingInMemoryFallback {
|
||||
AnalyticsManager.shared.track(.storageFallbackActivated)
|
||||
}
|
||||
if let url = AppDelegate.pendingDeepLinkURL {
|
||||
AppDelegate.pendingDeepLinkURL = nil
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
|
||||
handleDeepLink(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Lock screen overlay
|
||||
@@ -141,5 +145,10 @@ struct FeelsApp: App {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private func handleDeepLink(_ url: URL) {
|
||||
if url.scheme == "feels" && url.host == "subscribe" {
|
||||
showSubscriptionFromWidget = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user