LoopFollowApp.swift 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. // LoopFollow
  2. // LoopFollowApp.swift
  3. import SwiftUI
  4. @main
  5. struct LoopFollowApp: App {
  6. @UIApplicationDelegateAdaptor private var appDelegate: AppDelegate
  7. @ObservedObject private var storageReady = StorageReadiness.ready
  8. var body: some Scene {
  9. WindowGroup {
  10. // Gate the UI on storage readiness so nothing (bootstrap, telemetry
  11. // consent, onboarding) is built against a poisoned cache. True
  12. // synchronously on a normal launch; only false briefly while a BFU
  13. // background launch is foregrounded mid-hydration.
  14. if storageReady.value {
  15. MainTabView()
  16. .onOpenURL { url in
  17. guard url.scheme == AppGroupID.urlScheme, url.host == "la-tap" else { return }
  18. #if !targetEnvironment(macCatalyst)
  19. DispatchQueue.main.async {
  20. NotificationCenter.default.post(name: .liveActivityDidForeground, object: nil)
  21. }
  22. #endif
  23. }
  24. } else {
  25. StorageLoadingView()
  26. }
  27. }
  28. }
  29. }