Respect system dark mode setting, fixes #2628

This commit is contained in:
ismailgulek
2020-06-04 15:29:15 +03:00
parent 38794696d0
commit 52775d2f84
+9 -2
View File
@@ -63,8 +63,15 @@ NSString *const kThemeServiceDidChangeThemeNotification = @"kThemeServiceDidChan
if ([themeId isEqualToString:@"auto"])
{
// Translate "auto" into a theme
themeId = UIAccessibilityIsInvertColorsEnabled() ? @"dark" : @"light";
if (@available(iOS 13, *))
{
themeId = ([UITraitCollection currentTraitCollection].userInterfaceStyle == UIUserInterfaceStyleDark) ? @"dark" : @"light";
}
else
{
// Translate "auto" into a theme
themeId = UIAccessibilityIsInvertColorsEnabled() ? @"dark" : @"light";
}
}
if ([themeId isEqualToString:@"dark"])