2015-12-24 06:55:18 -07:00
|
|
|
// Copyright (c) 2015 GitHub, Inc.
|
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2021-11-22 00:34:31 -07:00
|
|
|
#ifndef ELECTRON_SHELL_BROWSER_NOTIFICATIONS_MAC_COCOA_NOTIFICATION_H_
|
|
|
|
#define ELECTRON_SHELL_BROWSER_NOTIFICATIONS_MAC_COCOA_NOTIFICATION_H_
|
2015-12-24 06:55:18 -07:00
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
|
2018-01-15 22:07:27 -07:00
|
|
|
#include <map>
|
2017-05-18 16:06:57 -06:00
|
|
|
#include <string>
|
|
|
|
|
2019-06-19 14:46:59 -06:00
|
|
|
#include "shell/browser/notifications/notification.h"
|
2015-12-24 06:55:18 -07:00
|
|
|
|
2019-06-19 15:23:04 -06:00
|
|
|
namespace electron {
|
2015-12-24 06:55:18 -07:00
|
|
|
|
2015-12-24 07:06:41 -07:00
|
|
|
class CocoaNotification : public Notification {
|
2015-12-24 06:55:18 -07:00
|
|
|
public:
|
2015-12-24 19:16:07 -07:00
|
|
|
CocoaNotification(NotificationDelegate* delegate,
|
|
|
|
NotificationPresenter* presenter);
|
2018-04-17 17:03:51 -06:00
|
|
|
~CocoaNotification() override;
|
2015-12-24 06:55:18 -07:00
|
|
|
|
2015-12-24 20:05:48 -07:00
|
|
|
// Notification:
|
2017-06-24 05:03:27 -06:00
|
|
|
void Show(const NotificationOptions& options) override;
|
2015-12-24 19:16:07 -07:00
|
|
|
void Dismiss() override;
|
2015-12-24 06:55:18 -07:00
|
|
|
|
2016-04-15 01:14:13 -06:00
|
|
|
void NotificationDisplayed();
|
2017-05-31 01:17:29 -06:00
|
|
|
void NotificationReplied(const std::string& reply);
|
2018-01-16 20:07:54 -07:00
|
|
|
void NotificationActivated();
|
2019-02-25 10:21:57 -07:00
|
|
|
void NotificationActivated(NSUserNotificationAction* action);
|
2018-08-13 05:09:25 -06:00
|
|
|
void NotificationDismissed();
|
2015-12-24 06:55:18 -07:00
|
|
|
|
2015-12-24 19:16:07 -07:00
|
|
|
NSUserNotification* notification() const { return notification_; }
|
2015-12-24 06:55:18 -07:00
|
|
|
|
2015-12-24 19:16:07 -07:00
|
|
|
private:
|
2017-12-12 17:09:11 -07:00
|
|
|
void LogAction(const char* action);
|
|
|
|
|
2023-08-04 02:47:29 -06:00
|
|
|
NSUserNotification* __strong notification_;
|
2018-01-15 21:50:03 -07:00
|
|
|
std::map<std::string, unsigned> additional_action_indices_;
|
|
|
|
unsigned action_index_;
|
2015-12-24 06:55:18 -07:00
|
|
|
};
|
|
|
|
|
2019-06-19 15:23:04 -06:00
|
|
|
} // namespace electron
|
2015-12-24 06:55:18 -07:00
|
|
|
|
2021-11-22 00:34:31 -07:00
|
|
|
#endif // ELECTRON_SHELL_BROWSER_NOTIFICATIONS_MAC_COCOA_NOTIFICATION_H_
|