Commit 331e87fe7812c4b7391b287c5401a84b115144a5

Authored by niudaojian
1 parent e8878d4a

0.7.5 版本

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.7.4' 11 + s.version = '0.7.5'
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.h
@@ -119,8 +119,9 @@ typedef void (^IMAConversationChangedCompletion)(IMAConversationChangedNotifyIte @@ -119,8 +119,9 @@ typedef void (^IMAConversationChangedCompletion)(IMAConversationChangedNotifyIte
119 - (void)updateConversationWith:(IMAUser *)user; 119 - (void)updateConversationWith:(IMAUser *)user;
120 120
121 /// zx 异步获取当前最新的所有未读数(去除所有大号的未读数) 121 /// zx 异步获取当前最新的所有未读数(去除所有大号的未读数)
122 -/// @param complete 完成回调  
123 -- (void)getExceptSysUnReadCount:(void(^)(NSInteger count))complete; 122 +/// @param complete 回调 count 是未读数,
  123 +/// groupNotPushUnreadCount 未群聊开启免打扰时,统计的群的未读消息数
  124 +- (void)getExceptSysUnReadCount:(void(^)(NSInteger count, NSInteger groupNotPushUnreadCount))complete;
124 125
125 /// 是否是自定义消息 126 /// 是否是自定义消息
126 /// @param elem TIMElem 127 /// @param elem TIMElem
CNLiveNewIMAManagerKit/Classes/Playform/IMAConversationManager.m
@@ -1707,10 +1707,16 @@ @@ -1707,10 +1707,16 @@
1707 { 1707 {
1708 } 1708 }
1709 1709
1710 -- (void)getExceptSysUnReadCount:(void (^)(NSInteger))complete 1710 +/// zx 异步获取当前最新的所有未读数(去除所有大号的未读数)
  1711 +/// @param complete 回调 count 是未读数,
  1712 +/// groupNotPushUnreadCount 未群聊开启免打扰时,统计的群的未读消息数
  1713 +- (void)getExceptSysUnReadCount:(void (^)(NSInteger count, NSInteger groupNotPushUnreadCount))complete
1711 { 1714 {
1712 dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ 1715 dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
1713 __block NSInteger unReadCount = 0; 1716 __block NSInteger unReadCount = 0;
  1717 + ///群聊如果设置了消息免打扰,记录下群聊免打扰未读数
  1718 + __block NSInteger groupNotPushUnreadCount = 0;
  1719 +
1714 NSArray *conversationArray = _conversationList.safeArray.copy; 1720 NSArray *conversationArray = _conversationList.safeArray.copy;
1715 for (int i = 0; i < conversationArray.count; i ++) { 1721 for (int i = 0; i < conversationArray.count; i ++) {
1716 IMAConversation *conv = [conversationArray objectAtIndex:i]; 1722 IMAConversation *conv = [conversationArray objectAtIndex:i];
@@ -1740,6 +1746,10 @@ @@ -1740,6 +1746,10 @@
1740 if ([conv.receiveMessageOpt isEqualToString:@"接收消息"]) { 1746 if ([conv.receiveMessageOpt isEqualToString:@"接收消息"]) {
1741 unReadCount += [conv unReadCount]; 1747 unReadCount += [conv unReadCount];
1742 } 1748 }
  1749 + else{
  1750 + groupNotPushUnreadCount += [conv unReadCount];
  1751 + }
  1752 +
1743 } 1753 }
1744 else 1754 else
1745 { 1755 {
@@ -1747,6 +1757,9 @@ @@ -1747,6 +1757,9 @@
1747 if ([[group receiveMessageOpt] isEqualToString:@"接收消息"]) { 1757 if ([[group receiveMessageOpt] isEqualToString:@"接收消息"]) {
1748 unReadCount += [conv unReadCount]; 1758 unReadCount += [conv unReadCount];
1749 } 1759 }
  1760 + else{
  1761 + groupNotPushUnreadCount += [conv unReadCount];
  1762 + }
1750 } 1763 }
1751 1764
1752 } 1765 }
@@ -1762,7 +1775,7 @@ @@ -1762,7 +1775,7 @@
1762 } 1775 }
1763 [IMAPlatform sharedInstance].conversationMgr.unReadMessageCount = unReadCount; 1776 [IMAPlatform sharedInstance].conversationMgr.unReadMessageCount = unReadCount;
1764 if (complete) { 1777 if (complete) {
1765 - complete(unReadCount); 1778 + complete(unReadCount, groupNotPushUnreadCount);
1766 } 1779 }
1767 }); 1780 });
1768 1781
CNLiveNewIMAManagerKit/Classes/Playform/IMAPlatform+AppConfig.m
@@ -25,7 +25,8 @@ @@ -25,7 +25,8 @@
25 // 将相关的配置缓存至本地 25 // 将相关的配置缓存至本地
26 [[IMAPlatform sharedInstance] saveToLocal]; 26 [[IMAPlatform sharedInstance] saveToLocal];
27 27
28 - [[IMAPlatform sharedInstance].conversationMgr getExceptSysUnReadCount:^(NSInteger count) { 28 + [[IMAPlatform sharedInstance].conversationMgr getExceptSysUnReadCount:^(NSInteger count, NSInteger groupNotPushUnreadCount) {
  29 +
29 dispatch_async(dispatch_get_main_queue(), ^{ 30 dispatch_async(dispatch_get_main_queue(), ^{
30 NSUInteger unReadCount = count; 31 NSUInteger unReadCount = count;
31 if (unReadCount > 999) unReadCount = 999; 32 if (unReadCount > 999) unReadCount = 999;
@@ -42,6 +43,7 @@ @@ -42,6 +43,7 @@
42 DebugLog(@"Fail: %d->%@", code, err); 43 DebugLog(@"Fail: %d->%@", code, err);
43 }]; 44 }];
44 }); 45 });
  46 +
45 }]; 47 }];
46 48
47 } 49 }