From 3e2f4bed504559e29c14f4a61acf7c2475553665 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 6 Apr 2020 13:07:49 +0400 Subject: [PATCH] Update scheme to layer 102. Support different dice-like media. --- Telegram/Resources/art/dart_idle.tgs | Bin 0 -> 8548 bytes Telegram/Resources/langs/lang.strings | 2 +- Telegram/Resources/qrc/telegram/telegram.qrc | 1 + Telegram/Resources/tl/api.tl | 27 ++++++----- Telegram/SourceFiles/api/api_sending.cpp | 9 ++-- Telegram/SourceFiles/apiwrap.cpp | 8 +++- .../chat_helpers/stickers_dice_pack.cpp | 27 +++++++++-- .../chat_helpers/stickers_dice_pack.h | 18 +++++++- .../codegen/scheme/codegen_scheme.py | 1 + .../SourceFiles/data/data_media_types.cpp | 13 ++++-- Telegram/SourceFiles/data/data_media_types.h | 6 ++- Telegram/SourceFiles/data/data_poll.cpp | 4 +- .../SourceFiles/history/history_message.cpp | 5 ++- .../history/view/media/history_view_dice.cpp | 42 ++++++++++-------- .../history/view/media/history_view_dice.h | 1 + .../view/media/history_view_sticker.cpp | 17 ++++--- .../history/view/media/history_view_sticker.h | 3 +- Telegram/SourceFiles/main/main_session.cpp | 2 +- Telegram/SourceFiles/main/main_session.h | 8 ++-- .../SourceFiles/mtproto/session_private.cpp | 5 ++- 20 files changed, 135 insertions(+), 64 deletions(-) create mode 100644 Telegram/Resources/art/dart_idle.tgs diff --git a/Telegram/Resources/art/dart_idle.tgs b/Telegram/Resources/art/dart_idle.tgs new file mode 100644 index 0000000000000000000000000000000000000000..ee3753cf7e6242e977c68b041a5525ce9003c012 GIT binary patch literal 8548 zcmV-qA)DSGiwFP!000021MOYeavMjM{S^nFt15C|`~f|$6VdZ96AC@h5+$=Oi3*Z- zkH_JEpL@>D0t!Hp1VB&(N%TSpg{-X1th=v&o!x%EIs4gmXMddid=`f|xU=r;)AiZU z$#iFz-_L%Qk1P48^7-$xpQCl%*{|*M+gG{go?q#6R(El8%dfwDugi`}y_7w_7e{w-xnv$S!uh8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>hvIC87hdrY=HI zSeEBN6AAV$XX)|{_0XeiZik|arU@w-0g=G$2p{2!j<{djG=+nUnQNQ!-Q(MR)ue`B zS0ZC)*!9MEYxDZolae~irVo)6GYg)K&~)@zFDj)DY{VoISlWQhBtkVTfx;zPJ!ttS z`aAatCHKOvkof|@<;UU9i-gR4Xvn003n@J;DxNimCltNlTuUs*h{XV{idMTeU;)Up z!%DZ9=Z;6!#iN!rj^SX{B*)gPD29lJ8CfI4A__8!GG|8|^0_$jq7Kcjuw zHLWTH8U$IQWlgghQk^PSb1IXKaS((=;~-RT-&CDkMq|s+Ws&gwy{gkIf_!&y$aj&l zFWujoNx-UHw6tkQ0ABE-JBiG!j@>wbN@9Rpl5hs*$gqO<+S0=ChLM?|p;K+5elb&< zs9(-BTErcLw^5ljs0f~f1w=pgD9{?hfQ`(oj6Nf7((;xN+>W3>?>4UL3=)kWb@~ap z>N@tw%y`2IXa3+Y=mnFhBk~iPU1m+ZUO#am4#I#t&qVMsUs^Op{aC;tYSD`1s~;SO zhy|gMb!-9ACh8Y6$v+}9ZTPuVazpFAQO6Ysl}-_sno6~>uLUJ@GyB1}66_InI=Q17 zccQ+pkoty$Lw*pEmz5p)2@A5&JTyGePcpdY+V=jj&{MaH7{(UIu~+leq}6LSI}(@$*F&Oe-LdKnx2>rCm{? z+{0{9qdkEA4NW-NCA?(T3SRFTZfq+i7kvH!{c=xy;U!>b+1U{s@j66UM$GG+-EjT) zBX@Q`!Wtw>YZQ3Vk6Awlklcw3hw8`a9=`-xQJ?#A5J`usRpmgb43f(Jy62FmGX7w z32-7*(Oa1*2Czf*9^gb7v$duGOuhrP*N^gk6zBj>@Z%1gfTO9hH%O@NA)F8i0-bY! zWNrf|QtKd-UKLI}T8d-Y3s`j#Wzs6=@o!+Ir../../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; }