Merge pull request #135 from vector-im/syios_202

SYIOS-202: IOS should no longer reset badge count on launch
This commit is contained in:
giomfo 2016-03-03 10:41:30 +01:00
commit 316e8065b5
2 changed files with 13 additions and 29 deletions

View file

@ -265,13 +265,6 @@
NSLog(@"[AppDelegate] didFinishLaunchingWithOptions: the application is launched in background");
}
else
{
NSLog(@"[AppDelegate] didFinishLaunchingWithOptions: clear the notifications");
// clear the notifications counter
// [self clearNotifications];
}
return YES;
}
@ -337,12 +330,8 @@
[account pauseInBackgroundTask];
}
// clear the notifications counter
// [self clearNotifications];
// cancel any background sync before resuming
// i.e. warn IOS that there is no new data with any received push.
[self cancelBackgroundSync];
// Refresh the notifications counter
[self refreshApplicationIconBadgeNumber];
_isAppForeground = NO;
}
@ -353,8 +342,9 @@
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
// clear the notifications counter
// [self clearNotifications];
// cancel any background sync before resuming
// i.e. warn IOS that there is no new data with any received push.
[self cancelBackgroundSync];
_isAppForeground = YES;
}
@ -643,18 +633,12 @@
completionHandler(UIBackgroundFetchResultNoData);
}
//- (void)clearNotifications
//{
// NSLog(@"[AppDelegate] clearNotifications");
//
// // force to clear the notification center
// // switching from 0 -> 1 -> 0 seems forcing the notifications center to refresh
// // so resetting it does not clear the notifications center.
// [UIApplication sharedApplication].applicationIconBadgeNumber = 1;
// [UIApplication sharedApplication].applicationIconBadgeNumber = 0;
//
// [[UIApplication sharedApplication] cancelAllLocalNotifications];
//}
- (void)refreshApplicationIconBadgeNumber
{
NSLog(@"[AppDelegate] refreshApplicationIconBadgeNumber");
[UIApplication sharedApplication].applicationIconBadgeNumber = [MXKRoomDataSourceManager notificationCount];
}
#pragma mark - Matrix sessions handling

View file

@ -59,10 +59,10 @@
}
// Notify unreads and bing
if (roomCellData.unreadCount)
if (roomCellData.hasUnread)
{
self.bingIndicator.hidden = NO;
if (0 < roomCellData.unreadBingCount)
if (0 < roomCellData.highlightCount)
{
self.bingIndicator.backgroundColor = roomCellData.recentsDataSource.eventFormatter.bingTextColor;
self.lastEventDate.textColor = self.bingIndicator.backgroundColor;