mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 22:27:20 +02:00
Auto-submit bot start in subscription settings.
This commit is contained in:
parent
916f86b401
commit
17b2d043cb
3 changed files with 19 additions and 2 deletions
|
@ -36,6 +36,7 @@ struct ClickHandlerContext {
|
|||
Fn<HistoryView::ElementDelegate*()> elementDelegate;
|
||||
base::weak_ptr<Window::SessionController> sessionWindow;
|
||||
bool skipBotAutoLogin = false;
|
||||
bool botStartAutoSubmit = false;
|
||||
// Is filled from peer info.
|
||||
PeerData *peer = nullptr;
|
||||
};
|
||||
|
|
|
@ -366,7 +366,7 @@ bool ResolveUsernameOrPhone(
|
|||
startToken = gameParam;
|
||||
resolveType = ResolveType::ShareGame;
|
||||
}
|
||||
const auto fromMessageId = context.value<ClickHandlerContext>().itemId;
|
||||
const auto myContext = context.value<ClickHandlerContext>();
|
||||
using Navigation = Window::SessionNavigation;
|
||||
controller->showPeerByLink(Navigation::PeerByLinkInfo{
|
||||
.usernameOrId = domain,
|
||||
|
@ -384,6 +384,7 @@ bool ResolveUsernameOrPhone(
|
|||
.resolveType = resolveType,
|
||||
.startToken = startToken,
|
||||
.startAdminRights = adminRights,
|
||||
.startAutoSubmit = myContext.botStartAutoSubmit,
|
||||
.attachBotUsername = params.value(u"attach"_q),
|
||||
.attachBotToggleCommand = (params.contains(u"startattach"_q)
|
||||
? params.value(u"startattach"_q)
|
||||
|
@ -397,7 +398,7 @@ bool ResolveUsernameOrPhone(
|
|||
: params.contains(u"voicechat"_q)
|
||||
? std::make_optional(params.value(u"voicechat"_q))
|
||||
: std::nullopt),
|
||||
.clickFromMessageId = fromMessageId,
|
||||
.clickFromMessageId = myContext.itemId,
|
||||
});
|
||||
controller->window().activate();
|
||||
return true;
|
||||
|
|
|
@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
#include "base/random.h"
|
||||
#include "core/application.h"
|
||||
#include "core/click_handler_types.h"
|
||||
#include "data/data_peer_values.h"
|
||||
#include "info/info_wrap_widget.h" // Info::Wrap.
|
||||
#include "info/settings/info_settings_widget.h" // SectionCustomTopBarData.
|
||||
|
@ -926,6 +927,20 @@ QPointer<Ui::RpWidget> Premium::createPinnedToBottom(
|
|||
button->resizeToWidth(width - padding.left() - padding.right());
|
||||
}, status->lifetime());
|
||||
|
||||
const auto controller = _controller;
|
||||
status->entity()->setClickHandlerFilter([=](
|
||||
const ClickHandlerPtr &handler,
|
||||
Qt::MouseButton button) {
|
||||
ActivateClickHandler(status, handler, {
|
||||
button,
|
||||
QVariant::fromValue(ClickHandlerContext{
|
||||
.sessionWindow = base::make_weak(controller.get()),
|
||||
.botStartAutoSubmit = true,
|
||||
})
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
const auto session = &_controller->session();
|
||||
rpl::combine(
|
||||
terms->heightValue(),
|
||||
|
|
Loading…
Add table
Reference in a new issue