Update color index caches on palette change.

This commit is contained in:
John Preston 2023-10-23 21:29:18 +04:00
parent 4709e11e46
commit 60fb5fdaf0
22 changed files with 148 additions and 72 deletions

View File

@ -72,41 +72,42 @@ struct PeerUpdate {
Usernames = (1ULL << 12),
TranslationDisabled = (1ULL << 13),
Color = (1ULL << 14),
BackgroundEmoji = (1ULL << 15),
// For users
CanShareContact = (1ULL << 15),
IsContact = (1ULL << 16),
PhoneNumber = (1ULL << 17),
OnlineStatus = (1ULL << 18),
BotCommands = (1ULL << 19),
BotCanBeInvited = (1ULL << 20),
BotStartToken = (1ULL << 21),
CommonChats = (1ULL << 22),
HasCalls = (1ULL << 23),
SupportInfo = (1ULL << 24),
IsBot = (1ULL << 25),
EmojiStatus = (1ULL << 26),
StoriesState = (1ULL << 27),
CanShareContact = (1ULL << 16),
IsContact = (1ULL << 17),
PhoneNumber = (1ULL << 18),
OnlineStatus = (1ULL << 19),
BotCommands = (1ULL << 20),
BotCanBeInvited = (1ULL << 21),
BotStartToken = (1ULL << 22),
CommonChats = (1ULL << 23),
HasCalls = (1ULL << 24),
SupportInfo = (1ULL << 25),
IsBot = (1ULL << 26),
EmojiStatus = (1ULL << 27),
StoriesState = (1ULL << 28),
// For chats and channels
InviteLinks = (1ULL << 28),
Members = (1ULL << 29),
Admins = (1ULL << 30),
BannedUsers = (1ULL << 31),
Rights = (1ULL << 32),
PendingRequests = (1ULL << 33),
Reactions = (1ULL << 34),
InviteLinks = (1ULL << 29),
Members = (1ULL << 30),
Admins = (1ULL << 31),
BannedUsers = (1ULL << 32),
Rights = (1ULL << 33),
PendingRequests = (1ULL << 34),
Reactions = (1ULL << 35),
// For channels
ChannelAmIn = (1ULL << 35),
StickersSet = (1ULL << 36),
ChannelLinkedChat = (1ULL << 37),
ChannelLocation = (1ULL << 38),
Slowmode = (1ULL << 39),
GroupCall = (1ULL << 40),
ChannelAmIn = (1ULL << 36),
StickersSet = (1ULL << 37),
ChannelLinkedChat = (1ULL << 38),
ChannelLocation = (1ULL << 39),
Slowmode = (1ULL << 40),
GroupCall = (1ULL << 41),
// For iteration
LastUsedBit = (1ULL << 40),
LastUsedBit = (1ULL << 41),
};
using Flags = base::flags<Flag>;
friend inline constexpr auto is_flag_type(Flag) { return true; }

View File

@ -627,6 +627,13 @@ bool PeerData::changeColorIndex(
: clearColorIndex();
}
bool PeerData::changeBackgroundEmoji(
const tl::conditional<MTPlong> &cloudBackgroundEmoji) {
return changeBackgroundEmoji(cloudBackgroundEmoji
? cloudBackgroundEmoji->v
: DocumentId());
}
void PeerData::fillNames() {
_nameWords.clear();
_nameFirstLetters.clear();
@ -862,6 +869,13 @@ bool PeerData::clearColorIndex() {
return true;
}
bool PeerData::changeBackgroundEmoji(uint64 id) {
if (_backgroundEmojiId == id) {
return false;
}
_backgroundEmojiId = id;
return true;
}
bool PeerData::isSelf() const {
if (const auto user = asUser()) {
return (user->flags() & UserDataFlag::Self);

View File

@ -169,6 +169,7 @@ public:
}
bool changeColorIndex(uint8 index);
bool clearColorIndex();
bool changeBackgroundEmoji(uint64 id);
[[nodiscard]] bool isUser() const {
return peerIsUser(id);
@ -360,6 +361,8 @@ public:
void setSettings(const MTPPeerSettings &data);
bool changeColorIndex(const tl::conditional<MTPint> &cloudColorIndex);
bool changeBackgroundEmoji(
const tl::conditional<MTPlong> &cloudBackgroundEmoji);
enum class BlockStatus : char {
Unknown,
@ -452,6 +455,7 @@ private:
base::flat_set<QString> _nameWords; // for filtering
base::flat_set<QChar> _nameFirstLetters;
uint64 _backgroundEmojiId = 0;
crl::time _lastFullUpdate = 0;
QString _name;

View File

@ -705,8 +705,18 @@ 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->changeBackgroundEmoji(data.vbackground_emoji_id())) {
flags |= UpdateFlag::BackgroundEmoji;
decorationsUpdated = true;
}
if (decorationsUpdated && result->isMinimalLoaded()) {
_peerDecorationsUpdated.fire_copy(result);
}
});
@ -982,8 +992,17 @@ 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->changeBackgroundEmoji(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();
@ -4515,6 +4534,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();

View File

@ -726,6 +726,9 @@ public:
void webViewResultSent(WebViewResultSent &&sent);
[[nodiscard]] rpl::producer<WebViewResultSent> webViewResultSent() const;
[[nodiscard]] auto peerDecorationsUpdated() const
-> rpl::producer<not_null<PeerData*>>;
void clearLocalStorage();
private:
@ -1011,6 +1014,8 @@ private:
rpl::event_stream<WebViewResultSent> _webViewResultSent;
rpl::event_stream<not_null<PeerData*>> _peerDecorationsUpdated;
Groups _groups;
const std::unique_ptr<ChatFilters> _chatsFilters;
std::unique_ptr<ScheduledMessages> _scheduledMessages;

View File

@ -306,6 +306,9 @@ enum class MessageFlag : uint64 {
StoryItem = (1ULL << 38),
InHighlightProcess = (1ULL << 39),
// If not set then we need to refresh _displayFrom value.
DisplayFromChecked = (1ULL << 40),
};
inline constexpr bool is_flag_type(MessageFlag) { return true; }
using MessageFlags = base::flags<MessageFlag>;

View File

@ -544,6 +544,10 @@ HistoryInner::HistoryInner(
PremiumPreview::InfiniteReactions);
}, lifetime());
session().data().peerDecorationsUpdated(
) | rpl::start_with_next([=] {
update();
}, lifetime());
session().data().itemRemoved(
) | rpl::start_with_next(
[this](auto item) { itemRemoved(item); },

View File

@ -1126,7 +1126,7 @@ HistoryItem *HistoryItem::lookupDiscussionPostOriginal() const {
forwarded->savedFromMsgId);
}
PeerData *HistoryItem::displayFrom() const {
PeerData *HistoryItem::computeDisplayFrom() const {
if (const auto sender = discussionPostOriginalSender()) {
return sender;
} else if (const auto sponsored = Get<HistoryMessageSponsored>()) {
@ -1134,14 +1134,24 @@ PeerData *HistoryItem::displayFrom() const {
return nullptr;
}
} else if (const auto forwarded = Get<HistoryMessageForwarded>()) {
if (_history->peer->isSelf() || _history->peer->isRepliesChat() || forwarded->imported) {
if (_history->peer->isSelf()
|| _history->peer->isRepliesChat()
|| forwarded->imported) {
return forwarded->originalSender;
}
}
return author().get();
}
uint8 HistoryItem::computeColorIndex() const {
PeerData *HistoryItem::displayFrom() const {
if (!(_flags & MessageFlag::DisplayFromChecked)) {
_flags |= MessageFlag::DisplayFromChecked;
_displayFrom = computeDisplayFrom();
}
return _displayFrom;
}
uint8 HistoryItem::colorIndex() const {
if (const auto from = displayFrom()) {
return from->colorIndex();
} else if (const auto info = hiddenSenderInfo()) {
@ -1615,6 +1625,7 @@ void HistoryItem::applyEdition(const MTPDmessageService &message) {
createServiceFromMtp(message);
applyServiceDateEdition(message);
finishEditionToEmpty();
_flags &= ~MessageFlag::DisplayFromChecked;
} else if (isService()) {
if (const auto reply = Get<HistoryMessageReply>()) {
reply->clearData(this);
@ -1624,6 +1635,7 @@ void HistoryItem::applyEdition(const MTPDmessageService &message) {
createServiceFromMtp(message);
applyServiceDateEdition(message);
finishEdition(-1);
_flags &= ~MessageFlag::DisplayFromChecked;
}
}

View File

@ -501,7 +501,7 @@ public:
[[nodiscard]] bool isDiscussionPost() const;
[[nodiscard]] HistoryItem *lookupDiscussionPostOriginal() const;
[[nodiscard]] PeerData *displayFrom() const;
[[nodiscard]] uint8 computeColorIndex() const;
[[nodiscard]] uint8 colorIndex() const;
[[nodiscard]] std::unique_ptr<HistoryView::Element> createView(
not_null<HistoryView::ElementDelegate*> delegate,
@ -584,8 +584,8 @@ private:
bool used);
void setSelfDestruct(HistorySelfDestructType type, MTPint mtpTTLvalue);
TextWithEntities fromLinkText() const;
ClickHandlerPtr fromLink() const;
[[nodiscard]] TextWithEntities fromLinkText() const;
[[nodiscard]] ClickHandlerPtr fromLink() const;
void setGroupId(MessageGroupId groupId);
@ -624,9 +624,12 @@ private:
[[nodiscard]] PreparedServiceText prepareCallScheduledText(
TimeId scheduleDate);
[[nodiscard]] PeerData *computeDisplayFrom() const;
const not_null<History*> _history;
const not_null<PeerData*> _from;
MessageFlags _flags = 0;
mutable PeerData *_displayFrom = nullptr;
mutable MessageFlags _flags = 0;
TextWithEntities _text;

View File

@ -402,11 +402,7 @@ bool HistoryMessageReply::updateData(
}
}
if (resolvedMessage) {
_colorIndexPlusOne = resolvedMessage->computeColorIndex() + 1;
} else if (resolvedStory) {
_colorIndexPlusOne = resolvedStory->peer()->colorIndex() + 1;
} else {
if (!resolvedMessage && !resolvedStory) {
_unavailable = 1;
}
@ -422,7 +418,6 @@ bool HistoryMessageReply::updateData(
if (_fields.messageId || _fields.storyId) {
_unavailable = 1;
}
_colorIndexPlusOne = 0;
spoiler = nullptr;
}
if (force) {
@ -681,14 +676,19 @@ void HistoryMessageReply::paint(
const auto rect = QRect(x, y, w, _height);
const auto hasQuote = !_fields.quote.empty();
const auto selected = context.selected();
const auto colorIndexPlusOne = context.outbg ? 0 : _colorIndexPlusOne;
const auto colorIndexPlusOne = resolvedMessage
? (resolvedMessage->colorIndex() + 1)
: resolvedStory
? (resolvedStory->peer()->colorIndex() + 1)
: 0;
const auto useColorIndex = colorIndexPlusOne && !context.outbg;
const auto twoColored = colorIndexPlusOne
&& Ui::ColorIndexTwoColored(colorIndexPlusOne - 1);
const auto cache = !inBubble
? (hasQuote
? st->serviceQuoteCache(twoColored)
: st->serviceReplyCache(twoColored)).get()
: colorIndexPlusOne
: useColorIndex
? (hasQuote
? st->coloredQuoteCache(selected, colorIndexPlusOne - 1)
: st->coloredReplyCache(selected, colorIndexPlusOne - 1)).get()
@ -768,7 +768,7 @@ void HistoryMessageReply::paint(
w -= textLeft + st::historyReplyPadding.right();
p.setPen(!inBubble
? st->msgImgReplyBarColor()->c
: colorIndexPlusOne
: useColorIndex
? FromNameFg(context, colorIndexPlusOne - 1)
: stm->msgServiceFg->c);
_name.drawLeftElided(p, x + textLeft, y + st::historyReplyPadding.top(), w, w + 2 * x + 2 * textLeft);
@ -786,7 +786,7 @@ void HistoryMessageReply::paint(
y + st::historyReplyPadding.top() + st::msgServiceNameFont->height);
auto replyToTextPalette = &(!inBubble
? st->imgReplyTextPalette()
: colorIndexPlusOne
: useColorIndex
? st->coloredTextPalette(selected, colorIndexPlusOne - 1)
: stm->replyTextPalette);
if (_fields.storyId) {
@ -802,7 +802,7 @@ void HistoryMessageReply::paint(
}
auto owned = std::optional<style::owned_color>();
auto copy = std::optional<style::TextPalette>();
if (inBubble && _colorIndexPlusOne) {
if (inBubble && colorIndexPlusOne) {
copy.emplace(*replyToTextPalette);
owned.emplace(cache->icon);
copy->linkFg = owned->color();

View File

@ -346,7 +346,6 @@ private:
mutable int _minHeight = 0;
mutable int _height = 0;
mutable int _nameVersion = 0;
uint8 _colorIndexPlusOne : 6 = 0;
uint8 _unavailable : 1 = 0;
};

View File

@ -467,7 +467,6 @@ Element::Element(
| (IsItemScheduledUntilOnline(data)
? Flag::ScheduledUntilOnline
: Flag()))
, _colorIndex(data->computeColorIndex())
, _context(delegate->elementContext()) {
history()->owner().registerItemView(this);
refreshMedia(replacing);
@ -492,7 +491,7 @@ not_null<History*> Element::history() const {
}
uint8 Element::colorIndex() const {
return _colorIndex;
return data()->colorIndex();
}
QDateTime Element::dateTime() const {

View File

@ -594,7 +594,6 @@ private:
int _indexInBlock = -1;
mutable Flags _flags = Flag(0);
uint8 _colorIndex = 0;
Context _context = Context();
};

View File

@ -353,6 +353,11 @@ ListWidget::ListWidget(
update();
}, lifetime());
session().data().peerDecorationsUpdated(
) | rpl::start_with_next([=] {
update();
}, lifetime());
session().data().itemRemoved(
) | rpl::start_with_next([=](not_null<const HistoryItem*> item) {
itemRemoved(item);

View File

@ -34,7 +34,6 @@ Game::Game(
: Media(parent)
, _st(st::historyPagePreview)
, _data(data)
, _colorIndex(parent->data()->computeColorIndex())
, _title(st::msgMinWidth - _st.padding.left() - _st.padding.right())
, _description(st::msgMinWidth - _st.padding.left() - _st.padding.right()) {
if (!consumed.text.isEmpty()) {
@ -219,11 +218,12 @@ void Game::draw(Painter &p, const PaintContext &context) const {
auto tshift = inner.top();
auto paintw = inner.width();
const auto colorIndex = parent()->colorIndex();
const auto selected = context.selected();
const auto twoColored = Ui::ColorIndexTwoColored(_colorIndex);
const auto twoColored = Ui::ColorIndexTwoColored(colorIndex);
const auto cache = context.outbg
? (twoColored ? stm->replyCacheTwo : stm->replyCache).get()
: st->coloredReplyCache(selected, _colorIndex).get();
: st->coloredReplyCache(selected, colorIndex).get();
Ui::Text::ValidateQuotePaintCache(*cache, _st);
Ui::Text::FillQuotePaint(p, outer, *cache, _st);
@ -232,7 +232,7 @@ void Game::draw(Painter &p, const PaintContext &context) const {
p.setPen(cache->icon);
p.setTextPalette(context.outbg
? stm->semiboldPalette
: st->coloredTextPalette(selected, _colorIndex));
: st->coloredTextPalette(selected, colorIndex));
auto endskip = 0;
if (_title.hasSkipBlock()) {

View File

@ -105,8 +105,7 @@ private:
int _gameTagWidth = 0;
int _descriptionLines = 0;
uint32 _titleLines : 24 = 0;
uint32 _colorIndex : 8 = 0;
int _titleLines = 0;
Ui::Text::String _title;
Ui::Text::String _description;

View File

@ -61,8 +61,7 @@ Giveaway::Giveaway(
, _participants(st::msgMinWidth)
, _countries(st::msgMinWidth)
, _winnersTitle(st::msgMinWidth)
, _winners(st::msgMinWidth)
, _colorIndex(parent->data()->computeColorIndex()) {
, _winners(st::msgMinWidth) {
fillFromData(giveaway);
}
@ -347,10 +346,11 @@ void Giveaway::paintChannels(
const auto ratio = style::DevicePixelRatio();
const auto stm = context.messageStyle();
const auto selected = context.selected();
const auto twoColored = Ui::ColorIndexTwoColored(_colorIndex);
const auto colorIndex = parent()->colorIndex();
const auto twoColored = Ui::ColorIndexTwoColored(colorIndex);
const auto cache = context.outbg
? (twoColored ? stm->replyCacheTwo : stm->replyCache).get()
: context.st->coloredReplyCache(selected, _colorIndex).get();
: context.st->coloredReplyCache(selected, colorIndex).get();
if (_channelCorners[0].isNull() || _channelBg != cache->bg) {
_channelBg = cache->bg;
_channelCorners = Images::CornersMask(size / 2);

View File

@ -115,7 +115,6 @@ private:
int _countriesWidth = 0;
int _winnersTitleTop = 0;
int _winnersTop = 0;
uint8 _colorIndex : 7 = 0;
mutable uint8 _subscribedToThumbnails : 1 = 0;
};

View File

@ -126,7 +126,6 @@ WebPage::WebPage(
: Media(parent)
, _st(st::historyPagePreview)
, _data(data)
, _colorIndex(parent->data()->computeColorIndex())
, _siteName(st::msgMinWidth - _st.padding.left() - _st.padding.right())
, _title(st::msgMinWidth - _st.padding.left() - _st.padding.right())
, _description(st::msgMinWidth - _st.padding.left() - _st.padding.right())
@ -546,10 +545,11 @@ void WebPage::draw(Painter &p, const PaintContext &context) const {
auto attachAdditionalInfoText = _attach ? _attach->additionalInfoString() : QString();
const auto selected = context.selected();
const auto twoColored = Ui::ColorIndexTwoColored(_colorIndex);
const auto colorIndex = parent()->colorIndex();
const auto twoColored = Ui::ColorIndexTwoColored(colorIndex);
const auto cache = context.outbg
? (twoColored ? stm->replyCacheTwo : stm->replyCache).get()
: st->coloredReplyCache(selected, _colorIndex).get();
: st->coloredReplyCache(selected, colorIndex).get();
Ui::Text::ValidateQuotePaintCache(*cache, _st);
Ui::Text::FillQuotePaint(p, outer, *cache, _st);
@ -605,7 +605,7 @@ void WebPage::draw(Painter &p, const PaintContext &context) const {
p.setPen(cache->icon);
p.setTextPalette(context.outbg
? stm->semiboldPalette
: st->coloredTextPalette(selected, _colorIndex));
: st->coloredTextPalette(selected, colorIndex));
auto endskip = 0;
if (_siteName.hasSkipBlock()) {

View File

@ -132,8 +132,7 @@ private:
int _dataVersion = -1;
int _siteNameLines = 0;
int _descriptionLines = 0;
uint32 _titleLines : 24 = 0;
uint32 _colorIndex : 7 = 0;
uint32 _titleLines : 31 = 0;
uint32 _asArticle : 1 = 0;
Ui::Text::String _siteName;

View File

@ -172,7 +172,7 @@ messageActionSuggestProfilePhoto#57de635e photo:Photo = MessageAction;
messageActionRequestedPeer#fe77345d button_id:int peer:Peer = MessageAction;
messageActionSetChatWallPaper#bc44a927 wallpaper:WallPaper = MessageAction;
messageActionSetSameChatWallPaper#c0787d6d wallpaper:WallPaper = MessageAction;
messageActionGiftCode#d2cfdb0e flags:# via_giveaway:flags.0?true boost_peer:flags.1?Peer months:int slug:string = MessageAction;
messageActionGiftCode#d2cfdb0e flags:# via_giveaway:flags.0?true unclaimed:flags.2?true boost_peer:flags.1?Peer months:int slug:string = MessageAction;
messageActionGiveawayLaunch#332ba9ed = MessageAction;
dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog;
@ -292,7 +292,7 @@ updateChatParticipantAdd#3dda5451 chat_id:long user_id:long inviter_id:long date
updateChatParticipantDelete#e32f3d77 chat_id:long user_id:long version:int = Update;
updateDcOptions#8e5e9873 dc_options:Vector<DcOption> = Update;
updateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings = Update;
updateServiceNotification#ebe46819 flags:# popup:flags.0?true inbox_date:flags.1?int type:string message:string media:MessageMedia entities:Vector<MessageEntity> = Update;
updateServiceNotification#ebe46819 flags:# popup:flags.0?true invert_media:flags.2?true inbox_date:flags.1?int type:string message:string media:MessageMedia entities:Vector<MessageEntity> = Update;
updatePrivacy#ee3b272a key:PrivacyKey rules:Vector<PrivacyRule> = Update;
updateUserPhone#5492a13 user_id:long phone:string = Update;
updateReadHistoryInbox#9c974fdf flags:# folder_id:flags.0?int peer:Peer max_id:int still_unread_count:int pts:int pts_count:int = Update;
@ -686,7 +686,7 @@ messages.savedGifsNotModified#e8025ca2 = messages.SavedGifs;
messages.savedGifs#84a02a0d hash:long gifs:Vector<Document> = messages.SavedGifs;
inputBotInlineMessageMediaAuto#3380c786 flags:# invert_media:flags.3?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
inputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
inputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true invert_media:flags.3?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
inputBotInlineMessageMediaGeo#96929a85 flags:# geo_point:InputGeoPoint heading:flags.0?int period:flags.1?int proximity_notification_radius:flags.3?int reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
inputBotInlineMessageMediaVenue#417bbf11 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
inputBotInlineMessageMediaContact#a6edbffd flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
@ -700,7 +700,7 @@ inputBotInlineResultDocument#fff8fdc4 flags:# id:string type:string title:flags.
inputBotInlineResultGame#4fa417f2 id:string short_name:string send_message:InputBotInlineMessage = InputBotInlineResult;
botInlineMessageMediaAuto#764cf810 flags:# invert_media:flags.3?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
botInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
botInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true invert_media:flags.3?true message:string entities:flags.1?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
botInlineMessageMediaGeo#51846fd flags:# geo:GeoPoint heading:flags.0?int period:flags.1?int proximity_notification_radius:flags.3?int reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
botInlineMessageMediaVenue#8a86659c flags:# geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
botInlineMessageMediaContact#18d1cdc2 flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage;

View File

@ -180,7 +180,7 @@ ColorIndexValues SimpleColorIndexValues(QColor color, bool twoColored) {
outline1.setAlphaF(0.9);
auto outline2 = outline1;
if (twoColored) {
outline2.setAlphaF(0.3);
outline2.setAlphaF(0.5);
}
return {
.name = color,
@ -624,7 +624,9 @@ void ChatStyle::assignPalette(not_null<const style::palette*> palette) {
style.msgBgCornersSmall = {};
style.msgBgCornersLarge = {};
style.quoteCache = nullptr;
style.quoteCacheTwo = nullptr;
style.replyCache = nullptr;
style.replyCacheTwo = nullptr;
style.preCache = nullptr;
}
for (auto &style : _imageStyles) {
@ -653,6 +655,12 @@ void ChatStyle::assignPalette(not_null<const style::palette*> palette) {
for (auto &palette : _coloredTextPalettes) {
palette.linkFg.reset();
}
for (auto &cache : _coloredReplyCaches) {
cache = nullptr;
}
for (auto &cache : _coloredQuoteCaches) {
cache = nullptr;
}
updateDarkValue();
_paletteChanged.fire({});
@ -782,7 +790,7 @@ const style::TextPalette &ChatStyle::coloredTextPalette(
const auto shift = (selected ? kColorIndexCount : 0);
auto &result = _coloredTextPalettes[shift + colorIndex];
if (!result.linkFg) {
result.linkFg.emplace(FromNameFg(this, selected, colorIndex));
result.linkFg.emplace(coloredValues(selected, colorIndex).name);
make(
result.data,
(selected