mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 23:24: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;
|
LastSettingsQueryMs = ms;
|
||||||
|
|
||||||
auto userDefaults = [NSUserDefaults alloc];
|
Boolean isKeyValid;
|
||||||
if ([userDefaults respondsToSelector:@selector(initWithSuiteName:)]) {
|
const auto doNotDisturb = CFPreferencesGetAppBooleanValue(
|
||||||
id userDefaultsValue = [[[NSUserDefaults alloc] initWithSuiteName:@"com.apple.notificationcenterui"] objectForKey:@"doNotDisturb"];
|
CFSTR("doNotDisturb"),
|
||||||
DoNotDisturbEnabled = ([userDefaultsValue boolValue] == YES);
|
CFSTR("com.apple.notificationcenterui"),
|
||||||
} else {
|
&isKeyValid);
|
||||||
DoNotDisturbEnabled = false;
|
DoNotDisturbEnabled = isKeyValid
|
||||||
}
|
? doNotDisturb
|
||||||
|
: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
using Manager = Platform::Notifications::Manager;
|
using Manager = Platform::Notifications::Manager;
|
||||||
|
|
Loading…
Add table
Reference in a new issue