This commit is contained in:
2025-07-19 17:43:32 -04:00
parent 2ef340e5c8
commit 33b88cb8f0
2 changed files with 18 additions and 4 deletions

View File

@ -263,8 +263,8 @@
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@ -294,8 +294,8 @@
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",

View File

@ -12,9 +12,12 @@ import SwiftUI
import SwiftData
import CloudKit
import CoreData
import UIKit
@main
struct WorkoutsApp: App {
// Control whether to prevent device auto-lock
@State private var preventAutoLock: Bool = true
let container: ModelContainer
@State private var cloudKitObserver: NSObjectProtocol?
@ -23,6 +26,9 @@ struct WorkoutsApp: App {
// Set up CloudKit notification observation
setupCloudKitObservation()
// Disable screen auto-lock
UIApplication.shared.isIdleTimerDisabled = true
}
private func setupCloudKitObservation() {
@ -61,6 +67,14 @@ struct WorkoutsApp: App {
var body: some Scene {
WindowGroup {
ContentView()
.onAppear {
// Ensure auto-lock is disabled when app appears
UIApplication.shared.isIdleTimerDisabled = preventAutoLock
}
.onDisappear {
// Re-enable auto-lock when app disappears
UIApplication.shared.isIdleTimerDisabled = false
}
}
.modelContainer(container)
}