Skip to content

Commit

Permalink
πŸ”§ μ§€μ›ν•˜μ§€μ•ŠλŠ” 파일 μ—…λ‘œλ“œν•  경우 μ–ΌλŸΏ
Browse files Browse the repository at this point in the history
  • Loading branch information
anyukyung committed Dec 14, 2023
1 parent 3ef2b12 commit e1cab82
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
12 changes: 8 additions & 4 deletions iOS/Layover/Layover/Scenes/UploadPost/UploadPostInteractor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,14 @@ final class UploadPostInteractor: NSObject, UploadPostBusinessLogic, UploadPostD
try fileManager.removeItem(at: url)
}
guard let videoURL else { return }
let exporter = AVAssetExportSession(asset: composition, presetName: AVAssetExportPresetPassthrough)
exporter?.outputURL = videoURL
exporter?.outputFileType = .from(videoURL)
await exporter?.export()
if let outputFileType = AVFileType.from(videoURL) {
let exporter = AVAssetExportSession(asset: composition, presetName: AVAssetExportPresetPassthrough)
exporter?.outputURL = videoURL
exporter?.outputFileType = .from(videoURL)
await exporter?.export()
} else {
presenter?.presentUnsupportedFormatAlert()
}
} catch {
os_log(.error, log: .data, "Failed to extract Video Without Audio with error: %@", error.localizedDescription)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ protocol UploadPostPresentationLogic {
func presentThumbnailImage(with response: UploadPostModels.FetchThumbnail.Response)
func presentCurrentAddress(with response: UploadPostModels.FetchCurrentAddress.Response)
func presentUploadButton(with response: UploadPostModels.CanUploadPost.Response)
// func presentUploadProgress(with response: UploadPostModels.UploadPost.Response)
func presentUnsupportedFormatAlert()
}

final class UploadPostPresenter: UploadPostPresentationLogic {
Expand Down Expand Up @@ -56,4 +56,7 @@ final class UploadPostPresenter: UploadPostPresentationLogic {
viewController?.displayUploadButton(viewModel: viewModel)
}

func presentUnsupportedFormatAlert() {
viewController?.displayUnsupportedFormatAlert()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ protocol UploadPostDisplayLogic: AnyObject {
func displayThumbnail(viewModel: UploadPostModels.FetchThumbnail.ViewModel)
func displayCurrentAddress(viewModel: UploadPostModels.FetchCurrentAddress.ViewModel)
func displayUploadButton(viewModel: UploadPostModels.CanUploadPost.ViewModel)
func displayUnsupportedFormatAlert()
}

final class UploadPostViewController: BaseViewController {
Expand Down Expand Up @@ -315,4 +316,9 @@ extension UploadPostViewController: UploadPostDisplayLogic {
uploadButton.isEnabled = viewModel.canUpload
}

func displayUnsupportedFormatAlert() {
router?.routeToBack()
Toast.shared.showToast(message: "μ§€μ›ν•˜μ§€ μ•ŠλŠ” 파일 ν˜•μ‹μ΄μ—μš” 😒")
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ final class VideoPickerManager: NSObject, PHPickerViewControllerDelegate {
if error != nil {
Task {
await MainActor.run {
Toast.shared.showToast(message: "μ§€μ›ν•˜μ§€ μ•ŠλŠ” λ™μ˜μƒ ν˜•μ‹μž…λ‹ˆλ‹€ T.T")
Toast.shared.showToast(message: "μ§€μ›ν•˜μ§€ μ•ŠλŠ” 파일 ν˜•μ‹μ΄μ—μš” 😒")
}
}
}
Expand Down

0 comments on commit e1cab82

Please sign in to comment.