From 488263abfea4a4d5322aa870ff666e085f845c37 Mon Sep 17 00:00:00 2001 From: Siwon-L <111dltldnjs@gmail.com> Date: Tue, 3 Dec 2024 20:28:50 +0900 Subject: [PATCH 1/3] =?UTF-8?q?fix=20chatInputField=20TapGestureRecognizer?= =?UTF-8?q?=20=EC=A0=9C=EC=99=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Chating/Views/ChattingListView.swift | 22 +++++++++++++------ .../LiveStreamViewController.swift | 2 +- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Projects/Features/LiveStreamFeature/Sources/Chating/Views/ChattingListView.swift b/Projects/Features/LiveStreamFeature/Sources/Chating/Views/ChattingListView.swift index 9c366fa..60c9b81 100644 --- a/Projects/Features/LiveStreamFeature/Sources/Chating/Views/ChattingListView.swift +++ b/Projects/Features/LiveStreamFeature/Sources/Chating/Views/ChattingListView.swift @@ -10,6 +10,7 @@ protocol ChatInputFieldAction { } final class ChattingListView: BaseView { + private let chattingContainerView = UIView() private let titleLabel = UILabel() private let chatListView = UITableView(frame: .zero, style: .plain) private let chatEmptyView = ChatEmptyView() @@ -48,8 +49,9 @@ final class ChattingListView: BaseView { } override func setupViews() { - addSubview(titleLabel) - addSubview(chatListView) + addSubview(chattingContainerView) + chattingContainerView.addSubview(titleLabel) + chattingContainerView.addSubview(chatListView) addSubview(recentChatButton) addSubview(chatInputField) @@ -77,15 +79,21 @@ final class ChattingListView: BaseView { } override func setupLayouts() { + chattingContainerView.ezl.makeConstraint { + $0.horizontal(to: self) + .top(to: self) + .bottom(to: chatInputField.ezl.top) + } + titleLabel.ezl.makeConstraint { - $0.top(to: self) - .leading(to: self, offset: 20) + $0.top(to: chattingContainerView, offset: 24) + .leading(to: chattingContainerView, offset: 20) } chatListView.ezl.makeConstraint { - $0.horizontal(to: self) + $0.horizontal(to: chattingContainerView) .top(to: titleLabel.ezl.bottom, offset: 21) - .bottom(to: chatInputField.ezl.top) + .bottom(to: chattingContainerView) } chatInputField.ezl.makeConstraint { @@ -107,7 +115,7 @@ final class ChattingListView: BaseView { override func setupActions() { let tapGesture: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(dismissKeyboard)) - self.addGestureRecognizer(tapGesture) + chattingContainerView.addGestureRecognizer(tapGesture) $isScrollFixed .sink { [weak self] in diff --git a/Projects/Features/LiveStreamFeature/Sources/Player/ViewControllers/LiveStreamViewController.swift b/Projects/Features/LiveStreamFeature/Sources/Player/ViewControllers/LiveStreamViewController.swift index 36b34f0..edca936 100644 --- a/Projects/Features/LiveStreamFeature/Sources/Player/ViewControllers/LiveStreamViewController.swift +++ b/Projects/Features/LiveStreamFeature/Sources/Player/ViewControllers/LiveStreamViewController.swift @@ -117,7 +117,7 @@ public final class LiveStreamViewController: BaseViewController Date: Tue, 3 Dec 2024 20:30:05 +0900 Subject: [PATCH 2/3] =?UTF-8?q?fix=20PlayerControl=20=EC=95=A0=EB=8B=88?= =?UTF-8?q?=EB=A9=94=EC=9D=B4=EC=85=98=20=EC=8B=9C=20=ED=82=A4=EB=B3=B4?= =?UTF-8?q?=EB=93=9C=20=EB=82=B4=EB=A0=A4=EA=B0=80=EB=8A=94=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Player/ViewControllers/LiveStreamViewController.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Projects/Features/LiveStreamFeature/Sources/Player/ViewControllers/LiveStreamViewController.swift b/Projects/Features/LiveStreamFeature/Sources/Player/ViewControllers/LiveStreamViewController.swift index edca936..143f570 100644 --- a/Projects/Features/LiveStreamFeature/Sources/Player/ViewControllers/LiveStreamViewController.swift +++ b/Projects/Features/LiveStreamFeature/Sources/Player/ViewControllers/LiveStreamViewController.swift @@ -133,6 +133,12 @@ public final class LiveStreamViewController: BaseViewController Date: Tue, 3 Dec 2024 20:33:04 +0900 Subject: [PATCH 3/3] =?UTF-8?q?fix=20=EC=B1=84=ED=8C=85=20=EC=8A=A4?= =?UTF-8?q?=ED=81=AC=EB=A1=A4=20=EC=8B=9C=20`=EC=B5=9C=EA=B7=BC=20?= =?UTF-8?q?=EC=B1=84=ED=8C=85=EC=9C=BC=EB=A1=9C=20=EC=9D=B4=EB=8F=99`=20?= =?UTF-8?q?=EB=B2=84=ED=8A=BC=20=EC=95=A0=EB=8B=88=EB=A9=94=EC=9D=B4?= =?UTF-8?q?=EC=85=98=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Chating/Views/ChattingListView.swift | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Projects/Features/LiveStreamFeature/Sources/Chating/Views/ChattingListView.swift b/Projects/Features/LiveStreamFeature/Sources/Chating/Views/ChattingListView.swift index 60c9b81..f63f935 100644 --- a/Projects/Features/LiveStreamFeature/Sources/Chating/Views/ChattingListView.swift +++ b/Projects/Features/LiveStreamFeature/Sources/Chating/Views/ChattingListView.swift @@ -18,6 +18,7 @@ final class ChattingListView: BaseView { private let recentChatButton = UIButton() @Published private var isScrollFixed = true + private var isAnimating = false private var recentChatButtonShowConstraints: [NSLayoutConstraint] = [] private var recentChatButtonHideConstraints: [NSLayoutConstraint] = [] @@ -61,7 +62,6 @@ final class ChattingListView: BaseView { chatListView.register(ChattingCell.self, forCellReuseIdentifier: ChattingCell.identifier) chatListView.register(SystemAlarmCell.self, forCellReuseIdentifier: SystemAlarmCell.identifier) chatListView.backgroundView = chatEmptyView - chatListView.bounces = false } override func setupStyles() { @@ -125,8 +125,8 @@ final class ChattingListView: BaseView { recentChatButton.addAction( UIAction { [weak self] _ in - self?.updateRecentChatButtonConstraint(isHidden: true) self?.scrollToBottom() + self?.updateRecentChatButtonConstraint(isHidden: true) }, for: .touchUpInside ) @@ -146,6 +146,7 @@ final class ChattingListView: BaseView { private func scrollToBottom() { guard let indexPath = lastIndexPath() else { return } + isAnimating = true chatListView.scrollToRow(at: indexPath, at: .bottom, animated: true) } @@ -189,9 +190,13 @@ extension ChattingListView: ChatInputFieldAction { } extension ChattingListView: UITableViewDelegate { - func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) { - guard let lastIndexPath = lastIndexPath(), - let indexPathList = chatListView.indexPathsForVisibleRows else { return } - isScrollFixed = indexPathList.contains(lastIndexPath) + func scrollViewDidScroll(_ scrollView: UIScrollView) { + guard !isAnimating else { return } + let offsetMaxY = scrollView.contentSize.height - scrollView.bounds.height + isScrollFixed = (offsetMaxY - 50...offsetMaxY) ~= scrollView.contentOffset.y || offsetMaxY < scrollView.contentOffset.y + } + + func scrollViewDidEndScrollingAnimation(_ scrollView: UIScrollView) { + isAnimating = false } }