mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
chore: wrap new NSAppearance in correct check (#14873)
* fix: wrap new NSAppearance in correct check * catch dark case on < 10.14 * fix @available conditional organization
This commit is contained in:
committed by
Samuel Attard
parent
40b676fee8
commit
ec38561254
@@ -37,7 +37,11 @@ struct Converter<NSAppearance*> {
|
||||
*out = [NSAppearance appearanceNamed:NSAppearanceNameAqua];
|
||||
return true;
|
||||
} else if (name == "dark") {
|
||||
*out = [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua];
|
||||
if (@available(macOS 10.14, *)) {
|
||||
*out = [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua];
|
||||
} else {
|
||||
*out = [NSAppearance appearanceNamed:NSAppearanceNameAqua];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -48,11 +52,14 @@ struct Converter<NSAppearance*> {
|
||||
if (val == nil) {
|
||||
return v8::Null(isolate);
|
||||
}
|
||||
|
||||
if (val.name == NSAppearanceNameAqua) {
|
||||
return mate::ConvertToV8(isolate, "light");
|
||||
}
|
||||
if (val.name == NSAppearanceNameDarkAqua) {
|
||||
return mate::ConvertToV8(isolate, "dark");
|
||||
if (@available(macOS 10.14, *)) {
|
||||
if (val.name == NSAppearanceNameDarkAqua) {
|
||||
return mate::ConvertToV8(isolate, "dark");
|
||||
}
|
||||
}
|
||||
|
||||
return mate::ConvertToV8(isolate, "unknown");
|
||||
|
||||
Reference in New Issue
Block a user