#if os(iOS)
import UIKit

/// iOS application delegate. Its sole job is to stand up the WatchConnectivity
/// receiver in `didFinishLaunching` — which runs even on a background launch the
/// system makes purely to deliver a watch file transfer, unlike a SwiftUI
/// `.task` that may not run until the UI is built.
///
/// The receiver is created and its `WCSession` activated here immediately, so a
/// delivered recording is staged to the inbox even before `AppServices` exists.
/// `NotesApp` wires the receiver's `syncEngine` in once services are ready, so a
/// live delivery can drain right away; a delivery that arrives before then is
/// drained on the next foreground connect.
@MainActor
final class AppDelegate: NSObject, UIApplicationDelegate {
    let watchReceiver = PhoneWatchReceiver()

    func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
    ) -> Bool {
        watchReceiver.activate()
        return true
    }
}
#endif
