Skip to content

Commit

Permalink
[Feat/#288] 캐릭터 선톡 채팅 박스 펼처지고 접힐 때 chevron 이미지 회전 애니메이션 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
nolanMinsung committed Nov 17, 2024
1 parent c17f611 commit 5bfce45
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,6 @@ extension ORBCharacterChatBox {
replyButtonTopConstraint.isActive = false
replyButtonBottomConstraint.isActive = false
}
//
//
// //messageLabel의 trailingAnchor관련 setupLayout 함수 안에 있는거 없에고 여기서 chevronImageButton이랑 엮어서 처리
// messageLabelTrailingConstraintToSuperview.isActive = mode == .withReplyButton ? false : true
// messageLabelTrailingConstraintToChevronImageButton.isActive = mode == .withReplyButton ? true : false
// replyButtonTopConstraint.isActive = mode == .withReplyButton ? true : false
// replyButtonBottomConstraint.isActive = mode == .withReplyButton ? true : false
// messageLabel.numberOfLines = mode == .withReplyButton ? 1 : 0
}

//MARK: - Private Func
Expand Down Expand Up @@ -148,7 +140,7 @@ extension ORBCharacterChatBox {
}

chevronImageButton.do { button in
button.setImage(.icnPlaceListExpendableCellChevron, for: .normal)
button.setImage(.icnChatViewChevronDown, for: .normal)
}

replyButton.do { button in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,21 +271,46 @@ extension ORBCharacterChatViewController {
}

func changeChatBoxMode(to mode: ChatBoxMode, animated: Bool) {
characterChatBoxModeChangingAnimator.stopAnimation(true)
rootView.characterChatBox.mode = mode
rootView.characterChatBox.chevronImageButton.isHidden =
(mode == .withoutReplyButtonShrinked || mode == .withoutReplyButtonExpanded) ? true : false
if animated {
characterChatBoxModeChangingAnimator.addAnimations { [weak self] in
guard let self else { return }
self.rootView.characterChatBox.replyButton.isHidden =
(mode == .withoutReplyButtonShrinked || mode == .withoutReplyButtonExpanded) ? true : false
switch mode {
case .withReplyButtonShrinked:
self.rootView.characterChatBox.replyButton.isHidden = false
self.rootView.characterChatBox.chevronImageButton.transform = .identity
case .withReplyButtonExpanded:
self.rootView.characterChatBox.replyButton.isHidden = false
self.rootView.characterChatBox.chevronImageButton.transform = .init(rotationAngle: .pi * 0.99)
case .withoutReplyButtonShrinked:
self.rootView.characterChatBox.replyButton.isHidden = true
self.rootView.characterChatBox.chevronImageButton.transform = .identity
case .withoutReplyButtonExpanded:
self.rootView.characterChatBox.replyButton.isHidden = true
self.rootView.characterChatBox.chevronImageButton.transform = .init(rotationAngle: .pi * 0.99)
}
self.rootView.characterChatBox.setupAdditionalLayout()
self.rootView.layoutIfNeeded()
}
characterChatBoxModeChangingAnimator.startAnimation()
} else {
self.rootView.characterChatBox.replyButton.isHidden =
(mode == .withoutReplyButtonShrinked || mode == .withoutReplyButtonExpanded) ? true : false
switch mode {
case .withReplyButtonShrinked:
self.rootView.characterChatBox.replyButton.isHidden = false
self.rootView.characterChatBox.chevronImageButton.transform = .identity
case .withReplyButtonExpanded:
self.rootView.characterChatBox.replyButton.isHidden = false
self.rootView.characterChatBox.chevronImageButton.transform = .init(rotationAngle: .pi)
case .withoutReplyButtonShrinked:
self.rootView.characterChatBox.replyButton.isHidden = true
self.rootView.characterChatBox.chevronImageButton.transform = .identity
case .withoutReplyButtonExpanded:
self.rootView.characterChatBox.replyButton.isHidden = true
self.rootView.characterChatBox.chevronImageButton.transform = .init(rotationAngle: .pi)
}
rootView.characterChatBox.setupAdditionalLayout()
rootView.layoutIfNeeded()
}
Expand Down

0 comments on commit 5bfce45

Please sign in to comment.