diff --git a/Riot/Modules/Room/RoomViewController.m b/Riot/Modules/Room/RoomViewController.m index c9869aec8..5ca4a0564 100644 --- a/Riot/Modules/Room/RoomViewController.m +++ b/Riot/Modules/Room/RoomViewController.m @@ -545,9 +545,13 @@ // Observe missed notifications mxRoomSummaryDidChangeObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kMXRoomSummaryDidChangeNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) { - - [self refreshMissedDiscussionsCount:NO]; - + + MXRoomSummary *roomSummary = notif.object; + + if ([roomSummary.roomId isEqualToString:self.roomDataSource.roomId]) + { + [self refreshMissedDiscussionsCount:NO]; + } }]; [self refreshMissedDiscussionsCount:YES]; @@ -3574,33 +3578,30 @@ { // Add typing notification listener MXWeakify(self); - [self.roomDataSource.room liveTimeline:^(MXEventTimeline *liveTimeline) { + self->typingNotifListener = [self.roomDataSource.room listenToEventsOfTypes:@[kMXEventTypeStringTypingNotification] onEvent:^(MXEvent *event, MXTimelineDirection direction, MXRoomState *roomState) { MXStrongifyAndReturnIfNil(self); - self->typingNotifListener = [liveTimeline listenToEventsOfTypes:@[kMXEventTypeStringTypingNotification] onEvent:^(MXEvent *event, MXTimelineDirection direction, MXRoomState *roomState) { - - // Handle only live events - if (direction == MXTimelineDirectionForwards) + // Handle only live events + if (direction == MXTimelineDirectionForwards) + { + // Retrieve typing users list + NSMutableArray *typingUsers = [NSMutableArray arrayWithArray:self.roomDataSource.room.typingUsers]; + // Remove typing info for the current user + NSUInteger index = [typingUsers indexOfObject:self.mainSession.myUser.userId]; + if (index != NSNotFound) { - // Retrieve typing users list - NSMutableArray *typingUsers = [NSMutableArray arrayWithArray:self.roomDataSource.room.typingUsers]; - // Remove typing info for the current user - NSUInteger index = [typingUsers indexOfObject:self.mainSession.myUser.userId]; - if (index != NSNotFound) - { - [typingUsers removeObjectAtIndex:index]; - } - - // Ignore this notification if both arrays are empty - if (currentTypingUsers.count || typingUsers.count) - { - currentTypingUsers = typingUsers; - [self refreshActivitiesViewDisplay]; - } + [typingUsers removeObjectAtIndex:index]; } - }]; + + // Ignore this notification if both arrays are empty + if (self->currentTypingUsers.count || typingUsers.count) + { + self->currentTypingUsers = typingUsers; + [self refreshActivitiesViewDisplay]; + } + } }]; - + // Retrieve the current typing users list NSMutableArray *typingUsers = [NSMutableArray arrayWithArray:self.roomDataSource.room.typingUsers]; // Remove typing info for the current user diff --git a/Riot/Modules/Room/Settings/RoomSettingsViewController.m b/Riot/Modules/Room/Settings/RoomSettingsViewController.m index 117d5b940..7d1605f6a 100644 --- a/Riot/Modules/Room/Settings/RoomSettingsViewController.m +++ b/Riot/Modules/Room/Settings/RoomSettingsViewController.m @@ -190,17 +190,12 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti [super initWithSession:session andRoomId:roomId]; // Add an additional listener to update banned users - MXWeakify(self); - [mxRoom liveTimeline:^(MXEventTimeline *liveTimeline) { - MXStrongifyAndReturnIfNil(self); + self->extraEventsListener = [mxRoom listenToEventsOfTypes:@[kMXEventTypeStringRoomMember] onEvent:^(MXEvent *event, MXTimelineDirection direction, MXRoomState *roomState) { - self->extraEventsListener = [liveTimeline listenToEventsOfTypes:@[kMXEventTypeStringRoomMember] onEvent:^(MXEvent *event, MXTimelineDirection direction, MXRoomState *roomState) { - - if (direction == MXTimelineDirectionForwards) - { - [self updateRoomState:roomState]; - } - }]; + if (direction == MXTimelineDirectionForwards) + { + [self updateRoomState:roomState]; + } }]; }