Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bef027e

Browse files
私信语音判断
1 parent 0616260 commit bef027e

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

‎Coding_iOS/Controllers/ConversationViewController.m‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
253253
PrivateMessage *curMsg = [_myPriMsgs.dataList objectAtIndex:curIndex];
254254
if (curMsg.hasMedia) {
255255
cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_MessageMedia forIndexPath:indexPath];
256-
}else if (curMsg.file || curMsg.voiceMedia) {
256+
}else if ([curMsgisVoice]) {
257257
cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_MessageVoice forIndexPath:indexPath];
258258
}else{
259259
cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_Message forIndexPath:indexPath];
@@ -296,7 +296,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
296296
[menuItemArray addObject:@"拷贝文字"];
297297
}
298298
}else{
299-
if (!(curMsg.voiceMedia || curMsg.file)) {
299+
if (!([curMsgisVoice])) {
300300
[menuItemArray addObject:@"拷贝"];
301301
}
302302
}

‎Coding_iOS/Models/PrivateMessage.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ typedef NS_ENUM(NSInteger, PrivateMessageSendStatus) {
1919
@interface PrivateMessage : NSObject
2020
@property (readwrite, nonatomic, strong) NSString *content, *extra, *file;
2121
@property (readwrite, nonatomic, strong) User *friend, *sender;
22-
@property (readwrite, nonatomic, strong) NSNumber *count, *unreadCount, *id, *read_at, *status, *duration, *played;
22+
@property (readwrite, nonatomic, strong) NSNumber *count, *unreadCount, *id, *read_at, *status, *duration, *played, *type;
2323
@property (readwrite, nonatomic, strong) NSDate *created_at;
2424
@property (readwrite, nonatomic, strong) HtmlMedia *htmlMedia;
2525
@property (assign, nonatomic) PrivateMessageSendStatus sendStatus;
@@ -28,6 +28,7 @@ typedef NS_ENUM(NSInteger, PrivateMessageSendStatus) {
2828

2929
- (BOOL)hasMedia;
3030
- (BOOL)isSingleBigMonkey;
31+
- (BOOL)isVoice;
3132

3233
+ (instancetype)privateMessageWithObj:(id)obj andFriend:(User *)curFriend;
3334

‎Coding_iOS/Models/PrivateMessage.m‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ - (BOOL)isSingleBigMonkey{
4545
}
4646
return isSingleBigMonkey;
4747
}
48+
- (BOOL)isVoice{
49+
return (_type.integerValue == 1 || _voiceMedia);
50+
}
4851
+ (instancetype)privateMessageWithObj:(id)obj andFriend:(User *)curFriend{
4952
PrivateMessage *nextMsg = [[PrivateMessage alloc] init];
5053
nextMsg.sender = [Login curLoginUser];
@@ -61,7 +64,6 @@ + (instancetype)privateMessageWithObj:(id)obj andFriend:(User *)curFriend{
6164
nextMsg.extra = @"";
6265
}else if ([obj isKindOfClass:[VoiceMedia class]]){
6366
nextMsg.voiceMedia = obj;
64-
// nextMsg.content = @"";
6567
nextMsg.extra = @"";
6668
}else if ([obj isKindOfClass:[PrivateMessage class]]){
6769
PrivateMessage *originalMsg = (PrivateMessage *)obj;

‎Coding_iOS/Views/Cell/ConversationCell.m‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ - (void)layoutSubviews{
6767
if (_curPriMsg.hasMedia) {
6868
[textMsg appendString:@"[图片]"];
6969
}
70-
if (_curPriMsg.file || _curPriMsg.voiceMedia) {
70+
if ([_curPriMsgisVoice]) {
7171
[textMsg setString:@"[语音]"];
7272
if (_curPriMsg.played.intValue == 0) {
7373
_msg.textColor = kColorBrandGreen;

‎Coding_iOS/Views/Cell/MessageCell.m‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ - (void)setCurPriMsg:(PrivateMessage *)curPriMsg andPrePriMsg:(PrivateMessage *)
172172
CGFloat contentWidth = [_curPriMsg isSingleBigMonkey]? [MessageMediaItemCCell monkeyCcellSize].width : kMessageCell_ContentWidth;
173173
bgImgViewSize = CGSizeMake(contentWidth +2*kMessageCell_PadingWidth,
174174
mediaViewHeight +textSize.height + kMessageCell_PadingHeight*(_curPriMsg.content.length > 0? 3:2));
175-
} else if (curPriMsg.file || curPriMsg.voiceMedia) {
175+
} else if ([curPriMsgisVoice]) {
176176
bgImgViewSize = CGSizeMake(kMessageCell_ContentWidth, 40);
177177
} else{
178178
[_contentLabel setY:kMessageCell_PadingHeight];
@@ -287,7 +287,7 @@ + (CGFloat)cellHeightWithObj:(id)obj preObj:(id)preObj{
287287
CGSize textSize = [curPriMsg.content getSizeWithFont:kMessageCell_FontContent constrainedToSize:CGSizeMake(kMessageCell_ContentWidth, CGFLOAT_MAX)];
288288
CGFloat mediaViewHeight = [MessageCell mediaViewHeightWithObj:curPriMsg];
289289
cellHeight += mediaViewHeight;
290-
if (curPriMsg.voiceMedia || curPriMsg.file) {
290+
if ([curPriMsgisVoice]) {
291291
cellHeight += kMessageCell_PadingHeight*2+40;
292292
} else {
293293
cellHeight += textSize.height + kMessageCell_PadingHeight*4;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /