mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Renamed Data::NotifySettings to Data::PeerNotifySettings.
This commit is contained in:
parent
70d1a1e376
commit
5a3bbfbf62
8 changed files with 41 additions and 41 deletions
|
@ -395,6 +395,8 @@ PRIVATE
|
|||
core/version.h
|
||||
countries/countries_manager.cpp
|
||||
countries/countries_manager.h
|
||||
data/notify/data_peer_notify_settings.cpp
|
||||
data/notify/data_peer_notify_settings.h
|
||||
data/stickers/data_stickers_set.cpp
|
||||
data/stickers/data_stickers_set.h
|
||||
data/stickers/data_stickers.cpp
|
||||
|
@ -458,8 +460,6 @@ PRIVATE
|
|||
data/data_message_reactions.cpp
|
||||
data/data_message_reactions.h
|
||||
data/data_msg_id.h
|
||||
data/data_notify_settings.cpp
|
||||
data/data_notify_settings.h
|
||||
data/data_peer.cpp
|
||||
data/data_peer.h
|
||||
data/data_peer_id.cpp
|
||||
|
|
|
@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
#include "data/data_types.h"
|
||||
#include "data/data_flags.h"
|
||||
#include "data/data_notify_settings.h"
|
||||
#include "data/notify/data_peer_notify_settings.h"
|
||||
#include "data/data_cloud_file.h"
|
||||
|
||||
class PeerData;
|
||||
|
@ -440,7 +440,7 @@ private:
|
|||
mutable std::unique_ptr<Ui::EmptyUserpic> _userpicEmpty;
|
||||
Ui::Text::String _nameText;
|
||||
|
||||
Data::NotifySettings _notify;
|
||||
Data::PeerNotifySettings _notify;
|
||||
|
||||
ClickHandlerPtr _openLink;
|
||||
base::flat_set<QString> _nameWords; // for filtering
|
||||
|
|
|
@ -2222,7 +2222,7 @@ Session::SentData Session::messageSentData(uint64 randomId) const {
|
|||
return (i != end(_sentMessagesData)) ? i->second : SentData();
|
||||
}
|
||||
|
||||
NotifySettings &Session::defaultNotifySettings(
|
||||
PeerNotifySettings &Session::defaultNotifySettings(
|
||||
not_null<const PeerData*> peer) {
|
||||
return peer->isUser()
|
||||
? _defaultUserNotifySettings
|
||||
|
@ -2231,7 +2231,7 @@ NotifySettings &Session::defaultNotifySettings(
|
|||
: _defaultBroadcastNotifySettings;
|
||||
}
|
||||
|
||||
const NotifySettings &Session::defaultNotifySettings(
|
||||
const PeerNotifySettings &Session::defaultNotifySettings(
|
||||
not_null<const PeerData*> peer) const {
|
||||
return peer->isUser()
|
||||
? _defaultUserNotifySettings
|
||||
|
@ -3893,7 +3893,7 @@ void Session::applyNotifySetting(
|
|||
const MTPPeerNotifySettings &settings) {
|
||||
const auto goodForUpdate = [&](
|
||||
not_null<const PeerData*> peer,
|
||||
const NotifySettings &settings) {
|
||||
const PeerNotifySettings &settings) {
|
||||
return !peer->notifySettingsUnknown()
|
||||
&& ((!peer->notifyMuteUntil() && settings.muteUntil())
|
||||
|| (!peer->notifySilentPosts() && settings.silentPosts())
|
||||
|
|
|
@ -13,7 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "dialogs/dialogs_main_list.h"
|
||||
#include "data/data_groups.h"
|
||||
#include "data/data_cloud_file.h"
|
||||
#include "data/data_notify_settings.h"
|
||||
#include "data/notify/data_peer_notify_settings.h"
|
||||
#include "history/history_location_manager.h"
|
||||
#include "base/timer.h"
|
||||
#include "base/flags.h"
|
||||
|
@ -822,8 +822,8 @@ private:
|
|||
|
||||
void setPinnedFromDialog(const Dialogs::Key &key, bool pinned);
|
||||
|
||||
NotifySettings &defaultNotifySettings(not_null<const PeerData*> peer);
|
||||
const NotifySettings &defaultNotifySettings(
|
||||
PeerNotifySettings &defaultNotifySettings(not_null<const PeerData*> peer);
|
||||
const PeerNotifySettings &defaultNotifySettings(
|
||||
not_null<const PeerData*> peer) const;
|
||||
void unmuteByFinished();
|
||||
void unmuteByFinishedDelayed(crl::time delay);
|
||||
|
@ -976,9 +976,9 @@ private:
|
|||
|
||||
History *_topPromoted = nullptr;
|
||||
|
||||
NotifySettings _defaultUserNotifySettings;
|
||||
NotifySettings _defaultChatNotifySettings;
|
||||
NotifySettings _defaultBroadcastNotifySettings;
|
||||
PeerNotifySettings _defaultUserNotifySettings;
|
||||
PeerNotifySettings _defaultChatNotifySettings;
|
||||
PeerNotifySettings _defaultBroadcastNotifySettings;
|
||||
rpl::event_stream<> _defaultUserNotifyUpdates;
|
||||
rpl::event_stream<> _defaultChatNotifyUpdates;
|
||||
rpl::event_stream<> _defaultBroadcastNotifyUpdates;
|
||||
|
|
|
@ -5,7 +5,7 @@ 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
|
||||
*/
|
||||
#include "data/data_notify_settings.h"
|
||||
#include "data/notify/data_peer_notify_settings.h"
|
||||
|
||||
#include "base/unixtime.h"
|
||||
|
||||
|
@ -53,9 +53,9 @@ namespace {
|
|||
|
||||
} // namespace
|
||||
|
||||
class NotifySettingsValue {
|
||||
class NotifyPeerSettingsValue {
|
||||
public:
|
||||
NotifySettingsValue(const MTPDpeerNotifySettings &data);
|
||||
NotifyPeerSettingsValue(const MTPDpeerNotifySettings &data);
|
||||
|
||||
bool change(const MTPDpeerNotifySettings &data);
|
||||
bool change(
|
||||
|
@ -82,12 +82,12 @@ private:
|
|||
|
||||
};
|
||||
|
||||
NotifySettingsValue::NotifySettingsValue(
|
||||
NotifyPeerSettingsValue::NotifyPeerSettingsValue(
|
||||
const MTPDpeerNotifySettings &data) {
|
||||
change(data);
|
||||
}
|
||||
|
||||
bool NotifySettingsValue::change(const MTPDpeerNotifySettings &data) {
|
||||
bool NotifyPeerSettingsValue::change(const MTPDpeerNotifySettings &data) {
|
||||
const auto mute = data.vmute_until();
|
||||
const auto sound = data.vother_sound();
|
||||
const auto showPreviews = data.vshow_previews();
|
||||
|
@ -101,7 +101,7 @@ bool NotifySettingsValue::change(const MTPDpeerNotifySettings &data) {
|
|||
silent ? std::make_optional(mtpIsTrue(*silent)) : std::nullopt);
|
||||
}
|
||||
|
||||
bool NotifySettingsValue::change(
|
||||
bool NotifyPeerSettingsValue::change(
|
||||
std::optional<int> muteForSeconds,
|
||||
std::optional<bool> silentPosts,
|
||||
std::optional<NotifySound> sound) {
|
||||
|
@ -127,7 +127,7 @@ bool NotifySettingsValue::change(
|
|||
newSilentPosts);
|
||||
}
|
||||
|
||||
bool NotifySettingsValue::change(
|
||||
bool NotifyPeerSettingsValue::change(
|
||||
std::optional<int> mute,
|
||||
std::optional<NotifySound> sound,
|
||||
std::optional<bool> showPreviews,
|
||||
|
@ -145,19 +145,19 @@ bool NotifySettingsValue::change(
|
|||
return true;
|
||||
}
|
||||
|
||||
std::optional<TimeId> NotifySettingsValue::muteUntil() const {
|
||||
std::optional<TimeId> NotifyPeerSettingsValue::muteUntil() const {
|
||||
return _mute;
|
||||
}
|
||||
|
||||
std::optional<bool> NotifySettingsValue::silentPosts() const {
|
||||
std::optional<bool> NotifyPeerSettingsValue::silentPosts() const {
|
||||
return _silent;
|
||||
}
|
||||
|
||||
std::optional<NotifySound> NotifySettingsValue::sound() const {
|
||||
std::optional<NotifySound> NotifyPeerSettingsValue::sound() const {
|
||||
return _sound;
|
||||
}
|
||||
|
||||
MTPinputPeerNotifySettings NotifySettingsValue::serialize() const {
|
||||
MTPinputPeerNotifySettings NotifyPeerSettingsValue::serialize() const {
|
||||
using Flag = MTPDinputPeerNotifySettings::Flag;
|
||||
const auto flag = [](auto &&optional, Flag flag) {
|
||||
return optional.has_value() ? flag : Flag(0);
|
||||
|
@ -173,9 +173,9 @@ MTPinputPeerNotifySettings NotifySettingsValue::serialize() const {
|
|||
SerializeSound(_sound));
|
||||
}
|
||||
|
||||
NotifySettings::NotifySettings() = default;
|
||||
PeerNotifySettings::PeerNotifySettings() = default;
|
||||
|
||||
bool NotifySettings::change(const MTPPeerNotifySettings &settings) {
|
||||
bool PeerNotifySettings::change(const MTPPeerNotifySettings &settings) {
|
||||
Expects(settings.type() == mtpc_peerNotifySettings);
|
||||
|
||||
auto &data = settings.c_peerNotifySettings();
|
||||
|
@ -192,11 +192,11 @@ bool NotifySettings::change(const MTPPeerNotifySettings &settings) {
|
|||
return _value->change(data);
|
||||
}
|
||||
_known = true;
|
||||
_value = std::make_unique<NotifySettingsValue>(data);
|
||||
_value = std::make_unique<NotifyPeerSettingsValue>(data);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool NotifySettings::change(
|
||||
bool PeerNotifySettings::change(
|
||||
std::optional<int> muteForSeconds,
|
||||
std::optional<bool> silentPosts,
|
||||
std::optional<bool> soundIsNone) {
|
||||
|
@ -225,34 +225,34 @@ bool NotifySettings::change(
|
|||
SerializeSound(notificationSound)));
|
||||
}
|
||||
|
||||
std::optional<TimeId> NotifySettings::muteUntil() const {
|
||||
std::optional<TimeId> PeerNotifySettings::muteUntil() const {
|
||||
return _value
|
||||
? _value->muteUntil()
|
||||
: std::nullopt;
|
||||
}
|
||||
|
||||
bool NotifySettings::settingsUnknown() const {
|
||||
bool PeerNotifySettings::settingsUnknown() const {
|
||||
return !_known;
|
||||
}
|
||||
|
||||
std::optional<bool> NotifySettings::silentPosts() const {
|
||||
std::optional<bool> PeerNotifySettings::silentPosts() const {
|
||||
return _value
|
||||
? _value->silentPosts()
|
||||
: std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<bool> NotifySettings::soundIsNone() const {
|
||||
std::optional<bool> PeerNotifySettings::soundIsNone() const {
|
||||
return (!_value || !_value->sound())
|
||||
? std::nullopt
|
||||
: std::make_optional(_value->sound()->none);
|
||||
}
|
||||
|
||||
MTPinputPeerNotifySettings NotifySettings::serialize() const {
|
||||
MTPinputPeerNotifySettings PeerNotifySettings::serialize() const {
|
||||
return _value
|
||||
? _value->serialize()
|
||||
: DefaultSettings();
|
||||
}
|
||||
|
||||
NotifySettings::~NotifySettings() = default;
|
||||
PeerNotifySettings::~PeerNotifySettings() = default;
|
||||
|
||||
} // namespace Data
|
|
@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
namespace Data {
|
||||
|
||||
class NotifySettingsValue;
|
||||
class NotifyPeerSettingsValue;
|
||||
|
||||
struct NotifySound {
|
||||
QString title;
|
||||
|
@ -25,9 +25,9 @@ inline bool operator==(const NotifySound &a, const NotifySound &b) {
|
|||
&& (a.data == b.data);
|
||||
}
|
||||
|
||||
class NotifySettings {
|
||||
class PeerNotifySettings {
|
||||
public:
|
||||
NotifySettings();
|
||||
PeerNotifySettings();
|
||||
|
||||
static constexpr auto kDefaultMutePeriod = 86400 * 365;
|
||||
|
||||
|
@ -43,11 +43,11 @@ public:
|
|||
std::optional<bool> soundIsNone() const;
|
||||
MTPinputPeerNotifySettings serialize() const;
|
||||
|
||||
~NotifySettings();
|
||||
~PeerNotifySettings();
|
||||
|
||||
private:
|
||||
bool _known = false;
|
||||
std::unique_ptr<NotifySettingsValue> _value;
|
||||
std::unique_ptr<NotifyPeerSettingsValue> _value;
|
||||
|
||||
};
|
||||
|
|
@ -3849,7 +3849,7 @@ void HistoryWidget::joinChannel() {
|
|||
void HistoryWidget::toggleMuteUnmute() {
|
||||
const auto muteForSeconds = _history->mute()
|
||||
? 0
|
||||
: Data::NotifySettings::kDefaultMutePeriod;
|
||||
: Data::PeerNotifySettings::kDefaultMutePeriod;
|
||||
session().data().updateNotifySettings(_peer, muteForSeconds);
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ MuteItem::MuteItem(
|
|||
setClickedCallback([=] {
|
||||
peer->owner().updateNotifySettings(
|
||||
peer,
|
||||
_isMuted ? 0 : Data::NotifySettings::kDefaultMutePeriod);
|
||||
_isMuted ? 0 : Data::PeerNotifySettings::kDefaultMutePeriod);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue