2018-11-10 01:56:00 +03:00
|
|
|
//
|
2023-01-01 00:28:08 +03:00
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
|
2018-11-10 01:56:00 +03:00
|
|
|
//
|
|
|
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
//
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "td/telegram/CallId.h"
|
2018-12-11 23:18:58 +03:00
|
|
|
#include "td/telegram/DialogId.h"
|
2019-04-09 23:39:41 +03:00
|
|
|
#include "td/telegram/Document.h"
|
2019-04-10 01:57:15 +03:00
|
|
|
#include "td/telegram/files/FileId.h"
|
2018-11-10 01:56:00 +03:00
|
|
|
#include "td/telegram/MessageId.h"
|
2019-04-09 17:33:27 +03:00
|
|
|
#include "td/telegram/Photo.h"
|
2018-11-15 18:58:33 +03:00
|
|
|
#include "td/telegram/td_api.h"
|
2019-03-30 17:59:35 +03:00
|
|
|
#include "td/telegram/UserId.h"
|
2018-11-10 01:56:00 +03:00
|
|
|
|
|
|
|
#include "td/utils/common.h"
|
|
|
|
#include "td/utils/StringBuilder.h"
|
|
|
|
|
|
|
|
namespace td {
|
|
|
|
|
|
|
|
class NotificationType {
|
|
|
|
public:
|
|
|
|
NotificationType() = default;
|
|
|
|
NotificationType(const NotificationType &) = delete;
|
|
|
|
NotificationType &operator=(const NotificationType &) = delete;
|
|
|
|
NotificationType(NotificationType &&) = delete;
|
|
|
|
NotificationType &operator=(NotificationType &&) = delete;
|
2019-05-03 23:22:49 +03:00
|
|
|
virtual ~NotificationType() = default;
|
2018-11-10 01:56:00 +03:00
|
|
|
|
2018-11-15 19:09:01 +03:00
|
|
|
virtual bool can_be_delayed() const = 0;
|
|
|
|
|
2019-03-30 23:49:14 +03:00
|
|
|
virtual bool is_temporary() const = 0;
|
|
|
|
|
2018-11-20 17:08:44 +03:00
|
|
|
virtual MessageId get_message_id() const = 0;
|
|
|
|
|
2019-04-10 01:57:15 +03:00
|
|
|
virtual vector<FileId> get_file_ids(const Td *td) const = 0;
|
|
|
|
|
2023-06-25 00:09:48 +03:00
|
|
|
virtual td_api::object_ptr<td_api::NotificationType> get_notification_type_object(Td *td,
|
|
|
|
DialogId dialog_id) const = 0;
|
2018-11-15 18:58:33 +03:00
|
|
|
|
2018-11-10 01:56:00 +03:00
|
|
|
virtual StringBuilder &to_string_builder(StringBuilder &string_builder) const = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
inline StringBuilder &operator<<(StringBuilder &string_builder, const NotificationType ¬ification_type) {
|
|
|
|
return notification_type.to_string_builder(string_builder);
|
|
|
|
}
|
|
|
|
|
2019-03-20 05:57:36 +03:00
|
|
|
inline StringBuilder &operator<<(StringBuilder &string_builder, const unique_ptr<NotificationType> ¬ification_type) {
|
|
|
|
if (notification_type == nullptr) {
|
|
|
|
return string_builder << "null";
|
|
|
|
}
|
|
|
|
return string_builder << *notification_type;
|
|
|
|
}
|
|
|
|
|
2022-06-16 18:54:50 +03:00
|
|
|
unique_ptr<NotificationType> create_new_message_notification(MessageId message_id, bool show_preview);
|
2018-11-10 01:56:00 +03:00
|
|
|
|
|
|
|
unique_ptr<NotificationType> create_new_secret_chat_notification();
|
|
|
|
|
|
|
|
unique_ptr<NotificationType> create_new_call_notification(CallId call_id);
|
|
|
|
|
2020-09-08 22:08:10 +03:00
|
|
|
unique_ptr<NotificationType> create_new_push_message_notification(UserId sender_user_id, DialogId sender_dialog_id,
|
|
|
|
string sender_name, bool is_outgoing,
|
|
|
|
MessageId message_id, string key, string arg,
|
|
|
|
Photo photo, Document document);
|
2019-03-29 00:08:57 +03:00
|
|
|
|
2018-11-10 01:56:00 +03:00
|
|
|
} // namespace td
|