修复了消息未读书不会更新的问题
This commit is contained in:
@@ -397,9 +397,9 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
|
||||
return;
|
||||
}
|
||||
if (value > 0) {
|
||||
[self.tabBarItem setBadgeValue:[NSString stringWithFormat:@"%ld", value]];
|
||||
[self.tabBarController.tabBar.items[3] setBadgeValue:[NSString stringWithFormat:@"%ld", value]];
|
||||
} else {
|
||||
[self.tabBarItem setBadgeValue:nil];
|
||||
[self.tabBarController.tabBar.items[3] setBadgeValue:@"0"];
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -401,6 +401,12 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
[self.presenter logout];
|
||||
}
|
||||
|
||||
- (void)onLogin:(NIMLoginStep)step {
|
||||
if (step == NIMLoginStepLoginOK) {
|
||||
[self addMessageBadge];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)onKickout:(NIMLoginKickoutResult *)result {
|
||||
[XCHUDTool showErrorWithMessage:@"您已被踢下线,若非正常行为,请及时修改密码"];
|
||||
UIViewController *rootViewController = [UIApplication sharedApplication].keyWindow.rootViewController;
|
||||
@@ -598,16 +604,16 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
#pragma mark - 动态
|
||||
- (void)monentsUnReadCount {
|
||||
[Api monentsUnReadCount:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
MonentsUnReadModel * model = [MonentsUnReadModel modelWithDictionary:data.data];
|
||||
NSString *badge = model.total > 0 ? @(model.total).stringValue : nil;
|
||||
if (model.total > 99) {
|
||||
badge = @"99+";
|
||||
}
|
||||
NSUInteger index = 1;
|
||||
UITabBarItem *item = self.tabBar.items.count > index ? self.tabBar.items[index] : nil;
|
||||
[item setBadgeValue:badge];
|
||||
}
|
||||
// if (code == 200) {
|
||||
// MonentsUnReadModel * model = [MonentsUnReadModel modelWithDictionary:data.data];
|
||||
// NSString *badge = model.total > 0 ? @(model.total).stringValue : nil;
|
||||
// if (model.total > 99) {
|
||||
// badge = @"99+";
|
||||
// }
|
||||
// NSUInteger index = 2;
|
||||
// UITabBarItem *item = self.tabBar.items.count > index ? self.tabBar.items[index] : nil;
|
||||
// [item setBadgeValue:badge];
|
||||
// }
|
||||
} uid:[AccountInfoStorage instance].getUid];
|
||||
}
|
||||
|
||||
@@ -699,6 +705,28 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
||||
[TTPopup popupView:view style:TTPopupStyleAlert];
|
||||
}
|
||||
|
||||
- (void)addMessageBadge {
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
NSArray * array = [NIMSDK sharedSDK].conversationManager.allRecentSessions;
|
||||
__block int unreadCount = 0;
|
||||
[array enumerateObjectsUsingBlock:^(NIMRecentSession * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (![[ClientConfig shareConfig].configInfo.officialMsgUids containsObject:obj.session.sessionId]) {
|
||||
if (obj.session.sessionId.integerValue > 0) {
|
||||
unreadCount += obj.unreadCount;
|
||||
}
|
||||
}
|
||||
}];
|
||||
if (self.parentMode) {
|
||||
unreadCount = 0;
|
||||
}
|
||||
if (unreadCount > 0) {
|
||||
[self.tabBar.items[3] setBadgeValue:[NSString stringWithFormat:@"%d", unreadCount]];
|
||||
} else {
|
||||
[self.tabBar.items[3] setBadgeValue:@"0"];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
#pragma mark - 主播卡片弹窗
|
||||
//新用户专享充值弹窗
|
||||
- (void)showNewUserRecharge {
|
||||
|
Reference in New Issue
Block a user