Commit 800634009700db0c21813ae9330a818a7920fddf
1 parent
f329a463
0.5.8 添加商家版 服务号
Showing
11 changed files
with
224 additions
and
60 deletions
CNLiveNewIMAManagerKit.podspec
| @@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
| 8 | 8 | ||
| 9 | Pod::Spec.new do |s| | 9 | Pod::Spec.new do |s| |
| 10 | s.name = 'CNLiveNewIMAManagerKit' | 10 | s.name = 'CNLiveNewIMAManagerKit' |
| 11 | - s.version = '0.5.7' | 11 | + s.version = '0.5.8' |
| 12 | s.summary = 'A short description of CNLiveNewIMAManagerKit.' | 12 | s.summary = 'A short description of CNLiveNewIMAManagerKit.' |
| 13 | 13 | ||
| 14 | #s.description = <<-DESC | 14 | #s.description = <<-DESC |
CNLiveNewIMAManagerKit/Classes/Playform/IMAContactManager+Group.h
| @@ -20,7 +20,7 @@ | @@ -20,7 +20,7 @@ | ||
| 20 | 20 | ||
| 21 | /// 存储 所有群id 和 同步所有最新的群组信息到本地 | 21 | /// 存储 所有群id 和 同步所有最新的群组信息到本地 |
| 22 | /// @param reloadLoclGrouoInfo 是否刷新会话 | 22 | /// @param reloadLoclGrouoInfo 是否刷新会话 |
| 23 | -- (void)saveGroupIdList:(BOOL)reloadLoclGrouoInfo; | 23 | +//- (void)saveGroupIdList:(BOOL)reloadLoclGrouoInfo; |
| 24 | 24 | ||
| 25 | /// 获取本地缓存的 某个群的群详情 | 25 | /// 获取本地缓存的 某个群的群详情 |
| 26 | /// @param groupId 群id | 26 | /// @param groupId 群id |
CNLiveNewIMAManagerKit/Classes/Playform/IMAConversationManager.m
| @@ -124,10 +124,19 @@ | @@ -124,10 +124,19 @@ | ||
| 124 | 124 | ||
| 125 | //如果是未知的 后台消息,直接 跳出循环ƒ | 125 | //如果是未知的 后台消息,直接 跳出循环ƒ |
| 126 | if ([conversation.getReceiver hasPrefix:@"sys"]) { | 126 | if ([conversation.getReceiver hasPrefix:@"sys"]) { |
| 127 | - if ([conversation.getReceiver isEqualToString:CNLifeHaoUserId] || [conversation.getReceiver isEqualToString:CNFirendMomentVideoUploadFinishUserId] || [conversation.getReceiver isEqualToString:CNWithdrawMessage] || [conversation.getReceiver isEqualToString:CNJoinFeatureGroupInvitation] || [conversation.getReceiver isEqualToString:CNWithNews] || [conversation.getReceiver isEqualToString:CNWithLive] || [conversation.getReceiver isEqualToString:CNWithVideo]|| [conversation.getReceiver isEqualToString:CNWithRepastPay]|| [conversation.getReceiver isEqualToString:CNWithReceipt] | ||
| 128 | - || [conversation.getReceiver isEqualToString:CNWithRepastVerify]) | 127 | + if ([conversation.getReceiver isEqualToString:CNLifeHaoUserId] |
| 128 | + || [conversation.getReceiver isEqualToString:CNFirendMomentVideoUploadFinishUserId] | ||
| 129 | + || [conversation.getReceiver isEqualToString:CNWithdrawMessage] | ||
| 130 | + || [conversation.getReceiver isEqualToString:CNJoinFeatureGroupInvitation] | ||
| 131 | + || [conversation.getReceiver isEqualToString:CNWithNews] | ||
| 132 | + || [conversation.getReceiver isEqualToString:CNWithLive] | ||
| 133 | + || [conversation.getReceiver isEqualToString:CNWithVideo] | ||
| 134 | + || [conversation.getReceiver isEqualToString:CNWithRepastPay] | ||
| 135 | + || [conversation.getReceiver isEqualToString:CNWithReceipt] | ||
| 136 | + || [conversation.getReceiver isEqualToString:CNWithRepastVerify] | ||
| 137 | + || [conversation.getReceiver isEqualToString:CNWithService]) | ||
| 129 | { | 138 | { |
| 130 | -// NSLog(@"已知后台消息"); | 139 | + NSLog(@"已知后台消息"); |
| 131 | }else{ | 140 | }else{ |
| 132 | NSLog(@"未知后台消息不添加到会话列表"); | 141 | NSLog(@"未知后台消息不添加到会话列表"); |
| 133 | continue; | 142 | continue; |
| @@ -757,7 +766,8 @@ | @@ -757,7 +766,8 @@ | ||
| 757 | || [conv.getReceiver isEqualToString:CNWithVideo] | 766 | || [conv.getReceiver isEqualToString:CNWithVideo] |
| 758 | || [conv.getReceiver isEqualToString:CNWithRepastPay] | 767 | || [conv.getReceiver isEqualToString:CNWithRepastPay] |
| 759 | || [conv.getReceiver isEqualToString:CNWithReceipt] | 768 | || [conv.getReceiver isEqualToString:CNWithReceipt] |
| 760 | - || [conv.getReceiver isEqualToString:CNWithRepastVerify]) | 769 | + || [conv.getReceiver isEqualToString:CNWithRepastVerify] |
| 770 | + || [conv.getReceiver isEqualToString:CNWithService]) | ||
| 761 | { | 771 | { |
| 762 | NSLog(@"已知后台消息"); | 772 | NSLog(@"已知后台消息"); |
| 763 | } | 773 | } |
CNLiveNewIMAManagerKit/Classes/PublicHeader/IMAConstant.h
| @@ -105,7 +105,9 @@ static NSString *const CNWithNews = @"sys_news"; | @@ -105,7 +105,9 @@ static NSString *const CNWithNews = @"sys_news"; | ||
| 105 | //直播号 | 105 | //直播号 |
| 106 | static NSString *const CNWithLive = @"sys_live"; | 106 | static NSString *const CNWithLive = @"sys_live"; |
| 107 | //轻松一刻 | 107 | //轻松一刻 |
| 108 | -static NSString *const CNWithVideo = @"sys_video"; | 108 | +static NSString *const CNWithVideo = @"sys_video"; |
| 109 | +//服务号 | ||
| 110 | +static NSString *const CNWithService = @"sys_service"; | ||
| 109 | 111 | ||
| 110 | //商家版订单系统通知号 | 112 | //商家版订单系统通知号 |
| 111 | static NSString *const CNWithRepastPay = @"sys_repastPay"; | 113 | static NSString *const CNWithRepastPay = @"sys_repastPay"; |
CNLiveNewIMAManagerKit/Classes/TIMCategory/IMAConversation+ShowAPIs.m
| @@ -40,6 +40,10 @@ | @@ -40,6 +40,10 @@ | ||
| 40 | else if ([recerive isEqualToString:CNWithLive]) { | 40 | else if ([recerive isEqualToString:CNWithLive]) { |
| 41 | return @"IMAConversation_ReuseIndentifier_news"; | 41 | return @"IMAConversation_ReuseIndentifier_news"; |
| 42 | } | 42 | } |
| 43 | + else if ([recerive isEqualToString:CNWithService]) | ||
| 44 | + { | ||
| 45 | + return @"IMAConversation_ReuseIndentifier_service"; | ||
| 46 | + } | ||
| 43 | else if ([recerive isEqualToString:CNWithVideo]) { | 47 | else if ([recerive isEqualToString:CNWithVideo]) { |
| 44 | return @"IMAConversation_ReuseIndentifier_video"; | 48 | return @"IMAConversation_ReuseIndentifier_video"; |
| 45 | } | 49 | } |
| @@ -98,6 +102,10 @@ | @@ -98,6 +102,10 @@ | ||
| 98 | else if ([recerive isEqualToString:CNWithLive]) { | 102 | else if ([recerive isEqualToString:CNWithLive]) { |
| 99 | return @"直播号"; | 103 | return @"直播号"; |
| 100 | } | 104 | } |
| 105 | + else if ([recerive isEqualToString:CNWithService]) | ||
| 106 | + { | ||
| 107 | + return @"服务号"; | ||
| 108 | + } | ||
| 101 | else if ([recerive isEqualToString:CNWithVideo]) | 109 | else if ([recerive isEqualToString:CNWithVideo]) |
| 102 | { | 110 | { |
| 103 | return @"轻松一刻"; | 111 | return @"轻松一刻"; |
CNLiveNewIMAManagerKit/Classes/TIMCategory/IMAMsg+UITableViewCell.h
| @@ -35,4 +35,15 @@ | @@ -35,4 +35,15 @@ | ||
| 35 | 35 | ||
| 36 | - (NSInteger)contentMaxWidth; | 36 | - (NSInteger)contentMaxWidth; |
| 37 | 37 | ||
| 38 | +#pragma mark - 下面几个方法是企业端使用 | ||
| 39 | +//获取消息的内容大小 | ||
| 40 | +- (CGSize)getMsgContentSize:(CGFloat)width; | ||
| 41 | + | ||
| 42 | +/// 获取消息内容的高度 | ||
| 43 | +- (CGFloat)getMsgContentHeight:(CGFloat)width; | ||
| 44 | + | ||
| 45 | +/// 获取消息内容文本 | ||
| 46 | +- (NSMutableAttributedString *)getMsgAttributedText:(CGFloat)width; | ||
| 47 | + | ||
| 48 | + | ||
| 38 | @end | 49 | @end |
CNLiveNewIMAManagerKit/Classes/TIMCategory/IMAMsg+UITableViewCell.m
| @@ -293,9 +293,10 @@ static NSString *const kIMAMsgShowChatAttributedText = @"kIMAMsgShowChatAttribut | @@ -293,9 +293,10 @@ static NSString *const kIMAMsgShowChatAttributedText = @"kIMAMsgShowChatAttribut | ||
| 293 | NSMutableAttributedString *string = objc_getAssociatedObject(self, (__bridge const void *)kIMAMsgShowChatAttributedText); | 293 | NSMutableAttributedString *string = objc_getAssociatedObject(self, (__bridge const void *)kIMAMsgShowChatAttributedText); |
| 294 | if (!string) | 294 | if (!string) |
| 295 | { | 295 | { |
| 296 | - NSAttributedString *ats = [self loadShowChatAttributedText]; | ||
| 297 | - self.showChatAttributedText = ats; | ||
| 298 | - return ats; | 296 | +// NSAttributedString *ats = [self loadShowChatAttributedText]; |
| 297 | +// self.showChatAttributedText = ats; | ||
| 298 | + | ||
| 299 | + return [[NSAttributedString alloc] initWithString:@""]; | ||
| 299 | 300 | ||
| 300 | } | 301 | } |
| 301 | if ([self isMineMsg]) { | 302 | if ([self isMineMsg]) { |
| @@ -307,31 +308,99 @@ static NSString *const kIMAMsgShowChatAttributedText = @"kIMAMsgShowChatAttribut | @@ -307,31 +308,99 @@ static NSString *const kIMAMsgShowChatAttributedText = @"kIMAMsgShowChatAttribut | ||
| 307 | return string; | 308 | return string; |
| 308 | } | 309 | } |
| 309 | 310 | ||
| 310 | -- (NSAttributedString *)loadShowChatAttributedText | 311 | +//- (NSAttributedString *)loadShowChatAttributedText |
| 312 | +//{ | ||
| 313 | +// NSMutableAttributedString *ats = [[NSMutableAttributedString alloc] init]; | ||
| 314 | +// ats.yy_font = UIFontCNMake(15);//[UIFont systemFontOfSize:15]; | ||
| 315 | +// NSInteger loc = 0; | ||
| 316 | +// for (int i = 0; i < self.msg.elemCount; i++) | ||
| 317 | +// { | ||
| 318 | +// TIMElem *e = [self.msg getElem:i]; | ||
| 319 | +// NSArray *array = [e chatAttachmentOf:self]; | ||
| 320 | +// for (NSAttributedString *ca in array) | ||
| 321 | +// { | ||
| 322 | +// [ats appendAttributedString:ca]; | ||
| 323 | +// // 移动光标 | ||
| 324 | +// loc += ca.length; | ||
| 325 | +// } | ||
| 326 | +// } | ||
| 327 | +// | ||
| 328 | +// NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; | ||
| 329 | +// paragraphStyle.lineSpacing = 1; | ||
| 330 | +// paragraphStyle.lineBreakMode = NSLineBreakByCharWrapping; | ||
| 331 | +// [ats addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, ats.length)]; | ||
| 332 | +// [ats addAttribute:NSFontAttributeName value:[self textFont] range:NSMakeRange(0, ats.length)]; | ||
| 333 | +// | ||
| 334 | +// | ||
| 335 | +// return ats; | ||
| 336 | +//} | ||
| 337 | + | ||
| 338 | +/// 获取消息内容文本 | ||
| 339 | +- (NSMutableAttributedString *)getMsgAttributedText:(CGFloat)width | ||
| 311 | { | 340 | { |
| 312 | - NSMutableAttributedString *ats = [[NSMutableAttributedString alloc] init]; | ||
| 313 | - ats.yy_font = UIFontCNMake(15);//[UIFont systemFontOfSize:15]; | ||
| 314 | - NSInteger loc = 0; | ||
| 315 | - for (int i = 0; i < self.msg.elemCount; i++) | ||
| 316 | - { | ||
| 317 | - TIMElem *e = [self.msg getElem:i]; | ||
| 318 | - NSArray *array = [e chatAttachmentOf:self]; | ||
| 319 | - for (NSAttributedString *ca in array) | 341 | + if (self.showChatAttributedText) { |
| 342 | + return self.showChatAttributedText; | ||
| 343 | + } | ||
| 344 | + if ([[self.msg getElem:0] isKindOfClass:[TIMCustomElem class]]) { | ||
| 345 | + TIMCustomElem *elem = (TIMCustomElem *)[self.msg getElem:0]; | ||
| 346 | + NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:elem.data options:NSJSONReadingMutableContainers error:nil]; | ||
| 347 | + if ([dic[@"type"] integerValue] == 12001) { | ||
| 348 | + NSDictionary *illegalData = dic[@"illegalData"]; | ||
| 349 | + return [self attributeText:illegalData[@"content"] width:width]; | ||
| 350 | + | ||
| 351 | + } | ||
| 352 | + else if ([dic[@"type"] integerValue] == 12002) | ||
| 320 | { | 353 | { |
| 321 | - [ats appendAttributedString:ca]; | ||
| 322 | - // 移动光标 | ||
| 323 | - loc += ca.length; | 354 | + NSDictionary *personageCerSuccessData = dic[@"personageCerSuccessData"]; |
| 355 | + return [self attributeText:personageCerSuccessData[@"content"] width:width]; | ||
| 356 | + | ||
| 357 | + } | ||
| 358 | + else if ([dic[@"type"] integerValue] == 12003) | ||
| 359 | + { | ||
| 360 | + NSDictionary *personageCerFailData = dic[@"personageCerFailData"]; | ||
| 361 | + return [self attributeText:personageCerFailData[@"content"] width:width]; | ||
| 362 | + | ||
| 363 | + } | ||
| 364 | + else if ([dic[@"type"] integerValue] == 12004) | ||
| 365 | + { | ||
| 366 | + NSDictionary *organizationCerSuccessData = dic[@"organizationCerSuccessData"]; | ||
| 367 | + return [self attributeText:organizationCerSuccessData[@"content"] width:width]; | ||
| 368 | + | ||
| 369 | + } | ||
| 370 | + else if ([dic[@"type"] integerValue] == 12005) | ||
| 371 | + { | ||
| 372 | + NSDictionary *organizationCerFailData = dic[@"organizationCerFailData"]; | ||
| 373 | + return [self attributeText:organizationCerFailData[@"content"] width:width]; | ||
| 324 | } | 374 | } |
| 325 | } | 375 | } |
| 376 | + | ||
| 377 | + return [[NSMutableAttributedString alloc] initWithString:@""]; | ||
| 378 | +} | ||
| 326 | 379 | ||
| 380 | +- (NSMutableAttributedString *)attributeText:(NSString *)content width:(CGFloat)width | ||
| 381 | +{ | ||
| 382 | + NSMutableAttributedString *attStr = [[NSMutableAttributedString alloc] initWithString:content]; | ||
| 383 | + | ||
| 327 | NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; | 384 | NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; |
| 328 | - paragraphStyle.lineSpacing = 1; | ||
| 329 | paragraphStyle.lineBreakMode = NSLineBreakByCharWrapping; | 385 | paragraphStyle.lineBreakMode = NSLineBreakByCharWrapping; |
| 330 | - [ats addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, ats.length)]; | ||
| 331 | - [ats addAttribute:NSFontAttributeName value:[self textFont] range:NSMakeRange(0, ats.length)]; | ||
| 332 | - | 386 | + paragraphStyle.lineSpacing = 5; //行高度 |
| 387 | + NSMutableAttributedString *attributes = [[NSMutableAttributedString alloc] initWithAttributedString:attStr]; | ||
| 388 | + [attributes addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, attributes.length)]; | ||
| 389 | + | ||
| 390 | + [attributes addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, attributes.length)]; | ||
| 391 | + self.showChatAttributedText = attributes; | ||
| 333 | 392 | ||
| 334 | - return ats; | 393 | + //获取高度 |
| 394 | + CGSize attSize = [attributes boundingRectWithSize:CGSizeMake(width, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading |NSStringDrawingUsesDeviceMetrics context:nil].size; | ||
| 395 | + //注*要向上取整!!!!!!! | ||
| 396 | + NSInteger minH = 16; //最小高度 | ||
| 397 | + attSize.width = ceil(attSize.width); | ||
| 398 | + attSize.height = ceil(attSize.height); | ||
| 399 | + if (attSize.height < minH) { | ||
| 400 | + attSize.height = minH; | ||
| 401 | + } | ||
| 402 | + self.showContentSizeInChat = attSize; | ||
| 403 | + return attributes; | ||
| 335 | } | 404 | } |
| 336 | 405 | ||
| 337 | @end | 406 | @end |
CNLiveNewIMAManagerKit/Classes/TIMCategory/TIMElem+ShowAPIs.m
| @@ -402,7 +402,7 @@ | @@ -402,7 +402,7 @@ | ||
| 402 | } | 402 | } |
| 403 | else if (msg.type == EIMAMSG_OrderConfirm) | 403 | else if (msg.type == EIMAMSG_OrderConfirm) |
| 404 | { | 404 | { |
| 405 | -#pragma mark DODO!!! 电商订单消息修改 | 405 | + // DODO!!! 电商订单消息修改 |
| 406 | return [NSClassFromString(@"CNOrderConfirmCell") class]; | 406 | return [NSClassFromString(@"CNOrderConfirmCell") class]; |
| 407 | // return [CNE_BusinessOrderConfirmCell class]; | 407 | // return [CNE_BusinessOrderConfirmCell class]; |
| 408 | } | 408 | } |
| @@ -412,7 +412,7 @@ | @@ -412,7 +412,7 @@ | ||
| 412 | } | 412 | } |
| 413 | else if (msg.type == EIMAMSG_OrderStatus) | 413 | else if (msg.type == EIMAMSG_OrderStatus) |
| 414 | { | 414 | { |
| 415 | -#pragma mark DODO!!! 电商订单消息修改 | 415 | + //DODO!!! 电商订单消息修改 |
| 416 | return [NSClassFromString(@"CNOrderStatusTableViewCell") class]; | 416 | return [NSClassFromString(@"CNOrderStatusTableViewCell") class]; |
| 417 | } | 417 | } |
| 418 | else if (msg.type == EIMAMSG_NewLiveVideo) | 418 | else if (msg.type == EIMAMSG_NewLiveVideo) |
| @@ -507,15 +507,6 @@ | @@ -507,15 +507,6 @@ | ||
| 507 | }else if (msg.type == EIMAMSG_SendCurrentlocation){ | 507 | }else if (msg.type == EIMAMSG_SendCurrentlocation){ |
| 508 | return [NSClassFromString(@"CNSendCurrentLocationCell") class]; | 508 | return [NSClassFromString(@"CNSendCurrentLocationCell") class]; |
| 509 | } | 509 | } |
| 510 | -// else if (msg.type == EIMAMSG_Sharelocation){ | ||
| 511 | -// return [CNMessageShareLocationCell class]; | ||
| 512 | -// }else if (msg.type == EIMAMSG_SendCurrentlocation){ | ||
| 513 | -// return [CNSendCurrentLocationCell class]; | ||
| 514 | -// }else if (msg.type == EIMAMSG_SharelocationEndTip) | ||
| 515 | -// { | ||
| 516 | -// return [CNShareLocationEndTipTableViewCell class]; | ||
| 517 | -// } | ||
| 518 | -#pragma mark - 音视频 | ||
| 519 | else if (msg.type == EIMAMSG_OutRoom) | 510 | else if (msg.type == EIMAMSG_OutRoom) |
| 520 | { | 511 | { |
| 521 | return [NSClassFromString(@"CNVideoOrAudioMssageCell") class]; | 512 | return [NSClassFromString(@"CNVideoOrAudioMssageCell") class]; |
| @@ -883,6 +874,45 @@ | @@ -883,6 +874,45 @@ | ||
| 883 | return CGSizeMake(width, 160); | 874 | return CGSizeMake(width, 160); |
| 884 | } | 875 | } |
| 885 | break; | 876 | break; |
| 877 | + case EIMAMSG_Illegal: | ||
| 878 | + { | ||
| 879 | + NSDictionary *illegalData = packMsg.customMsgData[@"illegalData"]; | ||
| 880 | + CGSize contentSize = [self sizeWithText:illegalData[@"content"] lineSpacing:5 width:width fontSize:14]; | ||
| 881 | + | ||
| 882 | + return CGSizeMake(contentSize.width, contentSize.height + 100); | ||
| 883 | + } | ||
| 884 | + break; | ||
| 885 | + case EIMAMSG_PersonageCerSuccess: | ||
| 886 | + { | ||
| 887 | + NSDictionary *personageCerSuccessData = packMsg.customMsgData[@"personageCerSuccessData"]; | ||
| 888 | + CGSize contentSize = [self sizeWithText:personageCerSuccessData[@"content"] lineSpacing:5 width:width fontSize:14]; | ||
| 889 | + return CGSizeMake(contentSize.width, contentSize.height + 100); | ||
| 890 | + } | ||
| 891 | + break; | ||
| 892 | + case EIMAMSG_PersonageCerFail: | ||
| 893 | + { | ||
| 894 | + NSDictionary *personageCerFailData = packMsg.customMsgData[@"personageCerFailData"]; | ||
| 895 | + CGSize contentSize = [self sizeWithText:personageCerFailData[@"content"] lineSpacing:5 width:width fontSize:14]; | ||
| 896 | + return CGSizeMake(contentSize.width, contentSize.height + 100); | ||
| 897 | + } | ||
| 898 | + break; | ||
| 899 | + case EIMAMSG_OrganizationCerSuccess: | ||
| 900 | + { | ||
| 901 | + NSDictionary *organizationCerSuccessData = packMsg.customMsgData[@"organizationCerSuccessData"]; | ||
| 902 | + | ||
| 903 | + CGSize contentSize = [self sizeWithText:organizationCerSuccessData[@"content"] lineSpacing:5 width:width fontSize:14]; | ||
| 904 | + return CGSizeMake(contentSize.width, contentSize.height + 100); | ||
| 905 | + | ||
| 906 | + } | ||
| 907 | + break; | ||
| 908 | + case EIMAMSG_OrganizationCerFail: | ||
| 909 | + { | ||
| 910 | + NSDictionary *organizationCerFailData = packMsg.customMsgData[@"organizationCerFailData"]; | ||
| 911 | + | ||
| 912 | + CGSize contentSize = [self sizeWithText:organizationCerFailData[@"content"] lineSpacing:5 width:width fontSize:14]; | ||
| 913 | + return CGSizeMake(contentSize.width, contentSize.height + 100); | ||
| 914 | + } | ||
| 915 | + break; | ||
| 886 | default: | 916 | default: |
| 887 | break; | 917 | break; |
| 888 | } | 918 | } |
| @@ -1170,7 +1200,7 @@ | @@ -1170,7 +1200,7 @@ | ||
| 1170 | 1200 | ||
| 1171 | } | 1201 | } |
| 1172 | 1202 | ||
| 1173 | -//同意添加好友 | 1203 | +/// 同意添加好友 |
| 1174 | - (CGFloat)agreeApplyCellHeight:(IMAMsg *)packMsg { | 1204 | - (CGFloat)agreeApplyCellHeight:(IMAMsg *)packMsg { |
| 1175 | 1205 | ||
| 1176 | TIMCustomElem *elem = (TIMCustomElem *)[packMsg.msg getElem:0]; | 1206 | TIMCustomElem *elem = (TIMCustomElem *)[packMsg.msg getElem:0]; |
| @@ -1181,6 +1211,33 @@ | @@ -1181,6 +1211,33 @@ | ||
| 1181 | return size.height+20; | 1211 | return size.height+20; |
| 1182 | 1212 | ||
| 1183 | } | 1213 | } |
| 1214 | + | ||
| 1215 | +/// 获取一段文本高度 | ||
| 1216 | +/// @param content 文本内容 | ||
| 1217 | +/// @param lineSpacing 行间距 | ||
| 1218 | +/// @param width 最大宽度 | ||
| 1219 | +/// @param fontSize 字体大小 | ||
| 1220 | +- (CGSize)sizeWithText:(NSString *)content lineSpacing:(CGFloat)lineSpacing width:(CGFloat)width fontSize:(CGFloat)fontSize | ||
| 1221 | +{ | ||
| 1222 | + NSMutableAttributedString *attStr = [[NSMutableAttributedString alloc] initWithString:content]; | ||
| 1223 | + NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; | ||
| 1224 | + paragraphStyle.lineBreakMode = NSLineBreakByCharWrapping; | ||
| 1225 | + paragraphStyle.lineSpacing = lineSpacing; //行高度 | ||
| 1226 | + NSMutableAttributedString *attributes = [[NSMutableAttributedString alloc] initWithAttributedString:attStr]; | ||
| 1227 | + [attributes addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:fontSize] range:NSMakeRange(0, attributes.length)]; | ||
| 1228 | + [attributes addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, attributes.length)]; | ||
| 1229 | + | ||
| 1230 | + //获取高度 | ||
| 1231 | + CGSize attSize = [attributes boundingRectWithSize:CGSizeMake(width, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading |NSStringDrawingUsesDeviceMetrics context:nil].size; | ||
| 1232 | + //注*要向上取整!!!!!!! | ||
| 1233 | + NSInteger minH = 16; //最小高度 | ||
| 1234 | + attSize.width = ceil(attSize.width); | ||
| 1235 | + attSize.height = ceil(attSize.height); | ||
| 1236 | + if (attSize.height < minH) { | ||
| 1237 | + attSize.height = minH; | ||
| 1238 | + } | ||
| 1239 | + return attSize; | ||
| 1240 | +} | ||
| 1184 | @end | 1241 | @end |
| 1185 | 1242 | ||
| 1186 | 1243 |
CNLiveNewIMAManagerKit/Classes/TIMModel/MSG/IMAMsg.h
| @@ -126,6 +126,7 @@ typedef NS_ENUM(NSInteger, IMAMSGType) { | @@ -126,6 +126,7 @@ typedef NS_ENUM(NSInteger, IMAMSGType) { | ||
| 126 | EIMAMSG_OrederQrcodeReceived , //二维码收款 | 126 | EIMAMSG_OrederQrcodeReceived , //二维码收款 |
| 127 | EIMAMSG_OrederReminder , //推单 | 127 | EIMAMSG_OrederReminder , //推单 |
| 128 | EIMAMSG_NewOrderRemind , //新订单提醒 | 128 | EIMAMSG_NewOrderRemind , //新订单提醒 |
| 129 | + EIMAMSG_LiveRemind , //直播开播提醒 | ||
| 129 | 130 | ||
| 130 | #pragma mark 网家家企业端消息相关 | 131 | #pragma mark 网家家企业端消息相关 |
| 131 | EIMAMSG_Illegal , //违规 | 132 | EIMAMSG_Illegal , //违规 |
| @@ -263,6 +264,7 @@ typedef NS_ENUM(NSUInteger, CustomMsgType) { | @@ -263,6 +264,7 @@ typedef NS_ENUM(NSUInteger, CustomMsgType) { | ||
| 263 | CustomMsgTypeApplyForRefund = 3111, //申请退款消息 | 264 | CustomMsgTypeApplyForRefund = 3111, //申请退款消息 |
| 264 | CustomMsgTypeReminder = 3222, //催单 | 265 | CustomMsgTypeReminder = 3222, //催单 |
| 265 | CustomMsgTypeNewOrderRemind = 3333, //新订单提醒 | 266 | CustomMsgTypeNewOrderRemind = 3333, //新订单提醒 |
| 267 | + CustomMsgTypeLiveRemind = 3444, //直播开播提醒 | ||
| 266 | #pragma mark 网家家企业端消息相关 | 268 | #pragma mark 网家家企业端消息相关 |
| 267 | CustomMsgTypeIllegal = 12001, //违规 | 269 | CustomMsgTypeIllegal = 12001, //违规 |
| 268 | CustomMsgTypePersonageCerSuccess = 12002, //个人认证成功 | 270 | CustomMsgTypePersonageCerSuccess = 12002, //个人认证成功 |
CNLiveNewIMAManagerKit/Classes/TIMModel/MSG/IMAMsg.m
| @@ -670,6 +670,11 @@ | @@ -670,6 +670,11 @@ | ||
| 670 | else if ([dic[@"type"] integerValue] == CustomMsgTypeOrganizationCerFail) | 670 | else if ([dic[@"type"] integerValue] == CustomMsgTypeOrganizationCerFail) |
| 671 | { | 671 | { |
| 672 | type = EIMAMSG_OrganizationCerFail; | 672 | type = EIMAMSG_OrganizationCerFail; |
| 673 | + | ||
| 674 | + } | ||
| 675 | + else if ([dic[@"type"] integerValue] == CustomMsgTypeLiveRemind) | ||
| 676 | + { | ||
| 677 | + type = EIMAMSG_LiveRemind; | ||
| 673 | } | 678 | } |
| 674 | else { | 679 | else { |
| 675 | type = EIMAMSG_Unknown; | 680 | type = EIMAMSG_Unknown; |
Example/CNLiveNewIMAManagerKit.xcodeproj/project.pbxproj
| @@ -207,8 +207,8 @@ | @@ -207,8 +207,8 @@ | ||
| 207 | 6003F586195388D20070C39A /* Sources */, | 207 | 6003F586195388D20070C39A /* Sources */, |
| 208 | 6003F587195388D20070C39A /* Frameworks */, | 208 | 6003F587195388D20070C39A /* Frameworks */, |
| 209 | 6003F588195388D20070C39A /* Resources */, | 209 | 6003F588195388D20070C39A /* Resources */, |
| 210 | - E8A9796D270F45C1CB475BB0 /* [CP] Embed Pods Frameworks */, | ||
| 211 | - C2F33B874AB1DC32FED2F23A /* [CP] Copy Pods Resources */, | 210 | + F49AE02C9BB581CC9494D1C5 /* [CP] Embed Pods Frameworks */, |
| 211 | + 21F6CCC1BE5265F5469D4B89 /* [CP] Copy Pods Resources */, | ||
| 212 | ); | 212 | ); |
| 213 | buildRules = ( | 213 | buildRules = ( |
| 214 | ); | 214 | ); |
| @@ -299,29 +299,25 @@ | @@ -299,29 +299,25 @@ | ||
| 299 | /* End PBXResourcesBuildPhase section */ | 299 | /* End PBXResourcesBuildPhase section */ |
| 300 | 300 | ||
| 301 | /* Begin PBXShellScriptBuildPhase section */ | 301 | /* Begin PBXShellScriptBuildPhase section */ |
| 302 | - 82CB990D38CC44C1D57DFB45 /* [CP] Check Pods Manifest.lock */ = { | 302 | + 21F6CCC1BE5265F5469D4B89 /* [CP] Copy Pods Resources */ = { |
| 303 | isa = PBXShellScriptBuildPhase; | 303 | isa = PBXShellScriptBuildPhase; |
| 304 | buildActionMask = 2147483647; | 304 | buildActionMask = 2147483647; |
| 305 | files = ( | 305 | files = ( |
| 306 | ); | 306 | ); |
| 307 | - inputFileListPaths = ( | ||
| 308 | - ); | ||
| 309 | inputPaths = ( | 307 | inputPaths = ( |
| 310 | - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", | ||
| 311 | - "${PODS_ROOT}/Manifest.lock", | ||
| 312 | - ); | ||
| 313 | - name = "[CP] Check Pods Manifest.lock"; | ||
| 314 | - outputFileListPaths = ( | 308 | + "${PODS_ROOT}/Target Support Files/Pods-CNLiveNewIMAManagerKit_Example/Pods-CNLiveNewIMAManagerKit_Example-resources.sh", |
| 309 | + "${PODS_CONFIGURATION_BUILD_DIR}/CNLivePhotoBrowser/CNLivePhotoBrowser.bundle", | ||
| 315 | ); | 310 | ); |
| 311 | + name = "[CP] Copy Pods Resources"; | ||
| 316 | outputPaths = ( | 312 | outputPaths = ( |
| 317 | - "$(DERIVED_FILE_DIR)/Pods-CNLiveNewIMAManagerKit_Tests-checkManifestLockResult.txt", | 313 | + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/CNLivePhotoBrowser.bundle", |
| 318 | ); | 314 | ); |
| 319 | runOnlyForDeploymentPostprocessing = 0; | 315 | runOnlyForDeploymentPostprocessing = 0; |
| 320 | shellPath = /bin/sh; | 316 | shellPath = /bin/sh; |
| 321 | - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; | 317 | + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CNLiveNewIMAManagerKit_Example/Pods-CNLiveNewIMAManagerKit_Example-resources.sh\"\n"; |
| 322 | showEnvVarsInLog = 0; | 318 | showEnvVarsInLog = 0; |
| 323 | }; | 319 | }; |
| 324 | - 8906C4D754AD31B635D77AE4 /* [CP] Check Pods Manifest.lock */ = { | 320 | + 82CB990D38CC44C1D57DFB45 /* [CP] Check Pods Manifest.lock */ = { |
| 325 | isa = PBXShellScriptBuildPhase; | 321 | isa = PBXShellScriptBuildPhase; |
| 326 | buildActionMask = 2147483647; | 322 | buildActionMask = 2147483647; |
| 327 | files = ( | 323 | files = ( |
| @@ -336,32 +332,36 @@ | @@ -336,32 +332,36 @@ | ||
| 336 | outputFileListPaths = ( | 332 | outputFileListPaths = ( |
| 337 | ); | 333 | ); |
| 338 | outputPaths = ( | 334 | outputPaths = ( |
| 339 | - "$(DERIVED_FILE_DIR)/Pods-CNLiveNewIMAManagerKit_Example-checkManifestLockResult.txt", | 335 | + "$(DERIVED_FILE_DIR)/Pods-CNLiveNewIMAManagerKit_Tests-checkManifestLockResult.txt", |
| 340 | ); | 336 | ); |
| 341 | runOnlyForDeploymentPostprocessing = 0; | 337 | runOnlyForDeploymentPostprocessing = 0; |
| 342 | shellPath = /bin/sh; | 338 | shellPath = /bin/sh; |
| 343 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; | 339 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; |
| 344 | showEnvVarsInLog = 0; | 340 | showEnvVarsInLog = 0; |
| 345 | }; | 341 | }; |
| 346 | - C2F33B874AB1DC32FED2F23A /* [CP] Copy Pods Resources */ = { | 342 | + 8906C4D754AD31B635D77AE4 /* [CP] Check Pods Manifest.lock */ = { |
| 347 | isa = PBXShellScriptBuildPhase; | 343 | isa = PBXShellScriptBuildPhase; |
| 348 | buildActionMask = 2147483647; | 344 | buildActionMask = 2147483647; |
| 349 | files = ( | 345 | files = ( |
| 350 | ); | 346 | ); |
| 347 | + inputFileListPaths = ( | ||
| 348 | + ); | ||
| 351 | inputPaths = ( | 349 | inputPaths = ( |
| 352 | - "${PODS_ROOT}/Target Support Files/Pods-CNLiveNewIMAManagerKit_Example/Pods-CNLiveNewIMAManagerKit_Example-resources.sh", | ||
| 353 | - "${PODS_CONFIGURATION_BUILD_DIR}/CNLivePhotoBrowser/CNLivePhotoBrowser.bundle", | 350 | + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", |
| 351 | + "${PODS_ROOT}/Manifest.lock", | ||
| 352 | + ); | ||
| 353 | + name = "[CP] Check Pods Manifest.lock"; | ||
| 354 | + outputFileListPaths = ( | ||
| 354 | ); | 355 | ); |
| 355 | - name = "[CP] Copy Pods Resources"; | ||
| 356 | outputPaths = ( | 356 | outputPaths = ( |
| 357 | - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/CNLivePhotoBrowser.bundle", | 357 | + "$(DERIVED_FILE_DIR)/Pods-CNLiveNewIMAManagerKit_Example-checkManifestLockResult.txt", |
| 358 | ); | 358 | ); |
| 359 | runOnlyForDeploymentPostprocessing = 0; | 359 | runOnlyForDeploymentPostprocessing = 0; |
| 360 | shellPath = /bin/sh; | 360 | shellPath = /bin/sh; |
| 361 | - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CNLiveNewIMAManagerKit_Example/Pods-CNLiveNewIMAManagerKit_Example-resources.sh\"\n"; | 361 | + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; |
| 362 | showEnvVarsInLog = 0; | 362 | showEnvVarsInLog = 0; |
| 363 | }; | 363 | }; |
| 364 | - E8A9796D270F45C1CB475BB0 /* [CP] Embed Pods Frameworks */ = { | 364 | + F49AE02C9BB581CC9494D1C5 /* [CP] Embed Pods Frameworks */ = { |
| 365 | isa = PBXShellScriptBuildPhase; | 365 | isa = PBXShellScriptBuildPhase; |
| 366 | buildActionMask = 2147483647; | 366 | buildActionMask = 2147483647; |
| 367 | files = ( | 367 | files = ( |