|
@@ -32,6 +32,23 @@ class ListGroupImages: UIViewController, UITableViewDataSource, UITableViewDeleg
|
|
|
tableViewImages.anchor(top: self.view.safeAreaLayoutGuide.topAnchor, left: self.view.safeAreaLayoutGuide.leftAnchor, bottom: self.view.safeAreaLayoutGuide.bottomAnchor, right: self.view.safeAreaLayoutGuide.rightAnchor)
|
|
|
|
|
|
tableViewImages.scrollToRow(at: IndexPath(row: imageTapped, section: 0), at: .top, animated: false)
|
|
|
+
|
|
|
+ let center: NotificationCenter = NotificationCenter.default
|
|
|
+ center.addObserver(self, selector: #selector(onStatusChat(notification:)), name: NSNotification.Name(rawValue: Nexilis.listenerStatusChat), object: nil)
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func onStatusChat(notification: NSNotification) {
|
|
|
+ DispatchQueue.main.async { [self] in
|
|
|
+ let data:[AnyHashable : Any] = notification.userInfo!
|
|
|
+ if let dataMessage = data["message"] as? TMessage {
|
|
|
+ var messageId = dataMessage.getBody(key: CoreMessage_TMessageKey.MESSAGE_ID)
|
|
|
+ messageId = messageId.contains("-2") ? String(messageId.split(separator: ",")[1]) : messageId
|
|
|
+ if let idx = listGroupingImages.firstIndex(where: { $0.messageId == messageId }) {
|
|
|
+ listGroupingImages[idx].status = dataMessage.getBody(key: CoreMessage_TMessageKey.STATUS)
|
|
|
+ tableViewImages.reloadRows(at: [IndexPath(row: idx, section: 0)], with: .none)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|