chore: finalize dropping support for OS X Mavericks (version 10.9) (#17102)

This commit is contained in:
Milan Burda 2019-02-25 18:21:57 +01:00 committed by Alexey Kuzmin
parent df5305d6a7
commit 5e762d6a47
14 changed files with 175 additions and 318 deletions

View file

@ -29,8 +29,7 @@ class CocoaNotification : public Notification {
void NotificationDisplayed();
void NotificationReplied(const std::string& reply);
void NotificationActivated();
void NotificationActivated(NSUserNotificationAction* action)
API_AVAILABLE(macosx(10.10));
void NotificationActivated(NSUserNotificationAction* action);
void NotificationDismissed();
NSUserNotification* notification() const { return notification_; }

View file

@ -72,24 +72,18 @@ void CocoaNotification::Show(const NotificationOptions& options) {
// All of the rest are appended to the list of additional actions
NSString* actionIdentifier =
[NSString stringWithFormat:@"%@Action%d", identifier, i];
if (@available(macOS 10.10, *)) {
NSUserNotificationAction* notificationAction =
[NSUserNotificationAction
actionWithIdentifier:actionIdentifier
title:base::SysUTF16ToNSString(action.text)];
[additionalActions addObject:notificationAction];
additional_action_indices_.insert(
std::make_pair(base::SysNSStringToUTF8(actionIdentifier), i));
}
NSUserNotificationAction* notificationAction = [NSUserNotificationAction
actionWithIdentifier:actionIdentifier
title:base::SysUTF16ToNSString(action.text)];
[additionalActions addObject:notificationAction];
additional_action_indices_.insert(
std::make_pair(base::SysNSStringToUTF8(actionIdentifier), i));
}
}
i++;
}
if ([additionalActions count] > 0 &&
[notification_ respondsToSelector:@selector(setAdditionalActions:)]) {
if (@available(macOS 10.10, *)) {
[notification_ setAdditionalActions:additionalActions];
}
if ([additionalActions count] > 0) {
[notification_ setAdditionalActions:additionalActions];
}
if (options.has_reply) {

View file

@ -47,12 +47,9 @@
NSUserNotificationActivationTypeReplied) {
notification->NotificationReplied([notif.response.string UTF8String]);
} else {
if (@available(macOS 10.10, *)) {
if (notif.activationType ==
NSUserNotificationActivationTypeAdditionalActionClicked) {
notification->NotificationActivated(
[notif additionalActivationAction]);
}
if (notif.activationType ==
NSUserNotificationActivationTypeAdditionalActionClicked) {
notification->NotificationActivated([notif additionalActivationAction]);
}
}
}