X-Git-Url: https://git.r.bdr.sh/rbdr/captura/blobdiff_plain/ba17de891507da74fb07423803fd636a4457354c..3472041dfee0a6e8c8a29e949f239bae13e1a18f:/Captura/Data/CapturaSettings.swift?ds=sidebyside diff --git a/Captura/Data/CapturaSettings.swift b/Captura/Data/CapturaSettings.swift index 85368ea..578d17c 100644 --- a/Captura/Data/CapturaSettings.swift +++ b/Captura/Data/CapturaSettings.swift @@ -3,7 +3,11 @@ import Foundation struct CapturaSettings { static var frameRate: Int { get { - UserDefaults.standard.integer(forKey: "frameRate") + if UserDefaults.standard.object(forKey: "frameRate") == nil { + return 10 + } else { + return min(10, max(4, UserDefaults.standard.integer(forKey: "frameRate"))) + } } set { UserDefaults.standard.setValue(newValue, forKey: "frameRate") @@ -62,7 +66,11 @@ struct CapturaSettings { static var shouldKeepLocalFiles: Bool { get { - UserDefaults.standard.bool(forKey: "keepFiles") + if UserDefaults.standard.object(forKey: "keepFiles") == nil { + return true + } else { + return UserDefaults.standard.bool(forKey: "keepFiles") + } } set { UserDefaults.standard.set(newValue, forKey: "keepFiles") @@ -70,7 +78,12 @@ struct CapturaSettings { } static var shouldAllowURLAutomation: Bool { - UserDefaults.standard.bool(forKey: "allowURLAutomation") + get { + UserDefaults.standard.bool(forKey: "allowURLAutomation") + } + set { + UserDefaults.standard.setValue(newValue, forKey: "allowURLAutomation") + } } static func apply(_ config: ConfigureAction) {