Merge tag 'v4.11.1' into dev

# Conflicts:
#	Telegram/Resources/winrc/Telegram.rc
#	Telegram/Resources/winrc/Updater.rc
#	Telegram/SourceFiles/core/version.h
#	Telegram/SourceFiles/history/history_inner_widget.cpp
#	Telegram/SourceFiles/platform/win/tray_win.cpp
#	Telegram/lib_ui
This commit is contained in:
ZavaruKitsu
2023-10-29 14:35:43 +03:00
251 changed files with 10939 additions and 3220 deletions
+58 -11
View File
@@ -716,6 +716,19 @@ not_null<UserData*> Session::processUser(const MTPUser &data) {
if (canShareThisContact != result->canShareThisContactFast()) {
flags |= UpdateFlag::CanShareContact;
}
auto decorationsUpdated = false;
if (result->changeColorIndex(data.vcolor())) {
flags |= UpdateFlag::Color;
decorationsUpdated = true;
}
if (result->changeBackgroundEmojiId(data.vbackground_emoji_id())) {
flags |= UpdateFlag::BackgroundEmoji;
decorationsUpdated = true;
}
if (decorationsUpdated && result->isMinimalLoaded()) {
_peerDecorationsUpdated.fire_copy(result);
}
});
if (minimal) {
@@ -990,6 +1003,18 @@ not_null<PeerData*> Session::processChat(const MTPChat &data) {
if (wasCallNotEmpty != Data::ChannelHasActiveCall(channel)) {
flags |= UpdateFlag::GroupCall;
}
auto decorationsUpdated = false;
if (result->changeColorIndex(data.vcolor())) {
flags |= UpdateFlag::Color;
decorationsUpdated = true;
}
if (result->changeBackgroundEmojiId(data.vbackground_emoji_id())) {
flags |= UpdateFlag::BackgroundEmoji;
decorationsUpdated = true;
}
if (decorationsUpdated && result->isMinimalLoaded()) {
_peerDecorationsUpdated.fire_copy(result);
}
}, [&](const MTPDchannelForbidden &data) {
const auto channel = result->asChannel();
@@ -3319,8 +3344,10 @@ not_null<WebPageData*> Session::processWebpage(const MTPWebPage &data) {
return processWebpage(data.c_webPage());
case mtpc_webPageEmpty: {
const auto result = webpage(data.c_webPageEmpty().vid().v);
result->type = WebPageType::None;
if (result->pendingTill > 0) {
result->pendingTill = -1; // failed
result->pendingTill = 0;
result->failed = 1;
notifyWebPageUpdateDelayed(result);
}
return result;
@@ -3341,12 +3368,13 @@ not_null<WebPageData*> Session::processWebpage(const MTPDwebPage &data) {
return result;
}
not_null<WebPageData*> Session::processWebpage(const MTPDwebPagePending &data) {
not_null<WebPageData*> Session::processWebpage(
const MTPDwebPagePending &data) {
constexpr auto kDefaultPendingTimeout = 60;
const auto result = webpage(data.vid().v);
webpageApplyFields(
result,
WebPageType::Article,
WebPageType::None,
QString(),
QString(),
QString(),
@@ -3358,6 +3386,7 @@ not_null<WebPageData*> Session::processWebpage(const MTPDwebPagePending &data) {
WebPageCollage(),
0,
QString(),
false,
data.vdate().v
? data.vdate().v
: (base::unixtime::now() + kDefaultPendingTimeout));
@@ -3381,6 +3410,7 @@ not_null<WebPageData*> Session::webpage(
WebPageCollage(),
0,
QString(),
false,
TimeId(0));
}
@@ -3397,6 +3427,7 @@ not_null<WebPageData*> Session::webpage(
WebPageCollage &&collage,
int duration,
const QString &author,
bool hasLargeMedia,
TimeId pendingTill) {
const auto result = webpage(id);
webpageApplyFields(
@@ -3413,6 +3444,7 @@ not_null<WebPageData*> Session::webpage(
std::move(collage),
duration,
author,
hasLargeMedia,
pendingTill);
return result;
}
@@ -3512,6 +3544,7 @@ void Session::webpageApplyFields(
WebPageCollage(this, data),
data.vduration().value_or_empty(),
qs(data.vauthor().value_or_empty()),
data.is_has_large_media(),
pendingTill);
}
@@ -3529,6 +3562,7 @@ void Session::webpageApplyFields(
WebPageCollage &&collage,
int duration,
const QString &author,
bool hasLargeMedia,
TimeId pendingTill) {
const auto requestPending = (!page->pendingTill && pendingTill > 0);
const auto changed = page->applyChanges(
@@ -3544,6 +3578,7 @@ void Session::webpageApplyFields(
std::move(collage),
duration,
author,
hasLargeMedia,
pendingTill);
if (requestPending) {
_session->api().requestWebPageDelayed(page);
@@ -4377,7 +4412,8 @@ auto Session::dialogsRowReplacements() const
void Session::serviceNotification(
const TextWithEntities &message,
const MTPMessageMedia &media) {
const MTPMessageMedia &media,
bool invertMedia) {
const auto date = base::unixtime::now();
if (!peerLoaded(PeerData::kServiceNotificationsId)) {
processUser(MTP_user(
@@ -4400,25 +4436,32 @@ void Session::serviceNotification(
MTPstring(), // lang_code
MTPEmojiStatus(),
MTPVector<MTPUsername>(),
MTPint())); // stories_max_id
MTPint(), // stories_max_id
MTP_int(0), // color
MTPlong())); // background_emoji_id
}
const auto history = this->history(PeerData::kServiceNotificationsId);
const auto insert = [=] {
insertCheckedServiceNotification(message, media, date, invertMedia);
};
if (!history->folderKnown()) {
histories().requestDialogEntry(history, [=] {
insertCheckedServiceNotification(message, media, date);
});
histories().requestDialogEntry(history, insert);
} else {
insertCheckedServiceNotification(message, media, date);
insert();
}
}
void Session::insertCheckedServiceNotification(
const TextWithEntities &message,
const MTPMessageMedia &media,
TimeId date) {
TimeId date,
bool invertMedia) {
const auto flags = MTPDmessage::Flag::f_entities
| MTPDmessage::Flag::f_from_id
| MTPDmessage::Flag::f_media;
| MTPDmessage::Flag::f_media
| (invertMedia
? MTPDmessage::Flag::f_invert_media
: MTPDmessage::Flag());
const auto localFlags = MessageFlag::ClientSideUnread
| MessageFlag::Local;
auto sending = TextWithEntities(), left = message;
@@ -4562,6 +4605,10 @@ auto Session::webViewResultSent() const -> rpl::producer<WebViewResultSent> {
return _webViewResultSent.events();
}
rpl::producer<not_null<PeerData*>> Session::peerDecorationsUpdated() const {
return _peerDecorationsUpdated.events();
}
void Session::clearLocalStorage() {
_cache->close();
_cache->clear();