mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-08-13 15:03:36 +00:00
Apply cloud themes.
This commit is contained in:
@@ -8,11 +8,28 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_cloud_themes.h"
|
||||
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_document.h"
|
||||
#include "main/main_session.h"
|
||||
#include "apiwrap.h"
|
||||
|
||||
namespace Data {
|
||||
|
||||
CloudTheme CloudTheme::Parse(
|
||||
not_null<Main::Session*> session,
|
||||
const MTPDtheme &data) {
|
||||
const auto document = data.vdocument();
|
||||
return {
|
||||
data.vid().v,
|
||||
data.vaccess_hash().v,
|
||||
qs(data.vslug()),
|
||||
qs(data.vtitle()),
|
||||
(document
|
||||
? session->data().processDocument(*document)->id
|
||||
: DocumentId(0)),
|
||||
data.is_creator() ? session->userId() : UserId(0)
|
||||
};
|
||||
}
|
||||
|
||||
QString CloudThemes::Format() {
|
||||
static const auto kResult = QString::fromLatin1("tdesktop");
|
||||
return kResult;
|
||||
@@ -46,17 +63,7 @@ void CloudThemes::parseThemes(const QVector<MTPTheme> &list) {
|
||||
_list.reserve(list.size());
|
||||
for (const auto &theme : list) {
|
||||
theme.match([&](const MTPDtheme &data) {
|
||||
const auto document = data.vdocument();
|
||||
_list.push_back({
|
||||
data.vid().v,
|
||||
data.vaccess_hash().v,
|
||||
qs(data.vslug()),
|
||||
qs(data.vtitle()),
|
||||
(document
|
||||
? _session->data().processDocument(*document).get()
|
||||
: nullptr),
|
||||
data.is_creator()
|
||||
});
|
||||
_list.push_back(CloudTheme::Parse(_session, data));
|
||||
}, [&](const MTPDthemeDocumentNotModified &data) {
|
||||
LOG(("API Error: Unexpected themeDocumentNotModified."));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user