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:
parent
40b676fee8
commit
ec38561254
1 changed files with 10 additions and 3 deletions
|
@ -37,7 +37,11 @@ struct Converter<NSAppearance*> {
|
|||
*out = [NSAppearance appearanceNamed:NSAppearanceNameAqua];
|
||||
return true;
|
||||
} else if (name == "dark") {
|
||||
if (@available(macOS 10.14, *)) {
|
||||
*out = [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua];
|
||||
} else {
|
||||
*out = [NSAppearance appearanceNamed:NSAppearanceNameAqua];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -48,12 +52,15 @@ struct Converter<NSAppearance*> {
|
|||
if (val == nil) {
|
||||
return v8::Null(isolate);
|
||||
}
|
||||
|
||||
if (val.name == NSAppearanceNameAqua) {
|
||||
return mate::ConvertToV8(isolate, "light");
|
||||
}
|
||||
if (@available(macOS 10.14, *)) {
|
||||
if (val.name == NSAppearanceNameDarkAqua) {
|
||||
return mate::ConvertToV8(isolate, "dark");
|
||||
}
|
||||
}
|
||||
|
||||
return mate::ConvertToV8(isolate, "unknown");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue