init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Close stale issues and PRs / stale (push) Successful in 13s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Close stale issues and PRs / stale (push) Successful in 13s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
This commit is contained in:
69
Telegram/SourceFiles/api/api_todo_lists.h
Normal file
69
Telegram/SourceFiles/api/api_todo_lists.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "base/timer.h"
|
||||
#include "mtproto/sender.h"
|
||||
|
||||
class ApiWrap;
|
||||
class HistoryItem;
|
||||
struct TodoListItem;
|
||||
struct TodoListData;
|
||||
|
||||
namespace Main {
|
||||
class Session;
|
||||
} // namespace Main
|
||||
|
||||
namespace Api {
|
||||
|
||||
struct SendAction;
|
||||
struct SendOptions;
|
||||
|
||||
class TodoLists final {
|
||||
public:
|
||||
explicit TodoLists(not_null<ApiWrap*> api);
|
||||
|
||||
void create(
|
||||
const TodoListData &data,
|
||||
SendAction action,
|
||||
Fn<void()> done,
|
||||
Fn<void(QString)> fail);
|
||||
void edit(
|
||||
not_null<HistoryItem*> item,
|
||||
const TodoListData &data,
|
||||
SendOptions options,
|
||||
Fn<void()> done,
|
||||
Fn<void(QString)> fail);
|
||||
void add(
|
||||
not_null<HistoryItem*> item,
|
||||
const std::vector<TodoListItem> &items,
|
||||
Fn<void()> done,
|
||||
Fn<void(QString)> fail);
|
||||
void toggleCompletion(FullMsgId itemId, int id, bool completed);
|
||||
|
||||
private:
|
||||
struct Accumulated {
|
||||
base::flat_set<int> completed;
|
||||
base::flat_set<int> incompleted;
|
||||
crl::time scheduled = 0;
|
||||
mtpRequestId requestId = 0;
|
||||
};
|
||||
|
||||
void sendAccumulatedToggles(bool force);
|
||||
void send(FullMsgId itemId, Accumulated &entry);
|
||||
void finishRequest(FullMsgId itemId);
|
||||
|
||||
const not_null<Main::Session*> _session;
|
||||
MTP::Sender _api;
|
||||
|
||||
base::flat_map<FullMsgId, Accumulated> _toggles;
|
||||
base::Timer _sendTimer;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Api
|
||||
Reference in New Issue
Block a user