diff --git a/Nextcloud Cookbook iOS Client.xcodeproj/project.xcworkspace/xcuserdata/vincie.xcuserdatad/UserInterfaceState.xcuserstate b/Nextcloud Cookbook iOS Client.xcodeproj/project.xcworkspace/xcuserdata/vincie.xcuserdatad/UserInterfaceState.xcuserstate index 323afc3..072e5e8 100644 Binary files a/Nextcloud Cookbook iOS Client.xcodeproj/project.xcworkspace/xcuserdata/vincie.xcuserdatad/UserInterfaceState.xcuserstate and b/Nextcloud Cookbook iOS Client.xcodeproj/project.xcworkspace/xcuserdata/vincie.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Nextcloud Cookbook iOS Client/Data/UserSettings.swift b/Nextcloud Cookbook iOS Client/Data/UserSettings.swift index e5b9245..0543b7a 100644 --- a/Nextcloud Cookbook iOS Client/Data/UserSettings.swift +++ b/Nextcloud Cookbook iOS Client/Data/UserSettings.swift @@ -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 != "" { diff --git a/Nextcloud Cookbook iOS Client/Localizable.xcstrings b/Nextcloud Cookbook iOS Client/Localizable.xcstrings index 7e37892..4dc9b12 100644 --- a/Nextcloud Cookbook iOS Client/Localizable.xcstrings +++ b/Nextcloud Cookbook iOS Client/Localizable.xcstrings @@ -293,6 +293,28 @@ } } }, + "A simple-to-use PDF builder for Swift. Used for generating recipe PDF documents." : { + "localizations" : { + "de" : { + "stringUnit" : { + "state" : "translated", + "value" : "" + } + }, + "es" : { + "stringUnit" : { + "state" : "translated", + "value" : "" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "" + } + } + } + }, "About" : { "localizations" : { "de" : { @@ -315,6 +337,28 @@ } } }, + "Acknowledgements" : { + "localizations" : { + "de" : { + "stringUnit" : { + "state" : "translated", + "value" : "Verwendete Bibliotheken" + } + }, + "es" : { + "stringUnit" : { + "state" : "translated", + "value" : "Reconocimientos" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Remerciements" + } + } + } + }, "Action delayed" : { "localizations" : { "de" : { @@ -381,6 +425,28 @@ } } }, + "An HTML parsing and web scraping library for Swift. Used for importing schema.org recipes from websites." : { + "localizations" : { + "de" : { + "stringUnit" : { + "state" : "translated", + "value" : "" + } + }, + "es" : { + "stringUnit" : { + "state" : "translated", + "value" : "" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "" + } + } + } + }, "An unknown error occured." : { "localizations" : { "de" : { @@ -1443,6 +1509,28 @@ } } }, + "Keep screen awake when viewing recipes" : { + "localizations" : { + "de" : { + "stringUnit" : { + "state" : "translated", + "value" : "Automatische Bildschirmsperre beim Ansehen von Rezepten deaktivieren" + } + }, + "es" : { + "stringUnit" : { + "state" : "translated", + "value" : "Mantener la pantalla encendida al ver recetas" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Garder l'écran allumé lors de la consultation des recettes" + } + } + } + }, "Keywords" : { "localizations" : { "de" : { @@ -2565,6 +2653,28 @@ } } }, + "SwiftSoup" : { + "localizations" : { + "de" : { + "stringUnit" : { + "state" : "translated", + "value" : "" + } + }, + "es" : { + "stringUnit" : { + "state" : "translated", + "value" : "" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "" + } + } + } + }, "Thank you for downloading" : { "localizations" : { "de" : { @@ -2829,6 +2939,28 @@ } } }, + "TPPDF" : { + "localizations" : { + "de" : { + "stringUnit" : { + "state" : "translated", + "value" : "" + } + }, + "es" : { + "stringUnit" : { + "state" : "translated", + "value" : "" + } + }, + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "" + } + } + } + }, "Unable to complete action." : { "localizations" : { "de" : { diff --git a/Nextcloud Cookbook iOS Client/Views/RecipeDetailView.swift b/Nextcloud Cookbook iOS Client/Views/RecipeDetailView.swift index aa3f51e..b8d8c2e 100644 --- a/Nextcloud Cookbook iOS Client/Views/RecipeDetailView.swift +++ b/Nextcloud Cookbook iOS Client/Views/RecipeDetailView.swift @@ -157,6 +157,14 @@ struct RecipeDetailView: View { fetchMode: UserSettings.shared.storeImages ? .preferServer : .onlyServer ) } + .onAppear { + if UserSettings.shared.keepScreenAwake { + UIApplication.shared.isIdleTimerDisabled = true + } + } + .onDisappear { + UIApplication.shared.isIdleTimerDisabled = false + } } } diff --git a/Nextcloud Cookbook iOS Client/Views/SettingsView.swift b/Nextcloud Cookbook iOS Client/Views/SettingsView.swift index a01a156..9314a07 100644 --- a/Nextcloud Cookbook iOS Client/Views/SettingsView.swift +++ b/Nextcloud Cookbook iOS Client/Views/SettingsView.swift @@ -48,6 +48,12 @@ struct SettingsView: View { Text("Configure which sections in your recipes are expanded by default.") } + Section { + Toggle(isOn: $userSettings.keepScreenAwake) { + Text("Keep screen awake when viewing recipes") + } + } + Section { Toggle(isOn: $userSettings.storeRecipes) { Text("Offline recipes") @@ -112,6 +118,23 @@ struct SettingsView: View { } footer: { Text("Deleting local data will not affect the recipe data stored on your server.") } + + Section(header: Text("Acknowledgements")) { + VStack(alignment: .leading) { + if let url = URL(string: "https://github.com/scinfu/SwiftSoup") { + Link("SwiftSoup", destination: url) + .font(.headline) + Text("An HTML parsing and web scraping library for Swift. Used for importing schema.org recipes from websites.") + } + } + VStack(alignment: .leading) { + if let url = URL(string: "https://github.com/techprimate/TPPDF") { + Link("TPPDF", destination: url) + .font(.headline) + Text("A simple-to-use PDF builder for Swift. Used for generating recipe PDF documents.") + } + } + } } .navigationTitle("Settings") .alert(alertType.getTitle(), isPresented: $showAlert) {