#ifndef REMOTING_IOS_APP_NOTIFICATION_PRESENTER_H_
#define REMOTING_IOS_APP_NOTIFICATION_PRESENTER_H_
#import <Foundation/Foundation.h>
#include "base/no_destructor.h"
#include "base/sequence_checker.h"
#include "base/threading/sequence_bound.h"
#include "base/timer/timer.h"
#include "remoting/client/notification/notification_client.h"
#include "remoting/client/notification/notification_message.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
namespace remoting {
class NotificationPresenter final {
public:
static NotificationPresenter* GetInstance();
NotificationPresenter(const NotificationPresenter&) = delete;
NotificationPresenter& operator=(const NotificationPresenter&) = delete;
void Start();
private:
friend class base::NoDestructor<NotificationPresenter>;
enum class State {
NOT_FETCHED,
FETCHING,
FETCHED,
};
NotificationPresenter();
~NotificationPresenter() = delete;
void FetchNotification();
void OnNotificationFetched(absl::optional<NotificationMessage> notification);
NotificationClient notification_client_;
base::OneShotTimer fetch_notification_timer_;
id<NSObject> user_update_observer_ = nil;
State state_ = State::NOT_FETCHED;
SEQUENCE_CHECKER(sequence_checker_);
};
}
#endif