接入七鱼SDK

This commit is contained in:
fengshuo
2023-03-09 19:46:22 +08:00
parent 9647ae616f
commit 2870dd9b1b
10 changed files with 89 additions and 20 deletions

View File

@@ -166,16 +166,19 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
__block int unreadCount = 0;
NSMutableArray<NSString *> * uids = [[NSMutableArray alloc] init];
NSMutableArray *officalArray = [NSMutableArray array];
NSMutableArray* sessionList = [NSMutableArray array];
[self.recentSessions enumerateObjectsUsingBlock:^(NIMRecentSession * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (self.openType != SessionListOpenTypeRoom && [[ClientConfig shareConfig].configInfo.officialMsgUids containsObject:obj.session.sessionId]) {
[officalArray addObject:obj];
[self.headView updateBadgeWithSessionId:obj.session.sessionId unreadCount:obj.unreadCount];
} else {
[uids addObject:obj.session.sessionId];
unreadCount += obj.unreadCount;
if (obj.session.sessionId.integerValue > 0) {
[sessionList addObject:obj];
unreadCount += obj.unreadCount;
}
}
}];
[self.recentSessions removeObjectsInArray:officalArray];
self.recentSessions = sessionList;
[self setTabBarItemBadge:unreadCount];
[[NIMSDK sharedSDK].userManager fetchUserInfos:uids completion:nil];
@@ -260,7 +263,9 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
[self.headView updateBadgeWithSessionId:recentSession.session.sessionId unreadCount:recentSession.unreadCount];
return;
}
[self.recentSessions addObject:recentSession];
if (recentSession.session.sessionId.integerValue > 0) {
[self.recentSessions addObject:recentSession];
}
[self.recentSessions sortUsingComparator:^NSComparisonResult(id obj1, id obj2) {
NIMRecentSession *item1 = obj1;
NIMRecentSession *item2 = obj2;
@@ -289,7 +294,9 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
}
}
NSInteger insert = [self findInsertPlace:recentSession];
[self.recentSessions insertObject:recentSession atIndex:insert];
if (recentSession.session.sessionId.integerValue > 0) {
[self.recentSessions insertObject:recentSession atIndex:insert];
}
[self.sessionListView reloadData];
[self setTabBarItemBadge:totalUnreadCount];
}