2016-10-02 13:54:27 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2016-10-02 13:54:27 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2016-10-02 13:54:27 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2022-08-16 17:57:40 +00:00
|
|
|
#include "data/data_message_reaction_id.h"
|
2019-01-18 11:26:43 +00:00
|
|
|
#include "base/timer.h"
|
2022-11-01 08:29:12 +00:00
|
|
|
#include "base/type_traits.h"
|
2019-01-18 11:26:43 +00:00
|
|
|
|
2019-09-13 06:06:02 +00:00
|
|
|
class History;
|
|
|
|
|
2020-05-29 16:55:01 +00:00
|
|
|
namespace Data {
|
2022-04-07 07:34:29 +00:00
|
|
|
class Session;
|
2022-10-12 20:23:14 +00:00
|
|
|
class ForumTopic;
|
2022-10-13 10:32:03 +00:00
|
|
|
class Thread;
|
|
|
|
struct ItemNotification;
|
|
|
|
enum class ItemNotificationType;
|
2020-05-29 16:55:01 +00:00
|
|
|
} // namespace Data
|
|
|
|
|
2022-12-05 12:18:10 +00:00
|
|
|
namespace Ui {
|
|
|
|
struct PeerUserpicView;
|
|
|
|
} // namespace Ui
|
|
|
|
|
2019-07-24 11:45:24 +00:00
|
|
|
namespace Main {
|
|
|
|
class Session;
|
|
|
|
} // namespace Main
|
2017-03-04 19:36:59 +00:00
|
|
|
|
|
|
|
namespace Platform {
|
|
|
|
namespace Notifications {
|
|
|
|
class Manager;
|
|
|
|
} // namespace Notifications
|
|
|
|
} // namespace Platform
|
|
|
|
|
2022-10-13 10:32:03 +00:00
|
|
|
namespace Media::Audio {
|
2017-05-03 13:01:15 +00:00
|
|
|
class Track;
|
2022-10-13 10:32:03 +00:00
|
|
|
} // namespace Media::Audio
|
2017-05-03 13:01:15 +00:00
|
|
|
|
2017-03-04 19:36:59 +00:00
|
|
|
namespace Window {
|
2021-02-25 15:12:51 +00:00
|
|
|
class SessionController;
|
2022-10-13 10:32:03 +00:00
|
|
|
} // namespace Window
|
2021-02-25 15:12:51 +00:00
|
|
|
|
2022-10-13 10:32:03 +00:00
|
|
|
namespace Window::Notifications {
|
2017-03-04 19:36:59 +00:00
|
|
|
|
2021-01-21 10:18:40 +00:00
|
|
|
enum class ManagerType {
|
|
|
|
Dummy,
|
|
|
|
Default,
|
|
|
|
Native,
|
|
|
|
};
|
|
|
|
|
2017-03-04 19:36:59 +00:00
|
|
|
enum class ChangeType {
|
|
|
|
SoundEnabled,
|
2020-05-12 10:04:53 +00:00
|
|
|
FlashBounceEnabled,
|
2017-03-04 19:36:59 +00:00
|
|
|
IncludeMuted,
|
2018-12-04 10:32:06 +00:00
|
|
|
CountMessages,
|
2017-03-04 19:36:59 +00:00
|
|
|
DesktopEnabled,
|
|
|
|
ViewParams,
|
|
|
|
MaxCount,
|
|
|
|
Corner,
|
|
|
|
DemoIsShown,
|
2021-05-25 22:22:55 +00:00
|
|
|
DemoIsHidden,
|
2017-03-04 19:36:59 +00:00
|
|
|
};
|
|
|
|
|
2022-10-13 10:32:03 +00:00
|
|
|
} // namespace Window::Notifications
|
2017-03-04 19:36:59 +00:00
|
|
|
|
|
|
|
namespace base {
|
|
|
|
|
|
|
|
template <>
|
2022-10-13 10:32:03 +00:00
|
|
|
struct custom_is_fast_copy_type<Window::Notifications::ChangeType> : std::true_type {
|
2017-03-04 19:36:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace base
|
|
|
|
|
2022-10-13 10:32:03 +00:00
|
|
|
namespace Window::Notifications {
|
2016-10-02 13:54:27 +00:00
|
|
|
|
|
|
|
class Manager;
|
|
|
|
|
2021-05-25 13:51:59 +00:00
|
|
|
class System final {
|
2017-03-04 19:36:59 +00:00
|
|
|
public:
|
2020-06-19 12:59:31 +00:00
|
|
|
System();
|
|
|
|
~System();
|
|
|
|
|
2020-06-24 09:05:56 +00:00
|
|
|
[[nodiscard]] Main::Session *findSession(uint64 sessionId) const;
|
2017-03-04 19:36:59 +00:00
|
|
|
|
|
|
|
void createManager();
|
2021-01-21 10:18:40 +00:00
|
|
|
void setManager(std::unique_ptr<Manager> manager);
|
2022-11-11 11:49:50 +00:00
|
|
|
[[nodiscard]] Manager &manager() const;
|
2017-03-04 19:36:59 +00:00
|
|
|
|
|
|
|
void checkDelayed();
|
2022-10-13 10:32:03 +00:00
|
|
|
void schedule(Data::ItemNotification notification);
|
2022-10-12 20:23:14 +00:00
|
|
|
void clearFromTopic(not_null<Data::ForumTopic*> topic);
|
2019-08-30 14:06:21 +00:00
|
|
|
void clearFromHistory(not_null<History*> history);
|
2022-10-12 20:23:14 +00:00
|
|
|
void clearIncomingFromTopic(not_null<Data::ForumTopic*> topic);
|
2019-08-30 14:06:21 +00:00
|
|
|
void clearIncomingFromHistory(not_null<History*> history);
|
2020-06-19 12:59:31 +00:00
|
|
|
void clearFromSession(not_null<Main::Session*> session);
|
2019-08-30 14:06:21 +00:00
|
|
|
void clearFromItem(not_null<HistoryItem*> item);
|
2017-03-04 19:36:59 +00:00
|
|
|
void clearAll();
|
|
|
|
void clearAllFast();
|
|
|
|
void updateAll();
|
|
|
|
|
2021-05-25 13:51:59 +00:00
|
|
|
[[nodiscard]] rpl::producer<ChangeType> settingsChanged() const;
|
|
|
|
void notifySettingsChanged(ChangeType type);
|
|
|
|
|
2022-04-07 07:34:29 +00:00
|
|
|
void playSound(not_null<Main::Session*> session, DocumentId id);
|
|
|
|
|
2021-05-25 13:51:59 +00:00
|
|
|
[[nodiscard]] rpl::lifetime &lifetime() {
|
|
|
|
return _lifetime;
|
2017-03-04 19:36:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2022-01-31 13:18:40 +00:00
|
|
|
struct Waiter;
|
|
|
|
|
2019-08-28 14:24:12 +00:00
|
|
|
struct SkipState {
|
|
|
|
enum Value {
|
|
|
|
Unknown,
|
|
|
|
Skip,
|
|
|
|
DontSkip
|
|
|
|
};
|
|
|
|
Value value = Value::Unknown;
|
|
|
|
bool silent = false;
|
2022-01-14 13:41:29 +00:00
|
|
|
};
|
|
|
|
struct NotificationInHistoryKey {
|
2022-10-13 10:32:03 +00:00
|
|
|
NotificationInHistoryKey(Data::ItemNotification notification);
|
|
|
|
NotificationInHistoryKey(
|
|
|
|
MsgId messageId,
|
|
|
|
Data::ItemNotificationType type);
|
2022-01-14 13:41:29 +00:00
|
|
|
|
|
|
|
MsgId messageId = 0;
|
2022-10-13 10:32:03 +00:00
|
|
|
Data::ItemNotificationType type = Data::ItemNotificationType();
|
2022-01-14 13:41:29 +00:00
|
|
|
|
2022-10-13 10:32:03 +00:00
|
|
|
friend inline auto operator<=>(
|
|
|
|
NotificationInHistoryKey a,
|
|
|
|
NotificationInHistoryKey b) = default;
|
2019-08-28 14:24:12 +00:00
|
|
|
};
|
2022-01-14 13:41:29 +00:00
|
|
|
struct Timing {
|
|
|
|
crl::time delay = 0;
|
|
|
|
crl::time when = 0;
|
|
|
|
};
|
|
|
|
struct ReactionNotificationId {
|
|
|
|
FullMsgId itemId;
|
|
|
|
uint64 sessionId = 0;
|
|
|
|
|
|
|
|
friend inline bool operator<(
|
|
|
|
ReactionNotificationId a,
|
|
|
|
ReactionNotificationId b) {
|
|
|
|
return std::pair(a.itemId, a.sessionId)
|
|
|
|
< std::pair(b.itemId, b.sessionId);
|
|
|
|
}
|
2020-06-19 12:59:31 +00:00
|
|
|
};
|
2019-08-28 14:24:12 +00:00
|
|
|
|
2022-10-13 10:32:03 +00:00
|
|
|
void clearForThreadIf(Fn<bool(not_null<Data::Thread*>)> predicate);
|
|
|
|
|
2020-06-19 12:59:31 +00:00
|
|
|
[[nodiscard]] SkipState skipNotification(
|
2022-10-13 10:32:03 +00:00
|
|
|
Data::ItemNotification notification) const;
|
2022-01-14 13:41:29 +00:00
|
|
|
[[nodiscard]] SkipState computeSkipState(
|
2022-10-13 10:32:03 +00:00
|
|
|
Data::ItemNotification notification) const;
|
2022-01-14 13:41:29 +00:00
|
|
|
[[nodiscard]] Timing countTiming(
|
2022-10-13 17:34:04 +00:00
|
|
|
not_null<Data::Thread*> thread,
|
2022-01-14 13:41:29 +00:00
|
|
|
crl::time minimalDelay) const;
|
|
|
|
[[nodiscard]] bool skipReactionNotification(
|
2020-06-19 12:59:31 +00:00
|
|
|
not_null<HistoryItem*> item) const;
|
2019-08-28 14:24:12 +00:00
|
|
|
|
2017-03-04 19:36:59 +00:00
|
|
|
void showNext();
|
2019-03-10 07:42:25 +00:00
|
|
|
void showGrouped();
|
2017-05-03 13:01:15 +00:00
|
|
|
void ensureSoundCreated();
|
2022-04-05 14:08:35 +00:00
|
|
|
[[nodiscard]] not_null<Media::Audio::Track*> lookupSound(
|
2022-04-07 07:34:29 +00:00
|
|
|
not_null<Data::Session*> owner,
|
2022-04-05 14:08:35 +00:00
|
|
|
DocumentId id);
|
2017-03-04 19:36:59 +00:00
|
|
|
|
2022-10-13 17:34:04 +00:00
|
|
|
void registerThread(not_null<Data::Thread*> thread);
|
|
|
|
|
2020-06-19 12:59:31 +00:00
|
|
|
base::flat_map<
|
2022-10-13 10:32:03 +00:00
|
|
|
not_null<Data::Thread*>,
|
2022-01-14 13:41:29 +00:00
|
|
|
base::flat_map<NotificationInHistoryKey, crl::time>> _whenMaps;
|
2017-03-04 19:36:59 +00:00
|
|
|
|
2022-10-13 10:32:03 +00:00
|
|
|
base::flat_map<not_null<Data::Thread*>, Waiter> _waiters;
|
|
|
|
base::flat_map<not_null<Data::Thread*>, Waiter> _settingWaiters;
|
2019-01-18 11:26:43 +00:00
|
|
|
base::Timer _waitTimer;
|
2019-03-10 07:42:25 +00:00
|
|
|
base::Timer _waitForAllGroupedTimer;
|
2017-03-04 19:36:59 +00:00
|
|
|
|
2022-01-14 13:41:29 +00:00
|
|
|
base::flat_map<
|
2022-10-13 10:32:03 +00:00
|
|
|
not_null<Data::Thread*>,
|
2022-01-14 13:41:29 +00:00
|
|
|
base::flat_map<crl::time, PeerData*>> _whenAlerts;
|
|
|
|
|
|
|
|
mutable base::flat_map<
|
|
|
|
ReactionNotificationId,
|
|
|
|
crl::time> _sentReactionNotifications;
|
2017-03-04 19:36:59 +00:00
|
|
|
|
|
|
|
std::unique_ptr<Manager> _manager;
|
|
|
|
|
2021-05-25 13:51:59 +00:00
|
|
|
rpl::event_stream<ChangeType> _settingsChanged;
|
2017-03-04 19:36:59 +00:00
|
|
|
|
2017-05-03 13:01:15 +00:00
|
|
|
std::unique_ptr<Media::Audio::Track> _soundTrack;
|
2022-04-05 14:08:35 +00:00
|
|
|
base::flat_map<
|
|
|
|
DocumentId,
|
|
|
|
std::unique_ptr<Media::Audio::Track>> _customSoundTracks;
|
2017-05-03 13:01:15 +00:00
|
|
|
|
2022-10-13 17:34:04 +00:00
|
|
|
base::flat_map<
|
|
|
|
not_null<Data::ForumTopic*>,
|
|
|
|
rpl::lifetime> _watchedTopics;
|
|
|
|
|
2019-03-10 07:42:25 +00:00
|
|
|
int _lastForwardedCount = 0;
|
2020-06-24 09:05:56 +00:00
|
|
|
uint64 _lastHistorySessionId = 0;
|
2019-03-10 07:42:25 +00:00
|
|
|
FullMsgId _lastHistoryItemId;
|
2019-06-05 20:41:51 +00:00
|
|
|
|
2021-05-25 13:51:59 +00:00
|
|
|
rpl::lifetime _lifetime;
|
|
|
|
|
2017-03-04 19:36:59 +00:00
|
|
|
};
|
2016-10-02 13:54:27 +00:00
|
|
|
|
|
|
|
class Manager {
|
|
|
|
public:
|
2022-10-12 20:23:14 +00:00
|
|
|
struct ContextId {
|
2020-06-24 09:05:56 +00:00
|
|
|
uint64 sessionId = 0;
|
2020-06-19 12:59:31 +00:00
|
|
|
PeerId peerId = 0;
|
2022-10-12 20:23:14 +00:00
|
|
|
MsgId topicRootId = 0;
|
2020-06-19 12:59:31 +00:00
|
|
|
|
2022-10-12 20:23:14 +00:00
|
|
|
friend inline auto operator<=>(
|
|
|
|
const ContextId&,
|
|
|
|
const ContextId&) = default;
|
2022-11-11 11:49:50 +00:00
|
|
|
|
|
|
|
[[nodiscard]] auto toTuple() const {
|
|
|
|
return std::make_tuple(
|
|
|
|
sessionId,
|
|
|
|
peerId.value,
|
|
|
|
topicRootId.bare);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
[[nodiscard]] static auto FromTuple(const T &tuple) {
|
|
|
|
return ContextId{
|
|
|
|
std::get<0>(tuple),
|
|
|
|
PeerIdHelper(std::get<1>(tuple)),
|
|
|
|
std::get<2>(tuple),
|
|
|
|
};
|
|
|
|
}
|
2020-06-19 12:59:31 +00:00
|
|
|
};
|
2020-06-24 09:05:56 +00:00
|
|
|
struct NotificationId {
|
2022-10-12 20:23:14 +00:00
|
|
|
ContextId contextId;
|
2020-06-24 09:05:56 +00:00
|
|
|
MsgId msgId = 0;
|
2021-10-15 13:57:27 +00:00
|
|
|
|
2022-10-12 20:23:14 +00:00
|
|
|
friend inline auto operator<=>(
|
|
|
|
const NotificationId&,
|
|
|
|
const NotificationId&) = default;
|
2022-11-11 11:49:50 +00:00
|
|
|
|
|
|
|
[[nodiscard]] auto toTuple() const {
|
|
|
|
return std::make_tuple(
|
|
|
|
contextId.toTuple(),
|
|
|
|
msgId.bare);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
[[nodiscard]] static auto FromTuple(const T &tuple) {
|
|
|
|
return NotificationId{
|
|
|
|
ContextId::FromTuple(std::get<0>(tuple)),
|
|
|
|
std::get<1>(tuple),
|
|
|
|
};
|
|
|
|
}
|
2020-06-24 09:05:56 +00:00
|
|
|
};
|
2022-01-14 13:41:29 +00:00
|
|
|
struct NotificationFields {
|
|
|
|
not_null<HistoryItem*> item;
|
|
|
|
int forwardedCount = 0;
|
2022-01-28 15:47:04 +00:00
|
|
|
PeerData *reactionFrom = nullptr;
|
2022-08-16 11:28:17 +00:00
|
|
|
Data::ReactionId reactionId;
|
2022-01-14 13:41:29 +00:00
|
|
|
};
|
2020-06-19 12:59:31 +00:00
|
|
|
|
2019-07-24 11:13:51 +00:00
|
|
|
explicit Manager(not_null<System*> system) : _system(system) {
|
2017-03-04 19:36:59 +00:00
|
|
|
}
|
|
|
|
|
2022-01-14 13:41:29 +00:00
|
|
|
void showNotification(NotificationFields fields) {
|
|
|
|
doShowNotification(std::move(fields));
|
2016-10-02 13:54:27 +00:00
|
|
|
}
|
|
|
|
void updateAll() {
|
|
|
|
doUpdateAll();
|
|
|
|
}
|
|
|
|
void clearAll() {
|
|
|
|
doClearAll();
|
|
|
|
}
|
|
|
|
void clearAllFast() {
|
|
|
|
doClearAllFast();
|
|
|
|
}
|
2019-08-30 14:06:21 +00:00
|
|
|
void clearFromItem(not_null<HistoryItem*> item) {
|
2016-10-02 13:54:27 +00:00
|
|
|
doClearFromItem(item);
|
|
|
|
}
|
2022-10-12 20:23:14 +00:00
|
|
|
void clearFromTopic(not_null<Data::ForumTopic*> topic) {
|
|
|
|
doClearFromTopic(topic);
|
|
|
|
}
|
2019-08-30 14:06:21 +00:00
|
|
|
void clearFromHistory(not_null<History*> history) {
|
2016-10-02 13:54:27 +00:00
|
|
|
doClearFromHistory(history);
|
|
|
|
}
|
2020-06-19 12:59:31 +00:00
|
|
|
void clearFromSession(not_null<Main::Session*> session) {
|
|
|
|
doClearFromSession(session);
|
|
|
|
}
|
2016-10-02 17:06:34 +00:00
|
|
|
|
2021-10-05 18:37:34 +00:00
|
|
|
void notificationActivated(
|
|
|
|
NotificationId id,
|
|
|
|
const TextWithTags &draft = {});
|
2020-06-19 12:59:31 +00:00
|
|
|
void notificationReplied(NotificationId id, const TextWithTags &reply);
|
2016-10-02 16:32:46 +00:00
|
|
|
|
2016-10-08 08:38:53 +00:00
|
|
|
struct DisplayOptions {
|
2020-06-19 12:59:31 +00:00
|
|
|
bool hideNameAndPhoto = false;
|
|
|
|
bool hideMessageText = false;
|
2021-10-06 15:24:30 +00:00
|
|
|
bool hideMarkAsRead = false;
|
2020-06-19 12:59:31 +00:00
|
|
|
bool hideReplyButton = false;
|
2016-10-08 08:38:53 +00:00
|
|
|
};
|
2021-04-27 09:51:52 +00:00
|
|
|
[[nodiscard]] DisplayOptions getNotificationOptions(
|
2022-01-14 13:41:29 +00:00
|
|
|
HistoryItem *item,
|
2022-10-13 10:32:03 +00:00
|
|
|
Data::ItemNotificationType type) const;
|
2022-08-29 06:10:15 +00:00
|
|
|
[[nodiscard]] static TextWithEntities ComposeReactionEmoji(
|
|
|
|
not_null<Main::Session*> session,
|
|
|
|
const Data::ReactionId &reaction);
|
2022-01-14 13:41:29 +00:00
|
|
|
[[nodiscard]] static TextWithEntities ComposeReactionNotification(
|
|
|
|
not_null<HistoryItem*> item,
|
2022-08-16 11:28:17 +00:00
|
|
|
const Data::ReactionId &reaction,
|
2022-01-14 13:41:29 +00:00
|
|
|
bool hideContent);
|
2016-10-08 08:38:53 +00:00
|
|
|
|
2022-11-01 16:57:36 +00:00
|
|
|
[[nodiscard]] TextWithEntities addTargetAccountName(
|
|
|
|
TextWithEntities title,
|
|
|
|
not_null<Main::Session*> session);
|
2020-06-19 13:34:43 +00:00
|
|
|
[[nodiscard]] QString addTargetAccountName(
|
|
|
|
const QString &title,
|
|
|
|
not_null<Main::Session*> session);
|
|
|
|
|
2021-01-21 10:18:40 +00:00
|
|
|
[[nodiscard]] virtual ManagerType type() const = 0;
|
|
|
|
|
2021-04-28 07:20:39 +00:00
|
|
|
[[nodiscard]] bool skipAudio() const {
|
|
|
|
return doSkipAudio();
|
|
|
|
}
|
|
|
|
[[nodiscard]] bool skipToast() const {
|
|
|
|
return doSkipToast();
|
|
|
|
}
|
|
|
|
[[nodiscard]] bool skipFlashBounce() const {
|
|
|
|
return doSkipFlashBounce();
|
|
|
|
}
|
|
|
|
|
2016-10-02 15:44:54 +00:00
|
|
|
virtual ~Manager() = default;
|
2016-10-02 13:54:27 +00:00
|
|
|
|
|
|
|
protected:
|
2022-10-12 20:23:14 +00:00
|
|
|
[[nodiscard]] not_null<System*> system() const {
|
2017-03-04 19:36:59 +00:00
|
|
|
return _system;
|
|
|
|
}
|
|
|
|
|
2016-10-02 13:54:27 +00:00
|
|
|
virtual void doUpdateAll() = 0;
|
2022-01-14 13:41:29 +00:00
|
|
|
virtual void doShowNotification(NotificationFields &&fields) = 0;
|
2016-10-02 13:54:27 +00:00
|
|
|
virtual void doClearAll() = 0;
|
|
|
|
virtual void doClearAllFast() = 0;
|
2019-08-30 14:06:21 +00:00
|
|
|
virtual void doClearFromItem(not_null<HistoryItem*> item) = 0;
|
2022-10-12 20:23:14 +00:00
|
|
|
virtual void doClearFromTopic(not_null<Data::ForumTopic*> topic) = 0;
|
2019-08-30 14:06:21 +00:00
|
|
|
virtual void doClearFromHistory(not_null<History*> history) = 0;
|
2020-06-19 12:59:31 +00:00
|
|
|
virtual void doClearFromSession(not_null<Main::Session*> session) = 0;
|
2021-04-28 07:20:39 +00:00
|
|
|
virtual bool doSkipAudio() const = 0;
|
|
|
|
virtual bool doSkipToast() const = 0;
|
|
|
|
virtual bool doSkipFlashBounce() const = 0;
|
2021-04-27 09:51:52 +00:00
|
|
|
[[nodiscard]] virtual bool forceHideDetails() const {
|
|
|
|
return false;
|
|
|
|
}
|
2020-06-19 12:59:31 +00:00
|
|
|
virtual void onBeforeNotificationActivated(NotificationId id) {
|
2016-10-02 16:32:46 +00:00
|
|
|
}
|
2021-02-25 15:12:51 +00:00
|
|
|
virtual void onAfterNotificationActivated(
|
|
|
|
NotificationId id,
|
|
|
|
not_null<SessionController*> window) {
|
2016-10-02 16:32:46 +00:00
|
|
|
}
|
2020-06-19 13:34:43 +00:00
|
|
|
[[nodiscard]] virtual QString accountNameSeparator();
|
2016-10-02 13:54:27 +00:00
|
|
|
|
2017-03-04 19:36:59 +00:00
|
|
|
private:
|
2018-02-12 11:10:40 +00:00
|
|
|
void openNotificationMessage(
|
|
|
|
not_null<History*> history,
|
|
|
|
MsgId messageId);
|
|
|
|
|
2019-07-24 11:13:51 +00:00
|
|
|
const not_null<System*> _system;
|
2017-03-04 19:36:59 +00:00
|
|
|
|
2016-10-02 13:54:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class NativeManager : public Manager {
|
2021-01-21 10:18:40 +00:00
|
|
|
public:
|
|
|
|
[[nodiscard]] ManagerType type() const override {
|
|
|
|
return ManagerType::Native;
|
|
|
|
}
|
|
|
|
|
2016-10-02 13:54:27 +00:00
|
|
|
protected:
|
2017-03-04 19:36:59 +00:00
|
|
|
using Manager::Manager;
|
|
|
|
|
2016-10-02 13:54:27 +00:00
|
|
|
void doUpdateAll() override {
|
|
|
|
doClearAllFast();
|
|
|
|
}
|
|
|
|
void doClearAll() override {
|
|
|
|
doClearAllFast();
|
|
|
|
}
|
2022-01-14 13:41:29 +00:00
|
|
|
void doShowNotification(NotificationFields &&fields) override;
|
2016-10-02 13:54:27 +00:00
|
|
|
|
2021-04-27 09:51:52 +00:00
|
|
|
bool forceHideDetails() const override;
|
|
|
|
|
2019-08-28 14:24:12 +00:00
|
|
|
virtual void doShowNativeNotification(
|
|
|
|
not_null<PeerData*> peer,
|
2022-10-12 20:23:14 +00:00
|
|
|
MsgId topicRootId,
|
2022-12-05 12:18:10 +00:00
|
|
|
Ui::PeerUserpicView &userpicView,
|
2019-08-28 14:24:12 +00:00
|
|
|
MsgId msgId,
|
|
|
|
const QString &title,
|
|
|
|
const QString &subtitle,
|
|
|
|
const QString &msg,
|
2021-10-06 15:24:30 +00:00
|
|
|
DisplayOptions options) = 0;
|
2016-10-02 13:54:27 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2021-01-05 13:02:54 +00:00
|
|
|
class DummyManager : public NativeManager {
|
|
|
|
public:
|
|
|
|
using NativeManager::NativeManager;
|
|
|
|
|
2021-01-21 10:18:40 +00:00
|
|
|
[[nodiscard]] ManagerType type() const override {
|
|
|
|
return ManagerType::Dummy;
|
|
|
|
}
|
|
|
|
|
2021-01-05 13:02:54 +00:00
|
|
|
protected:
|
|
|
|
void doShowNativeNotification(
|
|
|
|
not_null<PeerData*> peer,
|
2022-10-12 20:23:14 +00:00
|
|
|
MsgId topicRootId,
|
2022-12-05 12:18:10 +00:00
|
|
|
Ui::PeerUserpicView &userpicView,
|
2021-01-05 13:02:54 +00:00
|
|
|
MsgId msgId,
|
|
|
|
const QString &title,
|
|
|
|
const QString &subtitle,
|
|
|
|
const QString &msg,
|
2021-10-06 15:24:30 +00:00
|
|
|
DisplayOptions options) override {
|
2021-01-05 13:02:54 +00:00
|
|
|
}
|
|
|
|
void doClearAllFast() override {
|
|
|
|
}
|
2021-10-15 13:57:27 +00:00
|
|
|
void doClearFromItem(not_null<HistoryItem*> item) override {
|
|
|
|
}
|
2022-10-12 20:23:14 +00:00
|
|
|
void doClearFromTopic(not_null<Data::ForumTopic*> topic) override {
|
|
|
|
}
|
2021-01-05 13:02:54 +00:00
|
|
|
void doClearFromHistory(not_null<History*> history) override {
|
|
|
|
}
|
|
|
|
void doClearFromSession(not_null<Main::Session*> session) override {
|
|
|
|
}
|
2021-04-28 10:08:02 +00:00
|
|
|
bool doSkipAudio() const override {
|
2021-04-28 07:20:39 +00:00
|
|
|
return false;
|
|
|
|
}
|
2021-04-28 10:08:02 +00:00
|
|
|
bool doSkipToast() const override {
|
2021-04-28 07:20:39 +00:00
|
|
|
return false;
|
|
|
|
}
|
2021-04-28 10:08:02 +00:00
|
|
|
bool doSkipFlashBounce() const override {
|
2021-04-28 07:20:39 +00:00
|
|
|
return false;
|
|
|
|
}
|
2021-01-05 13:02:54 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2022-10-13 10:32:03 +00:00
|
|
|
[[nodiscard]] QString WrapFromScheduled(const QString &text);
|
2019-08-28 14:24:12 +00:00
|
|
|
|
2022-10-13 10:32:03 +00:00
|
|
|
} // namespace Window::Notifications
|