forked from xhzengAIB/MessageDisplayKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathXHMessage.h
More file actions
166 lines (141 loc) · 5.63 KB
/
XHMessage.h
File metadata and controls
166 lines (141 loc) · 5.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
//
// XHMessage.h
// MessageDisplayExample
//
// Created by HUAJIE-1 on 14-4-24.
// Copyright (c) 2014年 嗨,我是曾宪华(@xhzengAIB),曾加入YY Inc.担任高级移动开发工程师,拍立秀App联合创始人,热衷于简洁、而富有理性的事物 QQ:543413507 主页:http://zengxianhua.com All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
#import "XHMessageModel.h"
@interface XHMessage : NSObject <XHMessageModel, NSCoding, NSCopying>
@property (nonatomic, copy) NSString *text;
@property (nonatomic, strong) UIImage *photo;
@property (nonatomic, copy) NSString *thumbnailUrl;
@property (nonatomic, copy) NSString *originPhotoUrl;
@property (nonatomic, strong) UIImage *videoConverPhoto;
@property (nonatomic, copy) NSString *videoPath;
@property (nonatomic, copy) NSString *videoUrl;
@property (nonatomic, copy) NSString *voicePath;
@property (nonatomic, copy) NSString *voiceUrl;
@property (nonatomic, copy) NSString *voiceDuration;
@property (nonatomic, copy) NSString *emotionPath;
@property (nonatomic, strong) UIImage *localPositionPhoto;
@property (nonatomic, copy) NSString *geolocations;
@property (nonatomic, strong) CLLocation *location;
@property (nonatomic, strong) UIImage *avatar;
@property (nonatomic, copy) NSString *avatarUrl;
@property (nonatomic, copy) NSString *sender;
@property (nonatomic, strong) NSDate *timestamp;
@property (nonatomic, assign) BOOL shouldShowUserName;
@property (nonatomic, assign) BOOL sended;
@property (nonatomic, assign) XHBubbleMessageMediaType messageMediaType;
@property (nonatomic, assign) XHBubbleMessageType bubbleMessageType;
@property (nonatomic) BOOL isRead;
/**
* 初始化文本消息
*
* @param text 发送的目标文本
* @param sender 发送者的名称
* @param date 发送的时间
*
* @return 返回Message model 对象
*/
- (instancetype)initWithText:(NSString *)text
sender:(NSString *)sender
timestamp:(NSDate *)timestamp;
/**
* 初始化图片类型的消息
*
* @param photo 目标图片
* @param thumbnailUrl 目标图片在服务器的缩略图地址
* @param originPhotoUrl 目标图片在服务器的原图地址
* @param sender 发送者
* @param date 发送时间
*
* @return 返回Message model 对象
*/
- (instancetype)initWithPhoto:(UIImage *)photo
thumbnailUrl:(NSString *)thumbnailUrl
originPhotoUrl:(NSString *)originPhotoUrl
sender:(NSString *)sender
timestamp:(NSDate *)timestamp;
/**
* 初始化视频类型的消息
*
* @param videoConverPhoto 目标视频的封面图
* @param videoPath 目标视频的本地路径,如果是下载过,或者是从本地发送的时候,会存在
* @param videoUrl 目标视频在服务器上的地址
* @param sender 发送者
* @param date 发送时间
*
* @return 返回Message model 对象
*/
- (instancetype)initWithVideoConverPhoto:(UIImage *)videoConverPhoto
videoPath:(NSString *)videoPath
videoUrl:(NSString *)videoUrl
sender:(NSString *)sender
timestamp:(NSDate *)timestamp;
/**
* 初始化语音类型的消息
*
* @param voicePath 目标语音的本地路径
* @param voiceUrl 目标语音在服务器的地址
* @param voiceDuration 目标语音的时长
* @param sender 发送者
* @param date 发送时间
*
* @return 返回Message model 对象
*/
- (instancetype)initWithVoicePath:(NSString *)voicePath
voiceUrl:(NSString *)voiceUrl
voiceDuration:(NSString *)voiceDuration
sender:(NSString *)sender
timestamp:(NSDate *)timestamp;
/**
* 初始化语音类型的消息。增加已读未读标记
*
* @param voicePath 目标语音的本地路径
* @param voiceUrl 目标语音在服务器的地址
* @param voiceDuration 目标语音的时长
* @param sender 发送者
* @param date 发送时间
* @param isRead 已读未读标记
*
* @return 返回Message model 对象
*/
- (instancetype)initWithVoicePath:(NSString *)voicePath
voiceUrl:(NSString *)voiceUrl
voiceDuration:(NSString *)voiceDuration
sender:(NSString *)sender
timestamp:(NSDate *)timestamp
isRead:(BOOL)isRead;
/**
* 初始化gif表情类型的消息
*
* @param emotionPath 表情的路径
* @param sender 发送者
* @param timestamp 发送时间
*
* @return 返回Message model 对象
*/
- (instancetype)initWithEmotionPath:(NSString *)emotionPath
sender:(NSString *)sender
timestamp:(NSDate *)timestamp;
/**
* 初始化地理位置的消息
*
* @param localPositionPhoto 地理位置默认显示的图
* @param geolocations 地理位置的信息
* @param location 地理位置的经纬度
* @param sender 发送者
* @param timestamp 发送时间
*
* @return 返回Message model 对象
*/
- (instancetype)initWithLocalPositionPhoto:(UIImage *)localPositionPhoto
geolocations:(NSString *)geolocations
location:(CLLocation *)location
sender:(NSString *)sender
timestamp:(NSDate *)timestamp;
@end