|
@@ -2024,7 +2024,7 @@ extension EditorGroup: UITextViewDelegate {
|
|
|
onSuccess: { result in
|
|
|
let title = result.title ?? "No Title"
|
|
|
let description = stringURl.contains("google.com") ? "" : result.description
|
|
|
- let imageUrl = result.image
|
|
|
+ let imageUrl = result.icon
|
|
|
Database.shared.database?.inTransaction({ (fmdb, rollback) in
|
|
|
do {
|
|
|
var dataJson: [String: Any] = [:]
|
|
@@ -2094,11 +2094,7 @@ extension EditorGroup: UITextViewDelegate {
|
|
|
imagePreview.bottomAnchor.constraint(equalTo: self.containerLink.bottomAnchor).isActive = true
|
|
|
imagePreview.topAnchor.constraint(equalTo: self.containerLink.topAnchor).isActive = true
|
|
|
imagePreview.widthAnchor.constraint(equalToConstant: 80.0).isActive = true
|
|
|
- if !imageUrl!.starts(with: "https://") {
|
|
|
- imagePreview.loadImageAsync(with: "https://www.google.be" + imageUrl!)
|
|
|
- } else {
|
|
|
- imagePreview.loadImageAsync(with: imageUrl)
|
|
|
- }
|
|
|
+ imagePreview.loadImageAsync(with: imageUrl)
|
|
|
imagePreview.contentMode = .scaleAspectFit
|
|
|
}
|
|
|
|
|
@@ -3334,7 +3330,7 @@ extension EditorGroup: UITableViewDelegate, UITableViewDataSource {
|
|
|
|
|
|
let pictureImage = dataProfile["image_id"]
|
|
|
if dataMessages[indexPath.row]["f_pin"] as? String == "-999" {
|
|
|
- if Utils.getIconDock() != nil {
|
|
|
+ if !Utils.getIconDock().isEmpty {
|
|
|
let dataImage = try? Data(contentsOf: URL(string: Utils.getUrlDock()!)!) //make sure your image in this url does exist, otherwise unwrap in a if let check / try-catch
|
|
|
if dataImage != nil {
|
|
|
profileMessage.image = UIImage(data: dataImage!)
|
|
@@ -3561,29 +3557,33 @@ extension EditorGroup: UITableViewDelegate, UITableViewDataSource {
|
|
|
messageText.isUserInteractionEnabled = false
|
|
|
if !textChat!.isEmpty {
|
|
|
if textChat!.contains("■"){
|
|
|
- textChat = textChat?.components(separatedBy: "■")[0]
|
|
|
- textChat = textChat?.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
|
+ textChat = textChat!.components(separatedBy: "■")[0]
|
|
|
+ textChat = textChat!.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
|
}
|
|
|
let listTextEnter = textChat!.split(separator: "\n")
|
|
|
+ var finalAtribute = textChat!.richText()
|
|
|
+ var containsLink = false
|
|
|
for j in 0...listTextEnter.count - 1 {
|
|
|
let listText = listTextEnter[j].split(separator: " ")
|
|
|
if listText.count > 0 {
|
|
|
for i in 0...listText.count - 1 {
|
|
|
if listText[i].lowercased().checkStartWithLink() {
|
|
|
- let attributedString = textChat!.richText(group_id: self.dataGroup["group_id"] as! String)
|
|
|
- let rangeTapLink = (attributedString.string as NSString).range(of: String(listText[i]))
|
|
|
- attributedString.addAttributes([.foregroundColor: UIColor.blue, .underlineStyle: NSUnderlineStyle.single.rawValue], range: rangeTapLink)
|
|
|
- messageText.attributedText = attributedString
|
|
|
- if messageText.isUserInteractionEnabled == false && !copySession && !forwardSession && !deleteSession && !isHistoryCC && !removed {
|
|
|
- messageText.isUserInteractionEnabled = true
|
|
|
- let longPress = UILongPressGestureRecognizer(target: self, action: #selector(handleLongPressLink(_:)))
|
|
|
- longPress.minimumPressDuration = 0.1
|
|
|
- containerMessage.addGestureRecognizer(longPress)
|
|
|
+ let rangeTapLink = (finalAtribute.string as NSString).range(of: String(listText[i]))
|
|
|
+ finalAtribute.addAttributes([.foregroundColor: UIColor.blue, .underlineStyle: NSUnderlineStyle.single.rawValue], range: rangeTapLink)
|
|
|
+ if !containsLink {
|
|
|
+ containsLink = true
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ messageText.attributedText = finalAtribute
|
|
|
+ if containsLink && !copySession && !forwardSession && !deleteSession && !self.removed {
|
|
|
+ messageText.isUserInteractionEnabled = true
|
|
|
+ let longPress = UILongPressGestureRecognizer(target: self, action: #selector(handleLongPressLink(_:)))
|
|
|
+ longPress.minimumPressDuration = 0.1
|
|
|
+ containerMessage.addGestureRecognizer(longPress)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if !copySession && !forwardSession && !deleteSession && !isHistoryCC && !removed && messageText.isUserInteractionEnabled == false {
|
|
@@ -3999,11 +3999,7 @@ extension EditorGroup: UITableViewDelegate, UITableViewDataSource {
|
|
|
imagePreview.bottomAnchor.constraint(equalTo: containerLinkMessage.bottomAnchor).isActive = true
|
|
|
imagePreview.topAnchor.constraint(equalTo: containerLinkMessage.topAnchor).isActive = true
|
|
|
imagePreview.widthAnchor.constraint(equalToConstant: 80.0).isActive = true
|
|
|
- if !imageUrl!.starts(with: "https://") {
|
|
|
- imagePreview.loadImageAsync(with: "https://www.google.be" + imageUrl!)
|
|
|
- } else {
|
|
|
- imagePreview.loadImageAsync(with: imageUrl)
|
|
|
- }
|
|
|
+ imagePreview.loadImageAsync(with: imageUrl)
|
|
|
imagePreview.contentMode = .scaleToFill
|
|
|
}
|
|
|
|
|
@@ -4015,8 +4011,8 @@ extension EditorGroup: UITableViewDelegate, UITableViewDataSource {
|
|
|
} else {
|
|
|
titlePreview.leadingAnchor.constraint(equalTo: containerLinkMessage.leadingAnchor, constant: 5.0).isActive = true
|
|
|
}
|
|
|
- titlePreview.topAnchor.constraint(equalTo: containerLinkMessage.topAnchor, constant: 25.0).isActive = true
|
|
|
- titlePreview.trailingAnchor.constraint(equalTo: containerLinkMessage.trailingAnchor, constant: -80.0).isActive = true
|
|
|
+ titlePreview.topAnchor.constraint(equalTo: containerLinkMessage.topAnchor, constant: 10.0).isActive = true
|
|
|
+ titlePreview.trailingAnchor.constraint(equalTo: containerLinkMessage.trailingAnchor, constant: -5.0).isActive = true
|
|
|
titlePreview.text = title
|
|
|
titlePreview.font = UIFont.systemFont(ofSize: 14.0, weight: .bold)
|
|
|
titlePreview.textColor = .black
|
|
@@ -4030,7 +4026,7 @@ extension EditorGroup: UITableViewDelegate, UITableViewDataSource {
|
|
|
descPreview.leadingAnchor.constraint(equalTo: containerLinkMessage.leadingAnchor, constant: 5.0).isActive = true
|
|
|
}
|
|
|
descPreview.topAnchor.constraint(equalTo: titlePreview.bottomAnchor).isActive = true
|
|
|
- descPreview.trailingAnchor.constraint(equalTo: containerLinkMessage.trailingAnchor, constant: -80.0).isActive = true
|
|
|
+ descPreview.trailingAnchor.constraint(equalTo: containerLinkMessage.trailingAnchor, constant: -5.0).isActive = true
|
|
|
descPreview.text = description
|
|
|
descPreview.font = UIFont.systemFont(ofSize: 12.0)
|
|
|
descPreview.textColor = .gray
|
|
@@ -4045,7 +4041,7 @@ extension EditorGroup: UITableViewDelegate, UITableViewDataSource {
|
|
|
linkPreview.leadingAnchor.constraint(equalTo: containerLinkMessage.leadingAnchor, constant: 5.0).isActive = true
|
|
|
}
|
|
|
linkPreview.topAnchor.constraint(equalTo: descPreview.bottomAnchor, constant: 8.0).isActive = true
|
|
|
- linkPreview.trailingAnchor.constraint(equalTo: containerLinkMessage.trailingAnchor, constant: -80.0).isActive = true
|
|
|
+ linkPreview.trailingAnchor.constraint(equalTo: containerLinkMessage.trailingAnchor, constant: -5.0).isActive = true
|
|
|
linkPreview.text = link
|
|
|
linkPreview.font = UIFont.systemFont(ofSize: 10.0)
|
|
|
linkPreview.textColor = .gray
|
|
@@ -4076,7 +4072,7 @@ extension EditorGroup: UITableViewDelegate, UITableViewDataSource {
|
|
|
onSuccess: { result in
|
|
|
let title = result.title ?? "No Title"
|
|
|
let description = text.contains("google.com") ? "" : result.description
|
|
|
- let imageUrl = result.image
|
|
|
+ let imageUrl = result.icon
|
|
|
Database.shared.database?.inTransaction({ (fmdb, rollback) in
|
|
|
do {
|
|
|
var dataJson: [String: Any] = [:]
|