Fix non-available API usage in OS X 10.6-10.7 version.

This commit is contained in:
John Preston 2017-04-18 22:00:21 +03:00
parent bc1eff83cb
commit 71e653db30
2 changed files with 8 additions and 3 deletions

View file

@ -43,8 +43,13 @@ void queryDoNotDisturbState() {
}
LastSettingsQueryMs = ms;
id userDefaultsValue = [[[NSUserDefaults alloc] initWithSuiteName:@"com.apple.notificationcenterui"] objectForKey:@"doNotDisturb"];
DoNotDisturbEnabled = [userDefaultsValue boolValue];
auto userDefaults = [NSUserDefaults alloc];
if ([userDefaults respondsToSelector:@selector(initWithSuiteName:)]) {
id userDefaultsValue = [[[NSUserDefaults alloc] initWithSuiteName:@"com.apple.notificationcenterui_test"] objectForKey:@"doNotDisturb"];
DoNotDisturbEnabled = ([userDefaultsValue boolValue] == YES);
} else {
DoNotDisturbEnabled = false;
}
}
using Manager = Platform::Notifications::Manager;

View file

@ -60,7 +60,7 @@ void System::createManager() {
void System::schedule(History *history, HistoryItem *item) {
if (App::quitting() || !history->currentNotification() || !App::api()) return;
PeerData *notifyByFrom = (!history->peer->isUser() && item->mentionsMe()) ? item->from() : 0;
auto notifyByFrom = (!history->peer->isUser() && item->mentionsMe()) ? item->from() : nullptr;
if (item->isSilent()) {
history->popNotification(item);