|
@@ -33,6 +33,7 @@ class MessageMainViewController: BaseViewController {
|
|
|
var messageIndexModel : MessageIndexModel?
|
|
|
var users : Array<Any>?
|
|
|
var conversationModels : Array<ConversationModel>?
|
|
|
+ var rcConversations : Array<RCConversation>?
|
|
|
|
|
|
|
|
|
override func viewDidLoad() {
|
|
@@ -123,6 +124,7 @@ extension MessageMainViewController {
|
|
|
self.conversationModels = Mapper<ConversationModel>().mapArray(JSONString: self.users?.description ?? "[]")
|
|
|
self.tableView.reloadData()
|
|
|
BaseTabbarViewController.shared.setBadge()
|
|
|
+ NXLLog(self.users)
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -140,8 +142,6 @@ extension MessageMainViewController {
|
|
|
vc.messageShowTypes = messageShowTypes
|
|
|
self.navigationController?.pushViewController(vc, animated: true)
|
|
|
BaseTabbarViewController.shared.setBadge()
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -247,13 +247,50 @@ extension MessageMainViewController: UITableViewDelegate,UITableViewDataSource {
|
|
|
switch indexPath.section {
|
|
|
case 0:
|
|
|
return 107
|
|
|
- case 1,2:
|
|
|
+ case 1,2,3:
|
|
|
return 70
|
|
|
default:
|
|
|
return 0
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @available(iOS 11.0, *)
|
|
|
+ func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
|
|
|
+ switch indexPath.section {
|
|
|
+ case 2:
|
|
|
+ let cell = tableView.cellForRow(at: indexPath) as? MessageHomeThreeSectionTableViewCell
|
|
|
+ let deleteRowAction = UIContextualAction(style: UIContextualAction.Style.destructive, title: "删除") { [weak self] (contextualAction, view, completionHandler) in
|
|
|
+ guard let strongSelf = self else { return }
|
|
|
+ RCIMClient.shared()?.remove(RCConversationType.ConversationType_PRIVATE, targetId: cell?.rcConversation?.targetId)
|
|
|
+ strongSelf.conversationModels?.remove(at: indexPath.row)
|
|
|
+ tableView.deleteRows(at: [indexPath], with: UITableView.RowAnimation.left)
|
|
|
+ }
|
|
|
+ deleteRowAction.backgroundColor = .red
|
|
|
+
|
|
|
+ var topRowtitle : String?
|
|
|
+ if cell?.rcConversationModel?.isTop ?? false {
|
|
|
+ topRowtitle = "取消置顶"
|
|
|
+ } else {
|
|
|
+ topRowtitle = "置顶"
|
|
|
+
|
|
|
+ }
|
|
|
+ let topRowAction = UIContextualAction(style: UIContextualAction.Style.destructive, title: topRowtitle) { [weak self] (contextualAction, view, completionHandler) in
|
|
|
+ if cell?.rcConversationModel?.isTop ?? false {
|
|
|
+ RCIMClient.shared()?.setConversationToTop(RCConversationType.ConversationType_PRIVATE, targetId: cell?.rcConversation?.targetId, isTop: false)
|
|
|
+ } else {
|
|
|
+ RCIMClient.shared()?.setConversationToTop(RCConversationType.ConversationType_PRIVATE, targetId: cell?.rcConversation?.targetId, isTop: true)
|
|
|
+ }
|
|
|
+ self?.setConversationList()
|
|
|
+ }
|
|
|
+ topRowAction.backgroundColor = kThemeColor
|
|
|
+ let config = UISwipeActionsConfiguration(actions: [deleteRowAction,topRowAction])
|
|
|
+ return config
|
|
|
+ default:
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
|
|
|
return 10
|
|
|
}
|