Send app to background in OrganizerView handler
Keep handler in a single place.
This commit is contained in:
parent
781291940f
commit
2c5f3d0bf0
|
@ -30,8 +30,6 @@ import PassepartoutLibrary
|
|||
struct PassepartoutApp: App {
|
||||
@UIApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate
|
||||
|
||||
@Environment(\.scenePhase) private var scenePhase
|
||||
|
||||
@SceneBuilder var body: some Scene {
|
||||
WindowGroup {
|
||||
MainView()
|
||||
|
@ -44,18 +42,6 @@ struct PassepartoutApp: App {
|
|||
.onIntentActivity(IntentDispatcher.trustCurrentNetwork)
|
||||
.onIntentActivity(IntentDispatcher.untrustCellularNetwork)
|
||||
.onIntentActivity(IntentDispatcher.untrustCurrentNetwork)
|
||||
}.onChange(of: scenePhase, perform: onScenePhase)
|
||||
}
|
||||
|
||||
private func onScenePhase(_ scenePhase: ScenePhase) {
|
||||
switch scenePhase {
|
||||
case .background:
|
||||
#if targetEnvironment(macCatalyst)
|
||||
MacBundle.shared.utils.sendAppToBackground()
|
||||
#endif
|
||||
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,6 +94,9 @@ extension OrganizerView {
|
|||
|
||||
case .background:
|
||||
persist()
|
||||
#if targetEnvironment(macCatalyst)
|
||||
MacBundle.shared.utils.sendAppToBackground()
|
||||
#endif
|
||||
|
||||
default:
|
||||
break
|
||||
|
|
Loading…
Reference in New Issue