From d0597407d8828b33c95f23b1dc5ccd2b91cd584b Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 15 Jan 2020 16:30:29 +0300 Subject: [PATCH] Support creating polls from bot keyboards. --- Telegram/Resources/tl/api.tl | 1 + .../SourceFiles/boxes/create_poll_box.cpp | 54 ++++++++++++------- Telegram/SourceFiles/boxes/create_poll_box.h | 10 ++-- Telegram/SourceFiles/data/data_peer.cpp | 11 ++++ Telegram/SourceFiles/data/data_peer.h | 1 + Telegram/SourceFiles/facades.cpp | 14 +++++ .../history/history_item_components.cpp | 15 ++++++ .../history/history_item_components.h | 1 + .../SourceFiles/window/window_peer_menu.cpp | 19 +++++-- .../SourceFiles/window/window_peer_menu.h | 7 ++- 10 files changed, 104 insertions(+), 29 deletions(-) diff --git a/Telegram/Resources/tl/api.tl b/Telegram/Resources/tl/api.tl index d4e1991d0d..a7cddc5c3f 100644 --- a/Telegram/Resources/tl/api.tl +++ b/Telegram/Resources/tl/api.tl @@ -547,6 +547,7 @@ keyboardButtonGame#50f41ccf text:string = KeyboardButton; keyboardButtonBuy#afd93fbb text:string = KeyboardButton; keyboardButtonUrlAuth#10b78d29 flags:# text:string fwd_text:flags.0?string url:string button_id:int = KeyboardButton; inputKeyboardButtonUrlAuth#d02e7fd4 flags:# request_write_access:flags.0?true text:string fwd_text:flags.1?string url:string bot:InputUser = KeyboardButton; +keyboardButtonRequestPoll#bbc7515d flags:# quiz:flags.0?Bool text:string = KeyboardButton; keyboardButtonRow#77608b83 buttons:Vector = KeyboardButtonRow; diff --git a/Telegram/SourceFiles/boxes/create_poll_box.cpp b/Telegram/SourceFiles/boxes/create_poll_box.cpp index e2813eac7f..7e39924085 100644 --- a/Telegram/SourceFiles/boxes/create_poll_box.cpp +++ b/Telegram/SourceFiles/boxes/create_poll_box.cpp @@ -45,7 +45,8 @@ public: Options( not_null outer, not_null container, - not_null session); + not_null session, + bool chooseCorrectEnabled); [[nodiscard]] bool isValid() const; [[nodiscard]] rpl::producer isValidChanged() const; @@ -128,6 +129,8 @@ private: void destroy(std::unique_ptr