Revert "fix: Drop support for OS X Mavericks (version 10.9)" (#13333)
This commit is contained in:
parent
562eddf0e9
commit
79fbd6bab1
15 changed files with 290 additions and 156 deletions
|
@ -29,7 +29,8 @@ class CocoaNotification : public Notification {
|
|||
void NotificationDisplayed();
|
||||
void NotificationReplied(const std::string& reply);
|
||||
void NotificationActivated();
|
||||
void NotificationActivated(NSUserNotificationAction* action);
|
||||
void NotificationActivated(NSUserNotificationAction* action)
|
||||
API_AVAILABLE(macosx(10.10));
|
||||
|
||||
NSUserNotification* notification() const { return notification_; }
|
||||
|
||||
|
|
|
@ -72,18 +72,24 @@ 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];
|
||||
NSUserNotificationAction* notificationAction = [NSUserNotificationAction
|
||||
actionWithIdentifier:actionIdentifier
|
||||
title:base::SysUTF16ToNSString(action.text)];
|
||||
[additionalActions addObject:notificationAction];
|
||||
additional_action_indices_.insert(
|
||||
std::make_pair(base::SysNSStringToUTF8(actionIdentifier), 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if ([additionalActions count] > 0) {
|
||||
[notification_ setAdditionalActions:additionalActions];
|
||||
if ([additionalActions count] > 0 &&
|
||||
[notification_ respondsToSelector:@selector(setAdditionalActions:)]) {
|
||||
if (@available(macOS 10.10, *)) {
|
||||
[notification_ setAdditionalActions:additionalActions];
|
||||
}
|
||||
}
|
||||
|
||||
if (options.has_reply) {
|
||||
|
|
|
@ -48,9 +48,12 @@
|
|||
NSUserNotificationActivationTypeReplied) {
|
||||
notification->NotificationReplied([notif.response.string UTF8String]);
|
||||
} else {
|
||||
if (notif.activationType ==
|
||||
NSUserNotificationActivationTypeAdditionalActionClicked) {
|
||||
notification->NotificationActivated([notif additionalActivationAction]);
|
||||
if (@available(macOS 10.10, *)) {
|
||||
if (notif.activationType ==
|
||||
NSUserNotificationActivationTypeAdditionalActionClicked) {
|
||||
notification->NotificationActivated(
|
||||
[notif additionalActivationAction]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue