2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-02 23:45:44 +00:00

Refactor NotifySettings in PeerData.

This commit is contained in:
John Preston
2017-12-04 21:46:03 +04:00
parent 116e3fd9c5
commit 62568daffe
21 changed files with 562 additions and 290 deletions

View File

@@ -238,17 +238,19 @@ void Filler::addNotifications() {
if (!peer->isMuted()) {
Ui::show(Box<MuteSettingsBox>(peer));
} else {
App::main()->updateNotifySetting(
App::main()->updateNotifySettings(
peer,
NotifySettingSetNotify);
Data::NotifySettings::MuteChange::Unmute);
}
});
auto lifetime = Notify::PeerUpdateViewer(
_peer,
Notify::PeerUpdate::Flag::NotificationsEnabled)
| rpl::start_with_next([=] {
muteAction->setText(muteText(peer->isMuted()));
| rpl::map([=] { return peer->isMuted(); })
| rpl::distinct_until_changed()
| rpl::start_with_next([=](bool muted) {
muteAction->setText(muteText(muted));
});
Ui::AttachAsChild(muteAction, std::move(lifetime));