修改通知个数

This commit is contained in:
wu736139669
2015-06-29 14:26:21 +08:00
parent ba21957414
commit 2e2e948368
5 changed files with 39 additions and 109 deletions
@@ -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">
</BreakpointContent>
@@ -579,5 +579,21 @@
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/Main/MainViewController.m"
timestampString = "457251081.335297"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "148"
endingLineNumber = "148"
landmarkName = "-setupUnreadMessageCount"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
@@ -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
@@ -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];
}
@@ -13,7 +13,9 @@
#import "UpdateViewModel.h"
#import "ReportViewController.h"
#import "TypeSelectView.h"
#import "AppDelegate.h"
#import "TypeSelectBgView.h"
#import "MainViewController.h"
@interface NoteViewController ()<UIActionSheetDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate,UIAlertViewDelegate,NoteTableViewCellDelegate>
{
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) {
@@ -81,6 +81,7 @@
<constraint firstItem="tLB-Tb-fTR" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="xci-vh-SFB"/>
</constraints>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/>
<point key="canvasLocation" x="13" y="187"/>
</view>
</objects>
<resources>