diff options
| author | Ruben Beltran del Rio <ruben@unlimited.pizza> | 2023-07-31 16:58:57 +0200 |
|---|---|---|
| committer | Ruben Beltran del Rio <ruben@unlimited.pizza> | 2023-07-31 16:58:57 +0200 |
| commit | ba17de891507da74fb07423803fd636a4457354c (patch) | |
| tree | bdc75cff26dfce9bb67679e48ce09cc41817b506 /Captura/Domain/CaptureSessionConfiguration.swift | |
| parent | 533cd932281300fb444c07e80f81fc683a410b60 (diff) | |
Allow URL configuration
Diffstat (limited to 'Captura/Domain/CaptureSessionConfiguration.swift')
| -rw-r--r-- | Captura/Domain/CaptureSessionConfiguration.swift | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/Captura/Domain/CaptureSessionConfiguration.swift b/Captura/Domain/CaptureSessionConfiguration.swift new file mode 100644 index 0000000..69c1ebf --- /dev/null +++ b/Captura/Domain/CaptureSessionConfiguration.swift @@ -0,0 +1,43 @@ +import Foundation + +struct CaptureSessionConfiguration { + let frameRate: Int + let outputFormats: OutputFormatSetting + let backendFormat: OutputFormatSetting + let backend: URL? + let shouldKeepLocalFiles: Bool + + init( + frameRate: Int? = nil, + outputFormats: OutputFormatSetting? = nil, + backendFormat: OutputFormatSetting? = nil, + backend: URL? = nil, + shouldKeepLocalFiles: Bool? = nil + ) { + self.frameRate = frameRate ?? CapturaSettings.frameRate + self.outputFormats = outputFormats ?? CapturaSettings.outputFormats + self.backendFormat = backendFormat ?? CapturaSettings.backendFormat + self.backend = backend ?? CapturaSettings.backend + self.shouldKeepLocalFiles = shouldKeepLocalFiles ?? CapturaSettings.shouldKeepLocalFiles + } + + var shouldSaveMp4: Bool { + outputFormats.shouldSaveMp4() || (shouldUseBackend && shouldUploadMp4) + } + + var shouldSaveGif: Bool { + outputFormats.shouldSaveGif() || (shouldUseBackend && shouldUploadGif) + } + + var shouldUploadGif: Bool { + backendFormat.shouldSaveGif() + } + + var shouldUploadMp4: Bool { + backendFormat.shouldSaveMp4() + } + + var shouldUseBackend: Bool { + backend != nil + } +} |