mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Update API scheme on layer 140.
This commit is contained in:
parent
b38ac32898
commit
00f442573a
5 changed files with 76 additions and 17 deletions
|
@ -220,9 +220,9 @@ inputNotifyUsers#193b4417 = InputNotifyPeer;
|
||||||
inputNotifyChats#4a95e84e = InputNotifyPeer;
|
inputNotifyChats#4a95e84e = InputNotifyPeer;
|
||||||
inputNotifyBroadcasts#b1db7c7e = InputNotifyPeer;
|
inputNotifyBroadcasts#b1db7c7e = InputNotifyPeer;
|
||||||
|
|
||||||
inputPeerNotifySettings#9c3d198e flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?string = InputPeerNotifySettings;
|
inputPeerNotifySettings#df1f002b flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?NotificationSound = InputPeerNotifySettings;
|
||||||
|
|
||||||
peerNotifySettings#af509d20 flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?string = PeerNotifySettings;
|
peerNotifySettings#a83b0426 flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int ios_sound:flags.3?NotificationSound android_sound:flags.4?NotificationSound other_sound:flags.5?NotificationSound = PeerNotifySettings;
|
||||||
|
|
||||||
peerSettings#a518110d flags:# report_spam:flags.0?true add_contact:flags.1?true block_contact:flags.2?true share_contact:flags.3?true need_contacts_exception:flags.4?true report_geo:flags.5?true autoarchived:flags.7?true invite_members:flags.8?true request_chat_broadcast:flags.10?true geo_distance:flags.6?int request_chat_title:flags.9?string request_chat_date:flags.9?int = PeerSettings;
|
peerSettings#a518110d flags:# report_spam:flags.0?true add_contact:flags.1?true block_contact:flags.2?true share_contact:flags.3?true need_contacts_exception:flags.4?true report_geo:flags.5?true autoarchived:flags.7?true invite_members:flags.8?true request_chat_broadcast:flags.10?true geo_distance:flags.6?int request_chat_title:flags.9?string request_chat_date:flags.9?int = PeerSettings;
|
||||||
|
|
||||||
|
@ -388,6 +388,7 @@ updateBotChatInviteRequester#11dfa986 peer:Peer date:int user_id:long about:stri
|
||||||
updateMessageReactions#154798c3 peer:Peer msg_id:int reactions:MessageReactions = Update;
|
updateMessageReactions#154798c3 peer:Peer msg_id:int reactions:MessageReactions = Update;
|
||||||
updateAttachMenuBots#17b7a20b = Update;
|
updateAttachMenuBots#17b7a20b = Update;
|
||||||
updateWebViewResultSent#f8f63baa peer:Peer bot_id:long query_id:long = Update;
|
updateWebViewResultSent#f8f63baa peer:Peer bot_id:long query_id:long = Update;
|
||||||
|
updateSavedRingtones#74d8be99 = Update;
|
||||||
|
|
||||||
updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
|
updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
|
||||||
|
|
||||||
|
@ -1349,6 +1350,14 @@ simpleWebViewResultUrl#882f76bb url:string = SimpleWebViewResult;
|
||||||
|
|
||||||
webViewMessageSent#c94511c flags:# msg_id:flags.0?InputBotInlineMessageID = WebViewMessageSent;
|
webViewMessageSent#c94511c flags:# msg_id:flags.0?InputBotInlineMessageID = WebViewMessageSent;
|
||||||
|
|
||||||
|
account.savedRingtonesNotModified#fbf6e8b1 = account.SavedRingtones;
|
||||||
|
account.savedRingtones#c1e92cc5 hash:long ringtones:Vector<Document> = account.SavedRingtones;
|
||||||
|
|
||||||
|
notificationSoundDefault#97e8bebe = NotificationSound;
|
||||||
|
notificationSoundNone#6f0c34df = NotificationSound;
|
||||||
|
notificationSoundLocal#830b9ae4 title:string data:string = NotificationSound;
|
||||||
|
notificationSoundRingtone#ff6c8049 id:long = NotificationSound;
|
||||||
|
|
||||||
---functions---
|
---functions---
|
||||||
|
|
||||||
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
||||||
|
@ -1452,6 +1461,9 @@ account.declinePasswordReset#4c9409f6 = Bool;
|
||||||
account.getChatThemes#d638de89 hash:long = account.Themes;
|
account.getChatThemes#d638de89 hash:long = account.Themes;
|
||||||
account.setAuthorizationTTL#bf899aa0 authorization_ttl_days:int = Bool;
|
account.setAuthorizationTTL#bf899aa0 authorization_ttl_days:int = Bool;
|
||||||
account.changeAuthorizationSettings#40f48462 flags:# hash:long encrypted_requests_disabled:flags.0?Bool call_requests_disabled:flags.1?Bool = Bool;
|
account.changeAuthorizationSettings#40f48462 flags:# hash:long encrypted_requests_disabled:flags.0?Bool call_requests_disabled:flags.1?Bool = Bool;
|
||||||
|
account.getSavedRingtones#e1902288 hash:long = account.SavedRingtones;
|
||||||
|
account.saveRingtone#e9f81323 id:InputDocument unsave:Bool = Bool;
|
||||||
|
account.uploadRingtone#831a83a2 file:InputFile file_name:string mime_type:string = Document;
|
||||||
|
|
||||||
users.getUsers#d91a548 id:Vector<InputUser> = Vector<User>;
|
users.getUsers#d91a548 id:Vector<InputUser> = Vector<User>;
|
||||||
users.getFullUser#b60f5918 id:InputUser = users.UserFull;
|
users.getFullUser#b60f5918 id:InputUser = users.UserFull;
|
||||||
|
|
|
@ -1746,7 +1746,9 @@ void ApiWrap::requestNotifySettings(const MTPInputNotifyPeer &peer) {
|
||||||
MTPBool(),
|
MTPBool(),
|
||||||
MTPBool(),
|
MTPBool(),
|
||||||
MTPint(),
|
MTPint(),
|
||||||
MTPstring()));
|
MTPNotificationSound(),
|
||||||
|
MTPNotificationSound(),
|
||||||
|
MTPNotificationSound()));
|
||||||
_notifySettingRequests.erase(key);
|
_notifySettingRequests.erase(key);
|
||||||
}).send();
|
}).send();
|
||||||
|
|
||||||
|
|
|
@ -12,13 +12,43 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
namespace Data {
|
namespace Data {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
MTPinputPeerNotifySettings DefaultSettings() {
|
[[nodiscard]] MTPinputPeerNotifySettings DefaultSettings() {
|
||||||
return MTP_inputPeerNotifySettings(
|
return MTP_inputPeerNotifySettings(
|
||||||
MTP_flags(0),
|
MTP_flags(0),
|
||||||
MTPBool(),
|
MTPBool(),
|
||||||
MTPBool(),
|
MTPBool(),
|
||||||
MTPint(),
|
MTPint(),
|
||||||
MTPstring());
|
MTPNotificationSound());
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] NotifySound ParseSound(const MTPNotificationSound &sound) {
|
||||||
|
return sound.match([&](const MTPDnotificationSoundDefault &data) {
|
||||||
|
return NotifySound();
|
||||||
|
}, [&](const MTPDnotificationSoundNone &data) {
|
||||||
|
return NotifySound{ .none = true };
|
||||||
|
}, [&](const MTPDnotificationSoundLocal &data) {
|
||||||
|
return NotifySound{
|
||||||
|
.title = qs(data.vtitle()),
|
||||||
|
.data = qs(data.vdata()),
|
||||||
|
};
|
||||||
|
}, [&](const MTPDnotificationSoundRingtone &data) {
|
||||||
|
return NotifySound{ .id = data.vid().v };
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] MTPNotificationSound SerializeSound(
|
||||||
|
const std::optional<NotifySound> &sound) {
|
||||||
|
return !sound
|
||||||
|
? MTPNotificationSound()
|
||||||
|
: sound->none
|
||||||
|
? MTP_notificationSoundNone()
|
||||||
|
: sound->id
|
||||||
|
? MTP_notificationSoundRingtone(MTP_long(sound->id))
|
||||||
|
: !sound->title.isEmpty()
|
||||||
|
? MTP_notificationSoundLocal(
|
||||||
|
MTP_string(sound->title),
|
||||||
|
MTP_string(sound->data))
|
||||||
|
: MTP_notificationSoundDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -39,12 +69,12 @@ public:
|
||||||
private:
|
private:
|
||||||
bool change(
|
bool change(
|
||||||
std::optional<int> mute,
|
std::optional<int> mute,
|
||||||
std::optional<QString> sound,
|
std::optional<NotifySound> sound,
|
||||||
std::optional<bool> showPreviews,
|
std::optional<bool> showPreviews,
|
||||||
std::optional<bool> silentPosts);
|
std::optional<bool> silentPosts);
|
||||||
|
|
||||||
std::optional<TimeId> _mute;
|
std::optional<TimeId> _mute;
|
||||||
std::optional<QString> _sound;
|
std::optional<NotifySound> _sound;
|
||||||
std::optional<bool> _silent;
|
std::optional<bool> _silent;
|
||||||
std::optional<bool> _showPreviews;
|
std::optional<bool> _showPreviews;
|
||||||
|
|
||||||
|
@ -57,12 +87,12 @@ NotifySettingsValue::NotifySettingsValue(
|
||||||
|
|
||||||
bool NotifySettingsValue::change(const MTPDpeerNotifySettings &data) {
|
bool NotifySettingsValue::change(const MTPDpeerNotifySettings &data) {
|
||||||
const auto mute = data.vmute_until();
|
const auto mute = data.vmute_until();
|
||||||
const auto sound = data.vsound();
|
const auto sound = data.vother_sound();
|
||||||
const auto showPreviews = data.vshow_previews();
|
const auto showPreviews = data.vshow_previews();
|
||||||
const auto silent = data.vsilent();
|
const auto silent = data.vsilent();
|
||||||
return change(
|
return change(
|
||||||
mute ? std::make_optional(mute->v) : std::nullopt,
|
mute ? std::make_optional(mute->v) : std::nullopt,
|
||||||
sound ? std::make_optional(qs(*sound)) : std::nullopt,
|
sound ? std::make_optional(ParseSound(*sound)) : std::nullopt,
|
||||||
(showPreviews
|
(showPreviews
|
||||||
? std::make_optional(mtpIsTrue(*showPreviews))
|
? std::make_optional(mtpIsTrue(*showPreviews))
|
||||||
: std::nullopt),
|
: std::nullopt),
|
||||||
|
@ -81,22 +111,19 @@ bool NotifySettingsValue::change(
|
||||||
? (now + *muteForSeconds)
|
? (now + *muteForSeconds)
|
||||||
: 0)
|
: 0)
|
||||||
: _mute;
|
: _mute;
|
||||||
const auto newSound = (_sound && _sound->isEmpty() && notMuted)
|
|
||||||
? qsl("default")
|
|
||||||
: _sound;
|
|
||||||
const auto newSilentPosts = silentPosts
|
const auto newSilentPosts = silentPosts
|
||||||
? base::make_optional(*silentPosts)
|
? base::make_optional(*silentPosts)
|
||||||
: _silent;
|
: _silent;
|
||||||
return change(
|
return change(
|
||||||
newMute,
|
newMute,
|
||||||
newSound,
|
_sound,
|
||||||
_showPreviews,
|
_showPreviews,
|
||||||
newSilentPosts);
|
newSilentPosts);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NotifySettingsValue::change(
|
bool NotifySettingsValue::change(
|
||||||
std::optional<int> mute,
|
std::optional<int> mute,
|
||||||
std::optional<QString> sound,
|
std::optional<NotifySound> sound,
|
||||||
std::optional<bool> showPreviews,
|
std::optional<bool> showPreviews,
|
||||||
std::optional<bool> silentPosts) {
|
std::optional<bool> silentPosts) {
|
||||||
if (_mute == mute
|
if (_mute == mute
|
||||||
|
@ -133,7 +160,7 @@ MTPinputPeerNotifySettings NotifySettingsValue::serialize() const {
|
||||||
MTP_bool(_showPreviews ? *_showPreviews : true),
|
MTP_bool(_showPreviews ? *_showPreviews : true),
|
||||||
MTP_bool(_silent ? *_silent : false),
|
MTP_bool(_silent ? *_silent : false),
|
||||||
MTP_int(_mute ? *_mute : false),
|
MTP_int(_mute ? *_mute : false),
|
||||||
MTP_string(_sound ? *_sound : QString()));
|
SerializeSound(_sound));
|
||||||
}
|
}
|
||||||
|
|
||||||
NotifySettings::NotifySettings() = default;
|
NotifySettings::NotifySettings() = default;
|
||||||
|
@ -178,7 +205,9 @@ bool NotifySettings::change(
|
||||||
MTPBool(),
|
MTPBool(),
|
||||||
silentPosts ? MTP_bool(*silentPosts) : MTPBool(),
|
silentPosts ? MTP_bool(*silentPosts) : MTPBool(),
|
||||||
MTP_int(muteUntil),
|
MTP_int(muteUntil),
|
||||||
MTPstring()));
|
MTPNotificationSound(),
|
||||||
|
MTPNotificationSound(),
|
||||||
|
MTPNotificationSound()));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<TimeId> NotifySettings::muteUntil() const {
|
std::optional<TimeId> NotifySettings::muteUntil() const {
|
||||||
|
|
|
@ -11,6 +11,20 @@ namespace Data {
|
||||||
|
|
||||||
class NotifySettingsValue;
|
class NotifySettingsValue;
|
||||||
|
|
||||||
|
struct NotifySound {
|
||||||
|
QString title;
|
||||||
|
QString data;
|
||||||
|
DocumentId id = 0;
|
||||||
|
bool none = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline bool operator==(const NotifySound &a, const NotifySound &b) {
|
||||||
|
return (a.id == b.id)
|
||||||
|
&& (a.none == b.none)
|
||||||
|
&& (a.title == b.title)
|
||||||
|
&& (a.data == b.data);
|
||||||
|
}
|
||||||
|
|
||||||
class NotifySettings {
|
class NotifySettings {
|
||||||
public:
|
public:
|
||||||
NotifySettings();
|
NotifySettings();
|
||||||
|
|
|
@ -3964,7 +3964,9 @@ void Session::resetNotifySettingsToDefault(not_null<PeerData*> peer) {
|
||||||
MTPBool(),
|
MTPBool(),
|
||||||
MTPBool(),
|
MTPBool(),
|
||||||
MTPint(),
|
MTPint(),
|
||||||
MTPstring());
|
MTPNotificationSound(),
|
||||||
|
MTPNotificationSound(),
|
||||||
|
MTPNotificationSound());
|
||||||
if (peer->notifyChange(empty)) {
|
if (peer->notifyChange(empty)) {
|
||||||
updateNotifySettingsLocal(peer);
|
updateNotifySettingsLocal(peer);
|
||||||
_session->api().updateNotifySettingsDelayed(peer);
|
_session->api().updateNotifySettingsDelayed(peer);
|
||||||
|
|
Loading…
Add table
Reference in a new issue