X-Git-Url: https://git.r.bdr.sh/rbdr/captura/blobdiff_plain/5802c153cae64142d84e3cd5f762939501ee7e53..505c1e620497828ffb914e05dd76d9ab124f144a:/Captura/Data/CapturaSettings.swift?ds=sidebyside diff --git a/Captura/Data/CapturaSettings.swift b/Captura/Data/CapturaSettings.swift index c8af096..bfaa1ce 100644 --- a/Captura/Data/CapturaSettings.swift +++ b/Captura/Data/CapturaSettings.swift @@ -29,7 +29,7 @@ struct CapturaSettings { UserDefaults.standard.setValue(newValue, forKey: "frameRate") } } - + static var outputFormats: OutputFormatSetting { get { OutputFormatSetting(rawValue: UserDefaults.standard.integer(forKey: "outputFormats")) ?? .all @@ -38,27 +38,27 @@ struct CapturaSettings { UserDefaults.standard.setValue(newValue.rawValue, forKey: "outputFormats") } } - + static var shouldSaveMp4: Bool { outputFormats.shouldSaveMp4() || (shouldUseBackend && shouldUploadMp4) } - + static var shouldSaveGif: Bool { outputFormats.shouldSaveGif() || (shouldUseBackend && shouldUploadGif) } - + static var shouldUploadGif: Bool { backendFormat.shouldSaveGif() } - + static var shouldUploadMp4: Bool { backendFormat.shouldSaveMp4() } - + static var shouldUseBackend: Bool { backend != nil } - + static var backend: URL? { get { if let url = UserDefaults.standard.string(forKey: "backendUrl") { @@ -70,16 +70,17 @@ struct CapturaSettings { UserDefaults.standard.setValue(newValue?.absoluteString, forKey: "backendUrl") } } - + static var backendFormat: OutputFormatSetting { get { - OutputFormatSetting(rawValue: UserDefaults.standard.integer(forKey: "backendFormat")) ?? .gifOnly + 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 { @@ -92,7 +93,7 @@ struct CapturaSettings { UserDefaults.standard.set(newValue, forKey: "keepFiles") } } - + static var shouldAllowURLAutomation: Bool { get { UserDefaults.standard.bool(forKey: "allowURLAutomation") @@ -101,7 +102,7 @@ struct CapturaSettings { UserDefaults.standard.setValue(newValue, forKey: "allowURLAutomation") } } - + static func apply(_ config: ConfigureAction) { if let fps = config.fps { frameRate = fps