From 2a8e035f4220d7b42a2caac4b6b8f74d9efe1700 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 5 Jul 2022 23:36:36 +0400 Subject: [PATCH] For testing insert stickers as custom emoji. --- Telegram/SourceFiles/history/history_widget.cpp | 10 ++++++++++ .../view/controls/history_view_compose_controls.cpp | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index d4eb57ae84..00542b5a82 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -167,6 +167,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include +#include "data/stickers/data_custom_emoji.h" + const char kOptionAutoScrollInactiveChat[] = "auto-scroll-inactive-chat"; @@ -424,10 +426,14 @@ HistoryWidget::HistoryWidget( _fieldAutocomplete->stickerChosen( ) | rpl::start_with_next([=](FieldAutocomplete::StickerChosen data) { + Data::InsertCustomEmoji(_field.data(), data.sticker); + AssertIsDebug(); +#if 0 controller->sendingAnimation().appendSending( data.messageSendingFrom); const auto localId = data.messageSendingFrom.localId; sendExistingDocument(data.sticker, data.options, localId); +#endif }, lifetime()); _fieldAutocomplete->setModerateKeyActivateCallback([=](int key) { @@ -1053,12 +1059,16 @@ void HistoryWidget::initTabbedSelector() { selector->fileChosen( ) | filter | rpl::start_with_next([=](Selector::FileChosen data) { + Data::InsertCustomEmoji(_field.data(), data.document); + AssertIsDebug(); +#if 0 controller()->sendingAnimation().appendSending( data.messageSendingFrom); sendExistingDocument( data.document, data.options, data.messageSendingFrom.localId); +#endif }, lifetime()); selector->photoChosen( diff --git a/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp b/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp index da4d23433c..24f0ec4267 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp @@ -60,6 +60,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "window/window_session_controller.h" #include "mainwindow.h" +#include "data/stickers/data_custom_emoji.h" + namespace HistoryView { namespace { @@ -1485,6 +1487,9 @@ void ComposeControls::initAutocomplete() { _autocomplete->stickerChosen( ) | rpl::start_with_next([=](FieldAutocomplete::StickerChosen data) { + Data::InsertCustomEmoji(_field, data.sticker); + AssertIsDebug(); +#if 0 if (!_showSlowmodeError || !_showSlowmodeError()) { setText({}); } @@ -1497,6 +1502,7 @@ void ComposeControls::initAutocomplete() { .options = data.options, .messageSendingFrom = base::take(data.messageSendingFrom), }); +#endif }, _autocomplete->lifetime()); _autocomplete->choosingProcesses( @@ -1829,7 +1835,13 @@ void ComposeControls::initTabbedSelector() { }, wrap->lifetime()); selector->fileChosen( + ) | rpl::start_with_next([=](const FileChosen &data) { + Data::InsertCustomEmoji(_field, data.document); + AssertIsDebug(); + }, wrap->lifetime()); +#if 0 ) | rpl::start_to_stream(_fileChosen, wrap->lifetime()); +#endif selector->photoChosen( ) | rpl::start_to_stream(_photoChosen, wrap->lifetime());