diff --git a/Vector/ViewController/RoomDetailsViewController.m b/Vector/ViewController/RoomDetailsViewController.m index 5f688e3b9..aa0f957a3 100644 --- a/Vector/ViewController/RoomDetailsViewController.m +++ b/Vector/ViewController/RoomDetailsViewController.m @@ -56,11 +56,19 @@ self.tableView.separatorColor = [UIColor clearColor]; } +- (void)viewWillAppear:(BOOL)animated +{ + [super viewWillAppear:animated]; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didMXSessionStateChange:) name:kMXSessionStateDidChangeNotification object:nil]; +} + - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; [self dismissFirstResponder]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:kMXSessionStateDidChangeNotification object:nil]; } - (void)destroy @@ -139,6 +147,19 @@ } } +- (void)didMXSessionStateChange:(NSNotification *)notif +{ + // Check this is our Matrix session that has changed + if (notif.object == self.session) + { + // refresh when the session sync is done. + if (MXSessionStateRunning == self.session.state) + { + [self.tableView reloadData]; + } + } +} + - (IBAction)onDone:(id)sender { // check if there is some update