mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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;
|
Fn<HistoryView::ElementDelegate*()> elementDelegate;
|
||||||
base::weak_ptr<Window::SessionController> sessionWindow;
|
base::weak_ptr<Window::SessionController> sessionWindow;
|
||||||
bool skipBotAutoLogin = false;
|
bool skipBotAutoLogin = false;
|
||||||
|
bool botStartAutoSubmit = false;
|
||||||
// Is filled from peer info.
|
// Is filled from peer info.
|
||||||
PeerData *peer = nullptr;
|
PeerData *peer = nullptr;
|
||||||
};
|
};
|
||||||
|
|
|
@ -366,7 +366,7 @@ bool ResolveUsernameOrPhone(
|
||||||
startToken = gameParam;
|
startToken = gameParam;
|
||||||
resolveType = ResolveType::ShareGame;
|
resolveType = ResolveType::ShareGame;
|
||||||
}
|
}
|
||||||
const auto fromMessageId = context.value<ClickHandlerContext>().itemId;
|
const auto myContext = context.value<ClickHandlerContext>();
|
||||||
using Navigation = Window::SessionNavigation;
|
using Navigation = Window::SessionNavigation;
|
||||||
controller->showPeerByLink(Navigation::PeerByLinkInfo{
|
controller->showPeerByLink(Navigation::PeerByLinkInfo{
|
||||||
.usernameOrId = domain,
|
.usernameOrId = domain,
|
||||||
|
@ -384,6 +384,7 @@ bool ResolveUsernameOrPhone(
|
||||||
.resolveType = resolveType,
|
.resolveType = resolveType,
|
||||||
.startToken = startToken,
|
.startToken = startToken,
|
||||||
.startAdminRights = adminRights,
|
.startAdminRights = adminRights,
|
||||||
|
.startAutoSubmit = myContext.botStartAutoSubmit,
|
||||||
.attachBotUsername = params.value(u"attach"_q),
|
.attachBotUsername = params.value(u"attach"_q),
|
||||||
.attachBotToggleCommand = (params.contains(u"startattach"_q)
|
.attachBotToggleCommand = (params.contains(u"startattach"_q)
|
||||||
? params.value(u"startattach"_q)
|
? params.value(u"startattach"_q)
|
||||||
|
@ -397,7 +398,7 @@ bool ResolveUsernameOrPhone(
|
||||||
: params.contains(u"voicechat"_q)
|
: params.contains(u"voicechat"_q)
|
||||||
? std::make_optional(params.value(u"voicechat"_q))
|
? std::make_optional(params.value(u"voicechat"_q))
|
||||||
: std::nullopt),
|
: std::nullopt),
|
||||||
.clickFromMessageId = fromMessageId,
|
.clickFromMessageId = myContext.itemId,
|
||||||
});
|
});
|
||||||
controller->window().activate();
|
controller->window().activate();
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include "base/random.h"
|
#include "base/random.h"
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
|
#include "core/click_handler_types.h"
|
||||||
#include "data/data_peer_values.h"
|
#include "data/data_peer_values.h"
|
||||||
#include "info/info_wrap_widget.h" // Info::Wrap.
|
#include "info/info_wrap_widget.h" // Info::Wrap.
|
||||||
#include "info/settings/info_settings_widget.h" // SectionCustomTopBarData.
|
#include "info/settings/info_settings_widget.h" // SectionCustomTopBarData.
|
||||||
|
@ -926,6 +927,20 @@ QPointer<Ui::RpWidget> Premium::createPinnedToBottom(
|
||||||
button->resizeToWidth(width - padding.left() - padding.right());
|
button->resizeToWidth(width - padding.left() - padding.right());
|
||||||
}, status->lifetime());
|
}, 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();
|
const auto session = &_controller->session();
|
||||||
rpl::combine(
|
rpl::combine(
|
||||||
terms->heightValue(),
|
terms->heightValue(),
|
||||||
|
|
Loading…
Add table
Reference in a new issue