|
@@ -1129,7 +1129,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if row["image_id"] != nil && !(row["image_id"] as! String).isEmpty && (row["message_text"] as! String).isEmpty && (row["reff_id"] as! String).isEmpty && (row["credential"] as! String) != "1" && (row["read_receipts"] as! String) != "8" {
|
|
|
|
|
|
+ if (dataMessages.count == 0 || dataMessages.last!["f_pin"] as! String == row["f_pin"] as! String) && row["image_id"] != nil && !(row["image_id"] as! String).isEmpty && (row["message_text"] as! String).isEmpty && (row["reff_id"] as! String).isEmpty && (row["credential"] as! String) != "1" && (row["read_receipts"] as! String) != "8" {
|
|
tempImages.append(ImageGrouping(messageId: row["message_id"] as! String, thumbId: row["thumb_id"] as! String, imageId: row["image_id"] as! String, status: row["status"] as! String, time: row["server_date"] as! String, lPin: row["l_pin"] as! String, dataMessage: row, dataPerson: dataPerson))
|
|
tempImages.append(ImageGrouping(messageId: row["message_id"] as! String, thumbId: row["thumb_id"] as! String, imageId: row["image_id"] as! String, status: row["status"] as! String, time: row["server_date"] as! String, lPin: row["l_pin"] as! String, dataMessage: row, dataPerson: dataPerson))
|
|
} else if tempImages.count >= 4 {
|
|
} else if tempImages.count >= 4 {
|
|
groupImages[tempImages[0].messageId] = tempImages
|
|
groupImages[tempImages[0].messageId] = tempImages
|
|
@@ -4955,8 +4955,8 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
let paths = NSSearchPathForDirectoriesInDomains(nsDocumentDirectory, nsUserDomainMask, true)
|
|
let paths = NSSearchPathForDirectoriesInDomains(nsDocumentDirectory, nsUserDomainMask, true)
|
|
if let dirPath = paths.first {
|
|
if let dirPath = paths.first {
|
|
let thumbURL = URL(fileURLWithPath: dirPath).appendingPathComponent(listImages[i].thumbId)
|
|
let thumbURL = URL(fileURLWithPath: dirPath).appendingPathComponent(listImages[i].thumbId)
|
|
-// let image = UIImage(contentsOfFile: thumbURL.path)
|
|
|
|
- let image = UIGraphicsRenderer.renderImageAt(url: thumbURL as NSURL, size: CGSize(width: 250, height: 250))
|
|
|
|
|
|
+ let image = UIImage(contentsOfFile: thumbURL.path)
|
|
|
|
+// let image = UIGraphicsRenderer.renderImageAt(url: thumbURL as NSURL, size: CGSize(width: 250, height: 250))
|
|
listImageThumb[i].image = image
|
|
listImageThumb[i].image = image
|
|
|
|
|
|
let imageURL = URL(fileURLWithPath: dirPath).appendingPathComponent(listImages[i].imageId)
|
|
let imageURL = URL(fileURLWithPath: dirPath).appendingPathComponent(listImages[i].imageId)
|
|
@@ -5038,7 +5038,7 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
countRestImages.textColor = .white
|
|
countRestImages.textColor = .white
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- topMarginText.constant = topMarginText.constant + 205
|
|
|
|
|
|
+ topMarginText.constant = topMarginText.constant + ListGroupImages.getImageSize(image: thumbChat, screenWidth: self.view.frame.size.width * 0.6, screenHeight: 305)!.height
|
|
|
|
|
|
containerMessage.addSubview(imageThumb)
|
|
containerMessage.addSubview(imageThumb)
|
|
imageThumb.translatesAutoresizingMaskIntoConstraints = false
|
|
imageThumb.translatesAutoresizingMaskIntoConstraints = false
|
|
@@ -5049,7 +5049,7 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
imageThumb.leadingAnchor.constraint(equalTo: containerMessage.leadingAnchor, constant: 15).isActive = true
|
|
imageThumb.leadingAnchor.constraint(equalTo: containerMessage.leadingAnchor, constant: 15).isActive = true
|
|
imageThumb.bottomAnchor.constraint(equalTo: messageText.topAnchor, constant: -5).isActive = true
|
|
imageThumb.bottomAnchor.constraint(equalTo: messageText.topAnchor, constant: -5).isActive = true
|
|
imageThumb.trailingAnchor.constraint(equalTo: containerMessage.trailingAnchor, constant: -15).isActive = true
|
|
imageThumb.trailingAnchor.constraint(equalTo: containerMessage.trailingAnchor, constant: -15).isActive = true
|
|
- imageThumb.widthAnchor.constraint(equalToConstant: self.view.frame.size.width * 0.6).isActive = true
|
|
|
|
|
|
+ imageThumb.widthAnchor.constraint(equalToConstant: ListGroupImages.getImageSize(image: thumbChat, screenWidth: self.view.frame.size.width * 0.6, screenHeight: 305)!.width).isActive = true
|
|
imageThumb.layer.cornerRadius = 5.0
|
|
imageThumb.layer.cornerRadius = 5.0
|
|
imageThumb.clipsToBounds = true
|
|
imageThumb.clipsToBounds = true
|
|
imageThumb.contentMode = .scaleAspectFill
|
|
imageThumb.contentMode = .scaleAspectFill
|
|
@@ -5059,8 +5059,8 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
let paths = NSSearchPathForDirectoriesInDomains(nsDocumentDirectory, nsUserDomainMask, true)
|
|
let paths = NSSearchPathForDirectoriesInDomains(nsDocumentDirectory, nsUserDomainMask, true)
|
|
if let dirPath = paths.first {
|
|
if let dirPath = paths.first {
|
|
let thumbURL = URL(fileURLWithPath: dirPath).appendingPathComponent(thumbChat)
|
|
let thumbURL = URL(fileURLWithPath: dirPath).appendingPathComponent(thumbChat)
|
|
- // let image = UIImage(contentsOfFile: thumbURL.path)
|
|
|
|
- let image = UIGraphicsRenderer.renderImageAt(url: thumbURL as NSURL, size: CGSize(width: 250, height: 250))
|
|
|
|
|
|
+ let image = UIImage(contentsOfFile: thumbURL.path)
|
|
|
|
+// let image = UIGraphicsRenderer.renderImageAt(url: thumbURL as NSURL, size: CGSize(width: 250, height: 250))
|
|
imageThumb.image = image
|
|
imageThumb.image = image
|
|
|
|
|
|
let videoURL = URL(fileURLWithPath: dirPath).appendingPathComponent(videoChat)
|
|
let videoURL = URL(fileURLWithPath: dirPath).appendingPathComponent(videoChat)
|
|
@@ -5475,8 +5475,8 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
let paths = NSSearchPathForDirectoriesInDomains(nsDocumentDirectory, nsUserDomainMask, true)
|
|
let paths = NSSearchPathForDirectoriesInDomains(nsDocumentDirectory, nsUserDomainMask, true)
|
|
if let dirPath = paths.first {
|
|
if let dirPath = paths.first {
|
|
let thumbURL = URL(fileURLWithPath: dirPath).appendingPathComponent(thumb_chat)
|
|
let thumbURL = URL(fileURLWithPath: dirPath).appendingPathComponent(thumb_chat)
|
|
-// let image = UIImage(contentsOfFile: thumbURL.path)
|
|
|
|
- let image = UIGraphicsRenderer.renderImageAt(url: thumbURL as NSURL, size: CGSize(width: 250, height: 250))
|
|
|
|
|
|
+ let image = UIImage(contentsOfFile: thumbURL.path)
|
|
|
|
+// let image = UIGraphicsRenderer.renderImageAt(url: thumbURL as NSURL, size: CGSize(width: 250, height: 250))
|
|
let imageThumb = UIImageView(image: image)
|
|
let imageThumb = UIImageView(image: image)
|
|
containerReply.addSubview(imageThumb)
|
|
containerReply.addSubview(imageThumb)
|
|
imageThumb.layer.cornerRadius = 2.0
|
|
imageThumb.layer.cornerRadius = 2.0
|
|
@@ -5536,10 +5536,14 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
listGroupingImages.listGroupingImages = sender.listImageFromGrouping
|
|
listGroupingImages.listGroupingImages = sender.listImageFromGrouping
|
|
listGroupingImages.titleName = titleText
|
|
listGroupingImages.titleName = titleText
|
|
listGroupingImages.isInitiator = sender.isInitiator
|
|
listGroupingImages.isInitiator = sender.isInitiator
|
|
- listGroupingImages.updateEditor = { [self] updatedData in
|
|
|
|
- groupImages[sender.listImageFromGrouping[0].messageId] = updatedData
|
|
|
|
- DispatchQueue.main.async { [self] in
|
|
|
|
- tableChatView.reloadData()
|
|
|
|
|
|
+ listGroupingImages.updateEditor = { [self] updatedData, replyData in
|
|
|
|
+ if updatedData.count != 0 {
|
|
|
|
+ groupImages[sender.listImageFromGrouping[0].messageId] = updatedData
|
|
|
|
+ DispatchQueue.main.async { [self] in
|
|
|
|
+ tableChatView.reloadData()
|
|
|
|
+ }
|
|
|
|
+ } else if replyData.count != 0 {
|
|
|
|
+ handleReply(indexPath: IndexPath(row: 0, section: 0), dataMessagesImage: replyData)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
self.navigationController?.pushViewController(listGroupingImages, animated: true)
|
|
self.navigationController?.pushViewController(listGroupingImages, animated: true)
|
|
@@ -6019,10 +6023,14 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
// return UISwipeActionsConfiguration(actions: [action])
|
|
// return UISwipeActionsConfiguration(actions: [action])
|
|
// }
|
|
// }
|
|
|
|
|
|
- private func handleReply(indexPath: IndexPath) {
|
|
|
|
- let dataMessages = self.dataMessages.filter({ $0["chat_date"] as! String == dataDates[indexPath.section]})
|
|
|
|
|
|
+ private func handleReply(indexPath: IndexPath, dataMessagesImage: [String: Any?] = [:]) {
|
|
self.deleteReplyView()
|
|
self.deleteReplyView()
|
|
- self.textFieldSend.becomeFirstResponder()
|
|
|
|
|
|
+ var dataMessages = self.dataMessages.filter({ $0["chat_date"] as! String == dataDates[indexPath.section]})
|
|
|
|
+ if dataMessages.count != 0 {
|
|
|
|
+ dataMessages = [dataMessagesImage]
|
|
|
|
+ } else {
|
|
|
|
+ self.textFieldSend.becomeFirstResponder()
|
|
|
|
+ }
|
|
self.reffId = dataMessages[indexPath.row]["message_id"] as? String
|
|
self.reffId = dataMessages[indexPath.row]["message_id"] as? String
|
|
UIView.animate(withDuration: 0.25, delay: 0.0, options: .curveEaseInOut, animations: {
|
|
UIView.animate(withDuration: 0.25, delay: 0.0, options: .curveEaseInOut, animations: {
|
|
self.constraintTopTextField.constant = self.constraintTopTextField.constant + 50
|
|
self.constraintTopTextField.constant = self.constraintTopTextField.constant + 50
|
|
@@ -6125,8 +6133,8 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
let paths = NSSearchPathForDirectoriesInDomains(nsDocumentDirectory, nsUserDomainMask, true)
|
|
let paths = NSSearchPathForDirectoriesInDomains(nsDocumentDirectory, nsUserDomainMask, true)
|
|
if let dirPath = paths.first {
|
|
if let dirPath = paths.first {
|
|
let thumbURL = URL(fileURLWithPath: dirPath).appendingPathComponent(thumb_chat)
|
|
let thumbURL = URL(fileURLWithPath: dirPath).appendingPathComponent(thumb_chat)
|
|
-// let image = UIImage(contentsOfFile: thumbURL.path)
|
|
|
|
- let image = UIGraphicsRenderer.renderImageAt(url: thumbURL as NSURL, size: CGSize(width: 250, height: 250))
|
|
|
|
|
|
+ let image = UIImage(contentsOfFile: thumbURL.path)
|
|
|
|
+// let image = UIGraphicsRenderer.renderImageAt(url: thumbURL as NSURL, size: CGSize(width: 250, height: 250))
|
|
let imageThumb = UIImageView(image: image)
|
|
let imageThumb = UIImageView(image: image)
|
|
self.containerPreviewReply.addSubview(imageThumb)
|
|
self.containerPreviewReply.addSubview(imageThumb)
|
|
imageThumb.layer.cornerRadius = 2.0
|
|
imageThumb.layer.cornerRadius = 2.0
|