display(visionOS): disable background auto-suspend on visionOS
The auto-suspend can trigger any time user does not focus on view.
This commit is contained in:
parent
689367a9c3
commit
9a871c0c7d
|
@ -25,6 +25,8 @@
|
|||
<array>
|
||||
<string>iOS-Remote</string>
|
||||
</array>
|
||||
<key>Platform</key>
|
||||
<string>iOS</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Type</key>
|
||||
|
@ -35,6 +37,8 @@
|
|||
<string>AutosaveBackground</string>
|
||||
<key>DefaultValue</key>
|
||||
<true/>
|
||||
<key>Platform</key>
|
||||
<string>iOS</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Type</key>
|
||||
|
|
|
@ -499,6 +499,7 @@ extension VMSessionState {
|
|||
}
|
||||
|
||||
func didEnterBackground() {
|
||||
#if !os(visionOS)
|
||||
logger.info("Entering background")
|
||||
let shouldAutosaveBackground = UserDefaults.standard.bool(forKey: "AutosaveBackground")
|
||||
if shouldAutosaveBackground && vmState == .started {
|
||||
|
@ -521,14 +522,17 @@ extension VMSessionState {
|
|||
task = .invalid
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
func didEnterForeground() {
|
||||
#if !os(visionOS)
|
||||
logger.info("Entering foreground!")
|
||||
if (hasAutosave && vmState == .started) {
|
||||
logger.info("Deleting snapshot")
|
||||
vm.requestVmDeleteState()
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue