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];
|
*out = [NSAppearance appearanceNamed:NSAppearanceNameAqua];
|
||||||
return true;
|
return true;
|
||||||
} else if (name == "dark") {
|
} else if (name == "dark") {
|
||||||
*out = [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua];
|
if (@available(macOS 10.14, *)) {
|
||||||
|
*out = [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua];
|
||||||
|
} else {
|
||||||
|
*out = [NSAppearance appearanceNamed:NSAppearanceNameAqua];
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,11 +52,14 @@ struct Converter<NSAppearance*> {
|
||||||
if (val == nil) {
|
if (val == nil) {
|
||||||
return v8::Null(isolate);
|
return v8::Null(isolate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (val.name == NSAppearanceNameAqua) {
|
if (val.name == NSAppearanceNameAqua) {
|
||||||
return mate::ConvertToV8(isolate, "light");
|
return mate::ConvertToV8(isolate, "light");
|
||||||
}
|
}
|
||||||
if (val.name == NSAppearanceNameDarkAqua) {
|
if (@available(macOS 10.14, *)) {
|
||||||
return mate::ConvertToV8(isolate, "dark");
|
if (val.name == NSAppearanceNameDarkAqua) {
|
||||||
|
return mate::ConvertToV8(isolate, "dark");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return mate::ConvertToV8(isolate, "unknown");
|
return mate::ConvertToV8(isolate, "unknown");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue