2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Proof of concept webview attach menu support.

This commit is contained in:
John Preston
2022-03-25 18:13:30 +04:00
parent 841da9dde8
commit 1d8aac26ce
8 changed files with 706 additions and 56 deletions

View File

@@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/layers/layer_widget.h"
#include "ui/layers/show.h"
#include "window/window_adaptive.h"
#include "mtproto/sender.h"
class PhotoData;
class MainWidget;
@@ -60,6 +61,14 @@ struct ChatThemeBackgroundData;
class MessageSendingAnimationController;
} // namespace Ui
namespace Ui::BotWebView {
class Panel;
} // namespace Ui::BotWebView
namespace InlineBots {
struct ResultSelected;
} // namespace InlineBots
namespace Data {
struct CloudTheme;
enum class CloudThemeType;
@@ -195,9 +204,12 @@ public:
FullMsgId clickFromMessageId;
};
void showPeerByLink(const PeerByLinkInfo &info);
void showAttachWebview(
void resolveAttachWebview(
not_null<PeerData*> peer,
const QString &botUsername);
[[nodiscard]] auto inlineResultConfirmed() const
-> rpl::producer<InlineBots::ResultSelected>;
void showRepliesForMessage(
not_null<History*> history,
@@ -266,14 +278,34 @@ private:
not_null<PeerData*> peer,
const PeerByLinkInfo &info);
void requestAttachWebview(
not_null<PeerData*> peer,
not_null<UserData*> bot);
void requestAddToMenu(not_null<UserData*> bot, Fn<void()> callback);
void showAttachWebview(
not_null<PeerData*> peer,
not_null<UserData*> bot,
uint64 queryId,
const QString &url);
void toggleInMenu(
not_null<UserData*> bot,
bool enabled,
Fn<void()> callback);
const not_null<Main::Session*> _session;
MTP::Sender _api;
mtpRequestId _resolveRequestId = 0;
History *_showingRepliesHistory = nullptr;
MsgId _showingRepliesRootId = 0;
mtpRequestId _showingRepliesRequestId = 0;
std::unique_ptr<Ui::BotWebView::Panel> _botWebView;
rpl::event_stream<InlineBots::ResultSelected> _inlineResultConfirmed;
};
class SessionController : public SessionNavigation {