Visual_Novel_iOS/crush/Crush/Src/Modules/Chat/Model/IMBaseRemoteInfo.swift

76 lines
1.8 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// IMBaseRemoteInfo.swift
// Crush
//
// Created by Leon on 2025/8/18.
//
import UIKit
//
enum MsgOptType: Int, Codable {
case unknow = 0
case upvote = 1
case downvote = 2
init(from decoder: Decoder) throws {
let container = try decoder.singleValueContainer()
let rawValue = try? container.decode(Int.self)
self = MsgOptType(rawValue: rawValue ?? 0) ?? .unknow
}
}
/**
serverExtension customAttachment
*/
class IMBaseRemoteInfo: Codable{
var cellType: SessionCellType! = .text
/// text
var displayString: String?
var type: String?
///
var optType : MsgOptType?
///
var score: CGFloat?
///
var customAttachment: IMCustomAttachment?
/// (String) in ConversationserverExtension
var heartbeatVal: CGFloat?
/// in ConversationserverExtension
var heartbeatLevel: HeartbeatLevel?
/// in Conversation serverExtension
var isShow: Bool?
/// SessionBaseModel IMBaseRemoteInfo
static func getBaseInfo(model: SessionBaseModel) -> IMBaseRemoteInfo {
var baseInfo: IMBaseRemoteInfo!
if model.baseRemoteInfo != nil {
baseInfo = model.baseRemoteInfo
} else {
baseInfo = IMRemoteUtil.dealRemoteInfo(message: model.v2msg)
model.baseRemoteInfo = baseInfo
}
return baseInfo
}
}
class IMYidunExtInfo: Codable {
var ext: String?
var priceUnitDesc: String?
var type: String?
var version: String?
var taskId: String?
var code: Int?
var suggestion: Int?
var status: Int?
}