mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-30 08:12:40 +00:00
Merge pull request #608 from vector-im/mention_only
Bug Fix changing notif setting from swipe menu should change the room apparence in the list #525 Messages: Regular notifications should be ignored when the room is in mentions only mode.
This commit is contained in:
commit
961b8977b8
2 changed files with 34 additions and 0 deletions
|
@ -22,6 +22,8 @@
|
|||
#import "MXKRoomBubbleTableViewCell+Vector.h"
|
||||
#import "AvatarGenerator.h"
|
||||
|
||||
#import "MXRoom+Vector.h"
|
||||
|
||||
@implementation RoomDataSource
|
||||
|
||||
- (instancetype)initWithRoomId:(NSString *)roomId andMatrixSession:(MXSession *)matrixSession
|
||||
|
@ -51,6 +53,18 @@
|
|||
return self;
|
||||
}
|
||||
|
||||
// Ignore regular notification count if the room is in 'mentions only" mode
|
||||
- (NSUInteger)notificationCount
|
||||
{
|
||||
if (self.room.isMentionsOnly)
|
||||
{
|
||||
// Only the highlighted missed messages are counted
|
||||
return super.highlightCount;
|
||||
}
|
||||
|
||||
return super.notificationCount;
|
||||
}
|
||||
|
||||
- (void)didReceiveReceiptEvent:(MXEvent *)receiptEvent roomState:(MXRoomState *)roomState
|
||||
{
|
||||
// Override this callback to force rendering of each cell with read receipts information.
|
||||
|
|
|
@ -58,6 +58,9 @@
|
|||
|
||||
// Observe kAppDelegateDidTapStatusBarNotification to handle tap on clock status bar.
|
||||
id kAppDelegateDidTapStatusBarNotificationObserver;
|
||||
|
||||
// Observe kMXNotificationCenterDidUpdateRules to update missed messages counts.
|
||||
id kMXNotificationCenterDidUpdateRulesObserver;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -165,6 +168,17 @@
|
|||
[self scrollToTop:YES];
|
||||
|
||||
}];
|
||||
|
||||
// Observe kMXNotificationCenterDidUpdateRules to refresh missed messages counts
|
||||
kMXNotificationCenterDidUpdateRulesObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kMXNotificationCenterDidUpdateRules object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
|
||||
|
||||
// Do not refresh if there is a pending recent drag and drop
|
||||
if (!movingCellPath)
|
||||
{
|
||||
[self refreshRecentsTable];
|
||||
}
|
||||
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -180,6 +194,12 @@
|
|||
[[NSNotificationCenter defaultCenter] removeObserver:kAppDelegateDidTapStatusBarNotificationObserver];
|
||||
kAppDelegateDidTapStatusBarNotificationObserver = nil;
|
||||
}
|
||||
|
||||
if (kMXNotificationCenterDidUpdateRulesObserver)
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:kMXNotificationCenterDidUpdateRulesObserver];
|
||||
kMXNotificationCenterDidUpdateRulesObserver = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)viewDidAppear:(BOOL)animated
|
||||
|
|
Loading…
Reference in a new issue