1 /*
2 This file is part of Telegram Desktop,
3 the official desktop application for the Telegram messaging service.
4 
5 For license and copyright information please follow this link:
6 https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
7 */
8 #pragma once
9 
10 #include "ui/layers/generic_box.h"
11 
12 namespace Api {
13 struct SendOptions;
14 } // namespace Api
15 
16 namespace SendMenu {
17 enum class Type;
18 } // namespace SendMenu
19 
20 namespace HistoryView {
21 
22 [[nodiscard]] TimeId DefaultScheduleTime();
23 [[nodiscard]] bool CanScheduleUntilOnline(not_null<PeerData*> peer);
24 
25 void ScheduleBox(
26 	not_null<Ui::GenericBox*> box,
27 	SendMenu::Type type,
28 	Fn<void(Api::SendOptions)> done,
29 	TimeId time);
30 
31 template <typename Guard, typename Submit>
32 [[nodiscard]] object_ptr<Ui::GenericBox> PrepareScheduleBox(
33 		Guard &&guard,
34 		SendMenu::Type type,
35 		Submit &&submit,
36 		TimeId scheduleTime = DefaultScheduleTime()) {
37 	return Box(
38 		ScheduleBox,
39 		type,
40 		crl::guard(std::forward<Guard>(guard), std::forward<Submit>(submit)),
41 		scheduleTime);
42 }
43 
44 } // namespace HistoryView
45