Restore all settings usage.

This commit is contained in:
giomfo
2015-04-15 16:27:58 +02:00
parent 004825a3fc
commit 01946ea351
3 changed files with 19 additions and 3 deletions
+18
View File
@@ -95,11 +95,17 @@ static MatrixSDKHandler *sharedHandler = nil;
_unnotifiedRooms = [[NSMutableArray alloc] init];
_partialTextMsgByRoomId = [[NSMutableDictionary alloc] init];
[[MXKAppSettings standardAppSettings] addObserver:self forKeyPath:@"enableInAppNotifications" options:0 context:nil];
[[MXKAppSettings standardAppSettings] addObserver:self forKeyPath:@"showAllEventsInRoomHistory" options:0 context:nil];
}
return self;
}
- (void)dealloc {
[[MXKAppSettings standardAppSettings] removeObserver:self forKeyPath:@"enableInAppNotifications"];
[[MXKAppSettings standardAppSettings] removeObserver:self forKeyPath:@"showAllEventsInRoomHistory"];
[[NSNotificationCenter defaultCenter] removeObserver:self];
[[NSNotificationCenter defaultCenter] removeObserver:reachabilityObserver];
reachabilityObserver = nil;
@@ -891,4 +897,16 @@ static MatrixSDKHandler *sharedHandler = nil;
return NO;
}
#pragma mark - KVO
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
if ([@"showAllEventsInRoomHistory" isEqualToString:keyPath]) {
// Flush and restore Matrix data
[self reload:NO];
}
else if ([@"enableInAppNotifications" isEqualToString:keyPath]) {
[self enableInAppNotifications:[[MXKAppSettings standardAppSettings] enableInAppNotifications]];
}
}
@end