From 6a42b749c227630063f75f4eb0399c382384e08c Mon Sep 17 00:00:00 2001 From: Benoit Martins Date: Wed, 1 Feb 2023 15:41:28 +0100 Subject: [PATCH] Add title label (ChatMessage address) and message content in reply block --- .../Views/ChatConversationViewSwift.swift | 20 ++++++++++++++-- .../Util/BackActionsNavigationView.swift | 24 ++++++++++++++++--- Classes/Swift/Voip/Theme/VoipTheme.swift | 3 ++- 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/Classes/Swift/Chat/Views/ChatConversationViewSwift.swift b/Classes/Swift/Chat/Views/ChatConversationViewSwift.swift index 6a76c0a0e..643638131 100644 --- a/Classes/Swift/Chat/Views/ChatConversationViewSwift.swift +++ b/Classes/Swift/Chat/Views/ChatConversationViewSwift.swift @@ -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) } } diff --git a/Classes/Swift/Util/BackActionsNavigationView.swift b/Classes/Swift/Util/BackActionsNavigationView.swift index 3e47da8e0..79bc29282 100644 --- a/Classes/Swift/Util/BackActionsNavigationView.swift +++ b/Classes/Swift/Util/BackActionsNavigationView.swift @@ -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) diff --git a/Classes/Swift/Voip/Theme/VoipTheme.swift b/Classes/Swift/Voip/Theme/VoipTheme.swift index c33c3d052..a0fde06aa 100644 --- a/Classes/Swift/Voip/Theme/VoipTheme.swift +++ b/Classes/Swift/Voip/Theme/VoipTheme.swift @@ -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)