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
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
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
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
This commit is contained in:
63
Telegram/SourceFiles/api/api_transcribes.h
Normal file
63
Telegram/SourceFiles/api/api_transcribes.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
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 "mtproto/sender.h"
|
||||
|
||||
class ApiWrap;
|
||||
|
||||
namespace Main {
|
||||
class Session;
|
||||
} // namespace Main
|
||||
|
||||
namespace Api {
|
||||
|
||||
class Transcribes final {
|
||||
public:
|
||||
explicit Transcribes(not_null<ApiWrap*> api);
|
||||
|
||||
struct Entry {
|
||||
QString result;
|
||||
bool shown = false;
|
||||
bool failed = false;
|
||||
bool toolong = false;
|
||||
bool pending = false;
|
||||
bool roundview = false;
|
||||
mtpRequestId requestId = 0;
|
||||
};
|
||||
|
||||
void toggle(not_null<HistoryItem*> item);
|
||||
[[nodiscard]] const Entry &entry(not_null<HistoryItem*> item) const;
|
||||
|
||||
void apply(const MTPDupdateTranscribedAudio &update);
|
||||
|
||||
[[nodiscard]] bool freeFor(not_null<HistoryItem*> item) const;
|
||||
[[nodiscard]] bool isRated(not_null<HistoryItem*> item) const;
|
||||
void rate(not_null<HistoryItem*> item, bool isGood);
|
||||
|
||||
[[nodiscard]] bool trialsSupport();
|
||||
[[nodiscard]] TimeId trialsRefreshAt();
|
||||
[[nodiscard]] int trialsCount();
|
||||
[[nodiscard]] crl::time trialsMaxLengthMs() const;
|
||||
|
||||
private:
|
||||
void load(not_null<HistoryItem*> item);
|
||||
|
||||
const not_null<Main::Session*> _session;
|
||||
MTP::Sender _api;
|
||||
|
||||
int _trialsCount = -1;
|
||||
std::optional<bool> _trialsSupport;
|
||||
TimeId _trialsRefreshAt = -1;
|
||||
|
||||
base::flat_map<FullMsgId, Entry> _map;
|
||||
base::flat_map<uint64, FullMsgId> _ids;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Api
|
||||
Reference in New Issue
Block a user