The watch app's permission-denied state was a computed property reading AVAudioApplication.shared.recordPermission — external state Observation cannot track — so after a denied prompt the UI never flipped to the 'Microphone access is off' screen and the record button silently did nothing. Store the denied flag as a tracked property instead, updated on every permission request. Also: log (instead of swallow) recorder start failures, drop phantom recordings when no file was written (the watch simulator has no audio input device), sweep orphaned metadata sidecars on reconcile, and add a DEBUG-only 'autorecord' launch argument for CLI-driven testing. Claude-Session: https://claude.ai/code/session_01GKfAiKiQKLDTmbiGva4FGE
30 lines
856 B
Swift
30 lines
856 B
Swift
import SwiftUI
|
|
|
|
@main
|
|
struct NotesWatchApp: App {
|
|
@State private var services = WatchAppServices()
|
|
@Environment(\.scenePhase) private var scenePhase
|
|
|
|
var body: some Scene {
|
|
WindowGroup {
|
|
NavigationStack {
|
|
RecordView()
|
|
}
|
|
.environment(services)
|
|
.task {
|
|
services.bootstrap()
|
|
#if DEBUG
|
|
// CLI-driven repro of the record button (simctl launch … autorecord).
|
|
if ProcessInfo.processInfo.arguments.contains("autorecord") {
|
|
await services.startRecording()
|
|
}
|
|
#endif
|
|
}
|
|
.onOpenURL { url in services.handleDeepLink(url) }
|
|
}
|
|
.onChange(of: scenePhase) { _, phase in
|
|
services.handleScenePhase(phase)
|
|
}
|
|
}
|
|
}
|