Add title label (ChatMessage address) and message content in reply block

This commit is contained in:
Benoit Martins 2023-02-01 15:41:28 +01:00 committed by QuentinArguillere
parent 7a10c045c1
commit 6a42b749c2
3 changed files with 41 additions and 6 deletions

View file

@ -825,7 +825,23 @@ import AVFoundation
}
}
func initReplyView() {
func initReplyView(_ visible: Bool, message: OpaquePointer?) {
if visible {
let addresses = ChatMessage.getSwiftObject(cObject: message!).fromAddress
let composingAddresses : String? = FastAddressBook.displayName(for: addresses?.getCobject)
replyLabelTextView.text = String.localizedStringWithFormat(NSLocalizedString("%@", comment: ""), composingAddresses!)
//let content = ChatMessage.getSwiftObject(cObject: message!).utf8Text
let isIcal = ICSBubbleView.isConferenceInvitationMessage(cmessage: message!)
let content : String? = (isIcal ? ICSBubbleView.getSubjectFromContent(cmessage: message!) : ChatMessage.getSwiftObject(cObject: message!).utf8Text)
replyContentTextView.text = content
print("ChatConversationViewSwift initReplyView \(replyBubble.frame.width)")
print("ChatConversationViewSwift initReplyView \(replyBubble.frame.height)")
replyBubble.frame = CGRect(x: 0, y: 0, width: replyBubble.frame.width, height: replyBubble.frame.height*2)
}
var isBottomOfView = false
if (tableController.tableView.contentOffset.y + 1) >= (tableController.tableView.contentSize.height - tableController.tableView.frame.size.height) {
isBottomOfView = true
@ -1308,6 +1324,6 @@ import AVFoundation
tableController.scroll(to: message?.getCobject)
messageView.messageText.becomeFirstResponder()
*/
initReplyView()
initReplyView(true, message: forMessage)
}
}

View file

@ -38,6 +38,9 @@ import SnapKit
let contentView = UIView()
let isComposingView = UIView()
let isComposingTextView = StyledLabel(VoipTheme.chat_conversation_is_composing_text)
let replyLabelTextView = StyledLabel(VoipTheme.chat_conversation_reply_label)
let replyContentTextView = StyledLabel(VoipTheme.chat_conversation_reply_content)
let replyDeleteButton = CallControlButton(width: 22, height: 22, buttonTheme:VoipTheme.nav_black_button("reply_cancel"))
let messageView = MessageView()
let mediaSelector = UIView()
var replyBubble = UIView()
@ -137,7 +140,7 @@ import SnapKit
stackView.axis = .vertical;
stackView.distribution = .fill;
stackView.alignment = .center;
stackView.spacing = 0;
stackView.spacing = 1;
stackView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(stackView)
@ -157,8 +160,23 @@ import SnapKit
stackView.addArrangedSubview(replyBubble)
replyBubble.height(top_bar_height*2).matchParentSideBorders().done()
replyBubble.backgroundColor = UIColor.blue
replyBubble.translatesAutoresizingMaskIntoConstraints = false
replyBubble.backgroundColor = VoipTheme.voipToolbarBackgroundColor.get()
replyBubble.isHidden = true
replyBubble.addSubview(replyLabelTextView)
replyLabelTextView.alignParentLeft(withMargin: 10).alignParentRight(withMargin: 50).alignParentTop(withMargin: 10).done()
replyBubble.addSubview(replyContentTextView)
replyContentTextView.alignParentLeft(withMargin: 10).alignParentRight(withMargin: 50).alignParentBottom(withMargin: 10).done()
replyContentTextView.translatesAutoresizingMaskIntoConstraints = false
replyContentTextView.numberOfLines = 5
replyBubble.addSubview(replyDeleteButton)
replyDeleteButton.alignParentRight(withMargin: 15).matchParentHeight().done()
replyDeleteButton.onClickAction = {
self.replyBubble.isHidden = true
}
stackView.addArrangedSubview(mediaSelector)
mediaSelector.height(top_bar_height*2).matchParentSideBorders().done()
@ -182,7 +200,7 @@ import SnapKit
stackView.centerXAnchor.constraint(equalTo:self.view.centerXAnchor).isActive = true
stackView.centerYAnchor.constraint(equalTo:self.view.centerYAnchor).isActive = true
view.bringSubviewToFront(isComposingView)
view.bringSubviewToFront(mediaSelector)
view.bringSubviewToFront(replyBubble)

View file

@ -148,7 +148,8 @@ import UIKit
static let chat_conversation_participants = TextStyle(fgColor: LightDarkColor(voip_dark_gray,.white), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Regular", size: 14.0)
static let chat_conversation_is_composing_text = TextStyle(fgColor: LightDarkColor(voip_dark_gray,.white), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Regular", size: 16.0)
static let chat_conversation_operation_in_progress_wait = TextStyle(fgColor: LightDarkColor(primary_color,primary_color), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .center, font: fontName+"-Bold", size: 18.0)
static let chat_conversation_reply_label = TextStyle(fgColor: LightDarkColor(voip_dark_gray,.white), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Bold", size: 12.0)
static let chat_conversation_reply_content = TextStyle(fgColor: LightDarkColor(voip_dark_gray,.white), bgColor: LightDarkColor(.clear,.clear), allCaps: false, align: .left, font: fontName+"-Regular", size: 14.0)
// Buttons Background (State colors)