Enable Dark theme

TODO:
- fix the app freeze when user changes the app theme.
This commit is contained in:
Giom Foret
2017-08-11 16:56:09 +02:00
parent 7481d9d689
commit 6fdbb5d844
109 changed files with 1528 additions and 339 deletions
+57 -1
View File
@@ -26,6 +26,9 @@
// The temporary file used to store the screenshot
NSURL *screenShotFile;
// Observe kRiotDesignValuesDidChangeThemeNotification to handle user interface theme change.
id kRiotDesignValuesDidChangeThemeNotificationObserver;
}
@property (nonatomic) BOOL sendLogs;
@@ -72,7 +75,6 @@
_containerView.layer.cornerRadius = 20;
_bugReportDescriptionTextView.layer.borderWidth = 1.0f;
_bugReportDescriptionTextView.layer.borderColor = kRiotColorLightGrey.CGColor;
_bugReportDescriptionTextView.text = nil;
_bugReportDescriptionTextView.delegate = self;
@@ -121,6 +123,60 @@
// Add an accessory view in order to retrieve keyboard view
_bugReportDescriptionTextView.inputAccessoryView = [[UIView alloc] initWithFrame:CGRectZero];
// 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.defaultBarTintColor = kRiotSecondaryBgColor;
self.barTitleColor = kRiotPrimaryTextColor;
self.containerView.backgroundColor = kRiotPrimaryBgColor;
self.sendingContainer.backgroundColor = kRiotPrimaryBgColor;
self.titleLabel.textColor = kRiotPrimaryTextColor;
self.sendingLabel.textColor = kRiotPrimaryTextColor;
self.descriptionLabel.textColor = kRiotPrimaryTextColor;
self.bugReportDescriptionTextView.textColor = kRiotPrimaryTextColor;
self.bugReportDescriptionTextView.tintColor = kRiotColorGreen;
self.logsDescriptionLabel.textColor = kRiotPrimaryTextColor;
self.sendLogsLabel.textColor = kRiotPrimaryTextColor;
self.sendScreenshotLabel.textColor = kRiotPrimaryTextColor;
self.sendButton.tintColor = kRiotColorGreen;
self.cancelButton.tintColor = kRiotColorGreen;
_bugReportDescriptionTextView.layer.borderColor = kRiotSecondaryBgColor.CGColor;
}
- (UIStatusBarStyle)preferredStatusBarStyle
{
return kRiotDesignStatusBarStyle;
}
- (void)destroy
{
if (kRiotDesignValuesDidChangeThemeNotificationObserver)
{
[[NSNotificationCenter defaultCenter] removeObserver:kRiotDesignValuesDidChangeThemeNotificationObserver];
kRiotDesignValuesDidChangeThemeNotificationObserver = nil;
}
[super destroy];
}
- (void)dismissViewControllerAnimated:(BOOL)flag completion:(void (^)(void))completion
{
[super dismissViewControllerAnimated:flag completion:completion];
[self destroy];
}
- (void)dealloc