私信语音判断 · chenddcoder/Coding-iOS@bef027e · GitHub
Skip to content

Commit bef027e

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

5 files changed

Lines changed: 10 additions & 7 deletions

File tree

Coding_iOS/Controllers/ConversationViewController.m

Lines changed: 2 additions & 2 deletions

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 ([_curPriMsg isVoice]) {
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

0 commit comments

Comments
 (0)