|
@@ -29,6 +29,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
@IBOutlet var constraintTopTextField: NSLayoutConstraint!
|
|
@IBOutlet var constraintTopTextField: NSLayoutConstraint!
|
|
@IBOutlet var constraintBottomAttachment: NSLayoutConstraint!
|
|
@IBOutlet var constraintBottomAttachment: NSLayoutConstraint!
|
|
@IBOutlet var viewTextfield: UIView!
|
|
@IBOutlet var viewTextfield: UIView!
|
|
|
|
+ @IBOutlet weak var buttonAckConfidential: UIButton!
|
|
public var dataPerson: [String: String?] = [:]
|
|
public var dataPerson: [String: String?] = [:]
|
|
var dataMessages: [[String: Any?]] = []
|
|
var dataMessages: [[String: Any?]] = []
|
|
var dataDates: [String] = []
|
|
var dataDates: [String] = []
|
|
@@ -60,6 +61,8 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
let containerMultpileSelectSession = UIView()
|
|
let containerMultpileSelectSession = UIView()
|
|
let containerAction = UIView()
|
|
let containerAction = UIView()
|
|
var removed = false
|
|
var removed = false
|
|
|
|
+ var isConfidential = false
|
|
|
|
+ var isAck = false
|
|
let viewSticker = UIView()
|
|
let viewSticker = UIView()
|
|
let containerLink = UIView()
|
|
let containerLink = UIView()
|
|
let containerPreviewReply = UIView()
|
|
let containerPreviewReply = UIView()
|
|
@@ -110,6 +113,8 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
|
|
|
|
buttonSendChat.circle()
|
|
buttonSendChat.circle()
|
|
buttonSendChat.addTarget(self, action: #selector(sendTapped), for: .touchUpInside)
|
|
buttonSendChat.addTarget(self, action: #selector(sendTapped), for: .touchUpInside)
|
|
|
|
+ buttonAckConfidential.circle()
|
|
|
|
+ buttonAckConfidential.addTarget(self, action: #selector(showChooserACKConfidential), for: .touchUpInside)
|
|
textFieldSend.layer.cornerRadius = textFieldSend.maxCornerRadius()
|
|
textFieldSend.layer.cornerRadius = textFieldSend.maxCornerRadius()
|
|
textFieldSend.layer.borderWidth = 1.0
|
|
textFieldSend.layer.borderWidth = 1.0
|
|
textFieldSend.text = "Send message".localized()
|
|
textFieldSend.text = "Send message".localized()
|
|
@@ -149,7 +154,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
|
|
|
|
if dataMessageForward != nil {
|
|
if dataMessageForward != nil {
|
|
for i in 0..<dataMessageForward!.count {
|
|
for i in 0..<dataMessageForward!.count {
|
|
- sendChat(message_scope_id: "3", status: "2", message_text: dataMessageForward![i]["message_text"] as! String, credential: "0", attachment_flag: dataMessageForward![i]["attachment_flag"] as! String, ex_blog_id: "", message_large_text: "", ex_format: "", image_id: dataMessageForward![i]["image_id"] as! String, audio_id: dataMessageForward![i]["audio_id"] as! String, video_id: dataMessageForward![i]["video_id"] as! String, file_id: dataMessageForward![i]["file_id"] as! String, thumb_id: dataMessageForward![i]["thumb_id"] as! String, reff_id: "", read_receipts: "", chat_id: "", is_call_center: "0", call_center_id: "", viewController: self)
|
|
|
|
|
|
+ sendChat(message_scope_id: "3", status: "2", message_text: dataMessageForward![i]["message_text"] as! String, credential: "0", attachment_flag: dataMessageForward![i]["attachment_flag"] as! String, ex_blog_id: "", message_large_text: "", ex_format: "", image_id: dataMessageForward![i]["image_id"] as! String, audio_id: dataMessageForward![i]["audio_id"] as! String, video_id: dataMessageForward![i]["video_id"] as! String, file_id: dataMessageForward![i]["file_id"] as! String, thumb_id: dataMessageForward![i]["thumb_id"] as! String, reff_id: "", read_receipts: dataMessageForward![i]["read_receipts"] as! String, chat_id: "", is_call_center: "0", call_center_id: "", viewController: self)
|
|
}
|
|
}
|
|
dataMessageForward = nil
|
|
dataMessageForward = nil
|
|
}
|
|
}
|
|
@@ -701,7 +706,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
row["video_id"] = cursorData.string(forColumnIndex: 8)
|
|
row["video_id"] = cursorData.string(forColumnIndex: 8)
|
|
row["image_id"] = cursorData.string(forColumnIndex: 9)
|
|
row["image_id"] = cursorData.string(forColumnIndex: 9)
|
|
row["thumb_id"] = cursorData.string(forColumnIndex: 10)
|
|
row["thumb_id"] = cursorData.string(forColumnIndex: 10)
|
|
- row["read_receipts"] = cursorData.int(forColumnIndex: 11)
|
|
|
|
|
|
+ row["read_receipts"] = cursorData.string(forColumnIndex: 11)
|
|
row["chat_id"] = cursorData.string(forColumnIndex: 12)
|
|
row["chat_id"] = cursorData.string(forColumnIndex: 12)
|
|
row["file_id"] = cursorData.string(forColumnIndex: 13)
|
|
row["file_id"] = cursorData.string(forColumnIndex: 13)
|
|
row["attachment_flag"] = cursorData.string(forColumnIndex: 14)
|
|
row["attachment_flag"] = cursorData.string(forColumnIndex: 14)
|
|
@@ -1040,7 +1045,11 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
} else {
|
|
} else {
|
|
row["thumb_id"] = ""
|
|
row["thumb_id"] = ""
|
|
}
|
|
}
|
|
- row["read_receipts"] = 0
|
|
|
|
|
|
+ if (chatData.keys.contains(CoreMessage_TMessageKey.READ_RECEIPTS)) {
|
|
|
|
+ row["read_receipts"] = chatData[CoreMessage_TMessageKey.READ_RECEIPTS]
|
|
|
|
+ } else {
|
|
|
|
+ row["read_receipts"] = ""
|
|
|
|
+ }
|
|
row["chat_id"] = ""
|
|
row["chat_id"] = ""
|
|
if (chatData.keys.contains(CoreMessage_TMessageKey.FILE_ID)) {
|
|
if (chatData.keys.contains(CoreMessage_TMessageKey.FILE_ID)) {
|
|
row["file_id"] = chatData[CoreMessage_TMessageKey.FILE_ID]
|
|
row["file_id"] = chatData[CoreMessage_TMessageKey.FILE_ID]
|
|
@@ -1477,6 +1486,54 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
sendChat(message_text: textFieldSend.text!, viewController: self)
|
|
sendChat(message_text: textFieldSend.text!, viewController: self)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @objc func showChooserACKConfidential() {
|
|
|
|
+ let alertController = UIAlertController(title: "Message Mode".localized(), message: "Select".localized() + " " + "Message Mode".localized(), preferredStyle: .actionSheet)
|
|
|
|
+ let imageConfidential = resizeImage(image: UIImage(named: "confidential_icon", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 30, height: 30)).withRenderingMode(.alwaysOriginal)
|
|
|
|
+ let imageAck = resizeImage(image: UIImage(named: "ack_icon", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 30, height: 30)).withRenderingMode(.alwaysOriginal)
|
|
|
|
+ let confidentialAction = UIAlertAction(title: "Confidential Message".localized(), style: .default, handler: { (UIAlertAction) in
|
|
|
|
+ if !self.isConfidential {
|
|
|
|
+ self.isConfidential = true
|
|
|
|
+ self.buttonAckConfidential.setImage(imageConfidential, for: .normal)
|
|
|
|
+ }
|
|
|
|
+ if self.isAck {
|
|
|
|
+ self.isAck = false
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ let ackAction = UIAlertAction(title: "Confirmation Message".localized(), style: .default, handler: { (UIAlertAction) in
|
|
|
|
+ if !self.isAck {
|
|
|
|
+ self.isAck = true
|
|
|
|
+ self.buttonAckConfidential.setImage(imageAck, for: .normal)
|
|
|
|
+ }
|
|
|
|
+ if self.isConfidential {
|
|
|
|
+ self.isConfidential = false
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ confidentialAction.setValue(imageConfidential, forKey: "image")
|
|
|
|
+ ackAction.setValue(imageAck, forKey: "image")
|
|
|
|
+ alertController.addAction(confidentialAction)
|
|
|
|
+ alertController.addAction(ackAction)
|
|
|
|
+ alertController.addAction(UIAlertAction(title: "Cancel".localized(), style: .cancel, handler: { (UIAlertAction) in
|
|
|
|
+ self.isConfidential = false
|
|
|
|
+ self.isAck = false
|
|
|
|
+ self.buttonAckConfidential.setImage(UIImage(systemName: "gearshape.fill", withConfiguration: UIImage.SymbolConfiguration(scale: .large))?.withTintColor(.white).withRenderingMode(.alwaysTemplate), for: .normal)
|
|
|
|
+ }))
|
|
|
|
+ self.present(alertController, animated: true, completion: nil)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public func setAckConfidential(isAck: Bool, isConfidential: Bool) {
|
|
|
|
+ self.isConfidential = isConfidential
|
|
|
|
+ self.isAck = isAck
|
|
|
|
+ let imageConfidential = resizeImage(image: UIImage(named: "confidential_icon", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 30, height: 30)).withRenderingMode(.alwaysOriginal)
|
|
|
|
+ let imageAck = resizeImage(image: UIImage(named: "ack_icon", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 30, height: 30)).withRenderingMode(.alwaysOriginal)
|
|
|
|
+ if isAck {
|
|
|
|
+ buttonAckConfidential.setImage(imageAck, for: .normal)
|
|
|
|
+ } else if isConfidential {
|
|
|
|
+ buttonAckConfidential.setImage(imageConfidential, for: .normal)
|
|
|
|
+ } else {
|
|
|
|
+ self.buttonAckConfidential.setImage(UIImage(systemName: "gearshape.fill", withConfiguration: UIImage.SymbolConfiguration(scale: .large))?.withTintColor(.white).withRenderingMode(.alwaysTemplate), for: .normal)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
@objc func addRoom(sender: UIBarButtonItem) {
|
|
@objc func addRoom(sender: UIBarButtonItem) {
|
|
let controller = QmeraCallContactViewController()
|
|
let controller = QmeraCallContactViewController()
|
|
controller.isDismiss = { user in
|
|
controller.isDismiss = { user in
|
|
@@ -1670,6 +1727,14 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
if isContactCenter {
|
|
if isContactCenter {
|
|
opposite_pin = fPinContacCenter
|
|
opposite_pin = fPinContacCenter
|
|
}
|
|
}
|
|
|
|
+ var credential = credential
|
|
|
|
+ if isConfidential {
|
|
|
|
+ credential = "1"
|
|
|
|
+ }
|
|
|
|
+ var read_receipts = read_receipts
|
|
|
|
+ if isAck {
|
|
|
|
+ read_receipts = "8"
|
|
|
|
+ }
|
|
sendTyping(l_pin: l_pin, isTyping: true)
|
|
sendTyping(l_pin: l_pin, isTyping: true)
|
|
let message = CoreMessage_TMessageBank.sendMessage(l_pin: l_pin, message_scope_id: message_scope_id, status: status, message_text: message_text, credential: credential, attachment_flag: attachment_flag, ex_blog_id: ex_blog_id, message_large_text: message_large_text, ex_format: ex_format, image_id: image_id, audio_id: audio_id, video_id: video_id, file_id: file_id, thumb_id: thumb_id, reff_id: reff_id, read_receipts: read_receipts, chat_id: chat_id, is_call_center: is_call_center, call_center_id: call_center_id, opposite_pin: opposite_pin)
|
|
let message = CoreMessage_TMessageBank.sendMessage(l_pin: l_pin, message_scope_id: message_scope_id, status: status, message_text: message_text, credential: credential, attachment_flag: attachment_flag, ex_blog_id: ex_blog_id, message_large_text: message_large_text, ex_format: ex_format, image_id: image_id, audio_id: audio_id, video_id: video_id, file_id: file_id, thumb_id: thumb_id, reff_id: reff_id, read_receipts: read_receipts, chat_id: chat_id, is_call_center: is_call_center, call_center_id: call_center_id, opposite_pin: opposite_pin)
|
|
Nexilis.addQueueMessage(message: message)
|
|
Nexilis.addQueueMessage(message: message)
|
|
@@ -1686,7 +1751,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
row["video_id"] = video_id
|
|
row["video_id"] = video_id
|
|
row["image_id"] = image_id
|
|
row["image_id"] = image_id
|
|
row["thumb_id"] = thumb_id
|
|
row["thumb_id"] = thumb_id
|
|
- row["read_receipts"] = 0
|
|
|
|
|
|
+ row["read_receipts"] = read_receipts
|
|
row["chat_id"] = chat_id
|
|
row["chat_id"] = chat_id
|
|
row["file_id"] = file_id
|
|
row["file_id"] = file_id
|
|
row["attachment_flag"] = attachment_flag
|
|
row["attachment_flag"] = attachment_flag
|
|
@@ -2165,6 +2230,8 @@ extension EditorPersonal: PreviewAttachmentImageVideoDelegate {
|
|
}
|
|
}
|
|
previewImageVC.modalPresentationStyle = .custom
|
|
previewImageVC.modalPresentationStyle = .custom
|
|
previewImageVC.delegate = self
|
|
previewImageVC.delegate = self
|
|
|
|
+ previewImageVC.isAck = self.isAck
|
|
|
|
+ previewImageVC.isConfidential = self.isConfidential
|
|
self.present(previewImageVC, animated: true, completion: nil)
|
|
self.present(previewImageVC, animated: true, completion: nil)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -3435,7 +3502,11 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
let timeMessage = UILabel()
|
|
let timeMessage = UILabel()
|
|
cellMessage.contentView.addSubview(timeMessage)
|
|
cellMessage.contentView.addSubview(timeMessage)
|
|
timeMessage.translatesAutoresizingMaskIntoConstraints = false
|
|
timeMessage.translatesAutoresizingMaskIntoConstraints = false
|
|
- timeMessage.bottomAnchor.constraint(equalTo: cellMessage.contentView.bottomAnchor, constant: -5).isActive = true
|
|
|
|
|
|
+ if (dataMessages[indexPath.row]["read_receipts"] as? String) == "8" {
|
|
|
|
+ timeMessage.bottomAnchor.constraint(equalTo: cellMessage.contentView.bottomAnchor, constant: -40).isActive = true
|
|
|
|
+ } else {
|
|
|
|
+ timeMessage.bottomAnchor.constraint(equalTo: cellMessage.contentView.bottomAnchor, constant: -5).isActive = true
|
|
|
|
+ }
|
|
|
|
|
|
let statusMessage = UIImageView()
|
|
let statusMessage = UIImageView()
|
|
|
|
|
|
@@ -3488,7 +3559,11 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
|
|
|
|
if (dataMessages[indexPath.row]["f_pin"] as? String == idMe) {
|
|
if (dataMessages[indexPath.row]["f_pin"] as? String == idMe) {
|
|
containerMessage.leadingAnchor.constraint(greaterThanOrEqualTo: cellMessage.contentView.leadingAnchor, constant: 60).isActive = true
|
|
containerMessage.leadingAnchor.constraint(greaterThanOrEqualTo: cellMessage.contentView.leadingAnchor, constant: 60).isActive = true
|
|
- containerMessage.bottomAnchor.constraint(equalTo: cellMessage.contentView.bottomAnchor, constant: -5).isActive = true
|
|
|
|
|
|
+ if (dataMessages[indexPath.row]["read_receipts"] as? String) == "8" {
|
|
|
|
+ containerMessage.bottomAnchor.constraint(equalTo: cellMessage.contentView.bottomAnchor, constant: -40).isActive = true
|
|
|
|
+ } else {
|
|
|
|
+ containerMessage.bottomAnchor.constraint(equalTo: cellMessage.contentView.bottomAnchor, constant: -5).isActive = true
|
|
|
|
+ }
|
|
if isContactCenter {
|
|
if isContactCenter {
|
|
containerMessage.topAnchor.constraint(equalTo: nameSender.bottomAnchor).isActive = true
|
|
containerMessage.topAnchor.constraint(equalTo: nameSender.bottomAnchor).isActive = true
|
|
containerMessage.trailingAnchor.constraint(equalTo: profileMessage.leadingAnchor, constant: -5).isActive = true
|
|
containerMessage.trailingAnchor.constraint(equalTo: profileMessage.leadingAnchor, constant: -5).isActive = true
|
|
@@ -3519,6 +3594,8 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
statusMessage.image = UIImage(named: "checklist", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!.withTintColor(UIColor.lightGray)
|
|
statusMessage.image = UIImage(named: "checklist", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!.withTintColor(UIColor.lightGray)
|
|
} else if (dataMessages[indexPath.row]["status"]! as! String == "3") {
|
|
} else if (dataMessages[indexPath.row]["status"]! as! String == "3") {
|
|
statusMessage.image = UIImage(named: "double-checklist", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!.withTintColor(UIColor.lightGray)
|
|
statusMessage.image = UIImage(named: "double-checklist", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!.withTintColor(UIColor.lightGray)
|
|
|
|
+ } else if (dataMessages[indexPath.row]["status"]! as! String == "8") {
|
|
|
|
+ statusMessage.image = UIImage(named: "message_status_ack", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!.withRenderingMode(.alwaysOriginal)
|
|
} else {
|
|
} else {
|
|
statusMessage.image = UIImage(named: "double-checklist", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!.withTintColor(UIColor.systemBlue)
|
|
statusMessage.image = UIImage(named: "double-checklist", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!.withTintColor(UIColor.systemBlue)
|
|
}
|
|
}
|
|
@@ -3576,7 +3653,11 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
containerMessage.leadingAnchor.constraint(equalTo: cellMessage.contentView.leadingAnchor, constant: 15).isActive = true
|
|
containerMessage.leadingAnchor.constraint(equalTo: cellMessage.contentView.leadingAnchor, constant: 15).isActive = true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- containerMessage.bottomAnchor.constraint(equalTo: cellMessage.contentView.bottomAnchor, constant: -5).isActive = true
|
|
|
|
|
|
+ if (dataMessages[indexPath.row]["read_receipts"] as? String) == "8" {
|
|
|
|
+ containerMessage.bottomAnchor.constraint(equalTo: cellMessage.contentView.bottomAnchor, constant: -40).isActive = true
|
|
|
|
+ } else {
|
|
|
|
+ containerMessage.bottomAnchor.constraint(equalTo: cellMessage.contentView.bottomAnchor, constant: -5).isActive = true
|
|
|
|
+ }
|
|
containerMessage.trailingAnchor.constraint(lessThanOrEqualTo: cellMessage.contentView.trailingAnchor, constant: -60).isActive = true
|
|
containerMessage.trailingAnchor.constraint(lessThanOrEqualTo: cellMessage.contentView.trailingAnchor, constant: -60).isActive = true
|
|
containerMessage.widthAnchor.constraint(greaterThanOrEqualToConstant: 46).isActive = true
|
|
containerMessage.widthAnchor.constraint(greaterThanOrEqualToConstant: 46).isActive = true
|
|
if dataMessages[indexPath.row]["attachment_flag"] as? String == "11" && dataMessages[indexPath.row]["reff_id"]as? String == "" && (dataMessages[indexPath.row]["lock"] == nil || dataMessages[indexPath.row]["lock"] as! String != "1") {
|
|
if dataMessages[indexPath.row]["attachment_flag"] as? String == "11" && dataMessages[indexPath.row]["reff_id"]as? String == "" && (dataMessages[indexPath.row]["lock"] == nil || dataMessages[indexPath.row]["lock"] as! String != "1") {
|
|
@@ -3609,6 +3690,30 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
imageStared.tintColor = .systemYellow
|
|
imageStared.tintColor = .systemYellow
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if dataMessages[indexPath.row]["read_receipts"] as? String == "8" {
|
|
|
|
+ let imageAckView = UIImageView()
|
|
|
|
+ var imageAck = UIImage(named: "ack_icon_gray", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!.withRenderingMode(.alwaysOriginal)
|
|
|
|
+ if dataMessages[indexPath.row]["status"] as? String == "8" {
|
|
|
|
+ imageAck = UIImage(named: "ack_icon", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!.withRenderingMode(.alwaysOriginal)
|
|
|
|
+ }
|
|
|
|
+ imageAckView.image = imageAck
|
|
|
|
+ cellMessage.contentView.addSubview(imageAckView)
|
|
|
|
+ imageAckView.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
+ imageAckView.widthAnchor.constraint(equalToConstant: 30).isActive = true
|
|
|
|
+ imageAckView.heightAnchor.constraint(equalToConstant: 30).isActive = true
|
|
|
|
+ if (dataMessages[indexPath.row]["f_pin"] as? String == idMe) {
|
|
|
|
+ imageAckView.topAnchor.constraint(equalTo: containerMessage.bottomAnchor, constant: 5).isActive = true
|
|
|
|
+ imageAckView.trailingAnchor.constraint(equalTo: containerMessage.leadingAnchor, constant: 30).isActive = true
|
|
|
|
+ } else {
|
|
|
|
+ imageAckView.topAnchor.constraint(equalTo: containerMessage.bottomAnchor, constant: 5).isActive = true
|
|
|
|
+ imageAckView.leadingAnchor.constraint(equalTo: containerMessage.trailingAnchor, constant: -30).isActive = true
|
|
|
|
+ let tap = ObjectGesture(target: self, action: #selector(tapAck(_:)))
|
|
|
|
+ tap.indexPath = indexPath
|
|
|
|
+ imageAckView.addGestureRecognizer(tap)
|
|
|
|
+ imageAckView.isUserInteractionEnabled = true
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
let messageText = UILabel()
|
|
let messageText = UILabel()
|
|
messageText.numberOfLines = 0
|
|
messageText.numberOfLines = 0
|
|
messageText.lineBreakMode = .byWordWrapping
|
|
messageText.lineBreakMode = .byWordWrapping
|
|
@@ -4122,6 +4227,42 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
return cellMessage
|
|
return cellMessage
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @objc func tapAck(_ sender: ObjectGesture) {
|
|
|
|
+ let indexPath = sender.indexPath
|
|
|
|
+ let dataMessages = self.dataMessages.filter({ $0["chat_date"] as! String == dataDates[indexPath.section]})
|
|
|
|
+ if dataMessages[indexPath.row]["status"] as! String == "8" {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if !CheckConnection.isConnectedToNetwork() || API.nGetCLXConnState() == 0 {
|
|
|
|
+ let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
|
+ imageView.tintColor = .white
|
|
|
|
+ let banner = FloatingNotificationBanner(title: "Check your connection".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .danger, colors: nil, iconPosition: .center)
|
|
|
|
+ banner.show()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ DispatchQueue.global().async {
|
|
|
|
+ let result = Nexilis.write(message: CoreMessage_TMessageBank.getAckLocationMessage(f_pin: dataMessages[indexPath.row]["f_pin"] as! String, message_id: dataMessages[indexPath.row]["message_id"] as! String, l_pin: dataMessages[indexPath.row]["l_pin"] as! String, server_date: "\(Date().millisecondsSince1970)", message_scope_id: dataMessages[indexPath.row]["message_scope_id"] as! String, longitude: "", latitude: "", description: ""))
|
|
|
|
+ if result != nil {
|
|
|
|
+ Database.shared.database?.inTransaction({ (fmdb, rollback) in
|
|
|
|
+ _ = Database.shared.updateRecord(fmdb: fmdb, table: "MESSAGE", cvalues: [
|
|
|
|
+ "status" : "8"
|
|
|
|
+ ], _where: "message_id = '\(dataMessages[indexPath.row]["message_id"] as! String)'")
|
|
|
|
+ })
|
|
|
|
+ DispatchQueue.main.async {
|
|
|
|
+ if let index = self.dataMessages.firstIndex(where: {$0["message_id"] as? String == dataMessages[indexPath.row]["message_id"] as? String}) {
|
|
|
|
+ self.dataMessages[index]["status"] = "8"
|
|
|
|
+ let section = self.dataDates.firstIndex(of: self.dataMessages[index]["chat_date"] as! String)
|
|
|
|
+ let row = self.dataMessages.filter({$0["chat_date"] as! String == self.dataMessages[index]["chat_date"] as! String}).firstIndex(where: { $0["message_id"] as? String == self.dataMessages[indexPath.row]["message_id"] as? String})
|
|
|
|
+ if row != nil && section != nil {
|
|
|
|
+ self.tableChatView.reloadRows(at: [IndexPath(row: row!, section: section!)], with: .none)
|
|
|
|
+ }
|
|
|
|
+ self.showToast(message: "Confirmation Success.".localized(), font: UIFont.systemFont(ofSize: 12, weight: .medium), controller: self)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
// public func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
|
|
// public func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
|
|
// let velocity : CGPoint = gestureRecognizer.location(in: tableChatView)
|
|
// let velocity : CGPoint = gestureRecognizer.location(in: tableChatView)
|
|
// if velocity.x < 0 {
|
|
// if velocity.x < 0 {
|
|
@@ -4442,6 +4583,7 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
// }
|
|
// }
|
|
|
|
|
|
private func handleReply(indexPath: IndexPath) {
|
|
private func handleReply(indexPath: IndexPath) {
|
|
|
|
+ let dataMessages = self.dataMessages.filter({ $0["chat_date"] as! String == dataDates[indexPath.section]})
|
|
self.deleteReplyView()
|
|
self.deleteReplyView()
|
|
self.textFieldSend.becomeFirstResponder()
|
|
self.textFieldSend.becomeFirstResponder()
|
|
self.reffId = dataMessages[indexPath.row]["message_id"] as? String
|
|
self.reffId = dataMessages[indexPath.row]["message_id"] as? String
|