Skip to content

Commit

Permalink
Refactor out filename generators
Browse files Browse the repository at this point in the history
  • Loading branch information
dragermrb committed Oct 29, 2021
1 parent 0612750 commit 1d48c3a
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions ios/Plugin/VideoEditorPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,27 +91,15 @@ public class VideoEditorPlugin: CAPPlugin {
}

func getDestVideoUrl() -> URL {
var url: URL
var counter = 0;

repeat {
counter += 1
url = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("vid-\(counter).mp4")
} while FileManager.default.fileExists(atPath: url.path)

return url
return URL(fileURLWithPath: NSTemporaryDirectory())
.appendingPathComponent(NSUUID().uuidString)
.appendingPathExtension("mp4")
}

func getDestImageUrl() -> URL {
var url: URL
var counter = 0;

repeat {
counter += 1
url = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("th-\(counter).jpg")
} while FileManager.default.fileExists(atPath: url.path)

return url
return URL(fileURLWithPath: NSTemporaryDirectory())
.appendingPathComponent(NSUUID().uuidString)
.appendingPathExtension("jpg")
}

func createMediaFile(url: URL) -> JSObject {
Expand Down

0 comments on commit 1d48c3a

Please sign in to comment.