2024-06-19 15:15:27 +00:00
|
|
|
import Combine
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
@main
|
2024-09-03 15:13:58 +00:00
|
|
|
@MainActor
|
2024-10-31 11:43:16 +00:00
|
|
|
struct AnotherIMApp: App {
|
2024-10-22 17:57:50 +00:00
|
|
|
@Environment(\.scenePhase) private var scenePhase
|
2024-09-03 15:13:58 +00:00
|
|
|
private let clientsStore = ClientsStore.shared
|
|
|
|
|
|
|
|
init() {
|
|
|
|
// There's a bug on iOS 17 where sheet may not load with large title, even if modifiers are set, which causes some tests to fail
|
|
|
|
// https://stackoverflow.com/questions/77253122/swiftui-navigationstack-title-loads-inline-instead-of-large-when-sheet-is-pres
|
|
|
|
UINavigationBar.appearance().prefersLargeTitles = true
|
|
|
|
}
|
|
|
|
|
2024-06-19 15:15:27 +00:00
|
|
|
var body: some Scene {
|
|
|
|
WindowGroup {
|
2024-09-03 15:13:58 +00:00
|
|
|
RootView()
|
|
|
|
.environmentObject(clientsStore)
|
2024-10-22 17:57:50 +00:00
|
|
|
.onChange(of: scenePhase) { phase in
|
|
|
|
switch phase {
|
|
|
|
case .active:
|
|
|
|
clientsStore.reconnectOnActiveState()
|
|
|
|
|
|
|
|
case .inactive, .background:
|
|
|
|
fallthrough
|
|
|
|
|
|
|
|
@unknown default:
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
2024-06-19 15:15:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|