Stabilize iOS/watchOS/tvOS apps and add cross-platform audit remediation

This commit is contained in:
Trey t
2026-02-11 12:54:40 -06:00
parent e40275e694
commit acce712261
77 changed files with 2940 additions and 765 deletions

View File

@@ -8,6 +8,7 @@
import SwiftUI
import Combine
import AVKit
import SharedCore
struct Constants {
@@ -24,21 +25,24 @@ struct Werkout_iosApp: App {
let persistenceController = PersistenceController.shared
@State var additionalWindows: [UIWindow] = []
@State private var tabSelection = 1
@Environment(\.scenePhase) private var scenePhase
let pub = NotificationCenter.default.publisher(for: NSNotification.Name("CreatedNewWorkout"))
let pub = NotificationCenter.default.publisher(for: AppNotifications.createdNewWorkout)
private var screenDidConnectPublisher: AnyPublisher<UIScreen, Never> {
NotificationCenter.default
.publisher(for: UIScreen.didConnectNotification)
.compactMap { $0.object as? UIScreen }
.publisher(for: UIScene.willConnectNotification)
.compactMap { ($0.object as? UIWindowScene)?.screen }
.filter { $0 != UIScreen.main }
.receive(on: RunLoop.main)
.eraseToAnyPublisher()
}
private var screenDidDisconnectPublisher: AnyPublisher<UIScreen, Never> {
NotificationCenter.default
.publisher(for: UIScreen.didDisconnectNotification)
.compactMap { $0.object as? UIScreen }
.publisher(for: UIScene.didDisconnectNotification)
.compactMap { ($0.object as? UIWindowScene)?.screen }
.filter { $0 != UIScreen.main }
.receive(on: RunLoop.main)
.eraseToAnyPublisher()
}
@@ -74,10 +78,13 @@ struct Werkout_iosApp: App {
}
.accentColor(Color("appColor"))
.onAppear{
UIApplication.shared.isIdleTimerDisabled = true
UIApplication.shared.isIdleTimerDisabled = scenePhase == .active
_ = try? AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playback, mode: .default, options: .mixWithOthers)
// UserStore.shared.logout()
}
.onChange(of: scenePhase) { phase in
UIApplication.shared.isIdleTimerDisabled = phase == .active
}
.onReceive(pub) { (output) in
self.tabSelection = 1
}