mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 22:54:01 +02:00
Fixed memory leak in obtaining doNotDisturb value on macOS.
This commit is contained in:
parent
da690d2741
commit
8dceec5a9f
1 changed files with 8 additions and 7 deletions
|
@ -33,13 +33,14 @@ void queryDoNotDisturbState() {
|
|||
}
|
||||
LastSettingsQueryMs = ms;
|
||||
|
||||
auto userDefaults = [NSUserDefaults alloc];
|
||||
if ([userDefaults respondsToSelector:@selector(initWithSuiteName:)]) {
|
||||
id userDefaultsValue = [[[NSUserDefaults alloc] initWithSuiteName:@"com.apple.notificationcenterui"] objectForKey:@"doNotDisturb"];
|
||||
DoNotDisturbEnabled = ([userDefaultsValue boolValue] == YES);
|
||||
} else {
|
||||
DoNotDisturbEnabled = false;
|
||||
}
|
||||
Boolean isKeyValid;
|
||||
const auto doNotDisturb = CFPreferencesGetAppBooleanValue(
|
||||
CFSTR("doNotDisturb"),
|
||||
CFSTR("com.apple.notificationcenterui"),
|
||||
&isKeyValid);
|
||||
DoNotDisturbEnabled = isKeyValid
|
||||
? doNotDisturb
|
||||
: false;
|
||||
}
|
||||
|
||||
using Manager = Platform::Notifications::Manager;
|
||||
|
|
Loading…
Add table
Reference in a new issue