revert: "fix: reply notifs sometimes destroyed too early" (#25247)

* Revert "fix: reply notifs sometimes destroyed too early (#25086)"

This reverts commit bea6c9e4e1.

* nothing
This commit is contained in:
Samuel Attard 2020-09-01 18:02:47 -07:00 коммит произвёл GitHub
Родитель 3745b76da8
Коммит 184e72fafd
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 5 добавлений и 10 удалений

Просмотреть файл

@ -43,10 +43,7 @@
// https://developer.apple.com/documentation/foundation/nsusernotificationactivationtype?language=objc
if (notif.activationType ==
NSUserNotificationActivationTypeContentsClicked) {
// If a notification with a reply button is clicked and the user has not
// yet replied, we do not want to destroy the notification.
bool should_destroy = ![notif hasReplyButton];
notification->NotificationClicked(should_destroy);
notification->NotificationClicked();
} else if (notif.activationType ==
NSUserNotificationActivationTypeActionButtonClicked) {
notification->NotificationActivated();

Просмотреть файл

@ -21,12 +21,10 @@ Notification::~Notification() {
delegate()->NotificationDestroyed();
}
void Notification::NotificationClicked(bool should_destroy) {
void Notification::NotificationClicked() {
if (delegate())
delegate()->NotificationClick();
if (should_destroy)
Destroy();
Destroy();
}
void Notification::NotificationDismissed() {

Просмотреть файл

@ -54,7 +54,7 @@ class Notification {
virtual void Dismiss() = 0;
// Should be called by derived classes.
void NotificationClicked(bool should_destroy = true);
void NotificationClicked();
void NotificationDismissed();
void NotificationFailed();

Просмотреть файл

@ -476,7 +476,7 @@ IFACEMETHODIMP ToastEventHandler::Invoke(
IInspectable* args) {
base::PostTask(
FROM_HERE, {content::BrowserThread::UI},
base::BindOnce(&Notification::NotificationClicked, notification_, true));
base::BindOnce(&Notification::NotificationClicked, notification_));
if (IsDebuggingNotifications())
LOG(INFO) << "Notification clicked";