Directory: handle tap on clock status bar

This commit is contained in:
giomfo
2016-06-20 14:11:27 +02:00
parent 88520ce712
commit 92126b013e
@@ -27,6 +27,9 @@
@interface DirectoryViewController ()
{
PublicRoomsDirectoryDataSource *dataSource;
// Observe kAppDelegateDidTapStatusBarNotification to handle tap on clock status bar.
id kAppDelegateDidTapStatusBarNotificationObserver;
}
@end
@@ -61,6 +64,13 @@
[tracker set:kGAIScreenName value:@"Directory"];
[tracker send:[[GAIDictionaryBuilder createScreenView] build]];
}
// Observe kAppDelegateDidTapStatusBarNotificationObserver.
kAppDelegateDidTapStatusBarNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kAppDelegateDidTapStatusBarNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) {
[self.tableView setContentOffset:CGPointMake(-self.tableView.contentInset.left, -self.tableView.contentInset.top) animated:YES];
}];
[self.tableView reloadData];
}
@@ -82,6 +92,17 @@
}
}
- (void)viewWillDisappear:(BOOL)animated
{
if (kAppDelegateDidTapStatusBarNotificationObserver)
{
[[NSNotificationCenter defaultCenter] removeObserver:kAppDelegateDidTapStatusBarNotificationObserver];
kAppDelegateDidTapStatusBarNotificationObserver = nil;
}
[super viewWillDisappear:animated];
}
- (void)displayWitDataSource:(PublicRoomsDirectoryDataSource *)dataSource2
{
// Let the data source provide cells