SwiftUI port of the Android app under ios/, with CarPlay browse and Now Playing, Siri play-media intents, and a build-ipa.sh script that makes an unsigned IPA for sideloading. README gets an iOS section and the vibecoded disclaimer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
43 lines
1.5 KiB
Swift
43 lines
1.5 KiB
Swift
import AVFoundation
|
|
import Intents
|
|
import SwiftUI
|
|
import UIKit
|
|
|
|
final class AppDelegate: NSObject, UIApplicationDelegate {
|
|
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
|
|
try? AVAudioSession.sharedInstance().setCategory(.playback, mode: .default, policy: .longFormAudio)
|
|
MainActor.assumeIsolated { _ = AppGraph.shared }
|
|
return true
|
|
}
|
|
|
|
/// Phone windows go to SwiftUI; CarPlay gets its own scene delegate.
|
|
func application(_ application: UIApplication, configurationForConnecting session: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
|
|
if session.role == .carTemplateApplication {
|
|
let c = UISceneConfiguration(name: "CarPlay", sessionRole: session.role)
|
|
c.delegateClass = CarPlayScene.self
|
|
return c
|
|
}
|
|
return UISceneConfiguration(name: "Phone", sessionRole: session.role)
|
|
}
|
|
|
|
/// Siri: "Play <album> on Stemify".
|
|
func application(_ application: UIApplication, handlerFor intent: INIntent) -> Any? {
|
|
intent is INPlayMediaIntent ? PlayMediaHandler() : nil
|
|
}
|
|
}
|
|
|
|
@main
|
|
struct StemifyApp: App {
|
|
@UIApplicationDelegateAdaptor(AppDelegate.self) private var delegate
|
|
@Environment(\.scenePhase) private var phase
|
|
|
|
var body: some Scene {
|
|
WindowGroup {
|
|
RootView()
|
|
}
|
|
.onChange(of: phase) { _, p in
|
|
if p == .active { AppGraph.shared.eq.refreshRoute() }
|
|
}
|
|
}
|
|
}
|