Skip to content

Commit

Permalink
πŸ”§ Edit 데이터 νŒ¨μ‹± μ—λŸ¬ κ³ μΉ˜λŠ” 쀑..
Browse files Browse the repository at this point in the history
  • Loading branch information
anyukyung committed Nov 30, 2023
1 parent 4638a59 commit 68faf3d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion iOS/Layover/Layover/Scenes/EditVideo/EditVideoModels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ enum EditVideoModels {

enum FetchVideo {
struct Request {
let editedVideoURL: URL?
var editedVideoURL: URL?
var videoRange: ClosedRange<Double> = 3.0...60.0
}
struct Response {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ final class EditVideoViewController: BaseViewController {

override func viewDidLoad() {
super.viewDidLoad()
interactor?.fetchVideo(request: Models.FetchVideo.Request())
interactor?.fetchVideo(request: Models.FetchVideo.Request(editedVideoURL: nil))
}

override func viewWillDisappear(_ animated: Bool) {
Expand Down
10 changes: 6 additions & 4 deletions iOS/Layover/Layover/Workers/VideoFileWorker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import Foundation
import OSLog

protocol VideoFileWorkerProtocol {
func copyToNewURL(at videoURL: URL) -> URL?
Expand All @@ -25,7 +26,7 @@ final class VideoFileWorker: VideoFileWorkerProtocol {

init(fileManager: FileManager = FileManager.default,
directoryPath: String = "layover",
fileName: String = "\(Date().timeIntervalSince1970)") {
fileName: String = "\(Int(Date().timeIntervalSince1970))") {
self.fileManager = fileManager
self.directoryPath = directoryPath
self.fileName = fileName
Expand All @@ -35,16 +36,17 @@ final class VideoFileWorker: VideoFileWorkerProtocol {
// MARK: - Methods

func copyToNewURL(at videoURL: URL) -> URL? {
let documentsURL = FileManager.default.temporaryDirectory
let fileName = "\(directoryPath)/\(directoryPath).\(videoURL.pathExtension)"
let newURL = documentsURL.appending(path: fileName)
let temporaryDirectory = FileManager.default.temporaryDirectory
let fileName = "\(directoryPath)/\(fileName).\(videoURL.pathExtension)"
let newURL = temporaryDirectory.appending(path: fileName)
do {
if fileManager.fileExists(atPath: newURL.path()) {
delete(at: newURL)
}
try FileManager.default.copyItem(at: videoURL as URL, to: newURL)
return newURL
} catch {
os_log(.error, log: .data, "%@", error.localizedDescription)
return nil
}
}
Expand Down

0 comments on commit 68faf3d

Please sign in to comment.