diff --git a/Telegram/Resources/art/dart_idle.tgs b/Telegram/Resources/art/dart_idle.tgs
new file mode 100644
index 000000000..ee3753cf7
Binary files /dev/null and b/Telegram/Resources/art/dart_idle.tgs differ
diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings
index 2ef997bdf..6105b2b48 100644
--- a/Telegram/Resources/langs/lang.strings
+++ b/Telegram/Resources/langs/lang.strings
@@ -1329,7 +1329,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_dialogs_skip_archive_in_search" = "Skip results from archive";
"lng_dialogs_show_archive_in_search" = "With results from archive";
-"lng_about_dice" = "Send a 🎲 emoji to any chat to get a random number from Telegram.";
+"lng_about_random" = "Send a {emoji} emoji to any chat to get a random number from Telegram.";
"lng_open_this_link" = "Open this link?";
"lng_open_link" = "Open";
diff --git a/Telegram/Resources/qrc/telegram/telegram.qrc b/Telegram/Resources/qrc/telegram/telegram.qrc
index 68b67373b..86befe36e 100644
--- a/Telegram/Resources/qrc/telegram/telegram.qrc
+++ b/Telegram/Resources/qrc/telegram/telegram.qrc
@@ -48,6 +48,7 @@
../../art/logo_256_no_margin.png
../../art/sunrise.jpg
../../art/dice_idle.tgs
+ ../../art/dart_idle.tgs
../../day-blue.tdesktop-theme
../../night.tdesktop-theme
../../night-green.tdesktop-theme
diff --git a/Telegram/Resources/tl/api.tl b/Telegram/Resources/tl/api.tl
index 8a87a4424..02477dc55 100644
--- a/Telegram/Resources/tl/api.tl
+++ b/Telegram/Resources/tl/api.tl
@@ -71,8 +71,8 @@ inputMediaDocumentExternal#fb52dc99 flags:# url:string ttl_seconds:flags.0?int =
inputMediaGame#d33f43f3 id:InputGame = InputMedia;
inputMediaInvoice#f4e096c3 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON start_param:string = InputMedia;
inputMediaGeoLive#ce4e82fd flags:# stopped:flags.0?true geo_point:InputGeoPoint period:flags.1?int = InputMedia;
-inputMediaPoll#abe9ca25 flags:# poll:Poll correct_answers:flags.0?Vector = InputMedia;
-inputMediaDice#aeffa807 = InputMedia;
+inputMediaPoll#f94e5f1 flags:# poll:Poll correct_answers:flags.0?Vector solution:flags.1?string solution_entities:flags.1?Vector = InputMedia;
+inputMediaDice#e66fbf7b emoticon:string = InputMedia;
inputChatPhotoEmpty#1ca48f57 = InputChatPhoto;
inputChatUploadedPhoto#927c55b4 file:InputFile = InputChatPhoto;
@@ -157,7 +157,7 @@ messageMediaGame#fdb19008 game:Game = MessageMedia;
messageMediaInvoice#84551347 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument receipt_msg_id:flags.2?int currency:string total_amount:long start_param:string = MessageMedia;
messageMediaGeoLive#7c3c2609 geo:GeoPoint period:int = MessageMedia;
messageMediaPoll#4bd6e798 poll:Poll results:PollResults = MessageMedia;
-messageMediaDice#638fe46b value:int = MessageMedia;
+messageMediaDice#3f7ee58b value:int emoticon:string = MessageMedia;
messageActionEmpty#b6aef7b0 = MessageAction;
messageActionChatCreate#a6638b9a title:string users:Vector = MessageAction;
@@ -533,7 +533,7 @@ inputStickerSetEmpty#ffb62b95 = InputStickerSet;
inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet;
inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet;
inputStickerSetAnimatedEmoji#28703c8 = InputStickerSet;
-inputStickerSetDice#79e21a53 = InputStickerSet;
+inputStickerSetDice#e67f520e emoticon:string = InputStickerSet;
stickerSet#eeb46f27 flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true animated:flags.5?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string thumb:flags.4?PhotoSize thumb_dc_id:flags.4?int count:int hash:int = StickerSet;
@@ -692,8 +692,8 @@ contacts.topPeersDisabled#b52c939d = contacts.TopPeers;
draftMessageEmpty#1b0c841a flags:# date:flags.0?int = DraftMessage;
draftMessage#fd8e711f flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int message:string entities:flags.3?Vector date:int = DraftMessage;
-messages.featuredStickersNotModified#4ede3cf = messages.FeaturedStickers;
-messages.featuredStickers#f89d88e5 hash:int sets:Vector unread:Vector = messages.FeaturedStickers;
+messages.featuredStickersNotModified#c6dc0c66 count:int = messages.FeaturedStickers;
+messages.featuredStickers#b6abc341 hash:int count:int sets:Vector unread:Vector = messages.FeaturedStickers;
messages.recentStickersNotModified#b17f890 = messages.RecentStickers;
messages.recentStickers#22f3afb3 hash:int packs:Vector stickers:Vector dates:Vector = messages.RecentStickers;
@@ -1024,11 +1024,11 @@ help.userInfo#1eb3758 message:string entities:Vector author:strin
pollAnswer#6ca9c2e9 text:string option:bytes = PollAnswer;
-poll#d5529d06 id:long flags:# closed:flags.0?true public_voters:flags.1?true multiple_choice:flags.2?true quiz:flags.3?true question:string answers:Vector = Poll;
+poll#86e18161 id:long flags:# closed:flags.0?true public_voters:flags.1?true multiple_choice:flags.2?true quiz:flags.3?true question:string answers:Vector close_period:flags.4?int close_date:flags.5?int = Poll;
pollAnswerVoters#3b6ddad2 flags:# chosen:flags.0?true correct:flags.1?true option:bytes voters:int = PollAnswerVoters;
-pollResults#c87024a2 flags:# min:flags.0?true results:flags.1?Vector total_voters:flags.2?int recent_voters:flags.3?Vector = PollResults;
+pollResults#badcc1a3 flags:# min:flags.0?true results:flags.1?Vector total_voters:flags.2?int recent_voters:flags.3?Vector solution:flags.4?string solution_entities:flags.4?Vector = PollResults;
chatOnlines#f041e250 onlines:int = ChatOnlines;
@@ -1144,7 +1144,7 @@ stats.broadcastStats#bdf78394 period:StatsDateRangeDays followers:StatsAbsValueA
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
invokeAfterMsgs#3dc4b4f0 {X:Type} msg_ids:Vector query:!X = X;
-initConnection#785188b8 {X:Type} flags:# api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string proxy:flags.0?InputClientProxy query:!X = X;
+initConnection#785188b8 {X:Type} flags:# api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string proxy:flags.0?InputClientProxy params:flags.1?JSONValue query:!X = X;
invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X;
invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X;
invokeWithMessagesRange#365275f2 {X:Type} range:MessageRange query:!X = X;
@@ -1382,6 +1382,7 @@ messages.getDialogFilters#f19ed96d = Vector;
messages.getSuggestedDialogFilters#a29cd42c = Vector;
messages.updateDialogFilter#1ad4a04a flags:# id:int filter:flags.0?DialogFilter = Bool;
messages.updateDialogFiltersOrder#c563c1e4 order:Vector = Bool;
+messages.getOldFeaturedStickers#5fe7025b offset:int limit:int hash:int = messages.FeaturedStickers;
updates.getState#edd4882a = updates.State;
updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference;
@@ -1459,6 +1460,7 @@ channels.getInactiveChannels#11e831ee = messages.InactiveChats;
bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON;
bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool;
+bots.setBotCommands#805d46f6 commands:Vector = Bool;
payments.getPaymentForm#99f09745 msg_id:int = payments.PaymentForm;
payments.getPaymentReceipt#a092a980 msg_id:int = payments.PaymentReceipt;
@@ -1468,10 +1470,11 @@ payments.getSavedInfo#227d824b = payments.SavedInfo;
payments.clearSavedInfo#d83d70c1 flags:# credentials:flags.0?true info:flags.1?true = Bool;
payments.getBankCardData#2e79d779 number:string = payments.BankCardData;
-stickers.createStickerSet#9bd86e6a flags:# masks:flags.0?true user_id:InputUser title:string short_name:string stickers:Vector = messages.StickerSet;
+stickers.createStickerSet#f1036780 flags:# masks:flags.0?true animated:flags.1?true user_id:InputUser title:string short_name:string thumb:flags.2?InputDocument stickers:Vector = messages.StickerSet;
stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet;
stickers.changeStickerPosition#ffb6d4ca sticker:InputDocument position:int = messages.StickerSet;
stickers.addStickerToSet#8653febe stickerset:InputStickerSet sticker:InputStickerSetItem = messages.StickerSet;
+stickers.setStickerSetThumb#9a364e30 stickerset:InputStickerSet thumb:InputDocument = messages.StickerSet;
phone.getCallConfig#55451fa9 = DataJSON;
phone.requestCall#42ff96ed flags:# video:flags.0?true user_id:InputUser random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall;
@@ -1491,7 +1494,7 @@ langpack.getLanguage#6a596502 lang_pack:string lang_code:string = LangPackLangua
folders.editPeerFolders#6847d0ab folder_peers:Vector = Updates;
folders.deleteFolder#1c295881 folder_id:int = Updates;
-stats.getBroadcastStats#ab42441a flags:# dark:flags.0?true channel:InputChannel = stats.BroadcastStats;
+stats.getBroadcastStats#e6300dba flags:# dark:flags.0?true channel:InputChannel tz_offset:int = stats.BroadcastStats;
stats.loadAsyncGraph#621d5fa0 flags:# token:string x:flags.0?long = StatsGraph;
-// LAYER 111
+// LAYER 112
diff --git a/Telegram/SourceFiles/api/api_sending.cpp b/Telegram/SourceFiles/api/api_sending.cpp
index eaac3957e..2fdadaf1c 100644
--- a/Telegram/SourceFiles/api/api_sending.cpp
+++ b/Telegram/SourceFiles/api/api_sending.cpp
@@ -200,9 +200,12 @@ void SendExistingPhoto(
bool SendDice(Api::MessageToSend &message) {
static const auto kDiceString = QString::fromUtf8("\xF0\x9F\x8E\xB2");
- if (message.textWithTags.text.midRef(0).trimmed() != kDiceString) {
+ static const auto kDartString = QString::fromUtf8("\xF0\x9F\x8E\xAF");
+ const auto full = message.textWithTags.text.midRef(0).trimmed();
+ if (full != kDiceString && full != kDartString) {
return false;
}
+ const auto emoji = full.toString();
const auto history = message.action.history;
const auto peer = history->peer;
const auto session = &history->session();
@@ -266,7 +269,7 @@ bool SendDice(Api::MessageToSend &message) {
MTP_int(HistoryItem::NewMessageDate(
message.action.options.scheduled)),
MTP_string(),
- MTP_messageMediaDice(MTP_int(0)),
+ MTP_messageMediaDice(MTP_int(0), MTP_string(emoji)),
MTPReplyMarkup(),
MTP_vector(),
MTP_int(1),
@@ -284,7 +287,7 @@ bool SendDice(Api::MessageToSend &message) {
MTP_flags(sendFlags),
peer->input,
MTP_int(replyTo),
- MTP_inputMediaDice(),
+ MTP_inputMediaDice(MTP_string(emoji)),
MTP_string(),
MTP_long(randomId),
MTPReplyMarkup(),
diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp
index 5da6934f7..4a476ef9b 100644
--- a/Telegram/SourceFiles/apiwrap.cpp
+++ b/Telegram/SourceFiles/apiwrap.cpp
@@ -5775,7 +5775,9 @@ void ApiWrap::createPoll(
MTP_inputMediaPoll(
MTP_flags(inputFlags),
PollDataToMTP(&data),
- MTP_vector(correct)),
+ MTP_vector(correct),
+ MTPstring(), // #TODO polls solution
+ MTPvector()),
MTP_string(),
MTP_long(rand_value()),
MTPReplyMarkup(),
@@ -5870,7 +5872,9 @@ void ApiWrap::closePoll(not_null item) {
MTP_inputMediaPoll(
MTP_flags(inputFlags),
PollDataToMTP(poll, true),
- MTP_vector(correct)),
+ MTP_vector(correct),
+ MTPstring(), // #TODO polls solution
+ MTPvector()),
MTPReplyMarkup(),
MTPVector(),
MTP_int(0) // schedule_date
diff --git a/Telegram/SourceFiles/chat_helpers/stickers_dice_pack.cpp b/Telegram/SourceFiles/chat_helpers/stickers_dice_pack.cpp
index 1e9c6a7f6..869fa4b40 100644
--- a/Telegram/SourceFiles/chat_helpers/stickers_dice_pack.cpp
+++ b/Telegram/SourceFiles/chat_helpers/stickers_dice_pack.cpp
@@ -24,8 +24,9 @@ constexpr auto kZeroDiceDocumentId = 0xa3b83c9f84fa9e83ULL;
} // namespace
-DicePack::DicePack(not_null session)
-: _session(session) {
+DicePack::DicePack(not_null session, const QString &emoji)
+: _session(session)
+, _emoji(emoji) {
}
DicePack::~DicePack() = default;
@@ -47,7 +48,7 @@ void DicePack::load() {
return;
}
_requestId = _session->api().request(MTPmessages_GetStickerSet(
- MTP_inputStickerSetDice()
+ MTP_inputStickerSetDice(MTP_string(_emoji))
)).done([=](const MTPmessages_StickerSet &result) {
result.match([&](const MTPDmessages_stickerSet &data) {
applySet(data);
@@ -73,7 +74,11 @@ void DicePack::ensureZeroGenerated() {
return;
}
- const auto path = qsl(":/gui/art/dice_idle.tgs");
+ static const auto kDiceString = QString::fromUtf8("\xF0\x9F\x8E\xB2");
+ static const auto kDartString = QString::fromUtf8("\xF0\x9F\x8E\xAF");
+ const auto path = QString((_emoji == kDiceString)
+ ? ":/gui/art/dice_idle.tgs"
+ : ":/gui/art/dart_idle.tgs");
auto task = FileLoadTask(
path,
QByteArray(),
@@ -93,4 +98,18 @@ void DicePack::ensureZeroGenerated() {
Ensures(_zero->sticker()->animated);
}
+DicePacks::DicePacks(not_null session) : _session(session) {
+}
+
+DocumentData *DicePacks::lookup(const QString &emoji, int value) {
+ const auto i = _packs.find(emoji);
+ if (i != end(_packs)) {
+ return i->second->lookup(value);
+ }
+ return _packs.emplace(
+ emoji,
+ std::make_unique(_session, emoji)
+ ).first->second->lookup(value);
+}
+
} // namespace Stickers
diff --git a/Telegram/SourceFiles/chat_helpers/stickers_dice_pack.h b/Telegram/SourceFiles/chat_helpers/stickers_dice_pack.h
index 59a22a11a..aa8d2db31 100644
--- a/Telegram/SourceFiles/chat_helpers/stickers_dice_pack.h
+++ b/Telegram/SourceFiles/chat_helpers/stickers_dice_pack.h
@@ -17,7 +17,7 @@ namespace Stickers {
class DicePack final {
public:
- explicit DicePack(not_null session);
+ DicePack(not_null session, const QString &emoji);
~DicePack();
DocumentData *lookup(int value);
@@ -27,11 +27,25 @@ private:
void applySet(const MTPDmessages_stickerSet &data);
void ensureZeroGenerated();
- not_null _session;
+ const not_null _session;
+ QString _emoji;
base::flat_map> _map;
DocumentData *_zero = nullptr;
mtpRequestId _requestId = 0;
};
+class DicePacks final {
+public:
+ explicit DicePacks(not_null session);
+
+ DocumentData *lookup(const QString &emoji, int value);
+
+private:
+ const not_null _session;
+
+ base::flat_map> _packs;
+
+};
+
} // namespace Stickers
diff --git a/Telegram/SourceFiles/codegen/scheme/codegen_scheme.py b/Telegram/SourceFiles/codegen/scheme/codegen_scheme.py
index ff0e91d47..7f54a50b2 100644
--- a/Telegram/SourceFiles/codegen/scheme/codegen_scheme.py
+++ b/Telegram/SourceFiles/codegen/scheme/codegen_scheme.py
@@ -53,6 +53,7 @@ generate({
'ipPortSecret#37982646',
'accessPointRule#4679b65f',
'help.configSimple#5a592a6c',
+ 'initConnection#785188b8',
],
'renamedTypes': {
diff --git a/Telegram/SourceFiles/data/data_media_types.cpp b/Telegram/SourceFiles/data/data_media_types.cpp
index 9fd380bbe..d8a15180a 100644
--- a/Telegram/SourceFiles/data/data_media_types.cpp
+++ b/Telegram/SourceFiles/data/data_media_types.cpp
@@ -1326,21 +1326,26 @@ std::unique_ptr MediaPoll::createView(
return std::make_unique(message, _poll);
}
-MediaDice::MediaDice(not_null parent, int value)
+MediaDice::MediaDice(not_null parent, QString emoji, int value)
: Media(parent)
+, _emoji(emoji)
, _value(value) {
}
std::unique_ptr MediaDice::clone(not_null parent) {
- return std::make_unique(parent, _value);
+ return std::make_unique(parent, _emoji, _value);
}
-int MediaDice::diceValue() const {
+QString MediaDice::emoji() const {
+ return _emoji;
+}
+
+int MediaDice::value() const {
return _value;
}
QString MediaDice::notificationText() const {
- return QString::fromUtf8("\xF0\x9F\x8E\xB2");
+ return _emoji;
}
QString MediaDice::pinnedTextSubstring() const {
diff --git a/Telegram/SourceFiles/data/data_media_types.h b/Telegram/SourceFiles/data/data_media_types.h
index 6b77e7255..2404ba24c 100644
--- a/Telegram/SourceFiles/data/data_media_types.h
+++ b/Telegram/SourceFiles/data/data_media_types.h
@@ -407,11 +407,12 @@ private:
class MediaDice final : public Media {
public:
- MediaDice(not_null parent, int value);
+ MediaDice(not_null parent, QString emoji, int value);
std::unique_ptr clone(not_null parent) override;
- int diceValue() const;
+ [[nodiscard]] QString emoji() const;
+ [[nodiscard]] int value() const;
QString notificationText() const override;
QString pinnedTextSubstring() const override;
@@ -423,6 +424,7 @@ public:
not_null realParent) override;
private:
+ QString _emoji;
int _value = 0;
};
diff --git a/Telegram/SourceFiles/data/data_poll.cpp b/Telegram/SourceFiles/data/data_poll.cpp
index 977d614bb..6972710bd 100644
--- a/Telegram/SourceFiles/data/data_poll.cpp
+++ b/Telegram/SourceFiles/data/data_poll.cpp
@@ -231,5 +231,7 @@ MTPPoll PollDataToMTP(not_null poll, bool close) {
MTP_long(poll->id),
MTP_flags(flags),
MTP_string(poll->question),
- MTP_vector(answers));
+ MTP_vector(answers),
+ MTPint(), // #TODO polls close_period
+ MTPint());
}
diff --git a/Telegram/SourceFiles/history/history_message.cpp b/Telegram/SourceFiles/history/history_message.cpp
index c461982b4..69e0258ca 100644
--- a/Telegram/SourceFiles/history/history_message.cpp
+++ b/Telegram/SourceFiles/history/history_message.cpp
@@ -1025,7 +1025,10 @@ std::unique_ptr HistoryMessage::CreateMedia(
item,
item->history()->owner().processPoll(media));
}, [&](const MTPDmessageMediaDice &media) -> Result {
- return std::make_unique(item, media.vvalue().v);
+ return std::make_unique(
+ item,
+ qs(media.vemoticon()),
+ media.vvalue().v);
}, [](const MTPDmessageMediaEmpty &) -> Result {
return nullptr;
}, [](const MTPDmessageMediaUnsupported &) -> Result {
diff --git a/Telegram/SourceFiles/history/view/media/history_view_dice.cpp b/Telegram/SourceFiles/history/view/media/history_view_dice.cpp
index b61170805..30fb6468a 100644
--- a/Telegram/SourceFiles/history/view/media/history_view_dice.cpp
+++ b/Telegram/SourceFiles/history/view/media/history_view_dice.cpp
@@ -20,9 +20,22 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace HistoryView {
namespace {
-DocumentData *Lookup(not_null view, int value) {
+[[nodiscard]] DocumentData *Lookup(
+ not_null view,
+ const QString &emoji,
+ int value) {
const auto &session = view->data()->history()->session();
- return session.diceStickersPack().lookup(value);
+ return session.diceStickersPacks().lookup(emoji, value);
+}
+
+[[nodiscard]] ClickHandlerPtr MakeDiceHandler(const QString &emoji) {
+ return std::make_shared([=] {
+ auto config = Ui::Toast::Config();
+ config.multiline = true;
+ config.minWidth = st::msgMinWidth;
+ config.text = { tr::lng_about_random(tr::now, lt_emoji, emoji) };
+ Ui::Toast::Show(config);
+ });
}
} // namespace
@@ -30,9 +43,12 @@ DocumentData *Lookup(not_null view, int value) {
Dice::Dice(not_null parent, not_null dice)
: _parent(parent)
, _dice(dice)
-, _start(parent, Lookup(parent, 0)) {
+, _link(_parent->data()->Has()
+ ? nullptr
+ : MakeDiceHandler(dice->emoji()))
+, _start(parent, Lookup(parent, dice->emoji(), 0)) {
_showLastFrame = _parent->data()->Has();
- _start.setDiceIndex(0);
+ _start.setDiceIndex(_dice->emoji(), 0);
if (_showLastFrame) {
_drawingEnd = true;
}
@@ -45,24 +61,14 @@ QSize Dice::size() {
}
ClickHandlerPtr Dice::link() {
- if (_parent->data()->Has()) {
- return nullptr;
- }
- static auto kHandler = std::make_shared([] {
- auto config = Ui::Toast::Config();
- config.multiline = true;
- config.minWidth = st::msgMinWidth;
- config.text = { tr::lng_about_dice(tr::now) };
- Ui::Toast::Show(config);
- });
- return kHandler;
+ return _link;
}
void Dice::draw(Painter &p, const QRect &r, bool selected) {
- if (const auto value = _end ? 0 : _dice->diceValue()) {
- if (const auto document = Lookup(_parent, value)) {
+ if (const auto value = _end ? 0 : _dice->value()) {
+ if (const auto document = Lookup(_parent, _dice->emoji(), value)) {
_end.emplace(_parent, document);
- _end->setDiceIndex(value);
+ _end->setDiceIndex(_dice->emoji(), value);
_end->initSize();
}
}
diff --git a/Telegram/SourceFiles/history/view/media/history_view_dice.h b/Telegram/SourceFiles/history/view/media/history_view_dice.h
index 113c94dba..0c614deca 100644
--- a/Telegram/SourceFiles/history/view/media/history_view_dice.h
+++ b/Telegram/SourceFiles/history/view/media/history_view_dice.h
@@ -41,6 +41,7 @@ public:
private:
const not_null _parent;
const not_null _dice;
+ ClickHandlerPtr _link;
std::optional _end;
Sticker _start;
mutable bool _showLastFrame = false;
diff --git a/Telegram/SourceFiles/history/view/media/history_view_sticker.cpp b/Telegram/SourceFiles/history/view/media/history_view_sticker.cpp
index 800de02f7..037567221 100644
--- a/Telegram/SourceFiles/history/view/media/history_view_sticker.cpp
+++ b/Telegram/SourceFiles/history/view/media/history_view_sticker.cpp
@@ -37,13 +37,17 @@ namespace {
0.625);
}
-[[nodiscard]] QImage CacheDiceImage(int index, const QImage &image) {
- static auto Cache = base::flat_map();
- const auto i = Cache.find(index);
+[[nodiscard]] QImage CacheDiceImage(
+ const QString &emoji,
+ int index,
+ const QImage &image) {
+ static auto Cache = base::flat_map, QImage>();
+ const auto key = std::make_pair(emoji, index);
+ const auto i = Cache.find(key);
if (i != end(Cache) && i->second.size() == image.size()) {
return i->second;
}
- Cache[index] = image;
+ Cache[key] = image;
return image;
}
@@ -126,7 +130,7 @@ void Sticker::paintLottie(Painter &p, const QRect &r, bool selected) {
: Lottie::Animation::FrameInfo();
if (_nextLastDiceFrame) {
_nextLastDiceFrame = false;
- _lastDiceFrame = CacheDiceImage(_diceIndex, frame.image);
+ _lastDiceFrame = CacheDiceImage(_diceEmoji, _diceIndex, frame.image);
}
const auto &image = _lastDiceFrame.isNull()
? frame.image
@@ -237,7 +241,8 @@ void Sticker::refreshLink() {
}
}
-void Sticker::setDiceIndex(int index) {
+void Sticker::setDiceIndex(const QString &emoji, int index) {
+ _diceEmoji = emoji;
_diceIndex = index;
}
diff --git a/Telegram/SourceFiles/history/view/media/history_view_sticker.h b/Telegram/SourceFiles/history/view/media/history_view_sticker.h
index 6c9f4d0a6..7ec89fb3e 100644
--- a/Telegram/SourceFiles/history/view/media/history_view_sticker.h
+++ b/Telegram/SourceFiles/history/view/media/history_view_sticker.h
@@ -49,7 +49,7 @@ public:
}
void refreshLink() override;
- void setDiceIndex(int index);
+ void setDiceIndex(const QString &emoji, int index);
[[nodiscard]] bool atTheEnd() const {
return _atTheEnd;
}
@@ -71,6 +71,7 @@ private:
ClickHandlerPtr _link;
QSize _size;
QImage _lastDiceFrame;
+ QString _diceEmoji;
int _diceIndex = -1;
mutable bool _lottieOncePlayed = false;
mutable bool _atTheEnd = false;
diff --git a/Telegram/SourceFiles/main/main_session.cpp b/Telegram/SourceFiles/main/main_session.cpp
index 303be0c59..9332f678b 100644
--- a/Telegram/SourceFiles/main/main_session.cpp
+++ b/Telegram/SourceFiles/main/main_session.cpp
@@ -57,7 +57,7 @@ Session::Session(
, _data(std::make_unique(this))
, _user(_data->processUser(user))
, _emojiStickersPack(std::make_unique(this))
-, _diceStickersPack(std::make_unique(this))
+, _diceStickersPacks(std::make_unique(this))
, _changelogs(Core::Changelogs::Create(this))
, _supportHelper(Support::Helper::Create(this)) {
Core::App().passcodeLockChanges(
diff --git a/Telegram/SourceFiles/main/main_session.h b/Telegram/SourceFiles/main/main_session.h
index 552bd7630..87b747c73 100644
--- a/Telegram/SourceFiles/main/main_session.h
+++ b/Telegram/SourceFiles/main/main_session.h
@@ -46,7 +46,7 @@ class Instance;
namespace Stickers {
class EmojiPack;
-class DicePack;
+class DicePacks;
} // namespace Stickers;
namespace Core {
@@ -93,8 +93,8 @@ public:
[[nodiscard]] Stickers::EmojiPack &emojiStickersPack() const {
return *_emojiStickersPack;
}
- [[nodiscard]] Stickers::DicePack &diceStickersPack() const {
- return *_diceStickersPack;
+ [[nodiscard]] Stickers::DicePacks &diceStickersPacks() const {
+ return *_diceStickersPacks;
}
[[nodiscard]] base::Observable &downloaderTaskFinished();
@@ -161,7 +161,7 @@ private:
// _emojiStickersPack depends on _data.
const std::unique_ptr _emojiStickersPack;
- const std::unique_ptr _diceStickersPack;
+ const std::unique_ptr _diceStickersPacks;
// _changelogs depends on _data, subscribes on chats loading event.
const std::unique_ptr _changelogs;
diff --git a/Telegram/SourceFiles/mtproto/session_private.cpp b/Telegram/SourceFiles/mtproto/session_private.cpp
index 808af4543..f26e7c5d9 100644
--- a/Telegram/SourceFiles/mtproto/session_private.cpp
+++ b/Telegram/SourceFiles/mtproto/session_private.cpp
@@ -621,6 +621,7 @@ void SessionPrivate::tryToSend() {
MTP_string(langPackName),
MTP_string(cloudLangCode),
clientProxyFields,
+ MTPJSONValue(), // #TODO polls timezone
SerializedRequest());
initSizeInInts = (tl::count_length(initWrapper) >> 2) + 2;
initSize = initSizeInInts * sizeof(mtpPrime);
@@ -2007,9 +2008,9 @@ void SessionPrivate::requestsAcked(const QVector &ids, bool byResponse)
} else {
DEBUG_LOG(("Message Info: acked msgId %1 that was prepared to resend, requestId %2").arg(msgId).arg(requestId));
}
-
+
_ackedIds.emplace(msgId, j->second->requestId);
-
+
toSend.erase(j);
continue;
}