From 733279ae22b842cfbcb65c3d8159995b4f81cb9e Mon Sep 17 00:00:00 2001 From: seongmin221 Date: Mon, 8 Jan 2024 22:12:19 +0900 Subject: [PATCH] [FEAT] #33 - folder deleting attached --- .../View/StorageCollectionViewHeader.swift | 2 +- .../Scrap/Storage/View/StoragePostView.swift | 18 ------------------ .../ViewController/StorageViewController.swift | 10 ++++++---- .../Storage/ViewModel/StorageViewModel.swift | 6 ++++++ 4 files changed, 13 insertions(+), 23 deletions(-) diff --git a/EasyVel/Presentation/Scrap/Storage/View/StorageCollectionViewHeader.swift b/EasyVel/Presentation/Scrap/Storage/View/StorageCollectionViewHeader.swift index 60bbd06..f697880 100644 --- a/EasyVel/Presentation/Scrap/Storage/View/StorageCollectionViewHeader.swift +++ b/EasyVel/Presentation/Scrap/Storage/View/StorageCollectionViewHeader.swift @@ -20,7 +20,7 @@ final class StorageCollectionViewHeader: UICollectionReusableView { return self.changeNameButton.rx.tap.asDriver() } - var deleteFolderButtonTrigger: Driver { + var showBottomSheetTrigger: Driver { return self.deleteFolderButton.rx.tap.asDriver() } diff --git a/EasyVel/Presentation/Scrap/Storage/View/StoragePostView.swift b/EasyVel/Presentation/Scrap/Storage/View/StoragePostView.swift index 582bc98..a19f40c 100644 --- a/EasyVel/Presentation/Scrap/Storage/View/StoragePostView.swift +++ b/EasyVel/Presentation/Scrap/Storage/View/StoragePostView.swift @@ -146,24 +146,6 @@ extension StoragePostView { } } -//extension NewStoragePostView { -// -// func configureCollectionView(with title: String) { -// self.collectionView.collectionViewLayout = createLayout() -// self.collectionView.register( -// StorageCollectionViewHeader.self, -// forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, -// withReuseIdentifier: StorageCollectionViewHeader.reuseIdentifier -// ) -// } -//} - -//extension NewStoragePostView { -// func showEmptyView() { -// self.emptyImageView.isHidden = false -// } -//} - extension StoragePostView { func createLayout() -> UICollectionViewLayout { diff --git a/EasyVel/Presentation/Scrap/Storage/ViewController/StorageViewController.swift b/EasyVel/Presentation/Scrap/Storage/ViewController/StorageViewController.swift index b3da68b..3301269 100644 --- a/EasyVel/Presentation/Scrap/Storage/ViewController/StorageViewController.swift +++ b/EasyVel/Presentation/Scrap/Storage/ViewController/StorageViewController.swift @@ -66,10 +66,6 @@ final class StorageViewController: BaseViewController { // MARK: - Setting - override func render() {} - - override func configUI() {} - private func bind() { self.storageView.backButton.rx.tap .subscribe(onNext: { @@ -134,6 +130,11 @@ final class StorageViewController: BaseViewController { .drive(with: self) { owner, folderName in owner.showChageFolderNameAlert(folderName: folderName) }.disposed(by: self.disposeBag) + + header.showBottomSheetTrigger + .drive(with: self) { owner, _ in + owner.storageView.showDeleteFolderBottomSheet() + }.disposed(by: self.disposeBag) } private func bindNavigation() { @@ -244,5 +245,6 @@ extension StorageViewController { extension StorageViewController: FolderViewControllerDelegate { func folderVCDismiss(newFolderName: String) { self.storageView.updateTitle(to: newFolderName) + self.viewModel.updateFolderName(to: newFolderName) } } diff --git a/EasyVel/Presentation/Scrap/Storage/ViewModel/StorageViewModel.swift b/EasyVel/Presentation/Scrap/Storage/ViewModel/StorageViewModel.swift index 2a243db..792808e 100644 --- a/EasyVel/Presentation/Scrap/Storage/ViewModel/StorageViewModel.swift +++ b/EasyVel/Presentation/Scrap/Storage/ViewModel/StorageViewModel.swift @@ -140,3 +140,9 @@ extension StorageViewModel { return self.realm.deleteFolder(folderName: name) } } + +extension StorageViewModel { + func updateFolderName(to name: String) { + self.folderName = name + } +}