From 806a6683328084b3d679e03f52485d1511b27a2c Mon Sep 17 00:00:00 2001 From: JH713 Date: Tue, 16 Apr 2024 22:21:15 +0900 Subject: [PATCH 1/3] fix: bookmark move error --- iBox/Sources/BoxList/BoxListView.swift | 8 ++++++-- iBox/Sources/BoxList/BoxListViewModel.swift | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/iBox/Sources/BoxList/BoxListView.swift b/iBox/Sources/BoxList/BoxListView.swift index a492c96..c42d999 100644 --- a/iBox/Sources/BoxList/BoxListView.swift +++ b/iBox/Sources/BoxList/BoxListView.swift @@ -150,6 +150,7 @@ class BoxListView: UIView { return cell } + boxListDataSource.defaultRowAnimation = .top boxListDataSource.delegate = self } @@ -422,7 +423,6 @@ class BoxListDataSource: UITableViewDiffableDataSource() + var rowsToReload = Set() var isEditing = false var favoriteId: UUID? = nil From 3fb859a39b381a7b1444560b02580ea2f8197878 Mon Sep 17 00:00:00 2001 From: JH713 Date: Tue, 16 Apr 2024 23:11:40 +0900 Subject: [PATCH 2/3] feat: folder open scroll action --- iBox/Sources/BoxList/BoxListView.swift | 11 +++++++++++ iBox/Sources/BoxList/BoxListViewModel.swift | 3 ++- iBox/Sources/Favorite/FavoriteView.swift | 1 - 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/iBox/Sources/BoxList/BoxListView.swift b/iBox/Sources/BoxList/BoxListView.swift index c42d999..c230eb8 100644 --- a/iBox/Sources/BoxList/BoxListView.swift +++ b/iBox/Sources/BoxList/BoxListView.swift @@ -43,6 +43,9 @@ class BoxListView: UIView { $0.backgroundColor = .clear $0.separatorColor = .clear $0.rowHeight = 50 + $0.estimatedSectionHeaderHeight = 0 + $0.estimatedSectionFooterHeight = 0 + $0.estimatedRowHeight = 0 } private let emptyStackView = UIStackView().then { @@ -185,6 +188,14 @@ class BoxListView: UIView { guard var snapshot = self?.boxListDataSource.snapshot() else { return } snapshot.reloadItems(idArray) self?.boxListDataSource.apply(snapshot) + case .openCloseFolder(boxList: let boxList, section: let section, isEmpty: let isEmpty): + guard let prevOffset = self?.tableView.contentOffset else { return } + self?.applySnapshot(with: boxList) + self?.tableView.layoutIfNeeded() + if !isEmpty { + let indexPath = IndexPath(row: NSNotFound, section: section) + self?.tableView.scrollToRow(at: indexPath, at: .top, animated: true) + } } }.store(in: &cancellables) } diff --git a/iBox/Sources/BoxList/BoxListViewModel.swift b/iBox/Sources/BoxList/BoxListViewModel.swift index 867a7bb..d7bbcf0 100644 --- a/iBox/Sources/BoxList/BoxListViewModel.swift +++ b/iBox/Sources/BoxList/BoxListViewModel.swift @@ -38,6 +38,7 @@ class BoxListViewModel { case reloadSections(idArray: [BoxListSectionViewModel.ID]) case reloadRows(idArray: [BoxListCellViewModel.ID]) case editStatus(isEditing: Bool) + case openCloseFolder(boxList: [BoxListSectionViewModel], section: Int, isEmpty: Bool) } let input = PassthroughSubject() @@ -63,7 +64,7 @@ class BoxListViewModel { } case let .folderTapped(section): boxList[section].isOpened.toggle() - output.send(.sendBoxList(boxList: boxList)) + output.send(.openCloseFolder(boxList: boxList, section: section, isEmpty: boxList[section].boxListCellViewModelsWithStatus.isEmpty)) case let .deleteBookmark(indexPath): deleteBookmark(at: indexPath) case let .toggleFavorite(indexPath): diff --git a/iBox/Sources/Favorite/FavoriteView.swift b/iBox/Sources/Favorite/FavoriteView.swift index f4834e0..0963419 100644 --- a/iBox/Sources/Favorite/FavoriteView.swift +++ b/iBox/Sources/Favorite/FavoriteView.swift @@ -40,7 +40,6 @@ class FavoriteView: UIView { // MARK: - Setup Methods private func setupProperty() { - guard let webView else { return } backgroundColor = .backgroundColor } From 87e1f37d86c9490591298b01e4650ac8f93304da Mon Sep 17 00:00:00 2001 From: JH713 Date: Tue, 16 Apr 2024 23:22:55 +0900 Subject: [PATCH 3/3] =?UTF-8?q?chore:=20=ED=95=84=EC=9A=94=EC=97=86?= =?UTF-8?q?=EB=8A=94=20=EC=A4=84=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- iBox/Sources/BoxList/BoxListView.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/iBox/Sources/BoxList/BoxListView.swift b/iBox/Sources/BoxList/BoxListView.swift index c230eb8..5403162 100644 --- a/iBox/Sources/BoxList/BoxListView.swift +++ b/iBox/Sources/BoxList/BoxListView.swift @@ -189,7 +189,6 @@ class BoxListView: UIView { snapshot.reloadItems(idArray) self?.boxListDataSource.apply(snapshot) case .openCloseFolder(boxList: let boxList, section: let section, isEmpty: let isEmpty): - guard let prevOffset = self?.tableView.contentOffset else { return } self?.applySnapshot(with: boxList) self?.tableView.layoutIfNeeded() if !isEmpty {