mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Update API scheme to layer 160.
This commit is contained in:
@@ -36,7 +36,8 @@ MTPVector<MTPDocumentAttribute> ComposeSendingDocumentAttributes(
|
||||
MTP_flags(flags),
|
||||
MTP_int(duration),
|
||||
MTP_int(dimensions.width()),
|
||||
MTP_int(dimensions.height())));
|
||||
MTP_int(dimensions.height()),
|
||||
MTPint())); // preload_prefix_size
|
||||
} else {
|
||||
attributes.push_back(MTP_documentAttributeImageSize(
|
||||
MTP_int(dimensions.width()),
|
||||
|
@@ -453,11 +453,13 @@ void SendConfirmedFile(
|
||||
MTP_flags(Flag::f_document
|
||||
| (file->spoiler ? Flag::f_spoiler : Flag())),
|
||||
file->document,
|
||||
MTPDocument(), // alt_document
|
||||
MTPint());
|
||||
} else if (file->type == SendMediaType::Audio) {
|
||||
return MTP_messageMediaDocument(
|
||||
MTP_flags(MTPDmessageMediaDocument::Flag::f_document),
|
||||
file->document,
|
||||
MTPDocument(), // alt_document
|
||||
MTPint());
|
||||
} else {
|
||||
Unexpected("Type in sendFilesConfirmed.");
|
||||
|
@@ -82,6 +82,8 @@ TLInputRules RulesToTL(const UserPrivacy::Rule &rule) {
|
||||
switch (rule.option) {
|
||||
case Option::Everyone: return MTP_inputPrivacyValueAllowAll();
|
||||
case Option::Contacts: return MTP_inputPrivacyValueAllowContacts();
|
||||
case Option::CloseFriends:
|
||||
return MTP_inputPrivacyValueAllowCloseFriends();
|
||||
case Option::Nobody: return MTP_inputPrivacyValueDisallowAll();
|
||||
}
|
||||
Unexpected("Option value in Api::UserPrivacy::RulesToTL.");
|
||||
@@ -110,6 +112,8 @@ UserPrivacy::Rule TLToRules(const TLRules &rules, Data::Session &owner) {
|
||||
setOption(Option::Everyone);
|
||||
}, [&](const MTPDprivacyValueAllowContacts &) {
|
||||
setOption(Option::Contacts);
|
||||
}, [&](const MTPDprivacyValueAllowCloseFriends &) {
|
||||
setOption(Option::CloseFriends);
|
||||
}, [&](const MTPDprivacyValueAllowUsers &data) {
|
||||
const auto &users = data.vusers().v;
|
||||
always.reserve(always.size() + users.size());
|
||||
|
@@ -34,6 +34,7 @@ public:
|
||||
enum class Option {
|
||||
Everyone,
|
||||
Contacts,
|
||||
CloseFriends,
|
||||
Nobody,
|
||||
};
|
||||
struct Rule {
|
||||
|
@@ -116,6 +116,8 @@ QString EditPrivacyController::optionLabel(Option option) const {
|
||||
switch (option) {
|
||||
case Option::Everyone: return tr::lng_edit_privacy_everyone(tr::now);
|
||||
case Option::Contacts: return tr::lng_edit_privacy_contacts(tr::now);
|
||||
case Option::CloseFriends:
|
||||
return tr::lng_edit_privacy_close_friends(tr::now);
|
||||
case Option::Nobody: return tr::lng_edit_privacy_nobody(tr::now);
|
||||
}
|
||||
Unexpected("Option value in optionsLabelKey.");
|
||||
@@ -182,10 +184,12 @@ bool EditPrivacyBox::showExceptionLink(Exception exception) const {
|
||||
switch (exception) {
|
||||
case Exception::Always:
|
||||
return (_value.option == Option::Contacts)
|
||||
|| (_value.option == Option::CloseFriends)
|
||||
|| (_value.option == Option::Nobody);
|
||||
case Exception::Never:
|
||||
return (_value.option == Option::Everyone)
|
||||
|| (_value.option == Option::Contacts);
|
||||
|| (_value.option == Option::Contacts)
|
||||
|| (_value.option == Option::CloseFriends);
|
||||
}
|
||||
Unexpected("Invalid exception value.");
|
||||
}
|
||||
@@ -326,6 +330,7 @@ void EditPrivacyBox::setupContent() {
|
||||
{ 0, st::settingsPrivacySkipTop, 0, 0 });
|
||||
addOptionRow(Option::Everyone);
|
||||
addOptionRow(Option::Contacts);
|
||||
addOptionRow(Option::CloseFriends);
|
||||
addOptionRow(Option::Nobody);
|
||||
const auto warning = addLabelOrDivider(
|
||||
content,
|
||||
|
@@ -252,6 +252,7 @@ struct ForwardedTooltip {
|
||||
case Option::Everyone:
|
||||
return tr::lng_edit_privacy_forwards_sample_everyone(tr::now);
|
||||
case Option::Contacts:
|
||||
case Option::CloseFriends:
|
||||
return tr::lng_edit_privacy_forwards_sample_contacts(tr::now);
|
||||
case Option::Nobody:
|
||||
return tr::lng_edit_privacy_forwards_sample_nobody(tr::now);
|
||||
@@ -783,15 +784,14 @@ rpl::producer<QString> CallsPeer2PeerPrivacyController::optionsTitleKey() const
|
||||
QString CallsPeer2PeerPrivacyController::optionLabel(
|
||||
EditPrivacyBox::Option option) const {
|
||||
switch (option) {
|
||||
case Option::Everyone: {
|
||||
case Option::Everyone:
|
||||
return tr::lng_edit_privacy_calls_p2p_everyone(tr::now);
|
||||
};
|
||||
case Option::Contacts: {
|
||||
case Option::Contacts:
|
||||
return tr::lng_edit_privacy_calls_p2p_contacts(tr::now);
|
||||
};
|
||||
case Option::Nobody: {
|
||||
case Option::CloseFriends:
|
||||
return tr::lng_edit_privacy_close_friends(tr::now); // unused
|
||||
case Option::Nobody:
|
||||
return tr::lng_edit_privacy_calls_p2p_nobody(tr::now);
|
||||
};
|
||||
}
|
||||
Unexpected("Option value in optionsLabelKey.");
|
||||
}
|
||||
@@ -1215,15 +1215,13 @@ auto ProfilePhotoPrivacyController::exceptionsDescription() const
|
||||
return _option.value(
|
||||
) | rpl::map([](Option option) {
|
||||
switch (option) {
|
||||
case Option::Everyone: {
|
||||
case Option::Everyone:
|
||||
return tr::lng_edit_privacy_forwards_exceptions_everyone();
|
||||
};
|
||||
case Option::Contacts: {
|
||||
case Option::Contacts:
|
||||
case Option::CloseFriends:
|
||||
return tr::lng_edit_privacy_forwards_exceptions();
|
||||
};
|
||||
case Option::Nobody: {
|
||||
case Option::Nobody:
|
||||
return tr::lng_edit_privacy_forwards_exceptions_nobody();
|
||||
};
|
||||
}
|
||||
Unexpected("Option value in exceptionsDescription.");
|
||||
}) | rpl::flatten_latest();
|
||||
|
@@ -80,6 +80,8 @@ QString PrivacyBase(Privacy::Key key, Privacy::Option option) {
|
||||
return tr::lng_edit_privacy_calls_p2p_everyone(tr::now);
|
||||
case Option::Contacts:
|
||||
return tr::lng_edit_privacy_calls_p2p_contacts(tr::now);
|
||||
case Option::CloseFriends:
|
||||
return tr::lng_edit_privacy_close_friends(tr::now); // unused
|
||||
case Option::Nobody:
|
||||
return tr::lng_edit_privacy_calls_p2p_nobody(tr::now);
|
||||
}
|
||||
@@ -88,6 +90,8 @@ QString PrivacyBase(Privacy::Key key, Privacy::Option option) {
|
||||
switch (option) {
|
||||
case Option::Everyone: return tr::lng_edit_privacy_everyone(tr::now);
|
||||
case Option::Contacts: return tr::lng_edit_privacy_contacts(tr::now);
|
||||
case Option::CloseFriends:
|
||||
return tr::lng_edit_privacy_close_friends(tr::now);
|
||||
case Option::Nobody: return tr::lng_edit_privacy_nobody(tr::now);
|
||||
}
|
||||
Unexpected("Value in Privacy::Option.");
|
||||
|
@@ -918,7 +918,12 @@ void FileLoadTask::process(Args &&args) {
|
||||
if (video->supportsStreaming) {
|
||||
flags |= MTPDdocumentAttributeVideo::Flag::f_supports_streaming;
|
||||
}
|
||||
attributes.push_back(MTP_documentAttributeVideo(MTP_flags(flags), MTP_int(video->duration), MTP_int(coverWidth), MTP_int(coverHeight)));
|
||||
attributes.push_back(MTP_documentAttributeVideo(
|
||||
MTP_flags(flags),
|
||||
MTP_int(video->duration),
|
||||
MTP_int(coverWidth),
|
||||
MTP_int(coverHeight),
|
||||
MTPint())); // preload_prefix_size
|
||||
|
||||
if (args.generateGoodThumbnail) {
|
||||
goodThumbnail = video->thumbnail;
|
||||
|
@@ -192,7 +192,12 @@ DocumentData *Document::readFromStreamHelper(
|
||||
if (type == RoundVideoDocument) {
|
||||
flags |= MTPDdocumentAttributeVideo::Flag::f_round_message;
|
||||
}
|
||||
attributes.push_back(MTP_documentAttributeVideo(MTP_flags(flags), MTP_int(duration), MTP_int(width), MTP_int(height)));
|
||||
attributes.push_back(MTP_documentAttributeVideo(
|
||||
MTP_flags(flags),
|
||||
MTP_int(duration),
|
||||
MTP_int(width),
|
||||
MTP_int(height),
|
||||
MTPint())); // preload_prefix_size
|
||||
} else {
|
||||
attributes.push_back(MTP_documentAttributeImageSize(MTP_int(width), MTP_int(height)));
|
||||
}
|
||||
|
Reference in New Issue
Block a user