mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 15:13:57 +02:00
Update send gift icon visibility.
This commit is contained in:
parent
8b2a549fab
commit
44d9525476
2 changed files with 15 additions and 1 deletions
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "api/api_global_privacy.h"
|
#include "api/api_global_privacy.h"
|
||||||
|
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
|
#include "data/data_user.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "main/main_app_config.h"
|
#include "main/main_app_config.h"
|
||||||
|
|
||||||
|
@ -263,6 +264,8 @@ void GlobalPrivacy::update(
|
||||||
| ((disallowedGiftTypes & DisallowedGiftType::Unique)
|
| ((disallowedGiftTypes & DisallowedGiftType::Unique)
|
||||||
? DisallowedFlag::f_disallow_unique_stargifts
|
? DisallowedFlag::f_disallow_unique_stargifts
|
||||||
: DisallowedFlag());
|
: DisallowedFlag());
|
||||||
|
const auto typesWas = _disallowedGiftTypes.current();
|
||||||
|
const auto typesChanged = (typesWas != disallowedGiftTypes);
|
||||||
_requestId = _api.request(MTPaccount_SetGlobalPrivacySettings(
|
_requestId = _api.request(MTPaccount_SetGlobalPrivacySettings(
|
||||||
MTP_globalPrivacySettings(
|
MTP_globalPrivacySettings(
|
||||||
MTP_flags(flags),
|
MTP_flags(flags),
|
||||||
|
@ -271,6 +274,9 @@ void GlobalPrivacy::update(
|
||||||
)).done([=](const MTPGlobalPrivacySettings &result) {
|
)).done([=](const MTPGlobalPrivacySettings &result) {
|
||||||
_requestId = 0;
|
_requestId = 0;
|
||||||
apply(result);
|
apply(result);
|
||||||
|
if (typesChanged) {
|
||||||
|
_session->user()->updateFullForced();
|
||||||
|
}
|
||||||
}).fail([=](const MTP::Error &error) {
|
}).fail([=](const MTP::Error &error) {
|
||||||
_requestId = 0;
|
_requestId = 0;
|
||||||
if (error.type() == u"PREMIUM_ACCOUNT_REQUIRED"_q) {
|
if (error.type() == u"PREMIUM_ACCOUNT_REQUIRED"_q) {
|
||||||
|
|
|
@ -814,7 +814,15 @@ HistoryWidget::HistoryWidget(
|
||||||
| PeerUpdateFlag::StarsPerMessage
|
| PeerUpdateFlag::StarsPerMessage
|
||||||
| PeerUpdateFlag::GiftSettings
|
| PeerUpdateFlag::GiftSettings
|
||||||
) | rpl::filter([=](const Data::PeerUpdate &update) {
|
) | rpl::filter([=](const Data::PeerUpdate &update) {
|
||||||
return (update.peer.get() == _peer);
|
if (update.peer.get() == _peer) {
|
||||||
|
return true;
|
||||||
|
} else if (update.peer->isSelf()
|
||||||
|
&& (update.flags & PeerUpdateFlag::GiftSettings)) {
|
||||||
|
refreshSendGiftToggle();
|
||||||
|
updateControlsVisibility();
|
||||||
|
updateControlsGeometry();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}) | rpl::map([](const Data::PeerUpdate &update) {
|
}) | rpl::map([](const Data::PeerUpdate &update) {
|
||||||
return update.flags;
|
return update.flags;
|
||||||
}) | rpl::start_with_next([=](Data::PeerUpdate::Flags flags) {
|
}) | rpl::start_with_next([=](Data::PeerUpdate::Flags flags) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue