Files
peko-ios/YuMi/Modules/YMRoom/View/MessageContainerView/Model/XPMessageItem.h

61 lines
1.4 KiB
Objective-C
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.

//
// XPMessageItem.h
// YUMI
//
// Created by YUMI on 2024/12/19.
//
#import <Foundation/Foundation.h>
#import "XPMessageInfoModel.h"
NS_ASSUME_NONNULL_BEGIN
/**
* DiffableDataSource 兼容的消息项模型
* 用于替代原有的多数据源架构,提供统一的消息管理
*/
@interface XPMessageItem : NSObject <NSCopying>
/// 消息模型
@property (nonatomic, strong) XPMessageInfoModel *messageModel;
/// 唯一标识符,用于 DiffableDataSource 的 itemIdentifier
@property (nonatomic, strong) NSString *uniqueIdentifier;
/// 时间戳,用于排序和清理
@property (nonatomic, assign) NSTimeInterval timestamp;
/// 显示类型1=所有消息, 2=聊天消息, 3=礼物消息
@property (nonatomic, assign) NSInteger displayType;
/**
* 初始化方法
* @param model 消息模型
* @param identifier 唯一标识符
*/
- (instancetype)initWithMessageModel:(XPMessageInfoModel *)model
uniqueIdentifier:(NSString *)identifier;
/**
* 判断是否为聊天消息
* @return YES 如果是聊天消息
*/
- (BOOL)isChatMessage;
/**
* 判断是否为礼物消息
* @return YES 如果是礼物消息
*/
- (BOOL)isGiftMessage;
/**
* 判断是否应该显示在指定类型中
* @param displayType 显示类型
* @return YES 如果应该显示
*/
- (BOOL)shouldDisplayInType:(NSInteger)displayType;
@end
NS_ASSUME_NONNULL_END