|
@@ -106,6 +106,8 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
var isDirectCC = false
|
|
var isDirectCC = false
|
|
var fakeProgMultip = 0
|
|
var fakeProgMultip = 0
|
|
let maxFakeProgMultip = 2
|
|
let maxFakeProgMultip = 2
|
|
|
|
+ var groupImages: [String:[ImageGrouping]] = [:]
|
|
|
|
+ var titleText: String!
|
|
|
|
|
|
public override func viewDidDisappear(_ animated: Bool) {
|
|
public override func viewDidDisappear(_ animated: Bool) {
|
|
if self.isMovingFromParent {
|
|
if self.isMovingFromParent {
|
|
@@ -115,6 +117,9 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
self.timeoutCC.invalidate()
|
|
self.timeoutCC.invalidate()
|
|
UserDefaults.standard.removeObject(forKey: "inEditorPersonal")
|
|
UserDefaults.standard.removeObject(forKey: "inEditorPersonal")
|
|
NotificationCenter.default.removeObserver(self)
|
|
NotificationCenter.default.removeObserver(self)
|
|
|
|
+ super.viewDidDisappear(true)
|
|
|
|
+ self.removeFromParent()
|
|
|
|
+ self.dismiss(animated: true, completion: nil)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -808,6 +813,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
titleNavigation.textColor = .white
|
|
titleNavigation.textColor = .white
|
|
titleNavigation.font = UIFont.systemFont(ofSize: 12).bold
|
|
titleNavigation.font = UIFont.systemFont(ofSize: 12).bold
|
|
navigationItem.titleView = viewAppBar
|
|
navigationItem.titleView = viewAppBar
|
|
|
|
+ titleText = titleNavigation.text
|
|
} else {
|
|
} else {
|
|
searchBar = UISearchBar()
|
|
searchBar = UISearchBar()
|
|
searchBar.autocapitalizationType = .none
|
|
searchBar.autocapitalizationType = .none
|
|
@@ -1023,6 +1029,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
}
|
|
}
|
|
Database.shared.database?.inTransaction({ (fmdb, rollback) in
|
|
Database.shared.database?.inTransaction({ (fmdb, rollback) in
|
|
if let cursorData = Database.shared.getRecords(fmdb: fmdb, query: query) {
|
|
if let cursorData = Database.shared.getRecords(fmdb: fmdb, query: query) {
|
|
|
|
+ var tempImages: [ImageGrouping] = []
|
|
while cursorData.next() {
|
|
while cursorData.next() {
|
|
var row: [String: Any?] = [:]
|
|
var row: [String: Any?] = [:]
|
|
row["message_id"] = cursorData.string(forColumnIndex: 0)
|
|
row["message_id"] = cursorData.string(forColumnIndex: 0)
|
|
@@ -1117,8 +1124,25 @@ 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" {
|
|
|
|
+ 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))
|
|
|
|
+ } else if tempImages.count >= 4 {
|
|
|
|
+ groupImages[tempImages[0].messageId] = tempImages
|
|
|
|
+ for _ in 1..<tempImages.count {
|
|
|
|
+ dataMessages.removeLast()
|
|
|
|
+ }
|
|
|
|
+ tempImages.removeAll()
|
|
|
|
+ } else if tempImages.count > 0 {
|
|
|
|
+ tempImages.removeAll()
|
|
|
|
+ }
|
|
dataMessages.append(row)
|
|
dataMessages.append(row)
|
|
}
|
|
}
|
|
|
|
+ if tempImages.count >= 4 {
|
|
|
|
+ groupImages[tempImages[0].messageId] = tempImages
|
|
|
|
+ for _ in 1..<tempImages.count {
|
|
|
|
+ dataMessages.removeLast()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
cursorData.close()
|
|
cursorData.close()
|
|
}
|
|
}
|
|
})
|
|
})
|
|
@@ -4283,6 +4307,7 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
return cell
|
|
return cell
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ let messageIdChat = (dataMessages[indexPath.row]["message_id"] as? String) ?? ""
|
|
let thumbChat = (dataMessages[indexPath.row]["thumb_id"] as? String) ?? ""
|
|
let thumbChat = (dataMessages[indexPath.row]["thumb_id"] as? String) ?? ""
|
|
let imageChat = (dataMessages[indexPath.row]["image_id"] as? String) ?? ""
|
|
let imageChat = (dataMessages[indexPath.row]["image_id"] as? String) ?? ""
|
|
let videoChat = (dataMessages[indexPath.row]["video_id"] as? String) ?? ""
|
|
let videoChat = (dataMessages[indexPath.row]["video_id"] as? String) ?? ""
|
|
@@ -4755,102 +4780,210 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
let containerViewFile = UIView()
|
|
let containerViewFile = UIView()
|
|
|
|
|
|
if (!thumbChat.isEmpty && (dataMessages[indexPath.row]["lock"] == nil || dataMessages[indexPath.row]["lock"] as! String != "1") && (dataMessages[indexPath.row]["lock"] as? String != "2")) {
|
|
if (!thumbChat.isEmpty && (dataMessages[indexPath.row]["lock"] == nil || dataMessages[indexPath.row]["lock"] as! String != "1") && (dataMessages[indexPath.row]["lock"] as? String != "2")) {
|
|
- topMarginText.constant = topMarginText.constant + 205
|
|
|
|
-
|
|
|
|
- containerMessage.addSubview(imageThumb)
|
|
|
|
- imageThumb.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
- let data = queryMessageReply(message_id: reffChat)
|
|
|
|
- if (data.count == 0) {
|
|
|
|
- imageThumb.topAnchor.constraint(equalTo: containerMessage.topAnchor, 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.trailingAnchor.constraint(equalTo: containerMessage.trailingAnchor, constant: -15).isActive = true
|
|
|
|
- imageThumb.widthAnchor.constraint(equalToConstant: self.view.frame.size.width * 0.6).isActive = true
|
|
|
|
- imageThumb.layer.cornerRadius = 5.0
|
|
|
|
- imageThumb.clipsToBounds = true
|
|
|
|
- imageThumb.contentMode = .scaleAspectFill
|
|
|
|
-
|
|
|
|
- let nsDocumentDirectory = FileManager.SearchPathDirectory.documentDirectory
|
|
|
|
- let nsUserDomainMask = FileManager.SearchPathDomainMask.userDomainMask
|
|
|
|
- let paths = NSSearchPathForDirectoriesInDomains(nsDocumentDirectory, nsUserDomainMask, true)
|
|
|
|
- if let dirPath = paths.first {
|
|
|
|
- let thumbURL = URL(fileURLWithPath: dirPath).appendingPathComponent(thumbChat)
|
|
|
|
- let image = UIImage(contentsOfFile: thumbURL.path)
|
|
|
|
- imageThumb.image = image
|
|
|
|
-
|
|
|
|
- let videoURL = URL(fileURLWithPath: dirPath).appendingPathComponent(videoChat)
|
|
|
|
- let imageURL = URL(fileURLWithPath: dirPath).appendingPathComponent(imageChat)
|
|
|
|
- if !FileManager.default.fileExists(atPath: imageURL.path) || !FileManager.default.fileExists(atPath: videoURL.path) {
|
|
|
|
- let blurEffect = UIBlurEffect(style: UIBlurEffect.Style.light)
|
|
|
|
|
|
+ if let listImages = groupImages[messageIdChat] {
|
|
|
|
+ timeMessage.isHidden = true
|
|
|
|
+ statusMessage.isHidden = true
|
|
|
|
+ topMarginText.constant = topMarginText.constant + 225
|
|
|
|
+ let listImageThumb: [UIImageView] = [UIImageView(), UIImageView(), UIImageView(), UIImageView()]
|
|
|
|
+ for i in 0..<4 {
|
|
|
|
+ containerMessage.addSubview(listImageThumb[i])
|
|
|
|
+ listImageThumb[i].layer.cornerRadius = 5.0
|
|
|
|
+ listImageThumb[i].clipsToBounds = true
|
|
|
|
+ listImageThumb[i].contentMode = .scaleAspectFill
|
|
|
|
+ let widthHeightImage: CGFloat = 120
|
|
|
|
+ switch i {
|
|
|
|
+ case 0:
|
|
|
|
+ listImageThumb[i].anchor(top: containerMessage.topAnchor, left: containerMessage.leftAnchor, paddingTop: 5, paddingLeft: 5, width: widthHeightImage, height: widthHeightImage)
|
|
|
|
+ case 1:
|
|
|
|
+ listImageThumb[i].anchor(top: containerMessage.topAnchor, left: listImageThumb[0].rightAnchor, right: containerMessage.rightAnchor, paddingTop: 5, paddingLeft: 5, paddingRight: 5, width: widthHeightImage, height: widthHeightImage)
|
|
|
|
+ case 2:
|
|
|
|
+ listImageThumb[i].anchor(left: containerMessage.leftAnchor, bottom: containerMessage.bottomAnchor, paddingLeft: 5, paddingBottom: 5, width: widthHeightImage, height: widthHeightImage)
|
|
|
|
+ default:
|
|
|
|
+ listImageThumb[i].anchor(left: listImageThumb[2].rightAnchor, bottom: containerMessage.bottomAnchor, right: containerMessage.rightAnchor, paddingLeft: 5, paddingBottom: 5, paddingRight: 5, width: widthHeightImage, height: widthHeightImage)
|
|
|
|
+ }
|
|
|
|
+ let nsDocumentDirectory = FileManager.SearchPathDirectory.documentDirectory
|
|
|
|
+ let nsUserDomainMask = FileManager.SearchPathDomainMask.userDomainMask
|
|
|
|
+ let paths = NSSearchPathForDirectoriesInDomains(nsDocumentDirectory, nsUserDomainMask, true)
|
|
|
|
+ if let dirPath = paths.first {
|
|
|
|
+ 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))
|
|
|
|
+ listImageThumb[i].image = image
|
|
|
|
+
|
|
|
|
+ let imageURL = URL(fileURLWithPath: dirPath).appendingPathComponent(listImages[i].imageId)
|
|
|
|
+ if !FileManager.default.fileExists(atPath: imageURL.path) {
|
|
|
|
+ let blurEffect = UIBlurEffect(style: UIBlurEffect.Style.light)
|
|
|
|
+ let blurEffectView = UIVisualEffectView(effect: blurEffect)
|
|
|
|
+ blurEffectView.frame = CGRect(x: 0, y: 0, width: listImageThumb[i].frame.size.width, height: listImageThumb[i].frame.size.height)
|
|
|
|
+ blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
|
|
|
+ listImageThumb[i].addSubview(blurEffectView)
|
|
|
|
+ if !listImages[i].imageId.isEmpty {
|
|
|
|
+ let imageDownload = UIImageView(image: UIImage(systemName: "arrow.down.circle.fill", withConfiguration: UIImage.SymbolConfiguration(pointSize: 50, weight: .bold, scale: .default)))
|
|
|
|
+ listImageThumb[i].addSubview(imageDownload)
|
|
|
|
+ imageDownload.tintColor = .black.withAlphaComponent(0.3)
|
|
|
|
+ imageDownload.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
+ imageDownload.centerXAnchor.constraint(equalTo: listImageThumb[i].centerXAnchor).isActive = true
|
|
|
|
+ imageDownload.centerYAnchor.constraint(equalTo: listImageThumb[i].centerYAnchor).isActive = true
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ let containerTimeStatus = UIView()
|
|
|
|
+ listImageThumb[i].addSubview(containerTimeStatus)
|
|
|
|
+ containerTimeStatus.anchor(bottom: listImageThumb[i].bottomAnchor, right: listImageThumb[i].rightAnchor, height: 15)
|
|
|
|
+ let widthcontainerTimeStatus = containerTimeStatus.widthAnchor.constraint(equalToConstant: 50)
|
|
|
|
+ widthcontainerTimeStatus.isActive = true
|
|
|
|
+ containerTimeStatus.layer.cornerRadius = 5.0
|
|
|
|
+ containerTimeStatus.layer.masksToBounds = true
|
|
|
|
+ containerTimeStatus.backgroundColor = .black.withAlphaComponent(0.15)
|
|
|
|
+
|
|
|
|
+ let timeInImage = UILabel()
|
|
|
|
+ containerTimeStatus.addSubview(timeInImage)
|
|
|
|
+ let date = Date(milliseconds: Int64(listImages[i].time) ?? 100)
|
|
|
|
+ let formatter = DateFormatter()
|
|
|
|
+ formatter.dateFormat = "HH:mm"
|
|
|
|
+ formatter.locale = NSLocale(localeIdentifier: "id") as Locale?
|
|
|
|
+ timeInImage.text = formatter.string(from: date as Date)
|
|
|
|
+ timeInImage.textColor = .white
|
|
|
|
+ timeInImage.font = UIFont.systemFont(ofSize: 10, weight: .medium)
|
|
|
|
+
|
|
|
|
+ if (dataMessages[indexPath.row]["f_pin"] as? String == idMe) {
|
|
|
|
+ let statusInImage = UIImageView()
|
|
|
|
+ containerTimeStatus.addSubview(statusInImage)
|
|
|
|
+ statusInImage.anchor(right: containerTimeStatus.rightAnchor, centerY: containerTimeStatus.centerYAnchor, width: 15, height: 15)
|
|
|
|
+ if listImages[i].status == "1" || listImages[i].status == "2" {
|
|
|
|
+ statusInImage.image = UIImage(named: "checklist", in: Bundle.resourceBundle(for: DigiX.self), with: nil)!.withTintColor(UIColor.white)
|
|
|
|
+ } else if listImages[i].status == "3" {
|
|
|
|
+ statusInImage.image = UIImage(named: "double-checklist", in: Bundle.resourceBundle(for: DigiX.self), with: nil)!.withTintColor(UIColor.white)
|
|
|
|
+ } else {
|
|
|
|
+ statusInImage.image = UIImage(named: "double-checklist", in: Bundle.resourceBundle(for: DigiX.self), with: nil)!.withTintColor(UIColor.systemBlue)
|
|
|
|
+ }
|
|
|
|
+ timeInImage.anchor(right: statusInImage.leftAnchor, centerY: containerTimeStatus.centerYAnchor, height: 15)
|
|
|
|
+ } else {
|
|
|
|
+ timeInImage.anchor(right: containerTimeStatus.rightAnchor, paddingRight: 5, centerY: containerTimeStatus.centerYAnchor, height: 15)
|
|
|
|
+ widthcontainerTimeStatus.constant = 40
|
|
|
|
+ }
|
|
|
|
+ if !copySession && !forwardSession && !deleteSession {
|
|
|
|
+ let objectTap = ObjectGesture(target: self, action: #selector(imageGroupingTapped(_:)))
|
|
|
|
+ listImageThumb[i].isUserInteractionEnabled = true
|
|
|
|
+ listImageThumb[i].addGestureRecognizer(objectTap)
|
|
|
|
+ objectTap.indexImageTapped = i
|
|
|
|
+ objectTap.listImageFromGrouping = listImages
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if listImages.count > 4 {
|
|
|
|
+ let blurEffect = UIBlurEffect(style: UIBlurEffect.Style.dark)
|
|
let blurEffectView = UIVisualEffectView(effect: blurEffect)
|
|
let blurEffectView = UIVisualEffectView(effect: blurEffect)
|
|
- blurEffectView.frame = CGRect(x: 0, y: 0, width: imageThumb.frame.size.width, height: imageThumb.frame.size.height)
|
|
|
|
|
|
+ blurEffectView.frame = CGRect(x: 0, y: 0, width: listImageThumb[3].frame.size.width, height: listImageThumb[3].frame.size.height)
|
|
blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
|
blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
|
- imageThumb.addSubview(blurEffectView)
|
|
|
|
- if !imageChat.isEmpty {
|
|
|
|
- let imageDownload = UIImageView(image: UIImage(systemName: "arrow.down.circle.fill", withConfiguration: UIImage.SymbolConfiguration(pointSize: 50, weight: .bold, scale: .default)))
|
|
|
|
- imageThumb.addSubview(imageDownload)
|
|
|
|
- imageDownload.tintColor = .black.withAlphaComponent(0.3)
|
|
|
|
- imageDownload.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
- imageDownload.centerXAnchor.constraint(equalTo: imageThumb.centerXAnchor).isActive = true
|
|
|
|
- imageDownload.centerYAnchor.constraint(equalTo: imageThumb.centerYAnchor).isActive = true
|
|
|
|
|
|
+ listImageThumb[3].addSubview(blurEffectView)
|
|
|
|
+
|
|
|
|
+ let countRestImages = UILabel()
|
|
|
|
+ listImageThumb[3].addSubview(countRestImages)
|
|
|
|
+ countRestImages.anchor(centerX: listImageThumb[3].centerXAnchor, centerY: listImageThumb[3].centerYAnchor)
|
|
|
|
+ countRestImages.font = UIFont.systemFont(ofSize: 30, weight: .medium)
|
|
|
|
+ countRestImages.text = "+\(listImages.count - 3)"
|
|
|
|
+ countRestImages.textColor = .white
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ topMarginText.constant = topMarginText.constant + 205
|
|
|
|
+
|
|
|
|
+ containerMessage.addSubview(imageThumb)
|
|
|
|
+ imageThumb.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
+ let data = queryMessageReply(message_id: reffChat)
|
|
|
|
+ if (data.count == 0) {
|
|
|
|
+ imageThumb.topAnchor.constraint(equalTo: containerMessage.topAnchor, 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.trailingAnchor.constraint(equalTo: containerMessage.trailingAnchor, constant: -15).isActive = true
|
|
|
|
+ imageThumb.widthAnchor.constraint(equalToConstant: self.view.frame.size.width * 0.6).isActive = true
|
|
|
|
+ imageThumb.layer.cornerRadius = 5.0
|
|
|
|
+ imageThumb.clipsToBounds = true
|
|
|
|
+ imageThumb.contentMode = .scaleAspectFill
|
|
|
|
+
|
|
|
|
+ let nsDocumentDirectory = FileManager.SearchPathDirectory.documentDirectory
|
|
|
|
+ let nsUserDomainMask = FileManager.SearchPathDomainMask.userDomainMask
|
|
|
|
+ let paths = NSSearchPathForDirectoriesInDomains(nsDocumentDirectory, nsUserDomainMask, true)
|
|
|
|
+ if let dirPath = paths.first {
|
|
|
|
+ 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))
|
|
|
|
+ imageThumb.image = image
|
|
|
|
+
|
|
|
|
+ let videoURL = URL(fileURLWithPath: dirPath).appendingPathComponent(videoChat)
|
|
|
|
+ let imageURL = URL(fileURLWithPath: dirPath).appendingPathComponent(imageChat)
|
|
|
|
+ if !FileManager.default.fileExists(atPath: imageURL.path) || !FileManager.default.fileExists(atPath: videoURL.path) {
|
|
|
|
+ let blurEffect = UIBlurEffect(style: UIBlurEffect.Style.light)
|
|
|
|
+ let blurEffectView = UIVisualEffectView(effect: blurEffect)
|
|
|
|
+ blurEffectView.frame = CGRect(x: 0, y: 0, width: imageThumb.frame.size.width, height: imageThumb.frame.size.height)
|
|
|
|
+ blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
|
|
|
+ imageThumb.addSubview(blurEffectView)
|
|
|
|
+ if !imageChat.isEmpty {
|
|
|
|
+ let imageDownload = UIImageView(image: UIImage(systemName: "arrow.down.circle.fill", withConfiguration: UIImage.SymbolConfiguration(pointSize: 50, weight: .bold, scale: .default)))
|
|
|
|
+ imageThumb.addSubview(imageDownload)
|
|
|
|
+ imageDownload.tintColor = .black.withAlphaComponent(0.3)
|
|
|
|
+ imageDownload.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
+ imageDownload.centerXAnchor.constraint(equalTo: imageThumb.centerXAnchor).isActive = true
|
|
|
|
+ imageDownload.centerYAnchor.constraint(equalTo: imageThumb.centerYAnchor).isActive = true
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (videoChat != "") {
|
|
|
|
- let imagePlay = UIImageView(image: UIImage(systemName: "play.fill", withConfiguration: UIImage.SymbolConfiguration(pointSize: 20, weight: .bold, scale: .default))?.imageWithInsets(insets: UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10))?.withTintColor(.white))
|
|
|
|
- imagePlay.circle()
|
|
|
|
- imageThumb.addSubview(imagePlay)
|
|
|
|
- imagePlay.backgroundColor = .black.withAlphaComponent(0.3)
|
|
|
|
- imagePlay.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
- imagePlay.centerXAnchor.constraint(equalTo: imageThumb.centerXAnchor).isActive = true
|
|
|
|
- imagePlay.centerYAnchor.constraint(equalTo: imageThumb.centerYAnchor).isActive = true
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (dataMessages[indexPath.row]["progress"] as! Double != 100.0 && dataMessages[indexPath.row]["f_pin"] as? String == idMe) {
|
|
|
|
- let container = UIView()
|
|
|
|
- imageThumb.addSubview(container)
|
|
|
|
- container.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
- container.bottomAnchor.constraint(equalTo: imageThumb.bottomAnchor, constant: -10).isActive = true
|
|
|
|
- container.leadingAnchor.constraint(equalTo: imageThumb.leadingAnchor, constant: 10).isActive = true
|
|
|
|
- container.widthAnchor.constraint(equalToConstant: 30).isActive = true
|
|
|
|
- container.heightAnchor.constraint(equalToConstant: 30).isActive = true
|
|
|
|
- container.backgroundColor = .white.withAlphaComponent(0.1)
|
|
|
|
- let circlePath = UIBezierPath(arcCenter: CGPoint(x: 10, y: 20), radius: 15, startAngle: -(.pi / 2), endAngle: .pi * 2, clockwise: true)
|
|
|
|
- let trackShape = CAShapeLayer()
|
|
|
|
- trackShape.path = circlePath.cgPath
|
|
|
|
- trackShape.fillColor = UIColor.black.withAlphaComponent(0.3).cgColor
|
|
|
|
- trackShape.lineWidth = 3
|
|
|
|
- trackShape.strokeColor = UIColor.blueBubbleColor.withAlphaComponent(0.3).cgColor
|
|
|
|
- container.backgroundColor = .clear
|
|
|
|
- container.layer.addSublayer(trackShape)
|
|
|
|
- let shapeLoading = CAShapeLayer()
|
|
|
|
- shapeLoading.path = circlePath.cgPath
|
|
|
|
- shapeLoading.fillColor = UIColor.clear.cgColor
|
|
|
|
- shapeLoading.lineWidth = 3
|
|
|
|
- shapeLoading.strokeEnd = 0
|
|
|
|
- shapeLoading.strokeColor = UIColor.blueBubbleColor.cgColor
|
|
|
|
- container.layer.addSublayer(shapeLoading)
|
|
|
|
- let imageupload = UIImageView(image: UIImage(systemName: "arrow.up", withConfiguration: UIImage.SymbolConfiguration(pointSize: 10, weight: .bold, scale: .default)))
|
|
|
|
- imageupload.tintColor = .white
|
|
|
|
- container.addSubview(imageupload)
|
|
|
|
- imageupload.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
- imageupload.bottomAnchor.constraint(equalTo: imageThumb.bottomAnchor, constant: -10).isActive = true
|
|
|
|
- imageupload.leadingAnchor.constraint(equalTo: imageThumb.leadingAnchor, constant: 10).isActive = true
|
|
|
|
- imageupload.widthAnchor.constraint(equalToConstant: 20).isActive = true
|
|
|
|
- imageupload.heightAnchor.constraint(equalToConstant: 20).isActive = true
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if !copySession && !forwardSession && !deleteSession {
|
|
|
|
- let objectTap = ObjectGesture(target: self, action: #selector(contentMessageTapped(_:)))
|
|
|
|
- imageThumb.isUserInteractionEnabled = true
|
|
|
|
- imageThumb.addGestureRecognizer(objectTap)
|
|
|
|
- objectTap.image_id = imageChat
|
|
|
|
- objectTap.video_id = videoChat
|
|
|
|
- objectTap.imageView = imageThumb
|
|
|
|
- objectTap.indexPath = indexPath
|
|
|
|
|
|
+ if (videoChat != "") {
|
|
|
|
+ let imagePlay = UIImageView(image: UIImage(systemName: "play.fill", withConfiguration: UIImage.SymbolConfiguration(pointSize: 20, weight: .bold, scale: .default))?.imageWithInsets(insets: UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10))?.withTintColor(.white))
|
|
|
|
+ imagePlay.circle()
|
|
|
|
+ imageThumb.addSubview(imagePlay)
|
|
|
|
+ imagePlay.backgroundColor = .black.withAlphaComponent(0.3)
|
|
|
|
+ imagePlay.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
+ imagePlay.centerXAnchor.constraint(equalTo: imageThumb.centerXAnchor).isActive = true
|
|
|
|
+ imagePlay.centerYAnchor.constraint(equalTo: imageThumb.centerYAnchor).isActive = true
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (dataMessages[indexPath.row]["progress"] as! Double != 100.0 && dataMessages[indexPath.row]["f_pin"] as? String == idMe) {
|
|
|
|
+ let container = UIView()
|
|
|
|
+ imageThumb.addSubview(container)
|
|
|
|
+ container.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
+ container.bottomAnchor.constraint(equalTo: imageThumb.bottomAnchor, constant: -10).isActive = true
|
|
|
|
+ container.leadingAnchor.constraint(equalTo: imageThumb.leadingAnchor, constant: 10).isActive = true
|
|
|
|
+ container.widthAnchor.constraint(equalToConstant: 30).isActive = true
|
|
|
|
+ container.heightAnchor.constraint(equalToConstant: 30).isActive = true
|
|
|
|
+ container.backgroundColor = .white.withAlphaComponent(0.1)
|
|
|
|
+ let circlePath = UIBezierPath(arcCenter: CGPoint(x: 10, y: 20), radius: 15, startAngle: -(.pi / 2), endAngle: .pi * 2, clockwise: true)
|
|
|
|
+ let trackShape = CAShapeLayer()
|
|
|
|
+ trackShape.path = circlePath.cgPath
|
|
|
|
+ trackShape.fillColor = UIColor.black.withAlphaComponent(0.3).cgColor
|
|
|
|
+ trackShape.lineWidth = 3
|
|
|
|
+ trackShape.strokeColor = UIColor.blueBubbleColor.withAlphaComponent(0.3).cgColor
|
|
|
|
+ container.backgroundColor = .clear
|
|
|
|
+ container.layer.addSublayer(trackShape)
|
|
|
|
+ let shapeLoading = CAShapeLayer()
|
|
|
|
+ shapeLoading.path = circlePath.cgPath
|
|
|
|
+ shapeLoading.fillColor = UIColor.clear.cgColor
|
|
|
|
+ shapeLoading.lineWidth = 3
|
|
|
|
+ shapeLoading.strokeEnd = 0
|
|
|
|
+ shapeLoading.strokeColor = UIColor.blueBubbleColor.cgColor
|
|
|
|
+ container.layer.addSublayer(shapeLoading)
|
|
|
|
+ let imageupload = UIImageView(image: UIImage(systemName: "arrow.up", withConfiguration: UIImage.SymbolConfiguration(pointSize: 10, weight: .bold, scale: .default)))
|
|
|
|
+ imageupload.tintColor = .white
|
|
|
|
+ container.addSubview(imageupload)
|
|
|
|
+ imageupload.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
+ imageupload.bottomAnchor.constraint(equalTo: imageThumb.bottomAnchor, constant: -10).isActive = true
|
|
|
|
+ imageupload.leadingAnchor.constraint(equalTo: imageThumb.leadingAnchor, constant: 10).isActive = true
|
|
|
|
+ imageupload.widthAnchor.constraint(equalToConstant: 20).isActive = true
|
|
|
|
+ imageupload.heightAnchor.constraint(equalToConstant: 20).isActive = true
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if !copySession && !forwardSession && !deleteSession {
|
|
|
|
+ let objectTap = ObjectGesture(target: self, action: #selector(contentMessageTapped(_:)))
|
|
|
|
+ imageThumb.isUserInteractionEnabled = true
|
|
|
|
+ imageThumb.addGestureRecognizer(objectTap)
|
|
|
|
+ objectTap.image_id = imageChat
|
|
|
|
+ objectTap.video_id = videoChat
|
|
|
|
+ objectTap.imageView = imageThumb
|
|
|
|
+ objectTap.indexPath = indexPath
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -5190,7 +5323,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 = 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
|
|
@@ -5244,6 +5378,14 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
return cell
|
|
return cell
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @objc func imageGroupingTapped(_ sender: ObjectGesture) {
|
|
|
|
+ let listGroupingImages = ListGroupImages()
|
|
|
|
+ listGroupingImages.imageTapped = sender.indexImageTapped
|
|
|
|
+ listGroupingImages.listGroupingImages = sender.listImageFromGrouping
|
|
|
|
+ listGroupingImages.titleName = titleText
|
|
|
|
+ self.navigationController?.pushViewController(listGroupingImages, animated: true)
|
|
|
|
+ }
|
|
|
|
+
|
|
@objc func tapAck(_ sender: ObjectGesture) {
|
|
@objc func tapAck(_ sender: ObjectGesture) {
|
|
if blocking == "1" {
|
|
if blocking == "1" {
|
|
self.view.makeToast("You blocked this user".localized())
|
|
self.view.makeToast("You blocked this user".localized())
|
|
@@ -5824,7 +5966,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 = 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
|
|
@@ -6030,6 +6173,8 @@ public class ObjectGesture: UITapGestureRecognizer {
|
|
public var labelFile = UILabel()
|
|
public var labelFile = UILabel()
|
|
public var videoURL: NSURL?
|
|
public var videoURL: NSURL?
|
|
public var indexPath = IndexPath()
|
|
public var indexPath = IndexPath()
|
|
|
|
+ public var indexImageTapped: Int!
|
|
|
|
+ public var listImageFromGrouping: [ImageGrouping]!
|
|
}
|
|
}
|
|
|
|
|
|
class navigationQLPreviewDocument: UIBarButtonItem {
|
|
class navigationQLPreviewDocument: UIBarButtonItem {
|
|
@@ -6039,3 +6184,19 @@ class navigationQLPreviewDocument: UIBarButtonItem {
|
|
class segmentedControllerObject: UISegmentedControl {
|
|
class segmentedControllerObject: UISegmentedControl {
|
|
var navigation = UINavigationController()
|
|
var navigation = UINavigationController()
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+public class ImageGrouping {
|
|
|
|
+ public var messageId = ""
|
|
|
|
+ public var thumbId = ""
|
|
|
|
+ public var imageId = ""
|
|
|
|
+ public var status = ""
|
|
|
|
+ public var time = ""
|
|
|
|
+
|
|
|
|
+ public init(messageId: String, thumbId: String, imageId: String, status: String, time: String) {
|
|
|
|
+ self.messageId = messageId
|
|
|
|
+ self.thumbId = thumbId
|
|
|
|
+ self.imageId = imageId
|
|
|
|
+ self.status = status
|
|
|
|
+ self.time = time
|
|
|
|
+ }
|
|
|
|
+}
|