| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- //
- // LNIMChatCallMessageCell.swift
- // Gami
- //
- // Created by OneeChan on 2026/2/4.
- //
- import Foundation
- import UIKit
- import SnapKit
- import TUICallEngine
- class LNIMChatCallMessageCell: LNIMChatBaseMessageCell {
- private let contextLabel = UILabel()
-
- override func update(_ data: LNIMMessageData, viewModel: LNIMChatViewModel) {
- super.update(data, viewModel: viewModel)
-
- guard let order: LNIMVoiceCallMessage = data.decodeCustomMessage() else { return }
- guard let callData = order.callData else { return }
-
- if order.actionType == SignalingActionType.invite.rawValue,
- let data = callData.data, data.cmd == "hangup" {
- contextLabel.text = .init(key: "C00001") + " " + callData.call_end.timeCountDisplay
- } else if order.actionType == SignalingActionType.cancel_Invite.rawValue {
- contextLabel.text = .init(key: "C00003")
- } else if order.actionType == SignalingActionType.reject_Invite.rawValue {
- if callData.data?.cmd == "line_busy" {
- contextLabel.text = .init(key: "C00004")
- } else {
- contextLabel.text = .init(key: "C00005")
- }
- } else if order.actionType == SignalingActionType.invite_Timeout.rawValue {
- contextLabel.text = .init(key: "C00002")
- } else {
- contextLabel.text = ""
- }
- }
-
- override func setupViews() {
- super.setupViews()
-
- let callIc = UIImageView()
- callIc.image = .icImChatCallOver
- container.addSubview(callIc)
- callIc.snp.makeConstraints { make in
- make.centerY.equalToSuperview()
- make.leading.equalToSuperview()
- }
-
- contextLabel.font = .body_l
- contextLabel.textColor = .text_5
- contextLabel.numberOfLines = 0
- container.addSubview(contextLabel)
- contextLabel.snp.makeConstraints { make in
- make.verticalEdges.equalToSuperview()
- make.trailing.equalToSuperview()
- make.leading.equalTo(callIc.snp.trailing).offset(12)
- }
- }
- }
|