]>
Commit | Line | Data |
---|---|---|
c9b9e1d6 RBR |
1 | import Foundation |
2 | ||
3 | struct CapturaSettings { | |
4 | static var frameRate: Int { | |
5 | UserDefaults.standard.integer(forKey: "frameRate") | |
6 | } | |
7 | ||
8 | static var outputFormats: OutputFormatSetting { | |
9 | OutputFormatSetting(rawValue: UserDefaults.standard.integer(forKey: "outputFormats")) ?? .all | |
10 | } | |
11 | ||
12 | static var shouldSaveMp4: Bool { | |
533cd932 | 13 | outputFormats.shouldSaveMp4() || (shouldUseBackend && shouldUploadMp4) |
c9b9e1d6 RBR |
14 | } |
15 | ||
16 | static var shouldSaveGif: Bool { | |
533cd932 | 17 | outputFormats.shouldSaveGif() || (shouldUseBackend && shouldUploadGif) |
c9b9e1d6 RBR |
18 | } |
19 | ||
533cd932 RBR |
20 | static var shouldUploadGif: Bool { |
21 | backendFormat.shouldSaveGif() | |
22 | } | |
c9b9e1d6 | 23 | |
533cd932 RBR |
24 | static var shouldUploadMp4: Bool { |
25 | backendFormat.shouldSaveMp4() | |
26 | } | |
27 | ||
28 | static var shouldUseBackend: Bool { | |
29 | backend != nil | |
30 | } | |
31 | ||
32 | static var backend: URL? { | |
33 | if let url = UserDefaults.standard.string(forKey: "backendUrl") { | |
34 | return URL(string: url) | |
c9b9e1d6 | 35 | } |
533cd932 RBR |
36 | return nil |
37 | } | |
38 | ||
39 | static var backendFormat: OutputFormatSetting { | |
40 | OutputFormatSetting(rawValue: UserDefaults.standard.integer(forKey: "backendFormat")) ?? .all | |
41 | } | |
42 | ||
43 | static var shouldKeepLocalFiles: Bool { | |
44 | UserDefaults.standard.bool(forKey: "keepFiles") | |
c9b9e1d6 RBR |
45 | } |
46 | } |