|
@@ -823,6 +823,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
|
searchBar.autocapitalizationType = .none
|
|
|
searchBar.delegate = self
|
|
|
searchBar.searchTextField.tintColor = .mainColor
|
|
|
+ searchBar.searchTextField.textColor = .mainColor
|
|
|
searchBar.barTintColor = .secondaryColor
|
|
|
searchBar.searchTextField.backgroundColor = .secondaryColor
|
|
|
searchBar.showsCancelButton = false
|
|
@@ -4973,7 +4974,7 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
|
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 = UIImage(contentsOfFile: thumbURL.path)?.resize(target: CGSize(width: 500, height: 500))
|
|
|
// let image = UIGraphicsRenderer.renderImageAt(url: thumbURL as NSURL, size: CGSize(width: 250, height: 250))
|
|
|
listImageThumb[i].image = image
|
|
|
|
|
@@ -5077,10 +5078,20 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
|
let paths = NSSearchPathForDirectoriesInDomains(nsDocumentDirectory, nsUserDomainMask, true)
|
|
|
if let dirPath = paths.first {
|
|
|
let thumbURL = URL(fileURLWithPath: dirPath).appendingPathComponent(thumbChat)
|
|
|
- let image = UIImage(contentsOfFile: thumbURL.path)
|
|
|
+ DispatchQueue.main.async {
|
|
|
+ let image : UIImage? = {
|
|
|
+ if let img = DigiX.imageCache.object(forKey: thumbChat as NSString) {
|
|
|
+ return img
|
|
|
+ }
|
|
|
+ else if let img = UIImage(contentsOfFile: thumbURL.path)?.resize(target: CGSize(width: 500, height: 500)) {
|
|
|
+ DigiX.imageCache.setObject(img, forKey: thumbChat as NSString)
|
|
|
+ return img
|
|
|
+ }
|
|
|
+ return nil
|
|
|
+ }()
|
|
|
+ imageThumb.image = image
|
|
|
+ }
|
|
|
// 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) {
|
|
@@ -5493,32 +5504,43 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
|
let paths = NSSearchPathForDirectoriesInDomains(nsDocumentDirectory, nsUserDomainMask, true)
|
|
|
if let dirPath = paths.first {
|
|
|
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 imageThumb = UIImageView(image: image)
|
|
|
- containerReply.addSubview(imageThumb)
|
|
|
- imageThumb.layer.cornerRadius = 2.0
|
|
|
- imageThumb.clipsToBounds = true
|
|
|
- imageThumb.contentMode = .scaleAspectFill
|
|
|
- imageThumb.translatesAutoresizingMaskIntoConstraints = false
|
|
|
- imageThumb.trailingAnchor.constraint(equalTo: containerReply.trailingAnchor, constant: -10).isActive = true
|
|
|
- imageThumb.centerYAnchor.constraint(equalTo: containerReply.centerYAnchor).isActive = true
|
|
|
- imageThumb.widthAnchor.constraint(equalToConstant: 30).isActive = true
|
|
|
- imageThumb.heightAnchor.constraint(equalToConstant: 30).isActive = true
|
|
|
-
|
|
|
- if (attachment_flag == "2") {
|
|
|
- let imagePlay = UIImageView(image: UIImage(systemName: "play.circle.fill"))
|
|
|
- imageThumb.addSubview(imagePlay)
|
|
|
- imagePlay.clipsToBounds = true
|
|
|
- imagePlay.translatesAutoresizingMaskIntoConstraints = false
|
|
|
- imagePlay.centerYAnchor.constraint(equalTo: imageThumb.centerYAnchor).isActive = true
|
|
|
- imagePlay.centerXAnchor.constraint(equalTo: imageThumb.centerXAnchor).isActive = true
|
|
|
- imagePlay.widthAnchor.constraint(equalToConstant: 10).isActive = true
|
|
|
- imagePlay.heightAnchor.constraint(equalToConstant: 10).isActive = true
|
|
|
- imagePlay.tintColor = .white
|
|
|
+ DispatchQueue.main.async {
|
|
|
+ let image : UIImage? = {
|
|
|
+ if let img = DigiX.imageCache.object(forKey: thumbChat as NSString) {
|
|
|
+ return img
|
|
|
+ }
|
|
|
+ else if let img = UIImage(contentsOfFile: thumbURL.path)?.resize(target: CGSize(width: 500, height: 500)) {
|
|
|
+ DigiX.imageCache.setObject(img, forKey: thumbChat as NSString)
|
|
|
+ return img
|
|
|
+ }
|
|
|
+ return nil
|
|
|
+ }()
|
|
|
+ // let image = UIGraphicsRenderer.renderImageAt(url: thumbURL as NSURL, size: CGSize(width: 250, height: 250))
|
|
|
+ let imageThumb = UIImageView(image: image)
|
|
|
+ containerReply.addSubview(imageThumb)
|
|
|
+ imageThumb.layer.cornerRadius = 2.0
|
|
|
+ imageThumb.clipsToBounds = true
|
|
|
+ imageThumb.contentMode = .scaleAspectFill
|
|
|
+ imageThumb.translatesAutoresizingMaskIntoConstraints = false
|
|
|
+ imageThumb.trailingAnchor.constraint(equalTo: containerReply.trailingAnchor, constant: -10).isActive = true
|
|
|
+ imageThumb.centerYAnchor.constraint(equalTo: containerReply.centerYAnchor).isActive = true
|
|
|
+ imageThumb.widthAnchor.constraint(equalToConstant: 30).isActive = true
|
|
|
+ imageThumb.heightAnchor.constraint(equalToConstant: 30).isActive = true
|
|
|
+
|
|
|
+ if (attachment_flag == "2") {
|
|
|
+ let imagePlay = UIImageView(image: UIImage(systemName: "play.circle.fill"))
|
|
|
+ imageThumb.addSubview(imagePlay)
|
|
|
+ imagePlay.clipsToBounds = true
|
|
|
+ imagePlay.translatesAutoresizingMaskIntoConstraints = false
|
|
|
+ imagePlay.centerYAnchor.constraint(equalTo: imageThumb.centerYAnchor).isActive = true
|
|
|
+ imagePlay.centerXAnchor.constraint(equalTo: imageThumb.centerXAnchor).isActive = true
|
|
|
+ imagePlay.widthAnchor.constraint(equalToConstant: 10).isActive = true
|
|
|
+ imagePlay.heightAnchor.constraint(equalToConstant: 10).isActive = true
|
|
|
+ imagePlay.tintColor = .white
|
|
|
+ }
|
|
|
+ titleReply.trailingAnchor.constraint(equalTo: imageThumb.leadingAnchor, constant: -20).isActive = true
|
|
|
+ contentReply.trailingAnchor.constraint(equalTo: imageThumb.leadingAnchor, constant: -20).isActive = true
|
|
|
}
|
|
|
- titleReply.trailingAnchor.constraint(equalTo: imageThumb.leadingAnchor, constant: -20).isActive = true
|
|
|
- contentReply.trailingAnchor.constraint(equalTo: imageThumb.leadingAnchor, constant: -20).isActive = true
|
|
|
}
|
|
|
}
|
|
|
if (attachment_flag == "11" && message_text.components(separatedBy: "/").count > 1) {
|
|
@@ -6219,7 +6241,16 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
|
let paths = NSSearchPathForDirectoriesInDomains(nsDocumentDirectory, nsUserDomainMask, true)
|
|
|
if let dirPath = paths.first {
|
|
|
let thumbURL = URL(fileURLWithPath: dirPath).appendingPathComponent(thumb_chat)
|
|
|
- let image = UIImage(contentsOfFile: thumbURL.path)
|
|
|
+ let image : UIImage? = {
|
|
|
+ if let img = DigiX.imageCache.object(forKey: thumb_chat as NSString) {
|
|
|
+ return img
|
|
|
+ }
|
|
|
+ else if let img = UIImage(contentsOfFile: thumbURL.path)?.resize(target: CGSize(width: 500, height: 500)) {
|
|
|
+ DigiX.imageCache.setObject(img, forKey: thumb_chat as NSString)
|
|
|
+ return img
|
|
|
+ }
|
|
|
+ return nil
|
|
|
+ }()
|
|
|
// let image = UIGraphicsRenderer.renderImageAt(url: thumbURL as NSURL, size: CGSize(width: 250, height: 250))
|
|
|
let imageThumb = UIImageView(image: image)
|
|
|
self.containerPreviewReply.addSubview(imageThumb)
|