|
@@ -291,9 +291,6 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
|
self.navigationController?.popViewController(animated: true)
|
|
|
}
|
|
|
})
|
|
|
-// self.dataMessages.removeAll()
|
|
|
-// self.dataDates.removeAll()
|
|
|
-// self.tableChatView.reloadData()
|
|
|
}))
|
|
|
self.present(alert, animated: true, completion: nil)
|
|
|
}
|
|
@@ -370,9 +367,6 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
|
self.navigationController?.popViewController(animated: true)
|
|
|
}
|
|
|
})
|
|
|
- // self.dataMessages.removeAll()
|
|
|
- // self.dataDates.removeAll()
|
|
|
- // self.tableChatView.reloadData()
|
|
|
}))
|
|
|
self.present(alert, animated: true, completion: nil)
|
|
|
}
|
|
@@ -447,9 +441,6 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
|
self.navigationController?.popViewController(animated: true)
|
|
|
}
|
|
|
})
|
|
|
- // self.dataMessages.removeAll()
|
|
|
- // self.dataDates.removeAll()
|
|
|
- // self.tableChatView.reloadData()
|
|
|
}))
|
|
|
self.present(alert, animated: true, completion: nil)
|
|
|
}
|
|
@@ -489,9 +480,6 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
|
self.navigationController?.popViewController(animated: true)
|
|
|
}
|
|
|
})
|
|
|
- // self.dataMessages.removeAll()
|
|
|
- // self.dataDates.removeAll()
|
|
|
- // self.tableChatView.reloadData()
|
|
|
}))
|
|
|
self.present(alert, animated: true, completion: nil)
|
|
|
}
|
|
@@ -1500,10 +1488,20 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
|
self.counter = 0
|
|
|
self.updateCounter(counter: self.counter)
|
|
|
}
|
|
|
+ let lastMarkerCounter = markerCounter
|
|
|
if self.markerCounter != nil {
|
|
|
self.markerCounter = nil
|
|
|
}
|
|
|
- self.tableChatView.reloadData()
|
|
|
+ self.tableChatView.beginUpdates()
|
|
|
+ let indexMessage = self.dataMessages.firstIndex(where: { $0["message_id"] as? String == lastMarkerCounter })
|
|
|
+ if indexMessage != nil {
|
|
|
+ let section = self.dataDates.firstIndex(of: self.dataMessages[indexMessage!]["chat_date"] as! String)
|
|
|
+ let row = self.dataMessages.filter({ $0["chat_date"] as! String == self.dataMessages[indexMessage!]["chat_date"] as! String}).firstIndex(where: { $0["message_id"] as? String == self.dataMessages[indexMessage!]["message_id"] as? String })
|
|
|
+ if row != nil && section != nil {
|
|
|
+ self.tableChatView.reloadRows(at: [IndexPath(row: row!, section: section!)], with: .none)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ self.tableChatView.endUpdates()
|
|
|
}
|
|
|
else if self.currentIndexpath == nil {
|
|
|
self.counter = 0
|
|
@@ -1516,7 +1514,16 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
|
if !self.indicatorCounterBSTB.isDescendant(of: self.view) && self.buttonScrollToBottom.isDescendant(of: self.view) {
|
|
|
self.markerCounter = row["message_id"] as? String
|
|
|
self.addCounterAtButttonScrollToBottom()
|
|
|
- self.tableChatView.reloadData()
|
|
|
+ self.tableChatView.beginUpdates()
|
|
|
+ let indexMessage = self.dataMessages.firstIndex(where: { $0["message_id"] as? String == self.markerCounter })
|
|
|
+ if indexMessage != nil {
|
|
|
+ let section = self.dataDates.firstIndex(of: self.dataMessages[indexMessage!]["chat_date"] as! String)
|
|
|
+ let row = self.dataMessages.filter({ $0["chat_date"] as! String == self.dataMessages[indexMessage!]["chat_date"] as! String}).firstIndex(where: { $0["message_id"] as? String == self.dataMessages[indexMessage!]["message_id"] as? String })
|
|
|
+ if row != nil && section != nil {
|
|
|
+ self.tableChatView.reloadRows(at: [IndexPath(row: row!, section: section!)], with: .none)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ self.tableChatView.endUpdates()
|
|
|
} else if self.indicatorCounterBSTB.isDescendant(of: self.view) {
|
|
|
self.labelCounter.text = "\(self.counter)"
|
|
|
}
|
|
@@ -1569,7 +1576,6 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
|
let row = self.dataMessages.filter({ $0["chat_date"] as! String == self.dataMessages[idx!]["chat_date"] as! String}).firstIndex(where: { $0["message_id"] as? String == self.dataMessages[idx!]["message_id"] as? String })
|
|
|
if row != nil && section != nil {
|
|
|
self.tableChatView.reloadRows(at: [IndexPath(row: row!, section: section!)], with: .none)
|
|
|
- self.tableChatView.reloadData()
|
|
|
}
|
|
|
if self.listTimerCredential[self.dataMessages[idx!]["message_id"] as! String] != nil {
|
|
|
self.listTimerCredential.removeValue(forKey: self.dataMessages[idx!]["message_id"] as! String)
|
|
@@ -1600,7 +1606,6 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
|
let row = self.dataMessages.filter({ $0["chat_date"] as! String == self.dataMessages[idx!]["chat_date"] as! String}).firstIndex(where: { $0["message_id"] as? String == self.dataMessages[idx!]["message_id"] as? String })
|
|
|
if row != nil && section != nil {
|
|
|
self.tableChatView.reloadRows(at: [IndexPath(row: row!, section: section!)], with: .none)
|
|
|
- self.tableChatView.reloadData()
|
|
|
}
|
|
|
if self.listTimerCredential[self.dataMessages[idx!]["message_id"] as! String] != nil {
|
|
|
self.listTimerCredential.removeValue(forKey: self.dataMessages[idx!]["message_id"] as! String)
|
|
@@ -2301,8 +2306,18 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) {
|
|
|
self.tableChatView.scrollToBottom()
|
|
|
if self.markerCounter != nil {
|
|
|
+ let lastMarkerCounter = self.markerCounter
|
|
|
self.markerCounter = nil
|
|
|
- self.tableChatView.reloadData()
|
|
|
+ self.tableChatView.beginUpdates()
|
|
|
+ let indexMessage = self.dataMessages.firstIndex(where: { $0["message_id"] as? String == lastMarkerCounter })
|
|
|
+ if indexMessage != nil {
|
|
|
+ let section = self.dataDates.firstIndex(of: self.dataMessages[indexMessage!]["chat_date"] as! String)
|
|
|
+ let row = self.dataMessages.filter({ $0["chat_date"] as! String == self.dataMessages[indexMessage!]["chat_date"] as! String}).firstIndex(where: { $0["message_id"] as? String == self.dataMessages[indexMessage!]["message_id"] as? String })
|
|
|
+ if row != nil && section != nil {
|
|
|
+ self.tableChatView.reloadRows(at: [IndexPath(row: row!, section: section!)], with: .none)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ self.tableChatView.endUpdates()
|
|
|
}
|
|
|
}
|
|
|
}
|