mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Slightly optimized name of methods in data notify settings.
This commit is contained in:
parent
c04a0e42a7
commit
9950452e57
13 changed files with 60 additions and 75 deletions
|
@ -1908,7 +1908,7 @@ void Updates::feedUpdate(const MTPUpdate &update) {
|
||||||
|
|
||||||
case mtpc_updateNotifySettings: {
|
case mtpc_updateNotifySettings: {
|
||||||
auto &d = update.c_updateNotifySettings();
|
auto &d = update.c_updateNotifySettings();
|
||||||
session().data().notifySettings().applyNotifySetting(
|
session().data().notifySettings().apply(
|
||||||
d.vpeer(),
|
d.vpeer(),
|
||||||
d.vnotify_settings());
|
d.vnotify_settings());
|
||||||
} break;
|
} break;
|
||||||
|
|
|
@ -2095,20 +2095,20 @@ void ApiWrap::applyNotifySettings(
|
||||||
auto ¬ifySettings = _session->data().notifySettings();
|
auto ¬ifySettings = _session->data().notifySettings();
|
||||||
switch (notifyPeer.type()) {
|
switch (notifyPeer.type()) {
|
||||||
case mtpc_inputNotifyUsers:
|
case mtpc_inputNotifyUsers:
|
||||||
notifySettings.applyNotifySetting(MTP_notifyUsers(), settings);
|
notifySettings.apply(MTP_notifyUsers(), settings);
|
||||||
break;
|
break;
|
||||||
case mtpc_inputNotifyChats:
|
case mtpc_inputNotifyChats:
|
||||||
notifySettings.applyNotifySetting(MTP_notifyChats(), settings);
|
notifySettings.apply(MTP_notifyChats(), settings);
|
||||||
break;
|
break;
|
||||||
case mtpc_inputNotifyBroadcasts:
|
case mtpc_inputNotifyBroadcasts:
|
||||||
notifySettings.applyNotifySetting(
|
notifySettings.apply(
|
||||||
MTP_notifyBroadcasts(),
|
MTP_notifyBroadcasts(),
|
||||||
settings);
|
settings);
|
||||||
break;
|
break;
|
||||||
case mtpc_inputNotifyPeer: {
|
case mtpc_inputNotifyPeer: {
|
||||||
auto &peer = notifyPeer.c_inputNotifyPeer().vpeer();
|
auto &peer = notifyPeer.c_inputNotifyPeer().vpeer();
|
||||||
const auto apply = [&](PeerId peerId) {
|
const auto apply = [&](PeerId peerId) {
|
||||||
notifySettings.applyNotifySetting(
|
notifySettings.apply(
|
||||||
MTP_notifyPeer(peerToMTP(peerId)),
|
MTP_notifyPeer(peerToMTP(peerId)),
|
||||||
settings);
|
settings);
|
||||||
};
|
};
|
||||||
|
|
|
@ -76,9 +76,7 @@ void MuteSettingsBox::prepare() {
|
||||||
|
|
||||||
_save = [=] {
|
_save = [=] {
|
||||||
const auto muteForSeconds = group->value() * 3600;
|
const auto muteForSeconds = group->value() * 3600;
|
||||||
_peer->owner().notifySettings().updateNotifySettings(
|
_peer->owner().notifySettings().update(_peer, muteForSeconds);
|
||||||
_peer,
|
|
||||||
muteForSeconds);
|
|
||||||
closeBox();
|
closeBox();
|
||||||
};
|
};
|
||||||
addButton(tr::lng_box_ok(), _save);
|
addButton(tr::lng_box_ok(), _save);
|
||||||
|
|
|
@ -222,11 +222,7 @@ void RingtonesBox(
|
||||||
: (value == kNoSoundValue)
|
: (value == kNoSoundValue)
|
||||||
? Data::NotifySound{ .none = true }
|
? Data::NotifySound{ .none = true }
|
||||||
: Data::NotifySound{ .id = state->documentIds[value] };
|
: Data::NotifySound{ .id = state->documentIds[value] };
|
||||||
peer->owner().notifySettings().updateNotifySettings(
|
peer->owner().notifySettings().update(peer, {}, {}, sound);
|
||||||
peer,
|
|
||||||
std::nullopt,
|
|
||||||
std::nullopt,
|
|
||||||
sound);
|
|
||||||
box->closeBox();
|
box->closeBox();
|
||||||
});
|
});
|
||||||
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
||||||
|
|
|
@ -33,7 +33,7 @@ NotifySettings::NotifySettings(not_null<Session*> owner)
|
||||||
, _unmuteByFinishedTimer([=] { unmuteByFinished(); }) {
|
, _unmuteByFinishedTimer([=] { unmuteByFinished(); }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotifySettings::requestNotifySettings(not_null<PeerData*> peer) {
|
void NotifySettings::request(not_null<PeerData*> peer) {
|
||||||
if (peer->notifySettingsUnknown()) {
|
if (peer->notifySettingsUnknown()) {
|
||||||
peer->session().api().requestNotifySettings(
|
peer->session().api().requestNotifySettings(
|
||||||
MTP_inputNotifyPeer(peer->input));
|
MTP_inputNotifyPeer(peer->input));
|
||||||
|
@ -47,7 +47,7 @@ void NotifySettings::requestNotifySettings(not_null<PeerData*> peer) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotifySettings::applyNotifySetting(
|
void NotifySettings::apply(
|
||||||
const MTPNotifyPeer ¬ifyPeer,
|
const MTPNotifyPeer ¬ifyPeer,
|
||||||
const MTPPeerNotifySettings &settings) {
|
const MTPPeerNotifySettings &settings) {
|
||||||
const auto goodForUpdate = [&](
|
const auto goodForUpdate = [&](
|
||||||
|
@ -61,34 +61,34 @@ void NotifySettings::applyNotifySetting(
|
||||||
|
|
||||||
switch (notifyPeer.type()) {
|
switch (notifyPeer.type()) {
|
||||||
case mtpc_notifyUsers: {
|
case mtpc_notifyUsers: {
|
||||||
if (_defaultUserNotifySettings.change(settings)) {
|
if (_defaultUser.change(settings)) {
|
||||||
_defaultUserNotifyUpdates.fire({});
|
_defaultUserUpdates.fire({});
|
||||||
|
|
||||||
_owner->enumerateUsers([&](not_null<UserData*> user) {
|
_owner->enumerateUsers([&](not_null<UserData*> user) {
|
||||||
if (goodForUpdate(user, _defaultUserNotifySettings)) {
|
if (goodForUpdate(user, _defaultUser)) {
|
||||||
updateNotifySettingsLocal(user);
|
updateLocal(user);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case mtpc_notifyChats: {
|
case mtpc_notifyChats: {
|
||||||
if (_defaultChatNotifySettings.change(settings)) {
|
if (_defaultChat.change(settings)) {
|
||||||
_defaultChatNotifyUpdates.fire({});
|
_defaultChatUpdates.fire({});
|
||||||
|
|
||||||
_owner->enumerateGroups([&](not_null<PeerData*> peer) {
|
_owner->enumerateGroups([&](not_null<PeerData*> peer) {
|
||||||
if (goodForUpdate(peer, _defaultChatNotifySettings)) {
|
if (goodForUpdate(peer, _defaultChat)) {
|
||||||
updateNotifySettingsLocal(peer);
|
updateLocal(peer);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case mtpc_notifyBroadcasts: {
|
case mtpc_notifyBroadcasts: {
|
||||||
if (_defaultBroadcastNotifySettings.change(settings)) {
|
if (_defaultBroadcast.change(settings)) {
|
||||||
_defaultBroadcastNotifyUpdates.fire({});
|
_defaultBroadcastUpdates.fire({});
|
||||||
|
|
||||||
_owner->enumerateChannels([&](not_null<ChannelData*> channel) {
|
_owner->enumerateChannels([&](not_null<ChannelData*> channel) {
|
||||||
if (goodForUpdate(channel, _defaultBroadcastNotifySettings)) {
|
if (goodForUpdate(channel, _defaultBroadcast)) {
|
||||||
updateNotifySettingsLocal(channel);
|
updateLocal(channel);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -97,25 +97,25 @@ void NotifySettings::applyNotifySetting(
|
||||||
const auto &data = notifyPeer.c_notifyPeer();
|
const auto &data = notifyPeer.c_notifyPeer();
|
||||||
if (const auto peer = _owner->peerLoaded(peerFromMTP(data.vpeer()))) {
|
if (const auto peer = _owner->peerLoaded(peerFromMTP(data.vpeer()))) {
|
||||||
if (peer->notifyChange(settings)) {
|
if (peer->notifyChange(settings)) {
|
||||||
updateNotifySettingsLocal(peer);
|
updateLocal(peer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotifySettings::updateNotifySettings(
|
void NotifySettings::update(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
std::optional<int> muteForSeconds,
|
std::optional<int> muteForSeconds,
|
||||||
std::optional<bool> silentPosts,
|
std::optional<bool> silentPosts,
|
||||||
std::optional<NotifySound> sound) {
|
std::optional<NotifySound> sound) {
|
||||||
if (peer->notifyChange(muteForSeconds, silentPosts, sound)) {
|
if (peer->notifyChange(muteForSeconds, silentPosts, sound)) {
|
||||||
updateNotifySettingsLocal(peer);
|
updateLocal(peer);
|
||||||
peer->session().api().updateNotifySettingsDelayed(peer);
|
peer->session().api().updateNotifySettingsDelayed(peer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotifySettings::resetNotifySettingsToDefault(not_null<PeerData*> peer) {
|
void NotifySettings::resetToDefault(not_null<PeerData*> peer) {
|
||||||
const auto empty = MTP_peerNotifySettings(
|
const auto empty = MTP_peerNotifySettings(
|
||||||
MTP_flags(0),
|
MTP_flags(0),
|
||||||
MTPBool(),
|
MTPBool(),
|
||||||
|
@ -125,7 +125,7 @@ void NotifySettings::resetNotifySettingsToDefault(not_null<PeerData*> peer) {
|
||||||
MTPNotificationSound(),
|
MTPNotificationSound(),
|
||||||
MTPNotificationSound());
|
MTPNotificationSound());
|
||||||
if (peer->notifyChange(empty)) {
|
if (peer->notifyChange(empty)) {
|
||||||
updateNotifySettingsLocal(peer);
|
updateLocal(peer);
|
||||||
peer->session().api().updateNotifySettingsDelayed(peer);
|
peer->session().api().updateNotifySettingsDelayed(peer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -133,13 +133,13 @@ void NotifySettings::resetNotifySettingsToDefault(not_null<PeerData*> peer) {
|
||||||
const PeerNotifySettings &NotifySettings::defaultNotifySettings(
|
const PeerNotifySettings &NotifySettings::defaultNotifySettings(
|
||||||
not_null<const PeerData*> peer) const {
|
not_null<const PeerData*> peer) const {
|
||||||
return peer->isUser()
|
return peer->isUser()
|
||||||
? _defaultUserNotifySettings
|
? _defaultUser
|
||||||
: (peer->isChat() || peer->isMegagroup())
|
: (peer->isChat() || peer->isMegagroup())
|
||||||
? _defaultChatNotifySettings
|
? _defaultChat
|
||||||
: _defaultBroadcastNotifySettings;
|
: _defaultBroadcast;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotifySettings::updateNotifySettingsLocal(not_null<PeerData*> peer) {
|
void NotifySettings::updateLocal(not_null<PeerData*> peer) {
|
||||||
const auto history = _owner->historyLoaded(peer->id);
|
const auto history = _owner->historyLoaded(peer->id);
|
||||||
auto changesIn = crl::time(0);
|
auto changesIn = crl::time(0);
|
||||||
const auto muted = isMuted(peer, &changesIn);
|
const auto muted = isMuted(peer, &changesIn);
|
||||||
|
@ -281,15 +281,15 @@ bool NotifySettings::settingsUnknown(not_null<const PeerData*> peer) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<> NotifySettings::defaultUserNotifyUpdates() const {
|
rpl::producer<> NotifySettings::defaultUserNotifyUpdates() const {
|
||||||
return _defaultUserNotifyUpdates.events();
|
return _defaultUserUpdates.events();
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<> NotifySettings::defaultChatNotifyUpdates() const {
|
rpl::producer<> NotifySettings::defaultChatNotifyUpdates() const {
|
||||||
return _defaultChatNotifyUpdates.events();
|
return _defaultChatUpdates.events();
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<> NotifySettings::defaultBroadcastNotifyUpdates() const {
|
rpl::producer<> NotifySettings::defaultBroadcastNotifyUpdates() const {
|
||||||
return _defaultBroadcastNotifyUpdates.events();
|
return _defaultBroadcastUpdates.events();
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<> NotifySettings::defaultNotifyUpdates(
|
rpl::producer<> NotifySettings::defaultNotifyUpdates(
|
||||||
|
|
|
@ -21,16 +21,16 @@ class NotifySettings final {
|
||||||
public:
|
public:
|
||||||
NotifySettings(not_null<Session*> owner);
|
NotifySettings(not_null<Session*> owner);
|
||||||
|
|
||||||
void requestNotifySettings(not_null<PeerData*> peer);
|
void request(not_null<PeerData*> peer);
|
||||||
void applyNotifySetting(
|
void apply(
|
||||||
const MTPNotifyPeer ¬ifyPeer,
|
const MTPNotifyPeer ¬ifyPeer,
|
||||||
const MTPPeerNotifySettings &settings);
|
const MTPPeerNotifySettings &settings);
|
||||||
void updateNotifySettings(
|
void update(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
std::optional<int> muteForSeconds,
|
std::optional<int> muteForSeconds,
|
||||||
std::optional<bool> silentPosts = std::nullopt,
|
std::optional<bool> silentPosts = std::nullopt,
|
||||||
std::optional<NotifySound> sound = std::nullopt);
|
std::optional<NotifySound> sound = std::nullopt);
|
||||||
void resetNotifySettingsToDefault(not_null<PeerData*> peer);
|
void resetToDefault(not_null<PeerData*> peer);
|
||||||
|
|
||||||
[[nodiscard]] rpl::producer<> defaultUserNotifyUpdates() const;
|
[[nodiscard]] rpl::producer<> defaultUserNotifyUpdates() const;
|
||||||
[[nodiscard]] rpl::producer<> defaultChatNotifyUpdates() const;
|
[[nodiscard]] rpl::producer<> defaultChatNotifyUpdates() const;
|
||||||
|
@ -57,16 +57,16 @@ private:
|
||||||
|
|
||||||
void unmuteByFinished();
|
void unmuteByFinished();
|
||||||
void unmuteByFinishedDelayed(crl::time delay);
|
void unmuteByFinishedDelayed(crl::time delay);
|
||||||
void updateNotifySettingsLocal(not_null<PeerData*> peer);
|
void updateLocal(not_null<PeerData*> peer);
|
||||||
|
|
||||||
const not_null<Session*> _owner;
|
const not_null<Session*> _owner;
|
||||||
|
|
||||||
PeerNotifySettings _defaultUserNotifySettings;
|
PeerNotifySettings _defaultUser;
|
||||||
PeerNotifySettings _defaultChatNotifySettings;
|
PeerNotifySettings _defaultChat;
|
||||||
PeerNotifySettings _defaultBroadcastNotifySettings;
|
PeerNotifySettings _defaultBroadcast;
|
||||||
rpl::event_stream<> _defaultUserNotifyUpdates;
|
rpl::event_stream<> _defaultUserUpdates;
|
||||||
rpl::event_stream<> _defaultChatNotifyUpdates;
|
rpl::event_stream<> _defaultChatUpdates;
|
||||||
rpl::event_stream<> _defaultBroadcastNotifyUpdates;
|
rpl::event_stream<> _defaultBroadcastUpdates;
|
||||||
std::unordered_set<not_null<const PeerData*>> _mutedPeers;
|
std::unordered_set<not_null<const PeerData*>> _mutedPeers;
|
||||||
base::Timer _unmuteByFinishedTimer;
|
base::Timer _unmuteByFinishedTimer;
|
||||||
|
|
||||||
|
|
|
@ -2554,7 +2554,7 @@ void History::applyDialog(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
owner().notifySettings().applyNotifySetting(
|
owner().notifySettings().apply(
|
||||||
MTP_notifyPeer(data.vpeer()),
|
MTP_notifyPeer(data.vpeer()),
|
||||||
data.vnotify_settings());
|
data.vnotify_settings());
|
||||||
|
|
||||||
|
|
|
@ -2238,7 +2238,7 @@ void HistoryWidget::showHistory(
|
||||||
|
|
||||||
if (_peer->isChannel()) {
|
if (_peer->isChannel()) {
|
||||||
updateNotifyControls();
|
updateNotifyControls();
|
||||||
session().data().notifySettings().requestNotifySettings(_peer);
|
session().data().notifySettings().request(_peer);
|
||||||
refreshSilentToggle();
|
refreshSilentToggle();
|
||||||
} else if (_peer->isRepliesChat()) {
|
} else if (_peer->isRepliesChat()) {
|
||||||
updateNotifyControls();
|
updateNotifyControls();
|
||||||
|
@ -3852,9 +3852,7 @@ void HistoryWidget::toggleMuteUnmute() {
|
||||||
const auto muteForSeconds = _history->mute()
|
const auto muteForSeconds = _history->mute()
|
||||||
? 0
|
? 0
|
||||||
: Data::PeerNotifySettings::kDefaultMutePeriod;
|
: Data::PeerNotifySettings::kDefaultMutePeriod;
|
||||||
session().data().notifySettings().updateNotifySettings(
|
session().data().notifySettings().update(_peer, muteForSeconds);
|
||||||
_peer,
|
|
||||||
muteForSeconds);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::reportSelectedMessages() {
|
void HistoryWidget::reportSelectedMessages() {
|
||||||
|
|
|
@ -474,7 +474,7 @@ void ContactStatus::setupUnarchiveHandler(not_null<PeerData*> peer) {
|
||||||
_bar.entity()->unarchiveClicks(
|
_bar.entity()->unarchiveClicks(
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
Window::ToggleHistoryArchived(peer->owner().history(peer), false);
|
Window::ToggleHistoryArchived(peer->owner().history(peer), false);
|
||||||
peer->owner().notifySettings().resetNotifySettingsToDefault(peer);
|
peer->owner().notifySettings().resetToDefault(peer);
|
||||||
if (const auto settings = peer->settings()) {
|
if (const auto settings = peer->settings()) {
|
||||||
const auto flags = PeerSetting::AutoArchived
|
const auto flags = PeerSetting::AutoArchived
|
||||||
| PeerSetting::BlockContact
|
| PeerSetting::BlockContact
|
||||||
|
|
|
@ -112,7 +112,7 @@ MuteItem::MuteItem(
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
setClickedCallback([=] {
|
setClickedCallback([=] {
|
||||||
peer->owner().notifySettings().updateNotifySettings(
|
peer->owner().notifySettings().update(
|
||||||
peer,
|
peer,
|
||||||
_isMuted ? 0 : Data::PeerNotifySettings::kDefaultMutePeriod);
|
_isMuted ? 0 : Data::PeerNotifySettings::kDefaultMutePeriod);
|
||||||
});
|
});
|
||||||
|
@ -154,9 +154,7 @@ void MuteBox(not_null<Ui::GenericBox*> box, not_null<PeerData*> peer) {
|
||||||
: tr::lng_mute_menu_mute();
|
: tr::lng_mute_menu_mute();
|
||||||
}) | rpl::flatten_latest();
|
}) | rpl::flatten_latest();
|
||||||
const auto confirm = box->addButton(std::move(confirmText), [=] {
|
const auto confirm = box->addButton(std::move(confirmText), [=] {
|
||||||
peer->owner().notifySettings().updateNotifySettings(
|
peer->owner().notifySettings().update(peer, state->lastSeconds);
|
||||||
peer,
|
|
||||||
state->lastSeconds);
|
|
||||||
box->getDelegate()->hideLayer();
|
box->getDelegate()->hideLayer();
|
||||||
});
|
});
|
||||||
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
||||||
|
@ -194,7 +192,7 @@ void PickMuteBox(not_null<Ui::GenericBox*> box, not_null<PeerData*> peer) {
|
||||||
|
|
||||||
box->addButton(tr::lng_mute_menu_mute(), [=] {
|
box->addButton(tr::lng_mute_menu_mute(), [=] {
|
||||||
const auto muteFor = pickerCallback();
|
const auto muteFor = pickerCallback();
|
||||||
peer->owner().notifySettings().updateNotifySettings(peer, muteFor);
|
peer->owner().notifySettings().update(peer, muteFor);
|
||||||
peer->session().settings().addMutePeriod(muteFor);
|
peer->session().settings().addMutePeriod(muteFor);
|
||||||
peer->session().saveSettings();
|
peer->session().saveSettings();
|
||||||
box->closeBox();
|
box->closeBox();
|
||||||
|
@ -245,7 +243,7 @@ void FillMuteMenu(
|
||||||
auto ¬ifySettings = peer->owner().notifySettings();
|
auto ¬ifySettings = peer->owner().notifySettings();
|
||||||
auto sound = notifySettings.sound(peer);
|
auto sound = notifySettings.sound(peer);
|
||||||
sound.none = !sound.none;
|
sound.none = !sound.none;
|
||||||
notifySettings.updateNotifySettings(peer, {}, {}, sound);
|
notifySettings.update(peer, {}, {}, sound);
|
||||||
},
|
},
|
||||||
soundIsNone ? &st::menuIconSoundOn : &st::menuIconSoundOff);
|
soundIsNone ? &st::menuIconSoundOn : &st::menuIconSoundOff);
|
||||||
|
|
||||||
|
@ -254,9 +252,7 @@ void FillMuteMenu(
|
||||||
+ st::menuIconMuteForAnyTextPosition;
|
+ st::menuIconMuteForAnyTextPosition;
|
||||||
for (const auto &muteFor : peer->session().settings().mutePeriods()) {
|
for (const auto &muteFor : peer->session().settings().mutePeriods()) {
|
||||||
const auto callback = [=] {
|
const auto callback = [=] {
|
||||||
peer->owner().notifySettings().updateNotifySettings(
|
peer->owner().notifySettings().update(peer, muteFor);
|
||||||
peer,
|
|
||||||
muteFor);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
auto item = base::make_unique_q<IconWithText>(
|
auto item = base::make_unique_q<IconWithText>(
|
||||||
|
|
|
@ -865,10 +865,7 @@ void SilentToggle::mouseReleaseEvent(QMouseEvent *e) {
|
||||||
setChecked(!_checked);
|
setChecked(!_checked);
|
||||||
RippleButton::mouseReleaseEvent(e);
|
RippleButton::mouseReleaseEvent(e);
|
||||||
Ui::Tooltip::Show(0, this);
|
Ui::Tooltip::Show(0, this);
|
||||||
_channel->owner().notifySettings().updateNotifySettings(
|
_channel->owner().notifySettings().update(_channel, {}, _checked);
|
||||||
_channel,
|
|
||||||
std::nullopt,
|
|
||||||
_checked);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SilentToggle::tooltipText() const {
|
QString SilentToggle::tooltipText() const {
|
||||||
|
|
|
@ -198,13 +198,13 @@ System::SkipState System::computeSkipState(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (messageNotification) {
|
if (messageNotification) {
|
||||||
history->owner().notifySettings().requestNotifySettings(
|
history->owner().notifySettings().request(
|
||||||
history->peer);
|
history->peer);
|
||||||
} else if (notifyBy->blockStatus() == PeerData::BlockStatus::Unknown) {
|
} else if (notifyBy->blockStatus() == PeerData::BlockStatus::Unknown) {
|
||||||
notifyBy->updateFull();
|
notifyBy->updateFull();
|
||||||
}
|
}
|
||||||
if (notifyBy) {
|
if (notifyBy) {
|
||||||
history->owner().notifySettings().requestNotifySettings(notifyBy);
|
history->owner().notifySettings().request(notifyBy);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (messageNotification
|
if (messageNotification
|
||||||
|
|
|
@ -131,7 +131,7 @@ void PeerMenuAddMuteSubmenuAction(
|
||||||
not_null<Window::SessionController*> controller,
|
not_null<Window::SessionController*> controller,
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
const PeerMenuCallback &addAction) {
|
const PeerMenuCallback &addAction) {
|
||||||
peer->owner().notifySettings().requestNotifySettings(peer);
|
peer->owner().notifySettings().request(peer);
|
||||||
const auto isMuted = peer->owner().notifySettings().isMuted(peer);
|
const auto isMuted = peer->owner().notifySettings().isMuted(peer);
|
||||||
if (isMuted) {
|
if (isMuted) {
|
||||||
const auto text = tr::lng_context_unmute(tr::now)
|
const auto text = tr::lng_context_unmute(tr::now)
|
||||||
|
@ -139,7 +139,7 @@ void PeerMenuAddMuteSubmenuAction(
|
||||||
+ Ui::FormatMuteForTiny(peer->notifyMuteUntil().value_or(0)
|
+ Ui::FormatMuteForTiny(peer->notifyMuteUntil().value_or(0)
|
||||||
- base::unixtime::now());
|
- base::unixtime::now());
|
||||||
addAction(text, [=] {
|
addAction(text, [=] {
|
||||||
peer->owner().notifySettings().updateNotifySettings(peer, 0);
|
peer->owner().notifySettings().update(peer, 0);
|
||||||
}, &st::menuIconUnmute);
|
}, &st::menuIconUnmute);
|
||||||
} else {
|
} else {
|
||||||
const auto show = std::make_shared<Window::Show>(controller);
|
const auto show = std::make_shared<Window::Show>(controller);
|
||||||
|
@ -1426,7 +1426,7 @@ void PeerMenuAddMuteAction(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
const PeerMenuCallback &addAction) {
|
const PeerMenuCallback &addAction) {
|
||||||
// There is no async to make weak from controller.
|
// There is no async to make weak from controller.
|
||||||
peer->owner().notifySettings().requestNotifySettings(peer);
|
peer->owner().notifySettings().request(peer);
|
||||||
const auto muteText = [](bool isUnmuted) {
|
const auto muteText = [](bool isUnmuted) {
|
||||||
return isUnmuted
|
return isUnmuted
|
||||||
? tr::lng_context_mute(tr::now)
|
? tr::lng_context_mute(tr::now)
|
||||||
|
@ -1438,7 +1438,7 @@ void PeerMenuAddMuteAction(
|
||||||
Box<MuteSettingsBox>(peer),
|
Box<MuteSettingsBox>(peer),
|
||||||
Ui::LayerOption::CloseOther);
|
Ui::LayerOption::CloseOther);
|
||||||
} else {
|
} else {
|
||||||
peer->owner().notifySettings().updateNotifySettings(peer, 0);
|
peer->owner().notifySettings().update(peer, 0);
|
||||||
}
|
}
|
||||||
}, (peer->owner().notifySettings().isMuted(peer)
|
}, (peer->owner().notifySettings().isMuted(peer)
|
||||||
? &st::menuIconUnmute
|
? &st::menuIconUnmute
|
||||||
|
|
Loading…
Add table
Reference in a new issue