import SwiftUI @main struct MusicBridgeApp: App { @StateObject private var store = PreviewSupport.makeStore() @StateObject private var liveActivity = LiveActivityManager() @Environment(\.scenePhase) private var phase var body: some Scene { WindowGroup { Group { if PreviewSupport.liveCard, let state = store.state { ScrollView { VStack(spacing: 24) { Text("Live Activity · предпросмотр").font(.headline) MusicActivityCard(state: LiveActivityManager.content(state), stale: false) .background(Color(.secondarySystemBackground), in: RoundedRectangle(cornerRadius: 24)) MusicActivityCard(state: LiveActivityManager.content(state), stale: true) .background(Color(.secondarySystemBackground), in: RoundedRectangle(cornerRadius: 24)) }.padding() } } else { ContentView(store: store, liveActivity: liveActivity) } } .dynamicTypeSize(PreviewSupport.largeText ? DynamicTypeSize.accessibility2...DynamicTypeSize.accessibility2 : DynamicTypeSize.xSmall...DynamicTypeSize.accessibility5) .onOpenURL { if $0.absoluteString != "musicbridge://player" { store.importInvitation($0.absoluteString) } } .task { store.liveActivity = liveActivity if !PreviewSupport.enabled { store.setActive(phase == .active) } } .onChange(of: phase) { _, value in if !PreviewSupport.enabled { store.setActive(value == .active) } } } } }