forked from mirrors/linphone-iphone
Dynamic size of reply block
This commit is contained in:
parent
6a42b749c2
commit
9930b7d85d
2 changed files with 32 additions and 48 deletions
|
|
@ -131,6 +131,7 @@ import AVFoundation
|
|||
var replyViewOriginY = 0.0
|
||||
var replyViewHeight = 0.0
|
||||
var showReplyView = false
|
||||
var replyMessage : OpaquePointer? = nil
|
||||
|
||||
|
||||
override func viewDidLoad() {
|
||||
|
|
@ -643,12 +644,8 @@ import AVFoundation
|
|||
}
|
||||
|
||||
func onSendClick() {
|
||||
//let rootMessage = replyBubble ? linphone_chat_room_create_reply_message(chatRoom?.getCobject, replyBubble.message) : linphone_chat_room_create_empty_message(chatRoom?.getCobject)
|
||||
let rootMessage = linphone_chat_room_create_empty_message(chatRoom?.getCobject)
|
||||
let rootMessage = !replyBubble.isHidden ? linphone_chat_room_create_reply_message(chatRoom?.getCobject, replyMessage) : linphone_chat_room_create_empty_message(chatRoom?.getCobject)
|
||||
/*
|
||||
if replyBubble != nil {
|
||||
closePendingReply()
|
||||
}
|
||||
if isPendingVoiceRecord && voiceRecorder && linphone_recorder_get_file(voiceRecorder) {
|
||||
let voiceContent = linphone_recorder_create_content(voiceRecorder)
|
||||
isPendingVoiceRecord = false
|
||||
|
|
@ -836,11 +833,20 @@ import AVFoundation
|
|||
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.backgroundColor = (linphone_chat_message_is_outgoing(message) != 0) ? UIColor("A").withAlphaComponent(0.2) : UIColor("D").withAlphaComponent(0.2)
|
||||
|
||||
replyDeleteButton.onClickAction = {
|
||||
self.initReplyView(false, message: nil)
|
||||
}
|
||||
|
||||
if(isIcal){
|
||||
replyMeetingSchedule.image = UIImage(named: "voip_meeting_schedule")
|
||||
replyMeetingSchedule.isHidden = false
|
||||
print("voip_meeting_schedule")
|
||||
}else{
|
||||
replyMeetingSchedule.isHidden = true
|
||||
}
|
||||
|
||||
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) {
|
||||
|
|
@ -1295,35 +1301,11 @@ import AVFoundation
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
func closePendingReply() {
|
||||
if replyBubble != nil {
|
||||
showReplyView = false
|
||||
replyBubble!.view.removeFromSuperview()
|
||||
updateFramesInclRecordingAndReplyView()
|
||||
replyBubble = nil
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@objc func initiateReplyView(forMessage: OpaquePointer?) {
|
||||
/*
|
||||
if replyBubble != nil {
|
||||
closePendingReply()
|
||||
if(replyBubble.isHidden == false){
|
||||
replyBubble.isHidden = true
|
||||
}
|
||||
replyBubble = UIChatReplyBubbleView(nibName: "UIChatReplyBubbleView", bundle: nil)
|
||||
addChild(replyBubble)
|
||||
replyView.addSubview(replyBubble.view)
|
||||
replyBubble.didMove(toParent: self)
|
||||
replyBubble.configure(for: message, withDimissBlock: { [self] in
|
||||
closePendingReply()
|
||||
}, hideDismiss: false) {
|
||||
}
|
||||
showReplyView = true
|
||||
updateFramesInclRecordingAndReplyView()
|
||||
tableController.scroll(to: message?.getCobject)
|
||||
messageView.messageText.becomeFirstResponder()
|
||||
*/
|
||||
replyMessage = forMessage
|
||||
initReplyView(true, message: forMessage)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ import SnapKit
|
|||
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 replyMeetingSchedule = UIImageView()
|
||||
let messageView = MessageView()
|
||||
let mediaSelector = UIView()
|
||||
var replyBubble = UIView()
|
||||
|
|
@ -62,6 +63,7 @@ import SnapKit
|
|||
let floatingButton = CallControlButton(buttonTheme:VoipTheme.nav_button(""))
|
||||
|
||||
var stackView = UIStackView()
|
||||
var stackViewReply = UIStackView()
|
||||
|
||||
func viewDidLoad(backAction : @escaping () -> Void,
|
||||
action1 : @escaping () -> Void,
|
||||
|
|
@ -155,29 +157,29 @@ import SnapKit
|
|||
isComposingView.isHidden = true
|
||||
|
||||
isComposingView.addSubview(isComposingTextView)
|
||||
isComposingTextView.alignParentLeft(withMargin: 10).alignParentRight(withMargin: 10).matchParentHeight().done()
|
||||
isComposingTextView.alignParentLeft(withMargin: 10).alignParentRight(withMargin: 10).alignParentTop(withMargin: 10).matchParentHeight().done()
|
||||
isComposingView.backgroundColor = VoipTheme.backgroundWhiteBlack.get()
|
||||
|
||||
stackView.addArrangedSubview(replyBubble)
|
||||
replyBubble.height(top_bar_height*2).matchParentSideBorders().done()
|
||||
replyBubble.matchParentSideBorders().maxHeight(top_bar_height*2).done()
|
||||
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()
|
||||
replyLabelTextView.alignParentLeft(withMargin: 10).alignParentRight(withMargin: 50).height(40).done()
|
||||
|
||||
replyBubble.addSubview(replyMeetingSchedule)
|
||||
replyMeetingSchedule.alignParentLeft(withMargin: 10).alignParentBottom(withMargin: 10).size(w: 40, h: 40).done()
|
||||
|
||||
replyBubble.addSubview(replyContentTextView)
|
||||
replyContentTextView.alignParentLeft(withMargin: 10).alignParentRight(withMargin: 50).alignParentBottom(withMargin: 10).done()
|
||||
replyContentTextView.translatesAutoresizingMaskIntoConstraints = false
|
||||
replyContentTextView.alignParentLeft(withMargin: 10).alignParentRight(withMargin: 50).alignParentBottom(withMargin: 10).alignParentTop(withMargin: 35).wrapContentY().done()
|
||||
//replyContentTextView.toRightOf(replyMeetingSchedule, withLeftMargin: 10).alignParentRight(withMargin: 50).alignParentBottom(withMargin: 10).alignParentTop(withMargin: 60).wrapContentY().done()
|
||||
replyContentTextView.numberOfLines = 5
|
||||
|
||||
|
||||
replyBubble.addSubview(replyDeleteButton)
|
||||
replyDeleteButton.alignParentRight(withMargin: 15).matchParentHeight().done()
|
||||
replyDeleteButton.onClickAction = {
|
||||
self.replyBubble.isHidden = true
|
||||
}
|
||||
|
||||
replyDeleteButton.alignParentRight(withMargin: 15).centerY().done()
|
||||
|
||||
stackView.addArrangedSubview(mediaSelector)
|
||||
mediaSelector.height(top_bar_height*2).matchParentSideBorders().done()
|
||||
mediaSelector.backgroundColor = VoipTheme.voipToolbarBackgroundColor.get()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue