BugFix: Tap on clock status bar should scroll you up

https://github.com/vector-im/vector-ios/issues/289
https://github.com/vector-im/vector-ios/issues/125
This commit is contained in:
giomfo
2016-05-19 17:22:29 +02:00
parent 8f31f0a14f
commit c9eee9ff4e
8 changed files with 134 additions and 23 deletions
@@ -34,6 +34,8 @@
#import "MXRoom+Vector.h"
#import "AppDelegate.h"
#define ROOM_SECTION 0
#define ROOM_SECTION_PHOTO 0
@@ -70,6 +72,9 @@
// switches
UISwitch *roomNotifSwitch;
// Observe kAppDelegateDidTapStatusBarNotification to handle tap on clock status bar.
id kAppDelegateDidTapStatusBarNotificationObserver;
}
@end
@@ -119,6 +124,13 @@
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didMXSessionStateChange:) name:kMXSessionStateDidChangeNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didUpdateRules:) name:kMXNotificationCenterDidUpdateRules object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didAccountUserInfoDidChange:) name:kMXKAccountUserInfoDidChangeNotification object:nil];
// 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];
}];
}
- (void)viewWillDisappear:(BOOL)animated
@@ -129,6 +141,12 @@
[[NSNotificationCenter defaultCenter] removeObserver:self name:kMXSessionStateDidChangeNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:kMXNotificationCenterDidUpdateRules object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:kMXKAccountUserInfoDidChangeNotification object:nil];
if (kAppDelegateDidTapStatusBarNotificationObserver)
{
[[NSNotificationCenter defaultCenter] removeObserver:kAppDelegateDidTapStatusBarNotificationObserver];
kAppDelegateDidTapStatusBarNotificationObserver = nil;
}
}
// this method is called when the viewcontroller is displayed inside another one.