mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Removed App::wnd from local_url_handlers.
This commit is contained in:
parent
94468ecf6d
commit
58008ab7b0
1 changed files with 29 additions and 27 deletions
|
@ -64,7 +64,7 @@ bool ShowStickerSet(
|
||||||
}
|
}
|
||||||
Core::App().hideMediaView();
|
Core::App().hideMediaView();
|
||||||
Ui::show(Box<StickerSetBox>(
|
Ui::show(Box<StickerSetBox>(
|
||||||
App::wnd()->sessionController(),
|
controller,
|
||||||
MTP_inputStickerSetShortName(MTP_string(match->captured(1)))));
|
MTP_inputStickerSetShortName(MTP_string(match->captured(1)))));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ bool ShareUrl(
|
||||||
auto url = params.value(qsl("url"));
|
auto url = params.value(qsl("url"));
|
||||||
if (url.isEmpty()) {
|
if (url.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
} else if (const auto controller = App::wnd()->sessionController()) {
|
} else {
|
||||||
controller->content()->shareUrlLayer(url, params.value("text"));
|
controller->content()->shareUrlLayer(url, params.value("text"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,12 @@ bool ApplyMtprotoProxy(
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ShowPassportForm(const QMap<QString, QString> ¶ms) {
|
bool ShowPassportForm(
|
||||||
|
Window::SessionController *controller,
|
||||||
|
const QMap<QString, QString> ¶ms) {
|
||||||
|
if (!controller) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
const auto botId = params.value("bot_id", QString()).toInt();
|
const auto botId = params.value("bot_id", QString()).toInt();
|
||||||
const auto scope = params.value("scope", QString());
|
const auto scope = params.value("scope", QString());
|
||||||
const auto callback = params.value("callback_url", QString());
|
const auto callback = params.value("callback_url", QString());
|
||||||
|
@ -190,28 +195,25 @@ bool ShowPassportForm(const QMap<QString, QString> ¶ms) {
|
||||||
Passport::NonceNameByScope(scope),
|
Passport::NonceNameByScope(scope),
|
||||||
QString());
|
QString());
|
||||||
const auto errors = params.value("errors", QString());
|
const auto errors = params.value("errors", QString());
|
||||||
if (const auto window = App::wnd()) {
|
controller->showPassportForm(Passport::FormRequest(
|
||||||
if (const auto controller = window->sessionController()) {
|
botId,
|
||||||
controller->showPassportForm(Passport::FormRequest(
|
scope,
|
||||||
botId,
|
callback,
|
||||||
scope,
|
publicKey,
|
||||||
callback,
|
nonce,
|
||||||
publicKey,
|
errors));
|
||||||
nonce,
|
return true;
|
||||||
errors));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ShowPassport(
|
bool ShowPassport(
|
||||||
Window::SessionController *controller,
|
Window::SessionController *controller,
|
||||||
const Match &match,
|
const Match &match,
|
||||||
const QVariant &context) {
|
const QVariant &context) {
|
||||||
return ShowPassportForm(url_parse_params(
|
return ShowPassportForm(
|
||||||
match->captured(1),
|
controller,
|
||||||
qthelp::UrlParamNameTransform::ToLower));
|
url_parse_params(
|
||||||
|
match->captured(1),
|
||||||
|
qthelp::UrlParamNameTransform::ToLower));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ShowWallPaper(
|
bool ShowWallPaper(
|
||||||
|
@ -225,7 +227,7 @@ bool ShowWallPaper(
|
||||||
match->captured(1),
|
match->captured(1),
|
||||||
qthelp::UrlParamNameTransform::ToLower);
|
qthelp::UrlParamNameTransform::ToLower);
|
||||||
return BackgroundPreviewBox::Start(
|
return BackgroundPreviewBox::Start(
|
||||||
App::wnd()->sessionController(),
|
controller,
|
||||||
params.value(qsl("slug")),
|
params.value(qsl("slug")),
|
||||||
params);
|
params);
|
||||||
}
|
}
|
||||||
|
@ -249,7 +251,7 @@ bool ResolveUsername(
|
||||||
).valid();
|
).valid();
|
||||||
};
|
};
|
||||||
if (domain == qsl("telegrampassport")) {
|
if (domain == qsl("telegrampassport")) {
|
||||||
return ShowPassportForm(params);
|
return ShowPassportForm(controller, params);
|
||||||
} else if (!valid(domain)) {
|
} else if (!valid(domain)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -335,14 +337,14 @@ bool ResolveSettings(
|
||||||
Window::SessionController *controller,
|
Window::SessionController *controller,
|
||||||
const Match &match,
|
const Match &match,
|
||||||
const QVariant &context) {
|
const QVariant &context) {
|
||||||
const auto section = match->captured(1).mid(1).toLower();
|
|
||||||
if (!controller) {
|
if (!controller) {
|
||||||
if (section.isEmpty()) {
|
|
||||||
controller->window().showSettings();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
const auto section = match->captured(1).mid(1).toLower();
|
||||||
|
if (section.isEmpty()) {
|
||||||
|
controller->window().showSettings();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (section == qstr("devices")) {
|
if (section == qstr("devices")) {
|
||||||
Ui::show(Box<SessionsBox>(&controller->session()));
|
Ui::show(Box<SessionsBox>(&controller->session()));
|
||||||
return true;
|
return true;
|
||||||
|
@ -353,7 +355,7 @@ bool ResolveSettings(
|
||||||
const auto type = (section == qstr("folders"))
|
const auto type = (section == qstr("folders"))
|
||||||
? ::Settings::Type::Folders
|
? ::Settings::Type::Folders
|
||||||
: ::Settings::Type::Main;
|
: ::Settings::Type::Main;
|
||||||
App::wnd()->sessionController()->showSettings(type);
|
controller->showSettings(type);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue