Commit dfa6ea76cfcba392ede1815adc129a9e8925281c

Authored by daojian
1 parent 18c84b08

0.3.1 版本

1.YYkit 依赖修改
2.发送新消息通知
3.收到新消息判断是否携带时间消息
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.3.0' 11 + s.version = '0.3.1'
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/IMAConversationManager.m
@@ -707,6 +707,8 @@ @@ -707,6 +707,8 @@
707 { 707 {
708 NSLog(@"onNewMessage:%@",msgs); 708 NSLog(@"onNewMessage:%@",msgs);
709 709
  710 + [[NSNotificationCenter defaultCenter] postNotificationName:@"kIMAMSG_OnNewMessageNotification" object:msgs];
  711 +
710 for (TIMMessage *msg in msgs) 712 for (TIMMessage *msg in msgs)
711 { 713 {
712 IMAMsg *imamsg = [IMAMsg msgWith:msg]; 714 IMAMsg *imamsg = [IMAMsg msgWith:msg];
CNLiveNewIMAManagerKit/Classes/PublicHeader/IMANotification.h
@@ -164,5 +164,7 @@ static NSString *const kIMAMSG_PhotoFixSuccessNotification = @&quot;kIMAMSG_PhotoFixS @@ -164,5 +164,7 @@ static NSString *const kIMAMSG_PhotoFixSuccessNotification = @&quot;kIMAMSG_PhotoFixS
164 164
165 #pragma mark 收到商家版申请退款消息通知 165 #pragma mark 收到商家版申请退款消息通知
166 static NSString *const kIMAMSG_ApplyForRefundNotification = @"kIMAMSG_ApplyForRefundNotification"; 166 static NSString *const kIMAMSG_ApplyForRefundNotification = @"kIMAMSG_ApplyForRefundNotification";
  167 +#pragma mark 收到IM新消息
  168 +static NSString *const kIMAMSG_OnNewMessageNotification = @"kIMAMSG_OnNewMessageNotification";
167 169
168 #endif /* IMANotification_h */ 170 #endif /* IMANotification_h */
CNLiveNewIMAManagerKit/Classes/TIMCategory/IMAMsg+UITableViewCell.m
@@ -225,7 +225,7 @@ static NSString *const kIMAMsgShowChatAttributedText = @&quot;kIMAMsgShowChatAttribut @@ -225,7 +225,7 @@ static NSString *const kIMAMsgShowChatAttributedText = @&quot;kIMAMsgShowChatAttribut
225 - (NSMutableAttributedString *)attributedStringWithText:(NSString *)text font:(CGFloat)font { 225 - (NSMutableAttributedString *)attributedStringWithText:(NSString *)text font:(CGFloat)font {
226 226
227 NSMutableAttributedString *ats = [[NSMutableAttributedString alloc] initWithString:text]; 227 NSMutableAttributedString *ats = [[NSMutableAttributedString alloc] initWithString:text];
228 - ats.font = UIFontCNMake(font); 228 + ats.yy_font = UIFontCNMake(font);
229 NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; 229 NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
230 paragraphStyle.lineBreakMode = NSLineBreakByCharWrapping; 230 paragraphStyle.lineBreakMode = NSLineBreakByCharWrapping;
231 [ats addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, ats.length)]; 231 [ats addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, ats.length)];
@@ -310,7 +310,7 @@ static NSString *const kIMAMsgShowChatAttributedText = @&quot;kIMAMsgShowChatAttribut @@ -310,7 +310,7 @@ static NSString *const kIMAMsgShowChatAttributedText = @&quot;kIMAMsgShowChatAttribut
310 - (NSAttributedString *)loadShowChatAttributedText 310 - (NSAttributedString *)loadShowChatAttributedText
311 { 311 {
312 NSMutableAttributedString *ats = [[NSMutableAttributedString alloc] init]; 312 NSMutableAttributedString *ats = [[NSMutableAttributedString alloc] init];
313 - ats.font = UIFontCNMake(15);//[UIFont systemFontOfSize:15]; 313 + ats.yy_font = UIFontCNMake(15);//[UIFont systemFontOfSize:15];
314 NSInteger loc = 0; 314 NSInteger loc = 0;
315 for (int i = 0; i < self.msg.elemCount; i++) 315 for (int i = 0; i < self.msg.elemCount; i++)
316 { 316 {
CNLiveNewIMAManagerKit/Classes/TIMCategory/TIMElem+ShowAPIs.m
@@ -943,7 +943,7 @@ @@ -943,7 +943,7 @@
943 - (NSMutableAttributedString *)attributedStringWithText:(NSString *)text font:(CGFloat)font { 943 - (NSMutableAttributedString *)attributedStringWithText:(NSString *)text font:(CGFloat)font {
944 944
945 NSMutableAttributedString *ats = [[NSMutableAttributedString alloc] initWithString:text]; 945 NSMutableAttributedString *ats = [[NSMutableAttributedString alloc] initWithString:text];
946 - ats.font = UIFontCNMake(font); 946 + ats.yy_font = UIFontCNMake(font);
947 NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; 947 NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
948 paragraphStyle.lineBreakMode = NSLineBreakByCharWrapping; 948 paragraphStyle.lineBreakMode = NSLineBreakByCharWrapping;
949 [ats addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, ats.length)]; 949 [ats addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, ats.length)];
CNLiveNewIMAManagerKit/Classes/TIMFMDBManager/CNGroupListAvaterUtil.h
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 8
9 #import <Foundation/Foundation.h> 9 #import <Foundation/Foundation.h>
10 #import <CNLiveBaseKit/CNLiveBaseKit.h> 10 #import <CNLiveBaseKit/CNLiveBaseKit.h>
11 -#import <YYKit/YYKit.h> 11 +#import <YYCache/YYCache.h>
12 12
13 typedef enum : NSUInteger { 13 typedef enum : NSUInteger {
14 CNListAvaterOperationMemberChange,//人数变化 14 CNListAvaterOperationMemberChange,//人数变化
CNLiveNewIMAManagerKit/Classes/TIMModel/Conversation/IMAConversation.h
@@ -74,7 +74,10 @@ typedef void (^RemoveMsgBlock)(NSArray *imamsgList, BOOL succ, CommonVoidBlock r @@ -74,7 +74,10 @@ typedef void (^RemoveMsgBlock)(NSArray *imamsgList, BOOL succ, CommonVoidBlock r
74 @property (nonatomic, copy) NSString *strangerIcon; 74 @property (nonatomic, copy) NSString *strangerIcon;
75 75
76 ///群头像 76 ///群头像
77 -@property (nonatomic, strong)UIImage *groupAvator; 77 +@property (nonatomic, strong) UIImage *groupAvator;
  78 +
  79 +/// 是否需要创建时间消息,默认为YES
  80 +@property (nonatomic, assign) BOOL isCreateTimeMsg;
78 81
79 /// 根据腾讯IM的TIMConversation对象进行初始化 82 /// 根据腾讯IM的TIMConversation对象进行初始化
80 /// @param conv IM 原始会话 83 /// @param conv IM 原始会话
CNLiveNewIMAManagerKit/Classes/TIMModel/Conversation/IMAConversation.m
@@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
24 { 24 {
25 _conversation = conv; 25 _conversation = conv;
26 _msgList = [[CLSafeMutableArray alloc] init]; 26 _msgList = [[CLSafeMutableArray alloc] init];
27 - 27 + _isCreateTimeMsg = YES;
28 } 28 }
29 return self; 29 return self;
30 } 30 }
@@ -949,11 +949,9 @@ @@ -949,11 +949,9 @@
949 { 949 {
950 NSMutableArray *array = [NSMutableArray array]; 950 NSMutableArray *array = [NSMutableArray array];
951 951
952 - IMAMsg *timeTip = [self timeTipOnNewMessage:msg];  
953 -  
954 - if (timeTip)  
955 - {  
956 - [array addObject:timeTip]; 952 + if (self.isCreateTimeMsg) {
  953 + IMAMsg *timeTip = [self timeTipOnNewMessage:msg];
  954 + if (timeTip)[array addObject:timeTip];
957 } 955 }
958 956
959 [array addObject:msg]; 957 [array addObject:msg];
CNLiveNewIMAManagerKit/Classes/TIMModel/MSG/IMAMsg.m
@@ -1135,9 +1135,9 @@ @@ -1135,9 +1135,9 @@
1135 if (![self isWithdrawMsg]) { 1135 if (![self isWithdrawMsg]) {
1136 IMAUser *sender = [self getSender]; 1136 IMAUser *sender = [self getSender];
1137 if (sender) { 1137 if (sender) {
1138 - [nameAtt appendString:[NSString stringWithFormat:@"%@: ",[sender showTitle]]]; 1138 + [nameAtt yy_appendString:[NSString stringWithFormat:@"%@: ",[sender showTitle]]];
1139 } else { 1139 } else {
1140 - [nameAtt appendString:[NSString stringWithFormat:@"%@: ",[_msg sender]]]; 1140 + [nameAtt yy_appendString:[NSString stringWithFormat:@"%@: ",[_msg sender]]];
1141 } 1141 }
1142 if ([nameAtt.string hasPrefix:@"admin"]) { 1142 if ([nameAtt.string hasPrefix:@"admin"]) {
1143 //处理 是APP管理员发送的消息 1143 //处理 是APP管理员发送的消息
@@ -1174,7 +1174,7 @@ @@ -1174,7 +1174,7 @@
1174 { 1174 {
1175 if ([conv getUnReadMessageNum] > 1) 1175 if ([conv getUnReadMessageNum] > 1)
1176 { 1176 {
1177 - [unReadMsgNumAtt appendString:[NSString stringWithFormat:@"[%d条]",[conv getUnReadMessageNum]]]; 1177 + [unReadMsgNumAtt yy_appendString:[NSString stringWithFormat:@"[%d条]",[conv getUnReadMessageNum]]];
1178 } 1178 }
1179 } 1179 }
1180 } 1180 }
@@ -1189,13 +1189,13 @@ @@ -1189,13 +1189,13 @@
1189 if (self.type == EIMAMSG_SendGiftSuccess) { 1189 if (self.type == EIMAMSG_SendGiftSuccess) {
1190 //送礼填写地址成功 送礼者 红字提醒 1190 //送礼填写地址成功 送礼者 红字提醒
1191 NSString *redTipStr = @"Ta填写礼包地址 "; 1191 NSString *redTipStr = @"Ta填写礼包地址 ";
1192 - [tipAtt appendString:redTipStr]; 1192 + [tipAtt yy_appendString:redTipStr];
1193 [tipAtt addAttribute:NSForegroundColorAttributeName value:[UIColor qmui_colorWithHexString:@"#FC1541"] range:NSMakeRange(0, redTipStr.length)]; 1193 [tipAtt addAttribute:NSForegroundColorAttributeName value:[UIColor qmui_colorWithHexString:@"#FC1541"] range:NSMakeRange(0, redTipStr.length)];
1194 } 1194 }
1195 else if (self.type == EIMAMSG_ReceviedGiftSuccess) { 1195 else if (self.type == EIMAMSG_ReceviedGiftSuccess) {
1196 //送礼填写地址成功 收礼者 红字提醒 1196 //送礼填写地址成功 收礼者 红字提醒
1197 NSString *redTipStr = @"已填写礼包地址 "; 1197 NSString *redTipStr = @"已填写礼包地址 ";
1198 - [tipAtt appendString:redTipStr]; 1198 + [tipAtt yy_appendString:redTipStr];
1199 [tipAtt addAttribute:NSForegroundColorAttributeName value:[UIColor qmui_colorWithHexString:@"#FC1541"] range:NSMakeRange(0, redTipStr.length)]; 1199 [tipAtt addAttribute:NSForegroundColorAttributeName value:[UIColor qmui_colorWithHexString:@"#FC1541"] range:NSMakeRange(0, redTipStr.length)];
1200 1200
1201 } 1201 }
@@ -1228,14 +1228,14 @@ @@ -1228,14 +1228,14 @@
1228 redTipStr = @"已收礼 "; 1228 redTipStr = @"已收礼 ";
1229 } 1229 }
1230 } 1230 }
1231 - [tipAtt appendString:redTipStr]; 1231 + [tipAtt yy_appendString:redTipStr];
1232 [tipAtt addAttribute:NSForegroundColorAttributeName value:[UIColor qmui_colorWithHexString:@"#FC1541"] range:NSMakeRange(0, redTipStr.length)]; 1232 [tipAtt addAttribute:NSForegroundColorAttributeName value:[UIColor qmui_colorWithHexString:@"#FC1541"] range:NSMakeRange(0, redTipStr.length)];
1233 } 1233 }
1234 else if (self.type == EIMAMSG_HaveCoupon && ![_msg isReaded]) 1234 else if (self.type == EIMAMSG_HaveCoupon && ![_msg isReaded])
1235 { 1235 {
1236 //有未领取的优惠券 1236 //有未领取的优惠券
1237 NSString *redTipStr = @"[有红包]"; 1237 NSString *redTipStr = @"[有红包]";
1238 - [tipAtt appendString:redTipStr]; 1238 + [tipAtt yy_appendString:redTipStr];
1239 [tipAtt addAttribute:NSForegroundColorAttributeName value:[UIColor qmui_colorWithHexString:@"#FC1541"] range:NSMakeRange(0, redTipStr.length)]; 1239 [tipAtt addAttribute:NSForegroundColorAttributeName value:[UIColor qmui_colorWithHexString:@"#FC1541"] range:NSMakeRange(0, redTipStr.length)];
1240 1240
1241 } 1241 }
@@ -1247,7 +1247,7 @@ @@ -1247,7 +1247,7 @@
1247 NSArray *unreceivedTransferBalanceArray = [[CNTransferBalanceUnreceivedCache cache] objectForKey:[NSString stringWithFormat:@"key_%@_%@",CNUserShareModel.uid,[conv getReceiver]]]; 1247 NSArray *unreceivedTransferBalanceArray = [[CNTransferBalanceUnreceivedCache cache] objectForKey:[NSString stringWithFormat:@"key_%@_%@",CNUserShareModel.uid,[conv getReceiver]]];
1248 if (unreceivedTransferBalanceArray && unreceivedTransferBalanceArray.count > 0) { 1248 if (unreceivedTransferBalanceArray && unreceivedTransferBalanceArray.count > 0) {
1249 NSString *redTipStr = @"[转余额]"; 1249 NSString *redTipStr = @"[转余额]";
1250 - [tipAtt appendString:redTipStr]; 1250 + [tipAtt yy_appendString:redTipStr];
1251 [tipAtt addAttribute:NSForegroundColorAttributeName value:[UIColor qmui_colorWithHexString:@"#FC1541"] range:NSMakeRange(0, redTipStr.length)]; 1251 [tipAtt addAttribute:NSForegroundColorAttributeName value:[UIColor qmui_colorWithHexString:@"#FC1541"] range:NSMakeRange(0, redTipStr.length)];
1252 } 1252 }
1253 } 1253 }
CNLiveNewIMAManagerKit/PCH/CNLiveNewIMAManagerPCH.h
@@ -21,7 +21,9 @@ @@ -21,7 +21,9 @@
21 #import <CNLiveBusinessTools/CNLiveBusinessTools.h> 21 #import <CNLiveBusinessTools/CNLiveBusinessTools.h>
22 #import <SDWebImage/SDWebImage.h> 22 #import <SDWebImage/SDWebImage.h>
23 #import <CNLivePhotoBrowser/CNLivePhotoBrowserCache.h> 23 #import <CNLivePhotoBrowser/CNLivePhotoBrowserCache.h>
24 -#import <YYKit/YYKit.h> 24 +#import <YYCache/YYCache.h>
  25 +#import <YYCategories/YYCategories.h>
  26 +#import <YYText/YYText.h>
25 #import <CNLiveBeeHive/CNLiveBeeHive.h> 27 #import <CNLiveBeeHive/CNLiveBeeHive.h>
26 #import <QMUIKit/QMUIKit.h> 28 #import <QMUIKit/QMUIKit.h>
27 #import <CNLiveRequestBastKit/CNLiveNetworking.h> 29 #import <CNLiveRequestBastKit/CNLiveNetworking.h>
Example/CNLiveNewIMAManagerKit.xcodeproj/project.pbxproj
@@ -383,8 +383,16 @@ @@ -383,8 +383,16 @@
383 "${BUILT_PRODUCTS_DIR}/QMUIKit/QMUIKit.framework", 383 "${BUILT_PRODUCTS_DIR}/QMUIKit/QMUIKit.framework",
384 "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework", 384 "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework",
385 "${PODS_ROOT}/TXIMSDK_iOS/ImSDK.framework", 385 "${PODS_ROOT}/TXIMSDK_iOS/ImSDK.framework",
386 - "${BUILT_PRODUCTS_DIR}/YBImageBrowser_DSCnliveShop/YBImageBrowser_DSCnliveShop.framework",  
387 - "${BUILT_PRODUCTS_DIR}/YYKit/YYKit.framework", 386 + "${BUILT_PRODUCTS_DIR}/YBImageBrowser/YBImageBrowser.framework",
  387 + "${BUILT_PRODUCTS_DIR}/YYAsyncLayer/YYAsyncLayer.framework",
  388 + "${BUILT_PRODUCTS_DIR}/YYCache/YYCache.framework",
  389 + "${BUILT_PRODUCTS_DIR}/YYCategories/YYCategories.framework",
  390 + "${BUILT_PRODUCTS_DIR}/YYDispatchQueuePool/YYDispatchQueuePool.framework",
  391 + "${BUILT_PRODUCTS_DIR}/YYImage/YYImage.framework",
  392 + "${BUILT_PRODUCTS_DIR}/YYKeyboardManager/YYKeyboardManager.framework",
  393 + "${BUILT_PRODUCTS_DIR}/YYModel/YYModel.framework",
  394 + "${BUILT_PRODUCTS_DIR}/YYText/YYText.framework",
  395 + "${BUILT_PRODUCTS_DIR}/YYWebImage/YYWebImage.framework",
388 ); 396 );
389 name = "[CP] Embed Pods Frameworks"; 397 name = "[CP] Embed Pods Frameworks";
390 outputPaths = ( 398 outputPaths = (
@@ -403,8 +411,16 @@ @@ -403,8 +411,16 @@
403 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/QMUIKit.framework", 411 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/QMUIKit.framework",
404 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework", 412 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework",
405 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ImSDK.framework", 413 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ImSDK.framework",
406 - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YBImageBrowser_DSCnliveShop.framework",  
407 - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YYKit.framework", 414 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YBImageBrowser.framework",
  415 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YYAsyncLayer.framework",
  416 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YYCache.framework",
  417 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YYCategories.framework",
  418 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YYDispatchQueuePool.framework",
  419 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YYImage.framework",
  420 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YYKeyboardManager.framework",
  421 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YYModel.framework",
  422 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YYText.framework",
  423 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YYWebImage.framework",
408 ); 424 );
409 runOnlyForDeploymentPostprocessing = 0; 425 runOnlyForDeploymentPostprocessing = 0;
410 shellPath = /bin/sh; 426 shellPath = /bin/sh;