+ UserDefaults.standard.setValue(newValue?.absoluteString, forKey: "backendUrl")
+ }
+ }
+
+ static var backendFormat: OutputFormatSetting {
+ get {
+ OutputFormatSetting(rawValue: UserDefaults.standard.integer(forKey: "backendFormat")) ?? .gifOnly
+ }
+ set {
+ UserDefaults.standard.setValue(newValue.rawValue, forKey: "backendFormat")
+ }
+ }
+
+ static var shouldKeepLocalFiles: Bool {
+ get {
+ if UserDefaults.standard.object(forKey: "keepFiles") == nil {
+ return true
+ } else {
+ return UserDefaults.standard.bool(forKey: "keepFiles")
+ }
+ }
+ set {
+ UserDefaults.standard.set(newValue, forKey: "keepFiles")
+ }
+ }
+
+ static var shouldAllowURLAutomation: Bool {
+ get {
+ UserDefaults.standard.bool(forKey: "allowURLAutomation")
+ }
+ set {
+ UserDefaults.standard.setValue(newValue, forKey: "allowURLAutomation")
+ }
+ }
+
+ static func apply(_ config: ConfigureAction) {
+ if let fps = config.fps {
+ frameRate = fps
+ }
+ if let outputs = config.outputs {
+ outputFormats = outputs
+ }
+ if let newBackend = config.backend {
+ backend = newBackend
+ }
+ if let backendOutput = config.backendOutput {
+ backendFormat = backendOutput
+ }
+ if let keepLocalFiles = config.keepLocalFiles {
+ shouldKeepLocalFiles = keepLocalFiles