Modular integrations Manager: Improve dark theme management

This commit is contained in:
manuroe
2017-09-19 13:36:43 +02:00
parent 9d4977697d
commit 6b709647d4
@@ -36,9 +36,6 @@ NSString *const kJavascriptSendResponseToModular = @"riotIOS.sendResponse('%@',
NSString *scalarToken;
MXHTTPOperation *operation;
// Observe kRiotDesignValuesDidChangeThemeNotification to handle user interface theme change.
id kRiotDesignValuesDidChangeThemeNotificationObserver;
}
@end
@@ -64,12 +61,6 @@ NSString *const kJavascriptSendResponseToModular = @"riotIOS.sendResponse('%@',
[operation cancel];
operation = nil;
if (kRiotDesignValuesDidChangeThemeNotificationObserver)
{
[[NSNotificationCenter defaultCenter] removeObserver:kRiotDesignValuesDidChangeThemeNotificationObserver];
kRiotDesignValuesDidChangeThemeNotificationObserver = nil;
}
}
- (void)viewDidLoad
@@ -79,24 +70,10 @@ NSString *const kJavascriptSendResponseToModular = @"riotIOS.sendResponse('%@',
webView.scalesPageToFit = NO;
webView.scrollView.bounces = NO;
webView.delegate = self;
// Observe user interface theme change.
kRiotDesignValuesDidChangeThemeNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kRiotDesignValuesDidChangeThemeNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) {
[self userInterfaceThemeDidChange];
}];
[self userInterfaceThemeDidChange];
}
- (void)userInterfaceThemeDidChange
{
self.view.backgroundColor = kRiotPrimaryBgColor;
webView.backgroundColor = kRiotPrimaryBgColor;
// Disable opacity so that the webview background uses the current interface theme
webView.opaque = NO;
self.activityIndicator.backgroundColor = kRiotOverlayColor;
webView.delegate = self;
}
- (void)viewWillAppear:(BOOL)animated