2024-02-25 13:10:44 +08:00
|
|
|
//
|
|
|
|
// ChatVC.swift
|
|
|
|
// yinmeng-ios
|
|
|
|
//
|
|
|
|
// Created by MaiMang on 2024/2/25.
|
2024-02-27 23:34:55 +08:00
|
|
|
// 回话详情
|
2024-02-25 13:10:44 +08:00
|
|
|
|
|
|
|
import UIKit
|
2024-02-27 23:34:55 +08:00
|
|
|
import NIMSDK
|
2024-02-25 13:10:44 +08:00
|
|
|
class ChatVC: BaseViewController {
|
|
|
|
|
2024-02-27 23:34:55 +08:00
|
|
|
public init(session: NIMSession) {
|
|
|
|
vm = ChatViewModel(session: session)
|
|
|
|
super.init(nibName: nil, bundle: nil)
|
|
|
|
// vm.delegate = self
|
|
|
|
// NIMSDK.shared().mediaManager.add(self)
|
|
|
|
}
|
|
|
|
|
|
|
|
required init?(coder: NSCoder) {
|
|
|
|
fatalError("init(coder:) has not been implemented")
|
|
|
|
}
|
|
|
|
|
|
|
|
var vm:ChatViewModel
|
|
|
|
|
2024-02-25 13:10:44 +08:00
|
|
|
override func viewDidLoad() {
|
|
|
|
super.viewDidLoad()
|
|
|
|
|
|
|
|
view.backgroundColor = .orange
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-02-27 23:34:55 +08:00
|
|
|
private lazy var chatTableView: UITableView = {
|
|
|
|
let tableView = UITableView(frame: .zero, style: .plain)
|
|
|
|
tableView.delegate = self
|
|
|
|
tableView.dataSource = self
|
|
|
|
tableView.tableFooterView = UIView()
|
|
|
|
tableView.separatorStyle = .none
|
|
|
|
tableView.backgroundColor = .clear
|
|
|
|
if #available(iOS 11.0, *) {
|
|
|
|
tableView.contentInsetAdjustmentBehavior = .never
|
|
|
|
}
|
|
|
|
return tableView
|
|
|
|
}()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
extension ChatVC: UITableViewDelegate, UITableViewDataSource {
|
|
|
|
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
|
|
return vm.messageObjects.count
|
|
|
|
}
|
|
|
|
|
|
|
|
public func tableView(_ tableView: UITableView,
|
|
|
|
cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
|
|
return UITableViewCell()
|
|
|
|
}
|
|
|
|
|
|
|
|
public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
|
|
|
|
|
|
|
}
|
2024-02-25 13:10:44 +08:00
|
|
|
|
2024-02-27 23:34:55 +08:00
|
|
|
public func tableView(_ tableView: UITableView,
|
|
|
|
heightForRowAt indexPath: IndexPath) -> CGFloat {
|
|
|
|
let m = vm.messageObjects[safe:indexPath.row]
|
|
|
|
return CGFloat(m?.height ?? 0)
|
|
|
|
}
|
2024-02-25 13:10:44 +08:00
|
|
|
}
|