Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@ final class ChatInputField: BaseView {
heartButton.addTarget(self, action: #selector(didTapHeartButton), for: .touchUpInside)
}

override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
if heartButton.bounds.insetBy(dx: -30, dy: -30).contains(point) {
return heartButton
}
return super.hitTest(point, with: event)
}

@objc
private func didTapHeartButton() {
let generator = UIImpactFeedbackGenerator(style: .light)
Expand All @@ -142,7 +149,6 @@ final class ChatInputField: BaseView {
self?.heartLayer.birthRate = 0
}
layer.addSublayer(heartLayer)

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ final class ChattingListView: BaseView {
titleLabel.font = .setFont(.body1())

chatListView.backgroundColor = .clear
chatListView.keyboardDismissMode = .onDrag
chatListView.allowsSelection = false
chatListView.separatorStyle = .none

Expand Down Expand Up @@ -106,8 +105,10 @@ final class ChattingListView: BaseView {
}

override func setupActions() {
let tapGesture: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(dismissKeyboard))
self.addGestureRecognizer(tapGesture)

$isScrollFixed
.debounce(for: .milliseconds(50), scheduler: DispatchQueue.main)
.sink { [weak self] in
self?.updateRecentChatButtonConstraint(isHidden: $0)
}
Expand Down Expand Up @@ -135,24 +136,27 @@ final class ChattingListView: BaseView {
}

private func scrollToBottom() {
let lastRowIndex = chatListView.numberOfRows(inSection: 0) - 1
guard lastRowIndex >= 0,
let indexPath = lastIndexPath() else { return }
guard let indexPath = lastIndexPath() else { return }
chatListView.scrollToRow(at: indexPath, at: .bottom, animated: true)
}

private func updateRecentChatButtonConstraint(isHidden: Bool) {
UIView.animate(withDuration: 0.2) {
if isHidden {
NSLayoutConstraint.activate(self.recentChatButtonHideConstraints)
NSLayoutConstraint.deactivate(self.recentChatButtonShowConstraints)
NSLayoutConstraint.activate(self.recentChatButtonHideConstraints)
} else {
NSLayoutConstraint.activate(self.recentChatButtonShowConstraints)
NSLayoutConstraint.deactivate(self.recentChatButtonHideConstraints)
NSLayoutConstraint.activate(self.recentChatButtonShowConstraints)
}
self.layoutIfNeeded()
}
}

@objc
private func dismissKeyboard() {
endEditing(true)
}
}

extension ChattingListView {
Expand All @@ -176,7 +180,7 @@ extension ChattingListView: ChatInputFieldAction {
}

extension ChattingListView: UITableViewDelegate {
func scrollViewDidScroll(_ scrollView: UIScrollView) {
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

인예님 scrollViewDidEndDecelerating 호출 시점이 이상합니다ㅠㅠ
버튼이 가장 상단까지 스크롤이 되지 않으면 안올라와요ㅠ

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

엇? 한 번 확인해보겠습니다 시원님!

guard let lastIndexPath = lastIndexPath(),
let indexPathList = chatListView.indexPathsForVisibleRows else { return }
isScrollFixed = indexPathList.contains(lastIndexPath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ public final class LiveStreamViewController: BaseViewController<LiveStreamViewMo
.sink { [weak self] flag in
guard let self else { return }
self.playerView.playerControlViewAlphaAnimalation(flag)
view.endEditing(true)
}
.store(in: &subscription)

Expand Down
Loading