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:
Trey t
2026-02-20 11:58:12 -06:00
parent f495ae90fa
commit 5b8a98f763
2 changed files with 18 additions and 4 deletions

View File

@@ -11,11 +11,16 @@ import UIKit
import SwiftUI
class AppDelegate: NSObject, UIApplicationDelegate {
static var pendingDeepLinkURL: URL?
private let savedOnboardingData = UserDefaultsStore.getOnboarding()
@AppStorage(UserDefaultsStore.Keys.theme.rawValue, store: GroupUserDefaults.groupDefaults) private var theme: Theme = .system
@MainActor
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
if let url = launchOptions?[.url] as? URL {
AppDelegate.pendingDeepLinkURL = url
}
DataController.shared.removeNoForDates()
DataController.shared.fillInMissingDates()
UNUserNotificationCenter.current().delegate = self