Room details: fix display name for new joined members.

This commit is contained in:
giomfo
2014-12-09 10:39:56 +01:00
parent 91a014a30e
commit 673dbd70ee
6 changed files with 91 additions and 39 deletions
@@ -108,12 +108,6 @@
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
// Release potential Room ViewController
if (currentRoomViewController) {
currentRoomViewController.roomId = nil;
currentRoomViewController = nil;
}
// Refresh display
[self configureView];
[[MatrixHandler sharedHandler] addObserver:self forKeyPath:@"isInitialSyncDone" options:0 context:nil];
@@ -137,6 +131,16 @@
[[MatrixHandler sharedHandler] removeObserver:self forKeyPath:@"isResumeDone"];
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
// Release potential Room ViewController if none is visible (Note: check on room visibility is required to handle correctly splitViewController)
if ([AppDelegate theDelegate].masterTabBarController.visibleRoomId == nil && currentRoomViewController) {
currentRoomViewController.roomId = nil;
currentRoomViewController = nil;
}
}
#pragma mark -
- (void)setPreSelectedRoomId:(NSString *)roomId {
@@ -338,6 +342,11 @@
}
if ([controller isKindOfClass:[RoomViewController class]]) {
// Release potential Room ViewController
if (currentRoomViewController) {
currentRoomViewController.roomId = nil;
currentRoomViewController = nil;
}
currentRoomViewController = (RoomViewController *)controller;
currentRoomViewController.roomId = recentRoom.roomId;
}
@@ -415,7 +424,7 @@
// set background color
if (recentRoom.unreadCount) {
cell.backgroundColor = [UIColor colorWithRed:1 green:0.9 blue:0.9 alpha:1.0];
cell.roomTitle.text = [NSString stringWithFormat:@"%@ (%d)", cell.roomTitle.text, recentRoom.unreadCount];
cell.roomTitle.text = [NSString stringWithFormat:@"%@ (%lu)", cell.roomTitle.text, (unsigned long)recentRoom.unreadCount];
} else {
cell.backgroundColor = [UIColor clearColor];
}