mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
macOS: Simplify Utility::hasDarkSystray()
Signed-off-by: Camila Ayres <hello@camilasan.com>
This commit is contained in:
parent
a616fbf189
commit
fb13eb7203
@ -27,6 +27,7 @@
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#import <Foundation/NSFileManager.h>
|
||||
#import <Foundation/NSUserDefaults.h>
|
||||
|
||||
namespace OCC {
|
||||
|
||||
@ -223,17 +224,13 @@ void Utility::setLaunchOnStartup(const QString &appName, const QString &guiName,
|
||||
#ifndef TOKEN_AUTH_ONLY
|
||||
bool Utility::hasDarkSystray()
|
||||
{
|
||||
bool returnValue = false;
|
||||
CFStringRef interfaceStyleKey = CFSTR("AppleInterfaceStyle");
|
||||
CFStringRef interfaceStyle = nullptr;
|
||||
CFStringRef darkInterfaceStyle = CFSTR("Dark");
|
||||
interfaceStyle = (CFStringRef)CFPreferencesCopyAppValue(interfaceStyleKey,
|
||||
kCFPreferencesCurrentApplication);
|
||||
if (interfaceStyle) {
|
||||
returnValue = (kCFCompareEqualTo == CFStringCompare(interfaceStyle, darkInterfaceStyle, 0));
|
||||
CFRelease(interfaceStyle);
|
||||
@autoreleasepool {
|
||||
if (auto style = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"]) {
|
||||
return [style isEqualToString:@"Dark"];
|
||||
}
|
||||
}
|
||||
return returnValue;
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user