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:
Shelley Vohr 2018-10-01 07:52:04 -07:00 committed by Samuel Attard
parent 40b676fee8
commit ec38561254

View file

@ -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");