'Keep Screen Awake'-Setting, Acknowledge used libraries

This commit is contained in:
VincentMeilinger
2024-01-11 10:12:59 +01:00
parent eb3f11cd17
commit 772ee6b0e0
5 changed files with 170 additions and 0 deletions

View File

@@ -103,6 +103,12 @@ class UserSettings: ObservableObject {
}
}
@Published var keepScreenAwake: Bool {
didSet {
UserDefaults.standard.set(keepScreenAwake, forKey: "keepScreenAwake")
}
}
init() {
self.username = UserDefaults.standard.object(forKey: "username") as? String ?? ""
self.token = UserDefaults.standard.object(forKey: "token") as? String ?? ""
@@ -119,6 +125,7 @@ class UserSettings: ObservableObject {
self.expandNutritionSection = UserDefaults.standard.object(forKey: "expandNutritionSection") as? Bool ?? false
self.expandKeywordSection = UserDefaults.standard.object(forKey: "expandKeywordSection") as? Bool ?? false
self.expandInfoSection = UserDefaults.standard.object(forKey: "expandInfoSection") as? Bool ?? false
self.keepScreenAwake = UserDefaults.standard.object(forKey: "keepScreenAwake") as? Bool ?? true
if authString == "" {
if token != "" && username != "" {