Commit ed36a04c1f05ad29f883a0ef3dfc5acd85f7763f
1 parent
27b1c582
0.4.0 添加家园有新消息通知
Showing
3 changed files
with
13 additions
and
3 deletions
CNLiveNewIMAManagerKit.podspec
CNLiveNewIMAManagerKit/Classes/Playform/IMAConversationManager.m
| ... | ... | @@ -708,7 +708,7 @@ |
| 708 | 708 | NSLog(@"onNewMessage:%@",msgs); |
| 709 | 709 | |
| 710 | 710 | [[NSNotificationCenter defaultCenter] postNotificationName:@"kIMAMSG_OnNewMessageNotification" object:msgs]; |
| 711 | - | |
| 711 | + | |
| 712 | 712 | for (TIMMessage *msg in msgs) |
| 713 | 713 | { |
| 714 | 714 | IMAMsg *imamsg = [IMAMsg msgWith:msg]; |
| ... | ... | @@ -718,7 +718,15 @@ |
| 718 | 718 | } |
| 719 | 719 | TIMConversation *conv = [msg getConversation]; |
| 720 | 720 | NSLog(@"getReceiver =========== %@",conv.getReceiver); |
| 721 | - | |
| 721 | + if ([conv.getReceiver hasPrefix:@"family_"]) { | |
| 722 | + //家园新消息 | |
| 723 | + NSInteger unReadMessageNum = [conv getUnReadMessageNum]; | |
| 724 | + [[NSNotificationCenter defaultCenter] postNotificationName:kIMAMSG_FamilyNewMessageNotification object:nil userInfo:@{ | |
| 725 | + @"groupId" : conv.getReceiver, | |
| 726 | + @"unReadMessageNum" : @(unReadMessageNum)} | |
| 727 | + ]; | |
| 728 | + | |
| 729 | + } | |
| 722 | 730 | if ([[imamsg.msg getElem:0] isKindOfClass:[TIMCustomElem class]]) { |
| 723 | 731 | /**处理所有收到的自定义消息*/ |
| 724 | 732 | BOOL isBreak = [self handleCustomMsg:imamsg conv:conv]; | ... | ... |
CNLiveNewIMAManagerKit/Classes/PublicHeader/IMANotification.h
| ... | ... | @@ -172,4 +172,6 @@ static NSString *const kIMAMSG_CommunityPaySuccessNotification = @"kIMAMSG_Commu |
| 172 | 172 | #pragma mark 扫码支付成功 |
| 173 | 173 | static NSString *const kIMAMSG_ScanPaySuccessNotification = @"kIMAMSG_ScanPaySuccessNotification"; |
| 174 | 174 | |
| 175 | +#pragma mark 收到家园群消息 | |
| 176 | +static NSString *const kIMAMSG_FamilyNewMessageNotification = @"kIMAMSG_FamilyNewMessageNotification"; | |
| 175 | 177 | #endif /* IMANotification_h */ | ... | ... |