5b18cc46bc
* chore: bump chromium in DEPS to 129.0.6623.0
* chore: update mas_avoid_private_macos_api_usage.patch.patch
remove the changes to media/audio/mac/audio_manager_mac.cc,
since upstream has also made this change now.
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5738654
* chore: update fix_disable_scope_reuse_associated_dchecks.patch
We had been removing a couple of `DCHECK`. Upstream changed their
code to limit when these `DCHECK`s get called, so let's see if our
change is still needed.
Xref: https://chromium-review.googlesource.com/c/v8/v8/+/5739076
* chore: e patches all
* Bump the Chrome macOS deployment target to 11.0
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5734361
BREAKING CHANGE: Bump the Chrome macOS deployment target to 11.0
* src: stop using deprecated fields of `v8::FastApiCallbackOptions`
Xref: d0000b118d
Xref: https://chromium-review.googlesource.com/c/v8/v8/+/5741336
Xref: https://chromium-review.googlesource.com/c/v8/v8/+/5741199
* fixup! chore: update fix_disable_scope_reuse_associated_dchecks.patch
chore: re-disable DCHECKs
yep, it is still needed
* refactor use non-deprecated variant of openApplicationAtURL
old version is deprecated now in macOS 11
Xref: https://developer.apple.com/documentation/appkit/nsworkspace/1534810-launchapplicationaturl
Xref: https://developer.apple.com/documentation/appkit/nsworkspace/3172700-openapplicationaturl
* chore: bump chromium in DEPS to 129.0.6626.0
* chore: e patches all
* chore: disable NSUserNotification deprecation errors
* chore: disable NSWindowStyleMaskTexturedBackground deprecation errors
Xref: https://github.com/electron/electron/issues/43125
* chore: disable deprecation errors in platform_util_mac.mm
* chore: disable launchApplication deprecation errors
* chore: bump chromium in DEPS to 129.0.6630.0
* chore: update refactor_expose_file_system_access_blocklist.patch
apply patch manually due to context shear
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5745444
* chore: update deps_add_v8_object_setinternalfieldfornodecore.patch
no manual changes. patch applied with fuzz 1 (offset -5 lines)
* chore: e patches all
* fix: add clang_x64_v8_arm64/snapshot_blob.bin to the zip manifest
Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5746173
---------
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
97 lines
3.3 KiB
Text
97 lines
3.3 KiB
Text
// Copyright (c) 2015 GitHub, Inc.
|
|
// Use of this source code is governed by the MIT license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "shell/browser/notifications/mac/notification_center_delegate.h"
|
|
|
|
#include <string>
|
|
|
|
#include "base/logging.h"
|
|
#include "shell/browser/notifications/mac/cocoa_notification.h"
|
|
#include "shell/browser/notifications/mac/notification_presenter_mac.h"
|
|
|
|
// NSUserNotification is deprecated; we need to use the
|
|
// UserNotifications.frameworks API instead
|
|
#pragma clang diagnostic push
|
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
|
|
@implementation NotificationCenterDelegate
|
|
|
|
- (instancetype)initWithPresenter:
|
|
(electron::NotificationPresenterMac*)presenter {
|
|
self = [super init];
|
|
if (!self)
|
|
return nil;
|
|
|
|
presenter_ = presenter;
|
|
return self;
|
|
}
|
|
|
|
- (void)userNotificationCenter:(NSUserNotificationCenter*)center
|
|
didDeliverNotification:(NSUserNotification*)notif {
|
|
auto* notification = presenter_->GetNotification(notif);
|
|
if (notification)
|
|
notification->NotificationDisplayed();
|
|
}
|
|
|
|
- (void)userNotificationCenter:(NSUserNotificationCenter*)center
|
|
didActivateNotification:(NSUserNotification*)notif {
|
|
auto* notification = presenter_->GetNotification(notif);
|
|
|
|
if (getenv("ELECTRON_DEBUG_NOTIFICATIONS")) {
|
|
LOG(INFO) << "Notification activated (" << [notif.identifier UTF8String]
|
|
<< ")";
|
|
}
|
|
|
|
if (notification) {
|
|
// Ref:
|
|
// https://developer.apple.com/documentation/foundation/nsusernotificationactivationtype?language=objc
|
|
if (notif.activationType ==
|
|
NSUserNotificationActivationTypeContentsClicked) {
|
|
notification->NotificationClicked();
|
|
} else if (notif.activationType ==
|
|
NSUserNotificationActivationTypeActionButtonClicked) {
|
|
notification->NotificationActivated();
|
|
} else if (notif.activationType ==
|
|
NSUserNotificationActivationTypeReplied) {
|
|
notification->NotificationReplied([notif.response.string UTF8String]);
|
|
} else {
|
|
if (notif.activationType ==
|
|
NSUserNotificationActivationTypeAdditionalActionClicked) {
|
|
notification->NotificationActivated([notif additionalActivationAction]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
- (BOOL)userNotificationCenter:(NSUserNotificationCenter*)center
|
|
shouldPresentNotification:(NSUserNotification*)notification {
|
|
// Display notifications even if the app is active.
|
|
return YES;
|
|
}
|
|
|
|
#if !IS_MAS_BUILD()
|
|
// This undocumented method notifies us if a user closes "Alert" notifications
|
|
// https://chromium.googlesource.com/chromium/src/+/lkgr/chrome/browser/notifications/notification_platform_bridge_mac.mm
|
|
- (void)userNotificationCenter:(NSUserNotificationCenter*)center
|
|
didDismissAlert:(NSUserNotification*)notif {
|
|
auto* notification = presenter_->GetNotification(notif);
|
|
if (notification)
|
|
notification->NotificationDismissed();
|
|
}
|
|
#endif
|
|
|
|
#if !IS_MAS_BUILD()
|
|
// This undocumented method notifies us if a user closes "Banner" notifications
|
|
// https://github.com/mozilla/gecko-dev/blob/master/widget/cocoa/OSXNotificationCenter.mm
|
|
- (void)userNotificationCenter:(NSUserNotificationCenter*)center
|
|
didRemoveDeliveredNotifications:(NSArray*)notifications {
|
|
for (NSUserNotification* notif in notifications) {
|
|
auto* notification = presenter_->GetNotification(notif);
|
|
if (notification)
|
|
notification->NotificationDismissed();
|
|
}
|
|
}
|
|
#endif
|
|
|
|
@end
|