From 9ac67a67f9d9ec9d5fdd13c0d8a1eaf6ca0eebe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Tue, 3 Dec 2024 04:22:41 +0900 Subject: [PATCH 01/38] =?UTF-8?q?chore:=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=EC=BD=94=EB=93=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/BookCover/View/BookCoverViewController.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/BookCover/View/BookCoverViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/BookCover/View/BookCoverViewController.swift index 5ebdbc4..73c2b8b 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/BookCover/View/BookCoverViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/BookCover/View/BookCoverViewController.swift @@ -367,7 +367,6 @@ extension BookCoverViewController { bookTitleTextField.addAction(titleAction, for: .editingChanged) let selectPhotoAction = UIAction { [weak self] _ in - // TODO: - 사진 접근 제어 추가 let albumViewModel = CustomAlbumViewModel() let customAlbumViewController = CustomAlbumViewController(viewModel: albumViewModel, mediaType: .image) self?.navigationController?.pushViewController(customAlbumViewController, animated: true) From c7158c090204fdbfdb4068f04504c79124c0fb47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Tue, 3 Dec 2024 17:26:26 +0900 Subject: [PATCH 02/38] =?UTF-8?q?feat:=20showErrorAlert=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Extensions/UIViewController+ErrorAlert.swift | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 MemorialHouse/MHPresentation/MHPresentation/Source/Extensions/UIViewController+ErrorAlert.swift diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/Extensions/UIViewController+ErrorAlert.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/Extensions/UIViewController+ErrorAlert.swift new file mode 100644 index 0000000..3b80ce0 --- /dev/null +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/Extensions/UIViewController+ErrorAlert.swift @@ -0,0 +1,15 @@ +import UIKit + +extension UIViewController { + func showErrorAlert(with errorMessage: String) { + let alertController = UIAlertController( + title: "에러", + message: errorMessage, + preferredStyle: .alert + ) + let okAction = UIAlertAction(title: "확인", style: .default) + alertController.addAction(okAction) + + present(alertController, animated: true) + } +} From b2caff3b0428df29e14bb0a6b5c17241d5141a57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Tue, 3 Dec 2024 17:27:05 +0900 Subject: [PATCH 03/38] =?UTF-8?q?refactor:=20showErrorAlert=EB=A1=9C=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=20=EB=B3=80=EA=B2=BD=20=EB=B0=8F=20=EC=A4=91?= =?UTF-8?q?=EB=B3=B5=EB=90=9C=20=EC=BD=94=EB=93=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Category/BookCategoryViewController.swift | 14 +------------- .../Source/Home/HomeViewController.swift | 14 +------------- .../Source/Register/RegisterViewController.swift | 16 ++-------------- 3 files changed, 4 insertions(+), 40 deletions(-) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/Category/BookCategoryViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/Category/BookCategoryViewController.swift index 23c9ea2..2b0325c 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/Category/BookCategoryViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/Category/BookCategoryViewController.swift @@ -67,23 +67,11 @@ final class BookCategoryViewController: UIViewController { case .createdCategory, .updatedCategory, .fetchCategories, .deletedCategory: self?.categoryTableView.reloadData() case .failed(let errorMessage): - self?.handleError(with: errorMessage) + self?.showErrorAlert(with: errorMessage) } }.store(in: &cancellables) } - private func handleError(with errorMessage: String) { - let alertController = UIAlertController( - title: "에러", - message: errorMessage, - preferredStyle: .alert - ) - let okAction = UIAlertAction(title: "확인", style: .default) - alertController.addAction(okAction) - - present(alertController, animated: true) - } - private func configureNavigationBar() { navigationController?.navigationBar.isHidden = false navigationController?.navigationBar.titleTextAttributes = [ diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/Home/HomeViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/Home/HomeViewController.swift index a80f08a..9ef594e 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/Home/HomeViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/Home/HomeViewController.swift @@ -102,7 +102,7 @@ public final class HomeViewController: UIViewController { case .reloadData: self.collectionView.reloadData() case .fetchedFailure(let errorMessage): - self.handleError(with: errorMessage) + self.showErrorAlert(with: errorMessage) } }.store(in: &cancellables) } @@ -114,18 +114,6 @@ public final class HomeViewController: UIViewController { collectionView.reloadData() } - private func handleError(with errorMessage: String) { - let alertController = UIAlertController( - title: "에러", - message: errorMessage, - preferredStyle: .alert - ) - let okAction = UIAlertAction(title: "확인", style: .default) - alertController.addAction(okAction) - - present(alertController, animated: true) - } - private func configureAddSubView() { view.addSubview(navigationBar) view.addSubview(currentCategoryLabel) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/Register/RegisterViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/Register/RegisterViewController.swift index 1462137..dfb2dd4 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/Register/RegisterViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/Register/RegisterViewController.swift @@ -103,7 +103,7 @@ public final class RegisterViewController: UIViewController { case .moveToHome: self?.moveHome() case .createFailure(let errorMessage): - self?.handleError(with: errorMessage) + self?.showErrorAlert(with: errorMessage) } }.store(in: &cancellables) } @@ -117,22 +117,10 @@ public final class RegisterViewController: UIViewController { navigationController?.viewControllers.removeFirst() } catch { MHLogger.error(error.localizedDescription) - handleError(with: "홈 화면으로 이동 중에 오류가 발생했습니다.") + showErrorAlert(with: "홈 화면으로 이동 중에 오류가 발생했습니다.") } } - private func handleError(with errorMessage: String) { - let alertController = UIAlertController( - title: "에러", - message: errorMessage, - preferredStyle: .alert - ) - let okAction = UIAlertAction(title: "확인", style: .default) - alertController.addAction(okAction) - - present(alertController, animated: true) - } - private func configureAddSubview() { view.addSubview(coverImageView) view.addSubview(registerTextLabel) From dd2db490f576e12b5d7dc37f21db622bceedf2ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Tue, 3 Dec 2024 17:27:57 +0900 Subject: [PATCH 04/38] =?UTF-8?q?feat:=20EditBook=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EB=B9=84=EB=94=94=EC=98=A4=20=EC=B6=94=EA=B0=80=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/CustomAlbumViewController.swift | 56 +++++++++++++++---- .../View/EditBookViewController.swift | 10 +++- 2 files changed, 53 insertions(+), 13 deletions(-) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/CustomAlbum/View/CustomAlbumViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/CustomAlbum/View/CustomAlbumViewController.swift index bebb11b..dde9404 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/CustomAlbum/View/CustomAlbumViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/CustomAlbum/View/CustomAlbumViewController.swift @@ -2,6 +2,7 @@ import MHCore import UIKit import Photos import Combine +import PhotosUI final class CustomAlbumViewController: UIViewController { // MARK: - UI Components @@ -23,11 +24,17 @@ final class CustomAlbumViewController: UIViewController { private let input = PassthroughSubject() private var cancellables = Set() private let mediaType: PHAssetMediaType + private let videoSelectCompletionHandler: ((URL) -> Void)? // MARK: - Initializer - init(viewModel: CustomAlbumViewModel, mediaType: PHAssetMediaType) { + init( + viewModel: CustomAlbumViewModel, + mediaType: PHAssetMediaType, + videoSelectCompletionHandler: ((URL) -> Void)? = nil + ) { self.viewModel = viewModel self.mediaType = mediaType + self.videoSelectCompletionHandler = videoSelectCompletionHandler super.init(nibName: nil, bundle: nil) } @@ -35,6 +42,7 @@ final class CustomAlbumViewController: UIViewController { required init?(coder: NSCoder) { self.viewModel = CustomAlbumViewModel() self.mediaType = .image + self.videoSelectCompletionHandler = { _ in } super.init(nibName: nil, bundle: nil) } @@ -209,13 +217,21 @@ final class CustomAlbumViewController: UIViewController { } } - private func moveToEditView(image: UIImage?, creationDate: Date) { + private func moveToEditPhotoView(image: UIImage?, creationDate: Date) { guard let viewModelFactory = try? DIContainer.shared.resolve(EditPhotoViewModelFactory.self) else { return } let editPhotoViewModel = viewModelFactory.make(creationDate: creationDate) let editPhotoViewController = EditPhotoViewController(viewModel: editPhotoViewModel) editPhotoViewController.setPhoto(image: image) self.navigationController?.pushViewController(editPhotoViewController, animated: true) } + + private func moveToEditVideoView(url: URL) { + let editVideoViewController = EditVideoViewController( + videoURL: url, + videoSelectCompletionHandler: videoSelectCompletionHandler + ) + self.navigationController?.pushViewController(editVideoViewController, animated: true) + } } // MARK: - UICollectionViewDelegate @@ -228,15 +244,31 @@ extension CustomAlbumViewController: UICollectionViewDelegate { self.checkCameraAuthorization() } else { guard let asset = viewModel.photoAsset?[indexPath.item - 1] else { return } - Task { - await LocalPhotoManager.shared.requestThumbnailImage(with: asset) { [weak self] image in - guard let self else { return } - if self.mediaType == .image { - moveToEditView(image: image, creationDate: asset.creationDate ?? .now) - } else { - // TODO: - 동영상 편집 뷰로 이동 - } - } + + if self.mediaType == .image { + handleImageSelection(with: asset) + } else { + handleVideoSelection(with: asset) + } + } + } + + private func handleImageSelection(with asset: PHAsset) { + Task { + await LocalPhotoManager.shared.requestThumbnailImage(with: asset) { [weak self] image in + guard let self = self, let image = image else { return } + self.moveToEditPhotoView(image: image, creationDate: asset.creationDate ?? .now) + } + } + } + + private func handleVideoSelection(with asset: PHAsset) { + Task { + if let videoURL = await LocalPhotoManager.shared.requestVideoURL(with: asset) { + MHLogger.info("\(#function) 비디오 URL: \(videoURL)") + self.moveToEditVideoView(url: videoURL) + } else { + self.showErrorAlert(with: "비디오 URL을 가져올 수 없습니다.") } } } @@ -284,7 +316,7 @@ extension CustomAlbumViewController: UIImagePickerControllerDelegate, UINavigati ) { dismiss(animated: true) let image = info[UIImagePickerController.InfoKey.originalImage] as? UIImage - moveToEditView(image: image, creationDate: .now) + moveToEditPhotoView(image: image, creationDate: .now) } } diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditBookViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditBookViewController.swift index 50c270b..76de310 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditBookViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditBookViewController.swift @@ -223,7 +223,15 @@ final class EditBookViewController: UIViewController { addImageButton.addAction(addImageAction, for: .touchUpInside) let addVideoAction = UIAction { [weak self] _ in - // TODO: - 비디오 추가 로직 + let albumViewModel = CustomAlbumViewModel() + let customAlbumViewController = CustomAlbumViewController( + viewModel: albumViewModel, + mediaType: .video + ) { url in + self?.input.send(.didAddMediaInURL(type: .video, url: url)) + } + + self?.navigationController?.pushViewController(customAlbumViewController, animated: true) } addVideoButton.addAction(addVideoAction, for: .touchUpInside) From 49b1b1dda9d6e7872843ef25035a999f70500e92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Tue, 3 Dec 2024 17:28:14 +0900 Subject: [PATCH 05/38] =?UTF-8?q?feat:=20LocalPhotoManager=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EB=B9=84=EB=94=94=EC=98=A4=20=EC=98=81=EC=83=81=20?= =?UTF-8?q?URL=20=EA=B0=80=EC=A0=B8=EC=98=A4=EB=8A=94=20=EB=A9=94=EC=86=8C?= =?UTF-8?q?=EB=93=9C=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModel/LocalPhotoManager.swift | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/CustomAlbum/ViewModel/LocalPhotoManager.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/CustomAlbum/ViewModel/LocalPhotoManager.swift index d36c42c..fb9fedc 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/CustomAlbum/ViewModel/LocalPhotoManager.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/CustomAlbum/ViewModel/LocalPhotoManager.swift @@ -30,4 +30,20 @@ actor LocalPhotoManager { Task { await completion(image) } }) } + + func requestVideoURL( + with asset: PHAsset + ) async -> URL? { + await withCheckedContinuation { continuation in + let options = PHVideoRequestOptions() + options.version = .current + imageManager.requestAVAsset(forVideo: asset, options: options) { avAsset, _, _ in + if let urlAsset = avAsset as? AVURLAsset { + continuation.resume(returning: urlAsset.url) + } else { + continuation.resume(returning: nil) + } + } + } + } } From 11178b69d46f4419fe6548d7a8dae03fa1308f32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Tue, 3 Dec 2024 17:28:25 +0900 Subject: [PATCH 06/38] =?UTF-8?q?feat:=20AVKit=EC=9D=84=20=EC=9D=B4?= =?UTF-8?q?=EC=9A=A9=ED=95=B4=EC=84=9C=20=EC=98=81=EC=83=81=20=EB=B3=B4?= =?UTF-8?q?=EC=97=AC=EC=A3=BC=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EditVideo/EditVideoViewController.swift | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 MemorialHouse/MHPresentation/MHPresentation/Source/EditVideo/EditVideoViewController.swift diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/EditVideo/EditVideoViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/EditVideo/EditVideoViewController.swift new file mode 100644 index 0000000..47b49f7 --- /dev/null +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/EditVideo/EditVideoViewController.swift @@ -0,0 +1,94 @@ +import UIKit +import MHCore +import AVKit + +final class EditVideoViewController: UIViewController { + // MARK: - Properties + private let videoURL: URL + private let completion: (URL) -> Void + + // MARK: Initializer + init(videoURL: URL, videoSelectCompletionHandler: @escaping (URL) -> Void) { + self.videoURL = videoURL + self.completion = videoSelectCompletionHandler + MHLogger.info("\(#function) 비디오 URL: \(videoURL)") + + super.init(nibName: nil, bundle: nil) + } + + required init?(coder: NSCoder) { + self.videoURL = URL(fileURLWithPath: "") + self.completion = { _ in } + + super.init(coder: coder) + } + + // MARK: - Life Cycle + override func viewDidLoad() { + super.viewDidLoad() + + setup() + configureAddSubView() + configureConstraints() + configureNavigationBar() + } + + // MARK: - Setup & Configuration + private func setup() { + view.backgroundColor = .baseBackground + } + + private func configureAddSubView() { + let player = AVPlayer(url: videoURL) + let playerViewController = AVPlayerViewController() + playerViewController.player = player + playerViewController.view.frame = view.frame + playerViewController.showsPlaybackControls = true + + addChild(playerViewController) + view.addSubview(playerViewController.view) + playerViewController.didMove(toParent: self) + } + + private func configureConstraints() { + + } + + private func configureNavigationBar() { + navigationController?.navigationBar.isHidden = false + navigationController?.navigationBar.titleTextAttributes = [ + .font: UIFont.ownglyphBerry(size: 17), + .foregroundColor: UIColor.black + ] + navigationItem.title = "동영상 편집" + + // 공통 스타일 정의 + let normalAttributes: [NSAttributedString.Key: Any] = [ + .font: UIFont.ownglyphBerry(size: 17), + .foregroundColor: UIColor.mhTitle + ] + let selectedAttributes: [NSAttributedString.Key: Any] = [ + .font: UIFont.ownglyphBerry(size: 17), + .foregroundColor: UIColor.mhTitle + ] + + // 좌측 편집 버튼 + let editButton = UIBarButtonItem( + title: "취소", + normal: normalAttributes, + selected: selectedAttributes + ) { [weak self] in + self?.navigationController?.popViewController(animated: true) + } + navigationItem.leftBarButtonItem = editButton + + // 우측 추가 버튼 + navigationItem.rightBarButtonItem = UIBarButtonItem( + title: "추가", + normal: normalAttributes, + selected: selectedAttributes + ) { [weak self] in + self?.completion(self?.videoURL ?? URL(fileURLWithPath: "")) + } + } +} From 28bdf86ccfa45fb07fcb2b37395901db65554f6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Tue, 3 Dec 2024 17:45:45 +0900 Subject: [PATCH 07/38] =?UTF-8?q?fix:=20Photo=20=EC=84=A0=ED=83=9D?= =?UTF-8?q?=EA=B3=BC=20completion=20=EA=B2=B9=EC=B9=98=EB=8A=94=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookCover/View/BookCoverViewController.swift | 3 ++- .../View/CustomAlbumViewController.swift | 16 +++++++++------- .../EditBook/View/EditBookViewController.swift | 9 +++++---- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/BookCover/View/BookCoverViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/BookCover/View/BookCoverViewController.swift index 97ad31f..287a824 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/BookCover/View/BookCoverViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/BookCover/View/BookCoverViewController.swift @@ -377,7 +377,8 @@ extension BookCoverViewController { let customAlbumViewController = CustomAlbumViewController( viewModel: albumViewModel, mediaType: .image, - mode: .bookCover + mode: .bookCover, + videoSelectCompletionHandler: nil ) { imageData, _, _ in self?.createInput.send(.changedBookImage(bookImage: imageData)) self?.modifyInput.send(.changedBookImage(bookImage: imageData)) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/CustomAlbum/View/CustomAlbumViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/CustomAlbum/View/CustomAlbumViewController.swift index a62f42c..2869f5d 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/CustomAlbum/View/CustomAlbumViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/CustomAlbum/View/CustomAlbumViewController.swift @@ -9,6 +9,7 @@ final class CustomAlbumViewController: UIViewController { case bookCover case editPage } + // MARK: - UI Components private lazy var albumCollectionView: UICollectionView = { let flowLayout = UICollectionViewFlowLayout() @@ -28,9 +29,9 @@ final class CustomAlbumViewController: UIViewController { private let input = PassthroughSubject() private var cancellables = Set() private let mediaType: PHAssetMediaType - private let videoSelectCompletionHandler: ((URL) -> Void)? private let mode: Mode - private let completionHandler: (_ imageData: Data, _ creationDate: Date?, _ caption: String?) -> Void + private let videoSelectCompletionHandler: ((URL) -> Void)? + private let photoSelectCompletionHandler: ((Data, Date?, String?) -> Void)? // MARK: - Initializer init( @@ -38,13 +39,13 @@ final class CustomAlbumViewController: UIViewController { mediaType: PHAssetMediaType, mode: Mode = .editPage, videoSelectCompletionHandler: ((URL) -> Void)? = nil, - completionHandler: @escaping (_ imageData: Data, _ creationDate: Date?, _ caption: String?) -> Void + photoSelectCompletionHandler: ((Data, Date?, String?) -> Void)? = nil ) { self.viewModel = viewModel self.mediaType = mediaType self.mode = mode self.videoSelectCompletionHandler = videoSelectCompletionHandler - self.completionHandler = completionHandler + self.photoSelectCompletionHandler = photoSelectCompletionHandler super.init(nibName: nil, bundle: nil) } @@ -54,7 +55,7 @@ final class CustomAlbumViewController: UIViewController { self.mediaType = .image self.mode = .bookCover self.videoSelectCompletionHandler = { _ in } - self.completionHandler = { _, _, _ in } + self.photoSelectCompletionHandler = { _, _, _ in } super.init(nibName: nil, bundle: nil) } @@ -229,17 +230,18 @@ final class CustomAlbumViewController: UIViewController { } } private func moveToEditPhotoView(image: UIImage?, creationDate: Date) { + guard let photoSelectCompletionHandler else { return } var editPhotoViewController: EditPhotoViewController switch mode { case .bookCover: editPhotoViewController = EditPhotoViewController( mode: .bookCover, - completionHandler: completionHandler + completionHandler: photoSelectCompletionHandler ) case .editPage: editPhotoViewController = EditPhotoViewController( mode: .editPage, - completionHandler: completionHandler + completionHandler: photoSelectCompletionHandler ) } editPhotoViewController.setPhoto(image: image) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditBookViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditBookViewController.swift index 76de310..ae3ac12 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditBookViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditBookViewController.swift @@ -226,10 +226,11 @@ final class EditBookViewController: UIViewController { let albumViewModel = CustomAlbumViewModel() let customAlbumViewController = CustomAlbumViewController( viewModel: albumViewModel, - mediaType: .video - ) { url in - self?.input.send(.didAddMediaInURL(type: .video, url: url)) - } + mediaType: .video, + videoSelectCompletionHandler: { url in + self?.input.send(.didAddMediaInURL(type: .video, url: url)) + } + ) self?.navigationController?.pushViewController(customAlbumViewController, animated: true) } From 29dce63c5b54dbc0835964cf7d7dc97e865f9739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Tue, 3 Dec 2024 17:46:05 +0900 Subject: [PATCH 08/38] =?UTF-8?q?fix:=20bookcover=EC=97=90=EC=84=9C=20dism?= =?UTF-8?q?iss,=20editPage=EC=97=90=EC=84=9C=20popVC=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CustomAlbum/View/CustomAlbumViewController.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/CustomAlbum/View/CustomAlbumViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/CustomAlbum/View/CustomAlbumViewController.swift index 2869f5d..33c4ab2 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/CustomAlbum/View/CustomAlbumViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/CustomAlbum/View/CustomAlbumViewController.swift @@ -122,7 +122,14 @@ final class CustomAlbumViewController: UIViewController { normal: normalAttributes, selected: selectedAttributes ) { [weak self] in - self?.dismiss(animated: true) + switch self?.mode { + case .bookCover: + self?.dismiss(animated: true) + case .editPage: + self?.navigationController?.popViewController(animated: true) + default: + break + } } } From 8b0d34941e33f3dade7dadad9956e8ffabfbdcb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Tue, 3 Dec 2024 17:48:19 +0900 Subject: [PATCH 09/38] =?UTF-8?q?chore:=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=EC=BD=94=EB=93=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MHData/MHData/Repository/LocalMediaRepository.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MemorialHouse/MHData/MHData/Repository/LocalMediaRepository.swift b/MemorialHouse/MHData/MHData/Repository/LocalMediaRepository.swift index efc45fb..d3292f8 100644 --- a/MemorialHouse/MHData/MHData/Repository/LocalMediaRepository.swift +++ b/MemorialHouse/MHData/MHData/Repository/LocalMediaRepository.swift @@ -4,7 +4,6 @@ import MHDomain import MHCore import AVFoundation -// TODO: nil이라면 바로 error를 return하도록 수정 public struct LocalMediaRepository: MediaRepository, Sendable { private let storage: FileStorage private let temporaryPath = "temp" // TODO: - 지워질 것임! @@ -26,6 +25,7 @@ public struct LocalMediaRepository: MediaRepository, Sendable { return await storage.create(at: path, fileName: fileName, data: data) } + public func create( media mediaDescription: MediaDescription, from: URL, From 180ddbb98ebb232ffccc445425700079c3dd4545 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Tue, 3 Dec 2024 18:10:37 +0900 Subject: [PATCH 10/38] =?UTF-8?q?fix:=20editBook=EC=97=90=EC=84=9C=20video?= =?UTF-8?q?=20=EC=97=85=EB=A1=9C=EB=93=9C=20=EC=8B=9C,=20=EB=8B=A4?= =?UTF-8?q?=EC=8B=9C=20Editbook=EC=9C=BC=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/EditVideo/EditVideoViewController.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/EditVideo/EditVideoViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/EditVideo/EditVideoViewController.swift index 47b49f7..c06183a 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/EditVideo/EditVideoViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/EditVideo/EditVideoViewController.swift @@ -89,6 +89,10 @@ final class EditVideoViewController: UIViewController { selected: selectedAttributes ) { [weak self] in self?.completion(self?.videoURL ?? URL(fileURLWithPath: "")) + if let navigationController = self?.navigationController { + navigationController.popViewController(animated: false) + navigationController.popViewController(animated: true) + } } } } From 3ec4f561e12b7687d20acc8a51ca9c18af095f06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Tue, 3 Dec 2024 20:20:46 +0900 Subject: [PATCH 11/38] =?UTF-8?q?feat:=20=EB=8F=99=EC=98=81=EC=83=81?= =?UTF-8?q?=EC=9D=84=20=EB=B3=B4=EC=97=AC=EC=A3=BC=EB=8A=94=20MHVideoView?= =?UTF-8?q?=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/Design/MHVideoView.swift | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 MemorialHouse/MHPresentation/MHPresentation/Source/Design/MHVideoView.swift diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/Design/MHVideoView.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/Design/MHVideoView.swift new file mode 100644 index 0000000..5649488 --- /dev/null +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/Design/MHVideoView.swift @@ -0,0 +1,44 @@ +import AVKit + +final class MHVideoView: UIView { + private let playerViewController: AVPlayerViewController + + init(player: AVPlayer) { + self.playerViewController = AVPlayerViewController() + + super.init(frame: .zero) + setupPlayer(player: player) + } + + required init?(coder: NSCoder) { + self.playerViewController = AVPlayerViewController() + + super.init(coder: coder) + } + + private func setupPlayer(player: AVPlayer) { + playerViewController.player = player + playerViewController.showsPlaybackControls = true + } + + func attachPlayerViewController(to parentViewController: UIViewController) { + parentViewController.addChild(playerViewController) + addSubview(playerViewController.view) + + playerViewController.view.frame = bounds + playerViewController.view.autoresizingMask = [.flexibleWidth, .flexibleHeight] + playerViewController.didMove(toParent: parentViewController) + } + + func play() { + playerViewController.player?.play() + } + + func pause() { + playerViewController.player?.pause() + } + + func seek(to time: CMTime) { + playerViewController.player?.seek(to: time) + } +} From fb7a52ca2f957b9e52a88bb615136e79e6e11f73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Tue, 3 Dec 2024 20:22:26 +0900 Subject: [PATCH 12/38] =?UTF-8?q?feat:=20AudioSession=20=EC=A1=B0=EC=A0=88?= =?UTF-8?q?=ED=95=98=EB=8A=94=20=EB=A9=94=EC=86=8C=EB=93=9C=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Extensions/UIViewController+AudioSession.swift | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 MemorialHouse/MHPresentation/MHPresentation/Source/Extensions/UIViewController+AudioSession.swift diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/Extensions/UIViewController+AudioSession.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/Extensions/UIViewController+AudioSession.swift new file mode 100644 index 0000000..e6d0f68 --- /dev/null +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/Extensions/UIViewController+AudioSession.swift @@ -0,0 +1,13 @@ +import AVKit + +extension UIViewController { + func configureAudioSessionForPlayback() { + do { + let audioSession = AVAudioSession.sharedInstance() + try audioSession.setCategory(.playback, mode: .moviePlayback, options: .mixWithOthers) + try audioSession.setActive(true) + } catch { + print("Failed to configure audio session: \(error)") + } + } +} From dd6351ac6f1c1f0e08bf49fa0dfd657fb8856f1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Tue, 3 Dec 2024 20:23:50 +0900 Subject: [PATCH 13/38] =?UTF-8?q?feat:=20=ED=8E=B8=EC=A7=91=ED=99=94?= =?UTF-8?q?=EB=A9=B4=EC=97=90=EC=84=9C=20=EB=8F=99=EC=98=81=EC=83=81=20?= =?UTF-8?q?=EC=84=A0=ED=83=9D=ED=95=98=EB=8A=94=20UI=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EditVideo/EditVideoViewController.swift | 39 ++++++++----------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/EditVideo/EditVideoViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/EditVideo/EditVideoViewController.swift index c06183a..c6f4e8e 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/EditVideo/EditVideoViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/EditVideo/EditVideoViewController.swift @@ -1,17 +1,17 @@ -import UIKit -import MHCore import AVKit final class EditVideoViewController: UIViewController { // MARK: - Properties private let videoURL: URL private let completion: (URL) -> Void - - // MARK: Initializer + private let videoView: MHVideoView + + // MARK: - Initializer init(videoURL: URL, videoSelectCompletionHandler: @escaping (URL) -> Void) { self.videoURL = videoURL self.completion = videoSelectCompletionHandler - MHLogger.info("\(#function) 비디오 URL: \(videoURL)") + let player = AVPlayer(url: videoURL) + self.videoView = MHVideoView(player: player) super.init(nibName: nil, bundle: nil) } @@ -19,6 +19,8 @@ final class EditVideoViewController: UIViewController { required init?(coder: NSCoder) { self.videoURL = URL(fileURLWithPath: "") self.completion = { _ in } + let player = AVPlayer(url: videoURL) + self.videoView = MHVideoView(player: player) super.init(coder: coder) } @@ -26,11 +28,13 @@ final class EditVideoViewController: UIViewController { // MARK: - Life Cycle override func viewDidLoad() { super.viewDidLoad() - + configureAudioSessionForPlayback() setup() - configureAddSubView() - configureConstraints() + configureVideoView() configureNavigationBar() + + // 부모 컨트롤러에 AVPlayerViewController 연결 + videoView.attachPlayerViewController(to: self) } // MARK: - Setup & Configuration @@ -38,20 +42,9 @@ final class EditVideoViewController: UIViewController { view.backgroundColor = .baseBackground } - private func configureAddSubView() { - let player = AVPlayer(url: videoURL) - let playerViewController = AVPlayerViewController() - playerViewController.player = player - playerViewController.view.frame = view.frame - playerViewController.showsPlaybackControls = true - - addChild(playerViewController) - view.addSubview(playerViewController.view) - playerViewController.didMove(toParent: self) - } - - private func configureConstraints() { - + private func configureVideoView() { + view.addSubview(videoView) + videoView.fillSuperview() } private func configureNavigationBar() { @@ -60,7 +53,7 @@ final class EditVideoViewController: UIViewController { .font: UIFont.ownglyphBerry(size: 17), .foregroundColor: UIColor.black ] - navigationItem.title = "동영상 편집" + navigationItem.title = "동영상 업로드" // TODO: 동영상 편집 로직 변경 필요 // 공통 스타일 정의 let normalAttributes: [NSAttributedString.Key: Any] = [ From 2524d43471a1aa10a8a214fbd273f786aae09583 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Tue, 3 Dec 2024 23:56:27 +0900 Subject: [PATCH 14/38] =?UTF-8?q?refactor:=20=EB=B9=84=EB=94=94=EC=98=A4?= =?UTF-8?q?=20=ED=81=AC=EA=B8=B0=20=EC=A1=B0=EC=A0=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/EditBook/View/MediaAttachmentViewProvider.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/MediaAttachmentViewProvider.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/MediaAttachmentViewProvider.swift index 01e87a7..2766dd9 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/MediaAttachmentViewProvider.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/MediaAttachmentViewProvider.swift @@ -9,7 +9,7 @@ final class MediaAttachmentViewProvider: NSTextAttachmentViewProvider { case .image: 300 case .video: - 200 + 400 case .audio: 100 case nil: From 50f3694eb41b5323433d3fcc1d1178294afbc03e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Tue, 3 Dec 2024 23:57:24 +0900 Subject: [PATCH 15/38] =?UTF-8?q?fix:=20=EB=A8=B8=EC=A7=80=20=EC=A0=84=20?= =?UTF-8?q?=EC=B6=A9=EB=8F=8C=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/EditBook/View/EditBookViewController.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditBookViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditBookViewController.swift index 6411aed..70702a7 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditBookViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditBookViewController.swift @@ -221,7 +221,8 @@ final class EditBookViewController: UIViewController { let customAlbumViewController = CustomAlbumViewController( viewModel: albumViewModel, mediaType: .image, - mode: .editPage + mode: .editPage, + videoSelectCompletionHandler: nil ) { imageData, creationDate, caption in let attributes: [String: any Sendable] = [ Constant.photoCreationDate: creationDate?.toString(), @@ -241,7 +242,8 @@ final class EditBookViewController: UIViewController { viewModel: albumViewModel, mediaType: .video, videoSelectCompletionHandler: { url in - self?.input.send(.didAddMediaInURL(type: .video, url: url)) + MHLogger.debug("video url: \(url)") + self?.input.send(.didAddMediaInURL(type: .video, attributes: nil, url: url)) } ) @@ -298,6 +300,7 @@ extension EditBookViewController: UITableViewDataSource { let editPageViewModel = viewModel.editPageViewModel(at: indexPath.row) cell.configure(viewModel: editPageViewModel) + cell.configure(parentViewController: self) return cell } From 161913aef98f8ebb951d1122c934f672f4e31a94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Tue, 3 Dec 2024 23:57:45 +0900 Subject: [PATCH 16/38] =?UTF-8?q?refactor:=20MainActor=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/ReadPage/View/ReadPageViewController.swift | 4 +++- .../Source/ReadPage/ViewModel/ReadPageViewModel.swift | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/View/ReadPageViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/View/ReadPageViewController.swift index 9070adb..ebff196 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/View/ReadPageViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/View/ReadPageViewController.swift @@ -57,7 +57,9 @@ final class ReadPageViewController: UIViewController { private func bind() { let output = viewModel.transform(input: input.eraseToAnyPublisher()) - output.sink { [weak self] event in + output + .receive(on: DispatchQueue.main) + .sink { [weak self] event in switch event { case .loadPage(let page): guard let page else { return } diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/ViewModel/ReadPageViewModel.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/ViewModel/ReadPageViewModel.swift index d9a58d3..2293f4e 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/ViewModel/ReadPageViewModel.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/ViewModel/ReadPageViewModel.swift @@ -45,7 +45,6 @@ public final class ReadPageViewModel: ViewModelType { return output.eraseToAnyPublisher() } - @MainActor private func loadMediaForData(media: MediaDescription) async { do { let mediaData: Data = try await fetchMediaUseCase.execute(media: media, in: bookID) From dd12c1cb932c3a8de73977aa8bd70a72d386332a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Wed, 4 Dec 2024 00:03:27 +0900 Subject: [PATCH 17/38] =?UTF-8?q?feat:=20MHVideoView=20=EB=A1=9C=EC=A7=81?= =?UTF-8?q?=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/Design/MHVideoView.swift | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/Design/MHVideoView.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/Design/MHVideoView.swift index 5649488..880b7ee 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/Design/MHVideoView.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/Design/MHVideoView.swift @@ -1,13 +1,16 @@ import AVKit +import MHCore +import MHDomain final class MHVideoView: UIView { + // MARK: - Property private let playerViewController: AVPlayerViewController - init(player: AVPlayer) { + // MARK: - Initializer + init() { self.playerViewController = AVPlayerViewController() super.init(frame: .zero) - setupPlayer(player: player) } required init?(coder: NSCoder) { @@ -15,8 +18,9 @@ final class MHVideoView: UIView { super.init(coder: coder) } - - private func setupPlayer(player: AVPlayer) { + + // MARK: - Configuration + func configurePlayer(player: AVPlayer) { playerViewController.player = player playerViewController.showsPlaybackControls = true } @@ -42,3 +46,15 @@ final class MHVideoView: UIView { playerViewController.player?.seek(to: time) } } + +extension MHVideoView: @preconcurrency MediaAttachable { + func configureSource(with mediaDescription: MediaDescription, data: Data) { + MHLogger.debug(#function) + } + + func configureSource(with mediaDescription: MediaDescription, url: URL) { + let player = AVPlayer(url: url) + MHLogger.debug("\(#function): \(url)") + configurePlayer(player: player) + } +} From b07d32d764cd33ba782b119f688b62cdd9f4a1b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Wed, 4 Dec 2024 00:26:41 +0900 Subject: [PATCH 18/38] =?UTF-8?q?fix:=20MHVideoView=20=EB=A1=9C=EC=A7=81?= =?UTF-8?q?=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MHPresentation/Source/Design/MHVideoView.swift | 12 +++++------- .../EditBook/View/EditBookViewController.swift | 1 - 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/Design/MHVideoView.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/Design/MHVideoView.swift index 880b7ee..30e49ff 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/Design/MHVideoView.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/Design/MHVideoView.swift @@ -11,12 +11,14 @@ final class MHVideoView: UIView { self.playerViewController = AVPlayerViewController() super.init(frame: .zero) + configureConstraint() } required init?(coder: NSCoder) { self.playerViewController = AVPlayerViewController() super.init(coder: coder) + configureConstraint() } // MARK: - Configuration @@ -24,14 +26,10 @@ final class MHVideoView: UIView { playerViewController.player = player playerViewController.showsPlaybackControls = true } - - func attachPlayerViewController(to parentViewController: UIViewController) { - parentViewController.addChild(playerViewController) + + func configureConstraint() { addSubview(playerViewController.view) - - playerViewController.view.frame = bounds - playerViewController.view.autoresizingMask = [.flexibleWidth, .flexibleHeight] - playerViewController.didMove(toParent: parentViewController) + playerViewController.view.fillSuperview() } func play() { diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditBookViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditBookViewController.swift index 70702a7..a5d0f26 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditBookViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditBookViewController.swift @@ -300,7 +300,6 @@ extension EditBookViewController: UITableViewDataSource { let editPageViewModel = viewModel.editPageViewModel(at: indexPath.row) cell.configure(viewModel: editPageViewModel) - cell.configure(parentViewController: self) return cell } From b983842c6156f22961b70f254145fcd555b55f29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Wed, 4 Dec 2024 00:27:06 +0900 Subject: [PATCH 19/38] =?UTF-8?q?fix:=20PageCell=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EB=B7=B0=EC=BB=A8=ED=8A=B8=EB=A1=A4=EB=9F=AC=20=EC=9D=98?= =?UTF-8?q?=EC=A1=B4=EC=84=B1=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/EditBook/View/EditPageCell.swift | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditPageCell.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditPageCell.swift index 5e58c9f..31a3119 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditPageCell.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditPageCell.swift @@ -105,7 +105,9 @@ final class EditPageCell: UITableViewCell { } // MARK: - Method - func configure(viewModel: EditPageViewModel) { + func configure( + viewModel: EditPageViewModel + ) { self.viewModel = viewModel configureBinding() input.send(.pageWillAppear) @@ -167,11 +169,11 @@ final class EditPageCell: UITableViewCell { description: media ) case .video: - // TODO: - video 추가 필요 - attachment = MediaAttachment( - view: MHPolaroidPhotoView(), - description: media - ) + let view = MHVideoView() + attachment = MediaAttachment( + view: view, + description: media + ) case .audio: // TODO: - audio 추가 필요 attachment = MediaAttachment( @@ -195,11 +197,11 @@ final class EditPageCell: UITableViewCell { description: media ) case .video: - // TODO: - video 추가 필요 - attachment = MediaAttachment( - view: MHPolaroidPhotoView(), - description: media - ) + let view = MHVideoView() + attachment = MediaAttachment( + view: view, + description: media + ) case .audio: // TODO: - audio 추가 필요 attachment = MediaAttachment( @@ -210,6 +212,7 @@ final class EditPageCell: UITableViewCell { break } guard let attachment else { return } + MHLogger.debug("mediaAddedWithURL: \(url)") attachment.configure(with: url) appendAttachment(attachment) } From 09527e30236fa80a78cd48dedf91095ee7c24e54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Wed, 4 Dec 2024 00:27:33 +0900 Subject: [PATCH 20/38] =?UTF-8?q?refactor:=20MHVideoView=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=EC=97=90=20=EB=94=B0=EB=A5=B8=20EditVideoViewControll?= =?UTF-8?q?er=20=EB=A1=9C=EC=A7=81=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/EditVideo/EditVideoViewController.swift | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/EditVideo/EditVideoViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/EditVideo/EditVideoViewController.swift index c6f4e8e..f6f9964 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/EditVideo/EditVideoViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/EditVideo/EditVideoViewController.swift @@ -4,14 +4,12 @@ final class EditVideoViewController: UIViewController { // MARK: - Properties private let videoURL: URL private let completion: (URL) -> Void - private let videoView: MHVideoView + private let videoView = MHVideoView() // MARK: - Initializer init(videoURL: URL, videoSelectCompletionHandler: @escaping (URL) -> Void) { self.videoURL = videoURL self.completion = videoSelectCompletionHandler - let player = AVPlayer(url: videoURL) - self.videoView = MHVideoView(player: player) super.init(nibName: nil, bundle: nil) } @@ -19,8 +17,6 @@ final class EditVideoViewController: UIViewController { required init?(coder: NSCoder) { self.videoURL = URL(fileURLWithPath: "") self.completion = { _ in } - let player = AVPlayer(url: videoURL) - self.videoView = MHVideoView(player: player) super.init(coder: coder) } @@ -28,18 +24,18 @@ final class EditVideoViewController: UIViewController { // MARK: - Life Cycle override func viewDidLoad() { super.viewDidLoad() + configureAudioSessionForPlayback() setup() configureVideoView() configureNavigationBar() - - // 부모 컨트롤러에 AVPlayerViewController 연결 - videoView.attachPlayerViewController(to: self) } // MARK: - Setup & Configuration private func setup() { view.backgroundColor = .baseBackground + let player = AVPlayer(url: videoURL) + videoView.configurePlayer(player: player) } private func configureVideoView() { From aac831b52442bbb709c5d1128bdd8e80dee84c50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Wed, 4 Dec 2024 00:27:41 +0900 Subject: [PATCH 21/38] =?UTF-8?q?feat:=20Read=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EB=B9=84=EB=94=94=EC=98=A4=20=EB=B6=88=EB=9F=AC=EC=98=A4?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/ReadPage/View/ReadPageViewController.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/View/ReadPageViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/View/ReadPageViewController.swift index ebff196..0ef6c7a 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/View/ReadPageViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/View/ReadPageViewController.swift @@ -114,6 +114,12 @@ final class ReadPageViewController: UIViewController { view: MHPolaroidPhotoView(), description: description ) + case .video: + let view = MHVideoView() + mediaAttachment = MediaAttachment( + view: view, + description: description + ) default: break } From 7c5ebddad5ffd805860a0e915791ab8de0c7b19b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Wed, 4 Dec 2024 01:32:25 +0900 Subject: [PATCH 22/38] =?UTF-8?q?fix:=20DefaultCreateMediaUseCase=20?= =?UTF-8?q?=EC=97=90=EC=84=9C=20bookId=EB=A5=BC=20=EC=95=88=20=EC=A3=BC?= =?UTF-8?q?=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MHDomain/UseCase/DefaultMediaUseCase.swift | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/MemorialHouse/MHDomain/MHDomain/UseCase/DefaultMediaUseCase.swift b/MemorialHouse/MHDomain/MHDomain/UseCase/DefaultMediaUseCase.swift index 0f0241e..3aab7d1 100644 --- a/MemorialHouse/MHDomain/MHDomain/UseCase/DefaultMediaUseCase.swift +++ b/MemorialHouse/MHDomain/MHDomain/UseCase/DefaultMediaUseCase.swift @@ -30,18 +30,10 @@ public struct DefaultFetchMediaUseCase: FetchMediaUseCase { // MARK: - Method public func execute(media: MediaDescription, in bookID: UUID) async throws -> Data { - do { - return try await repository.fetch(media: media, from: nil).get() // TODO: - 없어질 로직 - } catch { - return try await repository.fetch(media: media, from: bookID).get() - } + try await repository.fetch(media: media, from: bookID).get() } public func execute(media: MediaDescription, in bookID: UUID) async throws -> URL { - do { - return try await repository.getURL(media: media, from: nil).get() // TODO: - 없어질 로직 - } catch { - return try await repository.getURL(media: media, from: bookID).get() - } + try await repository.getURL(media: media, from: bookID).get() } } From c9df84ba6f8e781d04806f7e49307d3cd93e0924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Wed, 4 Dec 2024 01:32:54 +0900 Subject: [PATCH 23/38] =?UTF-8?q?chore:=20=EB=AF=B8=EB=94=94=EC=96=B4=20?= =?UTF-8?q?=EC=A0=80=EC=9E=A5=EB=90=9C=20URL=20=EB=B0=9B=EC=95=84=EC=98=A4?= =?UTF-8?q?=EB=8A=94=20=EB=A1=9C=EA=B7=B8=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MHData/MHData/LocalStorage/FileManager/MHFileManager.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/MemorialHouse/MHData/MHData/LocalStorage/FileManager/MHFileManager.swift b/MemorialHouse/MHData/MHData/LocalStorage/FileManager/MHFileManager.swift index f2ab017..f09c30e 100644 --- a/MemorialHouse/MHData/MHData/LocalStorage/FileManager/MHFileManager.swift +++ b/MemorialHouse/MHData/MHData/LocalStorage/FileManager/MHFileManager.swift @@ -80,6 +80,7 @@ extension MHFileManager: FileStorage { else { return .failure(.directorySettingFailure) } let newDataPath = newDirectory.appendingPathComponent(name) + MHLogger.debug("\(#function) \(newDataPath)") do { try fileManager.createDirectory(at: newDirectory, withIntermediateDirectories: true) From 5198c53f8d1379e9a40e0cfde95c6508f4f004d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Wed, 4 Dec 2024 01:33:25 +0900 Subject: [PATCH 24/38] =?UTF-8?q?refactor:=20=EC=8B=A4=ED=8C=A8=20?= =?UTF-8?q?=EC=8B=9C=20Alert=20&=20fullScreen=20=20Present=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/EditBook/View/EditBookViewController.swift | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditBookViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditBookViewController.swift index f456519..b60aee4 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditBookViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditBookViewController.swift @@ -242,8 +242,8 @@ final class EditBookViewController: UIViewController { } case .revokeDone: self?.navigationController?.popViewController(animated: true) - case .error(message: let message): - MHLogger.error(message) // TODO: - Alert 띄우기 + case .error(let message): + self?.showErrorAlert(with: message) } } .store(in: &cancellables) @@ -275,12 +275,13 @@ final class EditBookViewController: UIViewController { viewModel: albumViewModel, mediaType: .video, videoSelectCompletionHandler: { url in - MHLogger.debug("video url: \(url)") self?.input.send(.didAddMediaInURL(type: .video, attributes: nil, url: url)) } ) - self?.navigationController?.pushViewController(customAlbumViewController, animated: true) + let navigationViewController = UINavigationController(rootViewController: customAlbumViewController) + navigationViewController.modalPresentationStyle = .fullScreen + self?.present(navigationViewController, animated: true) } addVideoButton.addAction(addVideoAction, for: .touchUpInside) From 368f7d7e2cb9ad49efd15f3297c346b8cc9a95ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Wed, 4 Dec 2024 01:33:53 +0900 Subject: [PATCH 25/38] =?UTF-8?q?refactor:=20ReadPageViewController=20?= =?UTF-8?q?=EC=8B=A4=ED=8C=A8=20=EC=98=88=EC=99=B8=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/ReadPage/View/ReadPageViewController.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/View/ReadPageViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/View/ReadPageViewController.swift index 274b84b..2dba080 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/View/ReadPageViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/View/ReadPageViewController.swift @@ -67,8 +67,7 @@ final class ReadPageViewController: UIViewController { case .mediaLoadedWithData(let media, let data): self?.mediaLoadedWithData(media: media, data: data) case .error(let message): - // TODO: Alert 띄우기 ? - MHLogger.error(message) + self?.showErrorAlert(with: message) } }.store(in: &cancellables) } From fb290eb3b9618cf8ae004cc67317dcba15ddd510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Wed, 4 Dec 2024 01:34:35 +0900 Subject: [PATCH 26/38] =?UTF-8?q?feat:=20=EC=B1=85=20Read=ED=95=A0=20?= =?UTF-8?q?=EB=95=8C=20URL=EB=A1=9C=EB=B6=80=ED=84=B0=20=EB=A9=80=ED=8B=B0?= =?UTF-8?q?=EB=AF=B8=EB=94=94=EC=96=B4=20=EB=B0=9B=EC=95=84=EC=98=A4?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ReadPage/View/ReadPageViewController.swift | 8 +++++--- .../ReadPage/ViewModel/ReadPageViewModel.swift | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/View/ReadPageViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/View/ReadPageViewController.swift index 2dba080..09ce2cb 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/View/ReadPageViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/View/ReadPageViewController.swift @@ -66,6 +66,8 @@ final class ReadPageViewController: UIViewController { self?.configurePage(page: page) case .mediaLoadedWithData(let media, let data): self?.mediaLoadedWithData(media: media, data: data) + case .mediaLoadedWithURL(let media, let url): + self?.mediaLoadedWithURL(media: media, url: url) case .error(let message): self?.showErrorAlert(with: message) } @@ -112,16 +114,16 @@ final class ReadPageViewController: UIViewController { view: MHPolaroidPhotoView(), description: description ) + input.send(.didRequestMediaDataForData(media: description)) case .video: - let view = MHVideoView() mediaAttachment = MediaAttachment( - view: view, + view: MHVideoView(), description: description ) + input.send(.didRequestMediaDataForURL(media: description)) default: break } - input.send(.didRequestMediaDataForData(media: description)) guard let mediaAttachment else { return } let range = NSRange(location: location, length: 1) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/ViewModel/ReadPageViewModel.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/ViewModel/ReadPageViewModel.swift index 2293f4e..4b6a993 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/ViewModel/ReadPageViewModel.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/ViewModel/ReadPageViewModel.swift @@ -7,11 +7,13 @@ public final class ReadPageViewModel: ViewModelType { enum Input { case viewDidLoad case didRequestMediaDataForData(media: MediaDescription) + case didRequestMediaDataForURL(media: MediaDescription) } enum Output { case loadPage(page: Page?) case mediaLoadedWithData(media: MediaDescription, data: Data) + case mediaLoadedWithURL(media: MediaDescription, url: URL) case error(message: String) } @@ -39,6 +41,8 @@ public final class ReadPageViewModel: ViewModelType { self?.output.send(.loadPage(page: self?.page)) case .didRequestMediaDataForData(let media): Task { await self?.loadMediaForData(media: media) } + case .didRequestMediaDataForURL(let media): + Task { await self?.loadMediaForURL(media: media) } } }.store(in: &cancellables) @@ -54,4 +58,15 @@ public final class ReadPageViewModel: ViewModelType { output.send(.error(message: "미디어 로딩에 실패하였습니다.")) } } + + private func loadMediaForURL(media: MediaDescription) async { + do { + MHLogger.debug("\(#function) \(bookID)") + let mediaURL: URL = try await fetchMediaUseCase.execute(media: media, in: bookID) + output.send(.mediaLoadedWithURL(media: media, url: mediaURL)) + } catch { + output.send(.error(message: "미디어 로딩에 실패하였습니다.")) + MHLogger.error(error.localizedDescription + #function) + } + } } From 0878f8f75fd420a9b3ab41027bb6ed7ac86926e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Wed, 4 Dec 2024 01:35:15 +0900 Subject: [PATCH 27/38] =?UTF-8?q?refactor:=20EditVideoViewController?= =?UTF-8?q?=EB=A5=BC=20dismiss=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/EditVideo/EditVideoViewController.swift | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/EditVideo/EditVideoViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/EditVideo/EditVideoViewController.swift index f6f9964..6238ef2 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/EditVideo/EditVideoViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/EditVideo/EditVideoViewController.swift @@ -78,10 +78,7 @@ final class EditVideoViewController: UIViewController { selected: selectedAttributes ) { [weak self] in self?.completion(self?.videoURL ?? URL(fileURLWithPath: "")) - if let navigationController = self?.navigationController { - navigationController.popViewController(animated: false) - navigationController.popViewController(animated: true) - } + self?.dismiss(animated: true) } } } From deee9e46017e2f41bc444d2c647eb0f3e26b0d7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Wed, 4 Dec 2024 01:35:29 +0900 Subject: [PATCH 28/38] =?UTF-8?q?refactor:=20EditPageCell=EC=97=90?= =?UTF-8?q?=EC=84=9C=20Video=20=EB=B6=88=EB=9F=AC=EC=98=A4=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/EditBook/View/EditPageCell.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditPageCell.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditPageCell.swift index 31a3119..a209d1d 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditPageCell.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditPageCell.swift @@ -99,7 +99,7 @@ final class EditPageCell: UITableViewCell { case let .mediaLoadedWithURL(media, url): self?.mediaLoadedWithURL(media: media, url: url) case let .error(message): - MHLogger.error(message) // 더 좋은 처리가 필요함 + MHLogger.error(message) // TODO: 더 좋은 처리가 필요함 } }.store(in: &cancellables) } @@ -137,10 +137,16 @@ final class EditPageCell: UITableViewCell { view: MHPolaroidPhotoView(), description: description ) + input.send(.didRequestMediaDataForData(media: description)) + case .video: + mediaAttachment = MediaAttachment( + view: MHVideoView(), + description: description + ) + input.send(.didRequestMediaDataForURL(media: description)) default: break } - input.send(.didRequestMediaDataForData(media: description)) guard let mediaAttachment else { return } let range = NSRange(location: location, length: 1) From a26004d23ad8faaae59c9e1f7c4d986da5bcc00c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Wed, 4 Dec 2024 01:44:27 +0900 Subject: [PATCH 29/38] =?UTF-8?q?fix:=20=EC=BB=A4=EC=8A=A4=ED=85=80=20?= =?UTF-8?q?=EC=95=A8=EB=B2=94=EC=97=90=EC=84=9C=20=EB=8B=AB=EA=B8=B0=20?= =?UTF-8?q?=EB=88=84=EB=A5=B8=20=EA=B2=BD=EC=9A=B0=20Dismiss=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CustomAlbum/View/CustomAlbumViewController.swift | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/CustomAlbum/View/CustomAlbumViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/CustomAlbum/View/CustomAlbumViewController.swift index 17e8814..32014bc 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/CustomAlbum/View/CustomAlbumViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/CustomAlbum/View/CustomAlbumViewController.swift @@ -122,14 +122,7 @@ final class CustomAlbumViewController: UIViewController { normal: normalAttributes, selected: selectedAttributes ) { [weak self] in - switch self?.mode { - case .bookCover: - self?.dismiss(animated: true) - case .editPage: - self?.navigationController?.popViewController(animated: true) - default: - break - } + self?.dismiss(animated: true) } } From 8acf0c48faeefc5c2157d44344915ad3e9f1ed2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Wed, 4 Dec 2024 01:45:43 +0900 Subject: [PATCH 30/38] =?UTF-8?q?chore:=20=EC=82=AC=EC=A7=84=20=ED=8E=B8?= =?UTF-8?q?=EC=A7=91=EC=97=90=EC=84=9C=20=EB=8B=AB=EA=B8=B0=20->=20?= =?UTF-8?q?=EC=B7=A8=EC=86=8C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/EditPhoto/EditPhotoViewController.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/EditPhoto/EditPhotoViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/EditPhoto/EditPhotoViewController.swift index d03605f..3267fee 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/EditPhoto/EditPhotoViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/EditPhoto/EditPhotoViewController.swift @@ -147,9 +147,9 @@ final class EditPhotoViewController: UIViewController { .font: UIFont.ownglyphBerry(size: 17) ] - // Left Bar Button: 닫기 + // Left Bar Button: 취소 navigationItem.leftBarButtonItem = UIBarButtonItem( - title: "닫기", + title: "취소", normal: normalAttributes, selected: selectedAttributes ) { [weak self] in From 4c8754ea2eb67c9f96b5de6ec88fff851d593795 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Wed, 4 Dec 2024 01:54:12 +0900 Subject: [PATCH 31/38] =?UTF-8?q?chore:=20=EA=B0=80=EB=8F=85=EC=84=B1=20?= =?UTF-8?q?=EC=A6=9D=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/EditBook/View/EditPageCell.swift | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditPageCell.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditPageCell.swift index a209d1d..e989c42 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditPageCell.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditPageCell.swift @@ -175,11 +175,10 @@ final class EditPageCell: UITableViewCell { description: media ) case .video: - let view = MHVideoView() - attachment = MediaAttachment( - view: view, - description: media - ) + attachment = MediaAttachment( + view: MHVideoView(), + description: media + ) case .audio: // TODO: - audio 추가 필요 attachment = MediaAttachment( @@ -204,10 +203,10 @@ final class EditPageCell: UITableViewCell { ) case .video: let view = MHVideoView() - attachment = MediaAttachment( - view: view, - description: media - ) + attachment = MediaAttachment( + view: view, + description: media + ) case .audio: // TODO: - audio 추가 필요 attachment = MediaAttachment( @@ -245,7 +244,7 @@ final class EditPageCell: UITableViewCell { in: NSRange(location: 0, length: textStorage.length) ) { value, _, _ in guard let mediaAttachment = value as? MediaAttachment, - mediaAttachment.mediaDescription.id == media.id else { return } + mediaAttachment.mediaDescription.id == media.id else { return } attachment = mediaAttachment } return attachment @@ -254,11 +253,16 @@ final class EditPageCell: UITableViewCell { private func appendAttachment(_ attachment: MediaAttachment) { guard let textStorage else { return } let text = NSMutableAttributedString(attachment: attachment) - text.addAttributes(defaultAttributes, - range: NSRange(location: 0, length: 1)) - guard isAcceptableHeight(textStorage, - shouldChangeTextIn: NSRange(location: textStorage.length, length: 0), - replacementText: text) else { return } + text.addAttributes( + defaultAttributes, + range: NSRange(location: 0, length: 1) + ) + + guard isAcceptableHeight( + textStorage, + shouldChangeTextIn: NSRange(location: textStorage.length, length: 0), + replacementText: text + ) else { return } textStorage.beginEditing() textStorage.append(text) textStorage.endEditing() @@ -311,7 +315,7 @@ extension EditPageCell: UITextViewDelegate { return false } else if let attachment = attachmentAt(range.location+2), // Attachment 2칸 앞에 줄바꿈을 추가할때 - textView.text[textView.text.index(textView.text.startIndex, offsetBy: range.location+1)] == "\n" { + textView.text[textView.text.index(textView.text.startIndex, offsetBy: range.location+1)] == "\n" { attachment.cachedViewProvider = nil } } From 9caf51d1f0367dc68a1395f7d748718c0cd5a739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Wed, 4 Dec 2024 01:55:14 +0900 Subject: [PATCH 32/38] =?UTF-8?q?chore:=20=EC=9D=B8=EB=8D=B4=ED=8A=B8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CustomAlbum/View/CustomAlbumViewController.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/CustomAlbum/View/CustomAlbumViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/CustomAlbum/View/CustomAlbumViewController.swift index 32014bc..87385c3 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/CustomAlbum/View/CustomAlbumViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/CustomAlbum/View/CustomAlbumViewController.swift @@ -40,11 +40,11 @@ final class CustomAlbumViewController: UIViewController { mode: Mode = .editPage, videoSelectCompletionHandler: ((URL) -> Void)? = nil, photoSelectCompletionHandler: ((Data, Date?, String?) -> Void)? = nil - ) { + ) { self.viewModel = viewModel self.mediaType = mediaType self.mode = mode - self.videoSelectCompletionHandler = videoSelectCompletionHandler + self.videoSelectCompletionHandler = videoSelectCompletionHandler self.photoSelectCompletionHandler = photoSelectCompletionHandler super.init(nibName: nil, bundle: nil) @@ -169,7 +169,7 @@ final class CustomAlbumViewController: UIViewController { // MARK: - Media private func checkThumbnailAuthorization() { let authorization = PHPhotoLibrary.authorizationStatus() - + switch authorization { case .notDetermined: PHPhotoLibrary.requestAuthorization(for: .readWrite) { @Sendable [weak self] status in @@ -269,7 +269,7 @@ extension CustomAlbumViewController: UICollectionViewDelegate { self.checkCameraAuthorization() } else { guard let asset = viewModel.photoAsset?[indexPath.item - 1] else { return } - + if self.mediaType == .image { handleImageSelection(with: asset) } else { @@ -286,7 +286,7 @@ extension CustomAlbumViewController: UICollectionViewDelegate { } } } - + private func handleVideoSelection(with asset: PHAsset) { Task { if let videoURL = await LocalPhotoManager.shared.requestVideoURL(with: asset) { From 5741cd029b4b72f757f3f77e75cf30d4ddad23ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Wed, 4 Dec 2024 01:55:57 +0900 Subject: [PATCH 33/38] =?UTF-8?q?chore:=20=EC=9D=B8=EB=8D=B4=ED=8A=B8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/EditBookViewController.swift | 6 ++--- .../EditPhoto/EditPhotoViewController.swift | 4 ++-- .../EditVideo/EditVideoViewController.swift | 2 +- .../View/ReadPageViewController.swift | 24 +++++++++---------- .../ViewModel/ReadPageViewModel.swift | 2 +- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditBookViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditBookViewController.swift index b60aee4..3f7faaa 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditBookViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditBookViewController.swift @@ -75,7 +75,7 @@ final class EditBookViewController: UIViewController { return button }() private var buttonStackViewBottomConstraint: NSLayoutConstraint? - + // MARK: - Property private let viewModel: EditBookViewModel private let input = PassthroughSubject() @@ -212,13 +212,13 @@ final class EditBookViewController: UIViewController { selector: #selector(keyboardWillAppear), name: UIResponder.keyboardWillShowNotification, object: nil - ) + ) NotificationCenter.default.addObserver( self, selector: #selector(keyboardWillHide), name: UIResponder.keyboardWillHideNotification, object: nil - ) + ) // 스크롤이 될 때 키보드 내려가게 설정 editPageTableView.keyboardDismissMode = .onDrag } diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/EditPhoto/EditPhotoViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/EditPhoto/EditPhotoViewController.swift index 3267fee..a188f19 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/EditPhoto/EditPhotoViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/EditPhoto/EditPhotoViewController.swift @@ -24,7 +24,7 @@ final class EditPhotoViewController: UIViewController { return scrollView }() private let photoImageView: UIImageView = { - let imageView = UIImageView() + let imageView = UIImageView() imageView.contentMode = .scaleAspectFit imageView.backgroundColor = .clear imageView.isUserInteractionEnabled = true @@ -338,7 +338,7 @@ extension EditPhotoViewController: UIScrollViewDelegate { contentOffset.x = (scrollView.contentSize.width - scrollViewSize.width) / 2 scrollView.setContentOffset(contentOffset, animated: animated) } - + if photoSize.height < scrollViewSize.height { contentOffset.y = (scrollView.contentSize.height - scrollViewSize.height) / 2 scrollView.setContentOffset(contentOffset, animated: animated) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/EditVideo/EditVideoViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/EditVideo/EditVideoViewController.swift index 6238ef2..90fd541 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/EditVideo/EditVideoViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/EditVideo/EditVideoViewController.swift @@ -5,7 +5,7 @@ final class EditVideoViewController: UIViewController { private let videoURL: URL private let completion: (URL) -> Void private let videoView = MHVideoView() - + // MARK: - Initializer init(videoURL: URL, videoSelectCompletionHandler: @escaping (URL) -> Void) { self.videoURL = videoURL diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/View/ReadPageViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/View/ReadPageViewController.swift index 09ce2cb..df52128 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/View/ReadPageViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/View/ReadPageViewController.swift @@ -60,18 +60,18 @@ final class ReadPageViewController: UIViewController { output .receive(on: DispatchQueue.main) .sink { [weak self] event in - switch event { - case .loadPage(let page): - guard let page else { return } - self?.configurePage(page: page) - case .mediaLoadedWithData(let media, let data): - self?.mediaLoadedWithData(media: media, data: data) - case .mediaLoadedWithURL(let media, let url): - self?.mediaLoadedWithURL(media: media, url: url) - case .error(let message): - self?.showErrorAlert(with: message) - } - }.store(in: &cancellables) + switch event { + case .loadPage(let page): + guard let page else { return } + self?.configurePage(page: page) + case .mediaLoadedWithData(let media, let data): + self?.mediaLoadedWithData(media: media, data: data) + case .mediaLoadedWithURL(let media, let url): + self?.mediaLoadedWithURL(media: media, url: url) + case .error(let message): + self?.showErrorAlert(with: message) + } + }.store(in: &cancellables) } // MARK: - Setup & Configure diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/ViewModel/ReadPageViewModel.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/ViewModel/ReadPageViewModel.swift index 4b6a993..a22b0fc 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/ViewModel/ReadPageViewModel.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/ViewModel/ReadPageViewModel.swift @@ -45,7 +45,7 @@ public final class ReadPageViewModel: ViewModelType { Task { await self?.loadMediaForURL(media: media) } } }.store(in: &cancellables) - + return output.eraseToAnyPublisher() } From 2e3113c88a4ffc6f5c0b9e6227c4b8a97f16ce4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Wed, 4 Dec 2024 02:01:14 +0900 Subject: [PATCH 34/38] =?UTF-8?q?chore:=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=EC=BD=94=EB=93=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/Design/MHVideoView.swift | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/Design/MHVideoView.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/Design/MHVideoView.swift index 30e49ff..bbd5f02 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/Design/MHVideoView.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/Design/MHVideoView.swift @@ -27,22 +27,10 @@ final class MHVideoView: UIView { playerViewController.showsPlaybackControls = true } - func configureConstraint() { + private func configureConstraint() { addSubview(playerViewController.view) playerViewController.view.fillSuperview() } - - func play() { - playerViewController.player?.play() - } - - func pause() { - playerViewController.player?.pause() - } - - func seek(to time: CMTime) { - playerViewController.player?.seek(to: time) - } } extension MHVideoView: @preconcurrency MediaAttachable { @@ -52,7 +40,6 @@ extension MHVideoView: @preconcurrency MediaAttachable { func configureSource(with mediaDescription: MediaDescription, url: URL) { let player = AVPlayer(url: url) - MHLogger.debug("\(#function): \(url)") configurePlayer(player: player) } } From fba00493362505579d487a73cf2f34b97463b514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Wed, 4 Dec 2024 02:02:54 +0900 Subject: [PATCH 35/38] =?UTF-8?q?refactor:=20=EB=B9=84=EB=94=94=EC=98=A4?= =?UTF-8?q?=EC=97=90=EC=84=9C=20Data=20=EB=A1=9C=EC=A7=81=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MHPresentation/Source/Design/MHVideoView.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/Design/MHVideoView.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/Design/MHVideoView.swift index bbd5f02..d415668 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/Design/MHVideoView.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/Design/MHVideoView.swift @@ -35,7 +35,8 @@ final class MHVideoView: UIView { extension MHVideoView: @preconcurrency MediaAttachable { func configureSource(with mediaDescription: MediaDescription, data: Data) { - MHLogger.debug(#function) + let player = AVPlayer() + configurePlayer(player: player) } func configureSource(with mediaDescription: MediaDescription, url: URL) { From 3bacbd30a5cdab9a073305241e2759f95837296b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Wed, 4 Dec 2024 02:04:23 +0900 Subject: [PATCH 36/38] =?UTF-8?q?chore:=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=EC=BD=94=EB=93=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MHPresentation/Source/EditBook/View/EditPageCell.swift | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditPageCell.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditPageCell.swift index e989c42..c46c7b2 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditPageCell.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/EditBook/View/EditPageCell.swift @@ -202,9 +202,8 @@ final class EditPageCell: UITableViewCell { description: media ) case .video: - let view = MHVideoView() attachment = MediaAttachment( - view: view, + view: MHVideoView(), description: media ) case .audio: @@ -217,7 +216,6 @@ final class EditPageCell: UITableViewCell { break } guard let attachment else { return } - MHLogger.debug("mediaAddedWithURL: \(url)") attachment.configure(with: url) appendAttachment(attachment) } From 45424e9b4f00b9baa92af56062d172f5e4dc9475 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Wed, 4 Dec 2024 02:18:13 +0900 Subject: [PATCH 37/38] =?UTF-8?q?fix:=20=EB=8F=99=EC=98=81=EC=83=81=20?= =?UTF-8?q?=EC=97=85=EB=A1=9C=EB=93=9C=20=ED=99=94=EB=A9=B4=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EC=9E=AC=EC=83=9D=20=EC=A4=91=EC=A7=80=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20=EC=95=88=20=EB=B3=B4=EC=9D=B4=EB=8A=94=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MHPresentation/Source/Design/MHVideoView.swift | 6 +----- .../Source/EditVideo/EditVideoViewController.swift | 3 ++- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/Design/MHVideoView.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/Design/MHVideoView.swift index d415668..fc40881 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/Design/MHVideoView.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/Design/MHVideoView.swift @@ -4,19 +4,15 @@ import MHDomain final class MHVideoView: UIView { // MARK: - Property - private let playerViewController: AVPlayerViewController + let playerViewController = AVPlayerViewController() // MARK: - Initializer init() { - self.playerViewController = AVPlayerViewController() - super.init(frame: .zero) configureConstraint() } required init?(coder: NSCoder) { - self.playerViewController = AVPlayerViewController() - super.init(coder: coder) configureConstraint() } diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/EditVideo/EditVideoViewController.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/EditVideo/EditVideoViewController.swift index 90fd541..f60414b 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/EditVideo/EditVideoViewController.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/EditVideo/EditVideoViewController.swift @@ -25,8 +25,8 @@ final class EditVideoViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - configureAudioSessionForPlayback() setup() + configureAudioSessionForPlayback() configureVideoView() configureNavigationBar() } @@ -39,6 +39,7 @@ final class EditVideoViewController: UIViewController { } private func configureVideoView() { + addChild(videoView.playerViewController) view.addSubview(videoView) videoView.fillSuperview() } From 596812a890079755e1058cb97db1b3d5de5d6c79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=9A=A8=EC=A4=80?= Date: Wed, 4 Dec 2024 02:18:23 +0900 Subject: [PATCH 38/38] =?UTF-8?q?chore:=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=EC=BD=94=EB=93=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/ReadPage/ViewModel/ReadPageViewModel.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/ViewModel/ReadPageViewModel.swift b/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/ViewModel/ReadPageViewModel.swift index a22b0fc..277a337 100644 --- a/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/ViewModel/ReadPageViewModel.swift +++ b/MemorialHouse/MHPresentation/MHPresentation/Source/ReadPage/ViewModel/ReadPageViewModel.swift @@ -61,7 +61,6 @@ public final class ReadPageViewModel: ViewModelType { private func loadMediaForURL(media: MediaDescription) async { do { - MHLogger.debug("\(#function) \(bookID)") let mediaURL: URL = try await fetchMediaUseCase.execute(media: media, in: bookID) output.send(.mediaLoadedWithURL(media: media, url: mediaURL)) } catch {