diff --git a/Ash_AWord.xcworkspace/xcuserdata/xmfish.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Ash_AWord.xcworkspace/xcuserdata/xmfish.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 565074d..f067091 100644 --- a/Ash_AWord.xcworkspace/xcuserdata/xmfish.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/Ash_AWord.xcworkspace/xcuserdata/xmfish.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -330,11 +330,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "Ash_AWord/ViewControllers/Main/NoteViewController.m" - timestampString = "457181872.052846" + timestampString = "457251250.000903" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "88" - endingLineNumber = "88" + startingLineNumber = "92" + endingLineNumber = "92" landmarkName = "-selectTypeBtn:" landmarkType = "5"> @@ -579,5 +579,21 @@ landmarkType = "5"> + + + + diff --git a/Ash_AWord/ViewControllers/Main/MainViewController.m b/Ash_AWord/ViewControllers/Main/MainViewController.m index 9872e64..ae71275 100644 --- a/Ash_AWord/ViewControllers/Main/MainViewController.m +++ b/Ash_AWord/ViewControllers/Main/MainViewController.m @@ -101,7 +101,7 @@ static NSString *kMessageType = @"MessageType"; [super viewWillAppear:animated]; //获取未读消息数,此时并没有把self注册为SDK的delegate,读取出的未读数是上次退出程序时的 - [self didUnreadMessagesCountChanged]; +// [self didUnreadMessagesCountChanged]; } #pragma mark - UIAlertViewDelegate @@ -151,15 +151,19 @@ static NSString *kMessageType = @"MessageType"; for (EMConversation *conversation in conversations) { unreadCount += conversation.unreadMessagesCount; } + NSInteger allunReadCount = unreadCount; + allunReadCount += [AWordUser sharedInstance].notReadCommentNum; + allunReadCount += [AWordUser sharedInstance].myNewFollowerCount; if (_myNav) { - if (unreadCount > 0) { - _myNav.tabBarItem.badgeValue = [NSString stringWithFormat:@"%i",(int)unreadCount]; + if (allunReadCount > 0) { + + _myNav.tabBarItem.badgeValue = [NSString stringWithFormat:@"%i",(int)allunReadCount]; }else{ _myNav.tabBarItem.badgeValue = nil; } } UIApplication *application = [UIApplication sharedApplication]; - [application setApplicationIconBadgeNumber:unreadCount]; + [application setApplicationIconBadgeNumber:allunReadCount]; return unreadCount; } @@ -399,21 +403,11 @@ static NSString *kMessageType = @"MessageType"; #pragma mark - 自动登录回调 - (void)willAutoReconnect{ -// [MBProgressHUD hideAllHUDsForView:self.view animated:YES]; -// [MBProgressHUD checkHudWithView:self.view label:NSLocalizedString(@"reconnection.ongoing", @"reconnecting...") hidesAfter:1.0]; -// [self hideHud]; -// [self showHint:NSLocalizedString(@"reconnection.ongoing", @"reconnecting...")]; + [self setupUnreadMessageCount]; } - (void)didAutoReconnectFinishedWithError:(NSError *)error{ -// [self hideHud]; -// [MBProgressHUD hideAllHUDsForView:self.view animated:YES]; -// -// if (error) { -// [MBProgressHUD checkHudWithView:self.view label:NSLocalizedString(@"reconnection.fail", @"reconnection failure, later will continue to reconnection") hidesAfter:1.0]; -// }else{ -// [MBProgressHUD checkHudWithView:self.view label:NSLocalizedString(@"reconnection.success", @"reconnection successful!") hidesAfter:1.0]; -// } + } #pragma mark - ICallManagerDelegate @@ -504,18 +498,6 @@ static NSString *kMessageType = @"MessageType"; } #pragma mark - public -- (void)jumpToChatList -{ - if ([self.navigationController.topViewController isKindOfClass:[ChatMainViewController class]]) { -// ChatMainViewController *chatController = (ChatMainViewController *)self.navigationController.topViewController; -// [chatController hideImagePicker]; - } - else if(_myNav) - { - [self.navigationController popToViewController:self animated:NO]; - [self setSelectedViewController:_myNav]; - } -} - (EMConversationType)conversationTypeFromMessageType:(EMMessageType)type { @@ -538,83 +520,7 @@ static NSString *kMessageType = @"MessageType"; - (void)didReceiveLocalNotification:(UILocalNotification *)notification { - NSDictionary *userInfo = notification.userInfo; - if (userInfo) - { - if ([self.navigationController.topViewController isKindOfClass:[ChatMainViewController class]]) { -// ChatMainViewController *chatController = (ChatMainViewController *)self.navigationController.topViewController; -// [chatController hideImagePicker]; - } - - NSArray *viewControllers = self.navigationController.viewControllers; - [viewControllers enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(id obj, NSUInteger idx, BOOL *stop){ - if (obj != self) - { - if (![obj isKindOfClass:[ChatMainViewController class]]) - { - [self.navigationController popViewControllerAnimated:NO]; - } - else - { -// NSString *conversationChatter = userInfo[kConversationChatter]; -// ChatMainViewController *chatViewController = (ChatMainViewController *)obj; -// if (![chatViewController.chatter isEqualToString:conversationChatter]) -// { -// [self.navigationController popViewControllerAnimated:NO]; -// EMMessageType messageType = [userInfo[kMessageType] intValue]; -// chatViewController = [[ChatViewController alloc] initWithChatter:conversationChatter conversationType:[self conversationTypeFromMessageType:messageType]]; -// switch (messageType) { -// case eMessageTypeGroupChat: -// { -// NSArray *groupArray = [[EaseMob sharedInstance].chatManager groupList]; -// for (EMGroup *group in groupArray) { -// if ([group.groupId isEqualToString:conversationChatter]) { -// chatViewController.title = group.groupSubject; -// break; -// } -// } -// } -// break; -// default: -// chatViewController.title = conversationChatter; -// break; -// } -// [self.navigationController pushViewController:chatViewController animated:NO]; -// } -// *stop= YES; - } - } - else - { -// ChatViewController *chatViewController = (ChatViewController *)obj; -// NSString *conversationChatter = userInfo[kConversationChatter]; -// EMMessageType messageType = [userInfo[kMessageType] intValue]; -// chatViewController = [[ChatViewController alloc] initWithChatter:conversationChatter conversationType:[self conversationTypeFromMessageType:messageType]]; -// switch (messageType) { -// case eMessageTypeGroupChat: -// { -// NSArray *groupArray = [[EaseMob sharedInstance].chatManager groupList]; -// for (EMGroup *group in groupArray) { -// if ([group.groupId isEqualToString:conversationChatter]) { -// chatViewController.title = group.groupSubject; -// break; -// } -// } -// } -// break; -// default: -// chatViewController.title = conversationChatter; -// break; -// } -// [self.navigationController pushViewController:chatViewController animated:NO]; - } - }]; - } - else if (_myNav) - { - [self.navigationController popToViewController:self animated:NO]; - [self setSelectedViewController:_myNav]; - } + } - (void)dealloc diff --git a/Ash_AWord/ViewControllers/Main/MyViewController.m b/Ash_AWord/ViewControllers/Main/MyViewController.m index 9ea1cec..9408fe5 100644 --- a/Ash_AWord/ViewControllers/Main/MyViewController.m +++ b/Ash_AWord/ViewControllers/Main/MyViewController.m @@ -157,8 +157,9 @@ case 4: { cell.textLabel.text = @"消息"; + NSInteger count = [((AppDelegate*)[UIApplication sharedApplication].delegate).mainViewController setupUnreadMessageCount]; - [(MyMessageTableViewCell*)cell setUnReadColor:[UIColor redColor]]; + [(MyMessageTableViewCell*)cell setUnReadColor:[UIColor appMainColor]]; [(MyMessageTableViewCell*)cell setUnReadCount:count]; } diff --git a/Ash_AWord/ViewControllers/Main/NoteViewController.m b/Ash_AWord/ViewControllers/Main/NoteViewController.m index 379b1ba..7b85d80 100644 --- a/Ash_AWord/ViewControllers/Main/NoteViewController.m +++ b/Ash_AWord/ViewControllers/Main/NoteViewController.m @@ -13,7 +13,9 @@ #import "UpdateViewModel.h" #import "ReportViewController.h" #import "TypeSelectView.h" +#import "AppDelegate.h" #import "TypeSelectBgView.h" +#import "MainViewController.h" @interface NoteViewController () { NSInteger _page; @@ -81,6 +83,8 @@ [menuItems addObject:messageRepItem]; UIMenuController *menu = [UIMenuController sharedMenuController]; [menu setMenuItems:menuItems]; + + } -(void)selectTypeBtn:(UIButton*)button @@ -214,6 +218,8 @@ NoteViewModel* noteViewModel = (NoteViewModel*)viewModel; if (_page <= 1) { + //设置未读消息数. + [((AppDelegate*)[UIApplication sharedApplication].delegate).mainViewController setupUnreadMessageCount]; [_text_imageArr removeAllObjects]; } if (noteViewModel.text_imagesArr) { diff --git a/Ash_AWord/ViewControllers/My/PersonalInfoViewController.xib b/Ash_AWord/ViewControllers/My/PersonalInfoViewController.xib index ec714f7..c9be727 100644 --- a/Ash_AWord/ViewControllers/My/PersonalInfoViewController.xib +++ b/Ash_AWord/ViewControllers/My/PersonalInfoViewController.xib @@ -81,6 +81,7 @@ +