]> git.r.bdr.sh - rbdr/captura/blobdiff - Captura/Domain/CaptureSessionConfiguration.swift
Use tinted PDF for Icon
[rbdr/captura] / Captura / Domain / CaptureSessionConfiguration.swift
index 69c1ebf35fbf5a67a038c50ca9015c11d87a76f9..673db5f563f39200a06b38f19954e752b6c71aac 100644 (file)
@@ -6,7 +6,15 @@ struct CaptureSessionConfiguration {
   let backendFormat: OutputFormatSetting
   let backend: URL?
   let shouldKeepLocalFiles: Bool
-  
+  let x: Int?
+  let y: Int?
+  let width: Int?
+  let height: Int?
+  let preventMove: Bool
+  let preventResize: Bool
+  let autoStart: Bool
+  let maxLength: Int
+
   init(
     frameRate: Int? = nil,
     outputFormats: OutputFormatSetting? = nil,
@@ -19,24 +27,52 @@ struct CaptureSessionConfiguration {
     self.backendFormat = backendFormat ?? CapturaSettings.backendFormat
     self.backend = backend ?? CapturaSettings.backend
     self.shouldKeepLocalFiles = shouldKeepLocalFiles ?? CapturaSettings.shouldKeepLocalFiles
+    x = nil
+    y = nil
+    width = nil
+    height = nil
+    preventMove = false
+    preventResize = false
+    autoStart = false
+    maxLength = 300
+  }
+
+  init(from action: RecordAction) {
+    self.frameRate = action.fps ?? CapturaSettings.frameRate
+    self.outputFormats = action.outputs ?? CapturaSettings.outputFormats
+    self.backendFormat = action.backendOutput ?? CapturaSettings.backendFormat
+    if action.skipBackend {
+      self.backend = nil
+    } else {
+      self.backend = action.backend ?? CapturaSettings.backend
+    }
+    self.shouldKeepLocalFiles = action.keepLocalFiles ?? CapturaSettings.shouldKeepLocalFiles
+    self.x = action.x
+    self.y = action.y
+    self.width = action.width
+    self.height = action.height
+    preventMove = action.preventMove ?? false
+    preventResize = action.preventResize ?? false
+    autoStart = action.autoStart ?? false
+    maxLength = action.maxLength ?? 300
   }
-  
+
   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
   }