|
@@ -89,6 +89,9 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
var lastScrollIdxSearch = 0
|
|
var lastScrollIdxSearch = 0
|
|
var buttonUp: UIButton!
|
|
var buttonUp: UIButton!
|
|
var buttonDown: UIButton!
|
|
var buttonDown: UIButton!
|
|
|
|
+ var multipleOffsetUp = 1
|
|
|
|
+ var lastOffsetDown = 1
|
|
|
|
+ var gettingDataMessage = true
|
|
|
|
|
|
public override func viewDidDisappear(_ animated: Bool) {
|
|
public override func viewDidDisappear(_ animated: Bool) {
|
|
if self.isMovingFromParent {
|
|
if self.isMovingFromParent {
|
|
@@ -116,6 +119,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
self.navigationController?.setNavigationBarHidden(false, animated: false)
|
|
self.navigationController?.setNavigationBarHidden(false, animated: false)
|
|
}
|
|
}
|
|
updateProfile()
|
|
updateProfile()
|
|
|
|
+ gettingDataMessage = false
|
|
}
|
|
}
|
|
|
|
|
|
public override func viewDidLoad() {
|
|
public override func viewDidLoad() {
|
|
@@ -274,13 +278,12 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
Database.shared.database?.inTransaction({ (fmdb, rollback) in
|
|
Database.shared.database?.inTransaction({ (fmdb, rollback) in
|
|
_ = Database.shared.deleteRecord(fmdb: fmdb, table: "MESSAGE", _where: "(f_pin='\(self.dataPerson["f_pin"]!!)' or l_pin='\(self.dataPerson["f_pin"]!!)') and (message_scope_id='3' or message_scope_id='18') and is_call_center = 0")
|
|
_ = Database.shared.deleteRecord(fmdb: fmdb, table: "MESSAGE", _where: "(f_pin='\(self.dataPerson["f_pin"]!!)' or l_pin='\(self.dataPerson["f_pin"]!!)') and (message_scope_id='3' or message_scope_id='18') and is_call_center = 0")
|
|
_ = Database.shared.deleteRecord(fmdb: fmdb, table: "MESSAGE_SUMMARY", _where: "l_pin='\(self.dataPerson["f_pin"]!!)'")
|
|
_ = Database.shared.deleteRecord(fmdb: fmdb, table: "MESSAGE_SUMMARY", _where: "l_pin='\(self.dataPerson["f_pin"]!!)'")
|
|
|
|
+ if self.fromNotification {
|
|
|
|
+ self.didTapExit()
|
|
|
|
+ } else {
|
|
|
|
+ self.navigationController?.popViewController(animated: true)
|
|
|
|
+ }
|
|
})
|
|
})
|
|
- NotificationCenter.default.post(name: NSNotification.Name(rawValue: "reloadTabChats"), object: nil, userInfo: nil)
|
|
|
|
- if self.fromNotification {
|
|
|
|
- self.didTapExit()
|
|
|
|
- } else {
|
|
|
|
- self.navigationController?.popViewController(animated: true)
|
|
|
|
- }
|
|
|
|
// self.dataMessages.removeAll()
|
|
// self.dataMessages.removeAll()
|
|
// self.dataDates.removeAll()
|
|
// self.dataDates.removeAll()
|
|
// self.tableChatView.reloadData()
|
|
// self.tableChatView.reloadData()
|
|
@@ -354,13 +357,12 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
Database.shared.database?.inTransaction({ (fmdb, rollback) in
|
|
Database.shared.database?.inTransaction({ (fmdb, rollback) in
|
|
_ = Database.shared.deleteRecord(fmdb: fmdb, table: "MESSAGE", _where: "(f_pin='\(self.dataPerson["f_pin"]!!)' or l_pin='\(self.dataPerson["f_pin"]!!)') and (message_scope_id='3' or message_scope_id='18') and is_call_center = 0")
|
|
_ = Database.shared.deleteRecord(fmdb: fmdb, table: "MESSAGE", _where: "(f_pin='\(self.dataPerson["f_pin"]!!)' or l_pin='\(self.dataPerson["f_pin"]!!)') and (message_scope_id='3' or message_scope_id='18') and is_call_center = 0")
|
|
_ = Database.shared.deleteRecord(fmdb: fmdb, table: "MESSAGE_SUMMARY", _where: "l_pin='\(self.dataPerson["f_pin"]!!)'")
|
|
_ = Database.shared.deleteRecord(fmdb: fmdb, table: "MESSAGE_SUMMARY", _where: "l_pin='\(self.dataPerson["f_pin"]!!)'")
|
|
|
|
+ if self.fromNotification {
|
|
|
|
+ self.didTapExit()
|
|
|
|
+ } else {
|
|
|
|
+ self.navigationController?.popViewController(animated: true)
|
|
|
|
+ }
|
|
})
|
|
})
|
|
- NotificationCenter.default.post(name: NSNotification.Name(rawValue: "reloadTabChats"), object: nil, userInfo: nil)
|
|
|
|
- if self.fromNotification {
|
|
|
|
- self.didTapExit()
|
|
|
|
- } else {
|
|
|
|
- self.navigationController?.popViewController(animated: true)
|
|
|
|
- }
|
|
|
|
// self.dataMessages.removeAll()
|
|
// self.dataMessages.removeAll()
|
|
// self.dataDates.removeAll()
|
|
// self.dataDates.removeAll()
|
|
// self.tableChatView.reloadData()
|
|
// self.tableChatView.reloadData()
|
|
@@ -429,18 +431,15 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
let alert = UIAlertController(title: "", message: "Are you sure to delete all message in this conversation?".localized(), preferredStyle: .alert)
|
|
let alert = UIAlertController(title: "", message: "Are you sure to delete all message in this conversation?".localized(), preferredStyle: .alert)
|
|
alert.addAction(UIAlertAction(title: "Cancel".localized(), style: UIAlertAction.Style.default, handler: nil))
|
|
alert.addAction(UIAlertAction(title: "Cancel".localized(), style: UIAlertAction.Style.default, handler: nil))
|
|
alert.addAction(UIAlertAction(title: "Delete".localized(), style: .destructive, handler: {(_) in
|
|
alert.addAction(UIAlertAction(title: "Delete".localized(), style: .destructive, handler: {(_) in
|
|
- DispatchQueue.global().async {
|
|
|
|
- Database.shared.database?.inTransaction({ (fmdb, rollback) in
|
|
|
|
- _ = Database.shared.deleteRecord(fmdb: fmdb, table: "MESSAGE_SUMMARY", _where: "l_pin='\(self.dataPerson["f_pin"]!!)'")
|
|
|
|
- _ = Database.shared.deleteRecord(fmdb: fmdb, table: "MESSAGE", _where: "(f_pin='\(self.dataPerson["f_pin"]!!)' or l_pin='\(self.dataPerson["f_pin"]!!)') and (message_scope_id='3' or message_scope_id='18') and is_call_center = 0")
|
|
|
|
- })
|
|
|
|
- NotificationCenter.default.post(name: NSNotification.Name(rawValue: "reloadTabChats"), object: nil, userInfo: nil)
|
|
|
|
- }
|
|
|
|
- if self.fromNotification {
|
|
|
|
- self.didTapExit()
|
|
|
|
- } else {
|
|
|
|
- self.navigationController?.popViewController(animated: true)
|
|
|
|
- }
|
|
|
|
|
|
+ Database.shared.database?.inTransaction({ (fmdb, rollback) in
|
|
|
|
+ _ = Database.shared.deleteRecord(fmdb: fmdb, table: "MESSAGE_SUMMARY", _where: "l_pin='\(self.dataPerson["f_pin"]!!)'")
|
|
|
|
+ _ = Database.shared.deleteRecord(fmdb: fmdb, table: "MESSAGE", _where: "(f_pin='\(self.dataPerson["f_pin"]!!)' or l_pin='\(self.dataPerson["f_pin"]!!)') and (message_scope_id='3' or message_scope_id='18') and is_call_center = 0")
|
|
|
|
+ if self.fromNotification {
|
|
|
|
+ self.didTapExit()
|
|
|
|
+ } else {
|
|
|
|
+ self.navigationController?.popViewController(animated: true)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
// self.dataMessages.removeAll()
|
|
// self.dataMessages.removeAll()
|
|
// self.dataDates.removeAll()
|
|
// self.dataDates.removeAll()
|
|
// self.tableChatView.reloadData()
|
|
// self.tableChatView.reloadData()
|
|
@@ -474,18 +473,15 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
let alert = UIAlertController(title: "", message: "Are you sure to delete all message in this conversation?".localized(), preferredStyle: .alert)
|
|
let alert = UIAlertController(title: "", message: "Are you sure to delete all message in this conversation?".localized(), preferredStyle: .alert)
|
|
alert.addAction(UIAlertAction(title: "Cancel".localized(), style: UIAlertAction.Style.default, handler: nil))
|
|
alert.addAction(UIAlertAction(title: "Cancel".localized(), style: UIAlertAction.Style.default, handler: nil))
|
|
alert.addAction(UIAlertAction(title: "Delete".localized(), style: .destructive, handler: {(_) in
|
|
alert.addAction(UIAlertAction(title: "Delete".localized(), style: .destructive, handler: {(_) in
|
|
- DispatchQueue.global().async {
|
|
|
|
- Database.shared.database?.inTransaction({ (fmdb, rollback) in
|
|
|
|
- _ = Database.shared.deleteRecord(fmdb: fmdb, table: "MESSAGE_SUMMARY", _where: "l_pin='\(self.dataPerson["f_pin"]!!)'")
|
|
|
|
- _ = Database.shared.deleteRecord(fmdb: fmdb, table: "MESSAGE", _where: "(f_pin='\(self.dataPerson["f_pin"]!!)' or l_pin='\(self.dataPerson["f_pin"]!!)') and (message_scope_id='3' or message_scope_id='18') and is_call_center = 0")
|
|
|
|
- })
|
|
|
|
- NotificationCenter.default.post(name: NSNotification.Name(rawValue: "reloadTabChats"), object: nil, userInfo: nil)
|
|
|
|
- }
|
|
|
|
- if self.fromNotification {
|
|
|
|
- self.didTapExit()
|
|
|
|
- } else {
|
|
|
|
- self.navigationController?.popViewController(animated: true)
|
|
|
|
- }
|
|
|
|
|
|
+ Database.shared.database?.inTransaction({ (fmdb, rollback) in
|
|
|
|
+ _ = Database.shared.deleteRecord(fmdb: fmdb, table: "MESSAGE_SUMMARY", _where: "l_pin='\(self.dataPerson["f_pin"]!!)'")
|
|
|
|
+ _ = Database.shared.deleteRecord(fmdb: fmdb, table: "MESSAGE", _where: "(f_pin='\(self.dataPerson["f_pin"]!!)' or l_pin='\(self.dataPerson["f_pin"]!!)') and (message_scope_id='3' or message_scope_id='18') and is_call_center = 0")
|
|
|
|
+ if self.fromNotification {
|
|
|
|
+ self.didTapExit()
|
|
|
|
+ } else {
|
|
|
|
+ self.navigationController?.popViewController(animated: true)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
// self.dataMessages.removeAll()
|
|
// self.dataMessages.removeAll()
|
|
// self.dataDates.removeAll()
|
|
// self.dataDates.removeAll()
|
|
// self.tableChatView.reloadData()
|
|
// self.tableChatView.reloadData()
|
|
@@ -853,7 +849,132 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private func addDataMessage() {
|
|
|
|
+ multipleOffsetUp += 1
|
|
|
|
+ let queryCount = "SELECT COUNT(*) FROM MESSAGE where (f_pin='\(dataPerson["f_pin"]!!)' or l_pin='\(dataPerson["f_pin"]!!)') AND (message_scope_id = '3' OR message_scope_id = '18') AND is_call_center = 0"
|
|
|
|
+ let query = "SELECT message_id, f_pin, l_pin, message_scope_id, server_date, status, message_text, audio_id, video_id, image_id, thumb_id, read_receipts, chat_id, file_id, attachment_flag, reff_id, lock, is_stared, blog_id, credential FROM MESSAGE where (f_pin='\(dataPerson["f_pin"]!!)' or l_pin='\(dataPerson["f_pin"]!!)') AND (message_scope_id = '3' OR message_scope_id = '18') AND is_call_center = 0 order by server_date asc LIMIT CASE WHEN (\(queryCount))-\(dataMessages.count)>=20 THEN 20*\(multipleOffsetUp-1) ELSE (\(queryCount))-\(dataMessages.count) END OFFSET CASE WHEN (\(queryCount))>=\(20*multipleOffsetUp) THEN (\(queryCount))-\(20*multipleOffsetUp) ELSE 0 END"
|
|
|
|
+ Database.shared.database?.inTransaction({ (fmdb, rollback) in
|
|
|
|
+ if let cursorData = Database.shared.getRecords(fmdb: fmdb, query: query) {
|
|
|
|
+ var tempData: [[String: Any?]] = []
|
|
|
|
+ while cursorData.next() {
|
|
|
|
+ var row: [String: Any?] = [:]
|
|
|
|
+ row["message_id"] = cursorData.string(forColumnIndex: 0)
|
|
|
|
+ row["f_pin"] = cursorData.string(forColumnIndex: 1)
|
|
|
|
+ row["l_pin"] = cursorData.string(forColumnIndex: 2)
|
|
|
|
+ row["message_scope_id"] = cursorData.string(forColumnIndex: 3)
|
|
|
|
+ row["server_date"] = cursorData.string(forColumnIndex: 4)
|
|
|
|
+ row["status"] = cursorData.string(forColumnIndex: 5)
|
|
|
|
+ row["message_text"] = cursorData.string(forColumnIndex: 6)
|
|
|
|
+ row["audio_id"] = cursorData.string(forColumnIndex: 7)
|
|
|
|
+ row["video_id"] = cursorData.string(forColumnIndex: 8)
|
|
|
|
+ row["image_id"] = cursorData.string(forColumnIndex: 9)
|
|
|
|
+ row["thumb_id"] = cursorData.string(forColumnIndex: 10)
|
|
|
|
+ row["read_receipts"] = cursorData.string(forColumnIndex: 11)
|
|
|
|
+ row["chat_id"] = cursorData.string(forColumnIndex: 12)
|
|
|
|
+ row["file_id"] = cursorData.string(forColumnIndex: 13)
|
|
|
|
+ row["attachment_flag"] = cursorData.string(forColumnIndex: 14)
|
|
|
|
+ row["reff_id"] = cursorData.string(forColumnIndex: 15)
|
|
|
|
+ row["lock"] = cursorData.string(forColumnIndex: 16)
|
|
|
|
+ row["is_stared"] = cursorData.string(forColumnIndex: 17)
|
|
|
|
+ row["blog_id"] = cursorData.string(forColumnIndex: 18)
|
|
|
|
+ row["credential"] = cursorData.string(forColumnIndex: 19)
|
|
|
|
+ if let cursorStatus = Database.shared.getRecords(fmdb: fmdb, query: "SELECT status FROM MESSAGE_STATUS WHERE message_id='\(row["message_id"] as! String)'") {
|
|
|
|
+ while cursorStatus.next() {
|
|
|
|
+ row["status"] = cursorStatus.string(forColumnIndex: 0)
|
|
|
|
+ }
|
|
|
|
+ cursorStatus.close()
|
|
|
|
+ }
|
|
|
|
+ let nsDocumentDirectory = FileManager.SearchPathDirectory.documentDirectory
|
|
|
|
+ let nsUserDomainMask = FileManager.SearchPathDomainMask.userDomainMask
|
|
|
|
+ let paths = NSSearchPathForDirectoriesInDomains(nsDocumentDirectory, nsUserDomainMask, true)
|
|
|
|
+ if let dirPath = paths.first {
|
|
|
|
+ let videoURL = URL(fileURLWithPath: dirPath).appendingPathComponent(row["video_id"] as! String)
|
|
|
|
+ let fileURL = URL(fileURLWithPath: dirPath).appendingPathComponent(row["file_id"] as! String)
|
|
|
|
+ if ((row["video_id"] as! String) != "") {
|
|
|
|
+ if FileManager.default.fileExists(atPath: videoURL.path){
|
|
|
|
+ row["progress"] = 100.0
|
|
|
|
+ } else {
|
|
|
|
+ row["progress"] = 0.0
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if FileManager.default.fileExists(atPath: fileURL.path){
|
|
|
|
+ row["progress"] = 100.0
|
|
|
|
+ } else {
|
|
|
|
+ row["progress"] = 0.0
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ row["chat_date"] = chatDate(stringDate: row["server_date"] as! String)
|
|
|
|
+ row["isSelected"] = false
|
|
|
|
+ if row["credential"] as! String == "1" {
|
|
|
|
+ let idMe = UserDefaults.standard.string(forKey: "me")!
|
|
|
|
+ if row["f_pin"] as! String == idMe {
|
|
|
|
+ let second = getSecondsDifferenceFromTwoDates(start: Date.init(milliseconds: Int64(row["server_date"] as! String)!), end: Date())
|
|
|
|
+ if second > 60 {
|
|
|
|
+ listTimerCredential[row["message_id"] as! String] = 0
|
|
|
|
+ row["lock"] = "2"
|
|
|
|
+ row["reff_id"] = ""
|
|
|
|
+ DispatchQueue.global().async {
|
|
|
|
+ Database.shared.database?.inTransaction({ (fmdb, rollback) in
|
|
|
|
+ _ = Database.shared.updateRecord(fmdb: fmdb, table: "MESSAGE", cvalues: [
|
|
|
|
+ "lock" : "2"
|
|
|
|
+ ], _where: "message_id = '\(row["message_id"] as! String)'")
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ let second = 60 - second
|
|
|
|
+ listTimerCredential[row["message_id"] as! String] = second
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ let hasMessageId = UserDefaults.standard.string(forKey: row["message_id"] as! String)
|
|
|
|
+ if hasMessageId != nil {
|
|
|
|
+ let second = getSecondsDifferenceFromTwoDates(start: Date.init(milliseconds: Int64(hasMessageId!)!), end: Date())
|
|
|
|
+ if second > 60 {
|
|
|
|
+ listTimerCredential[row["message_id"] as! String] = 0
|
|
|
|
+ row["lock"] = "2"
|
|
|
|
+ row["reff_id"] = ""
|
|
|
|
+ DispatchQueue.global().async {
|
|
|
|
+ Database.shared.database?.inTransaction({ (fmdb, rollback) in
|
|
|
|
+ _ = Database.shared.updateRecord(fmdb: fmdb, table: "MESSAGE", cvalues: [
|
|
|
|
+ "lock" : "2"
|
|
|
|
+ ], _where: "message_id = '\(row["message_id"] as! String)'")
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ let second = 60 - second
|
|
|
|
+ listTimerCredential[row["message_id"] as! String] = second
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ UserDefaults.standard.set("\(Date().currentTimeMillis())", forKey: row["message_id"] as! String)
|
|
|
|
+ listTimerCredential[row["message_id"] as! String] = 60
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ tempData.append(row)
|
|
|
|
+ }
|
|
|
|
+ if tempData.count != 0 && (dataMessages.firstIndex(where: { $0["message_id"] as? String == tempData[0]["message_id"] as? String }) == nil) {
|
|
|
|
+ let lastIndex = tempData.count - 1
|
|
|
|
+ for i in 0..<tempData.count {
|
|
|
|
+ tableChatView.beginUpdates()
|
|
|
|
+ dataMessages.insert(tempData[lastIndex - i], at: 0)
|
|
|
|
+ if dataMessages.firstIndex(where: { $0["chat_date"] as? String == tempData[lastIndex - i]["chat_date"] as? String }) != nil {
|
|
|
|
+ tableChatView.insertRows(at: [IndexPath(row: 0, section: currentIndexpath!.section)], with: .top)
|
|
|
|
+ } else {
|
|
|
|
+ tableChatView.insertSections(IndexSet(integer: 0), with: .top)
|
|
|
|
+ tableChatView.insertRows(at: [IndexPath(row: 0, section: 0)], with: .top)
|
|
|
|
+ }
|
|
|
|
+ tableChatView.endUpdates()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ cursorData.close()
|
|
|
|
+ gettingDataMessage = false
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
private func getData() {
|
|
private func getData() {
|
|
|
|
+// let queryCount = "SELECT COUNT(*) FROM MESSAGE where (f_pin='\(dataPerson["f_pin"]!!)' or l_pin='\(dataPerson["f_pin"]!!)') AND (message_scope_id = '3' OR message_scope_id = '18') AND is_call_center = 0"
|
|
|
|
+// var query = "SELECT message_id, f_pin, l_pin, message_scope_id, server_date, status, message_text, audio_id, video_id, image_id, thumb_id, read_receipts, chat_id, file_id, attachment_flag, reff_id, lock, is_stared, blog_id, credential FROM MESSAGE where (f_pin='\(dataPerson["f_pin"]!!)' or l_pin='\(dataPerson["f_pin"]!!)') AND (message_scope_id = '3' OR message_scope_id = '18') AND is_call_center = 0 order by server_date asc LIMIT CASE WHEN (\(queryCount))-\(dataMessages.count)>=20 THEN 20 ELSE (\(queryCount))-\(dataMessages.count) END OFFSET CASE WHEN (\(queryCount))>=\(20*multipleOffsetUp) THEN (\(queryCount))-\(20*multipleOffsetUp) ELSE 0 END"
|
|
var query = "SELECT message_id, f_pin, l_pin, message_scope_id, server_date, status, message_text, audio_id, video_id, image_id, thumb_id, read_receipts, chat_id, file_id, attachment_flag, reff_id, lock, is_stared, blog_id, credential FROM MESSAGE where (f_pin='\(dataPerson["f_pin"]!!)' or l_pin='\(dataPerson["f_pin"]!!)') AND (message_scope_id = '3' OR message_scope_id = '18') AND is_call_center = 0 order by server_date asc"
|
|
var query = "SELECT message_id, f_pin, l_pin, message_scope_id, server_date, status, message_text, audio_id, video_id, image_id, thumb_id, read_receipts, chat_id, file_id, attachment_flag, reff_id, lock, is_stared, blog_id, credential FROM MESSAGE where (f_pin='\(dataPerson["f_pin"]!!)' or l_pin='\(dataPerson["f_pin"]!!)') AND (message_scope_id = '3' OR message_scope_id = '18') AND is_call_center = 0 order by server_date asc"
|
|
if isContactCenter {
|
|
if isContactCenter {
|
|
if complaintId.isEmpty {
|
|
if complaintId.isEmpty {
|
|
@@ -2088,7 +2209,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
if isContactCenter {
|
|
if isContactCenter {
|
|
opposite_pin = fPinContacCenter
|
|
opposite_pin = fPinContacCenter
|
|
} else {
|
|
} else {
|
|
- opposite_pin = l_pin
|
|
|
|
|
|
+ opposite_pin = idMe ?? ""
|
|
}
|
|
}
|
|
var credential = credential
|
|
var credential = credential
|
|
if isConfidential {
|
|
if isConfidential {
|
|
@@ -2576,6 +2697,14 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
}
|
|
}
|
|
|
|
|
|
private func checkNewMessage(tableView: UITableView) {
|
|
private func checkNewMessage(tableView: UITableView) {
|
|
|
|
+// let indexPathFirst = tableView.indexPathsForVisibleRows?.first
|
|
|
|
+// if indexPathFirst != nil {
|
|
|
|
+// let dataMessages = self.dataMessages.filter({ $0["chat_date"] as! String == dataDates[indexPathFirst!.section] })
|
|
|
|
+// if self.dataMessages.firstIndex(where: { $0["message_id"] as? String == dataMessages[indexPathFirst!.row]["message_id"] as? String }) == 0 && !gettingDataMessage {
|
|
|
|
+// gettingDataMessage = true
|
|
|
|
+// addDataMessage()
|
|
|
|
+// }
|
|
|
|
+// }
|
|
currentIndexpath = tableView.indexPathsForVisibleRows?.last
|
|
currentIndexpath = tableView.indexPathsForVisibleRows?.last
|
|
if currentIndexpath != nil {
|
|
if currentIndexpath != nil {
|
|
let dataMessages = dataMessages.filter({ $0["chat_date"] as! String == dataDates[currentIndexpath!.section] })
|
|
let dataMessages = dataMessages.filter({ $0["chat_date"] as! String == dataDates[currentIndexpath!.section] })
|
|
@@ -4417,7 +4546,6 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
|
|
for j in 0...listTextEnter.count - 1 {
|
|
for j in 0...listTextEnter.count - 1 {
|
|
let listText = listTextEnter[j].split(separator: " ")
|
|
let listText = listTextEnter[j].split(separator: " ")
|
|
for i in 0...listText.count - 1 {
|
|
for i in 0...listText.count - 1 {
|
|
- print("HMM \(listText[i].lowercased().checkStartWithLink())")
|
|
|
|
if listText[i].lowercased().checkStartWithLink() {
|
|
if listText[i].lowercased().checkStartWithLink() {
|
|
if ((listText[i].lowercased().starts(with: "www.") && listText[i].lowercased().split(separator: ".").count >= 3) || (!listText[i].lowercased().starts(with: "www.") && listText[i].lowercased().split(separator: ".").count >= 2)) && listText[i].lowercased().split(separator: ".").last!.count >= 2 {
|
|
if ((listText[i].lowercased().starts(with: "www.") && listText[i].lowercased().split(separator: ".").count >= 3) || (!listText[i].lowercased().starts(with: "www.") && listText[i].lowercased().split(separator: ".").count >= 2)) && listText[i].lowercased().split(separator: ".").last!.count >= 2 {
|
|
let objectGesture = ObjectGesture(target: self, action: #selector(tapMessageText(_:)))
|
|
let objectGesture = ObjectGesture(target: self, action: #selector(tapMessageText(_:)))
|