mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Detach ComposeControls from SessionController.
This commit is contained in:
@@ -917,6 +917,14 @@ rpl::producer<bool> Application::appDeactivatedValue() const {
|
||||
});
|
||||
}
|
||||
|
||||
void Application::materializeLocalDrafts() {
|
||||
_materializeLocalDraftsRequests.fire({});
|
||||
}
|
||||
|
||||
rpl::producer<> Application::materializeLocalDraftsRequests() const {
|
||||
return _materializeLocalDraftsRequests.events();
|
||||
}
|
||||
|
||||
void Application::switchDebugMode() {
|
||||
if (Logs::DebugEnabled()) {
|
||||
Logs::SetDebugEnabled(false);
|
||||
|
@@ -314,6 +314,9 @@ public:
|
||||
void handleAppDeactivated();
|
||||
[[nodiscard]] rpl::producer<bool> appDeactivatedValue() const;
|
||||
|
||||
void materializeLocalDrafts();
|
||||
[[nodiscard]] rpl::producer<> materializeLocalDraftsRequests() const;
|
||||
|
||||
void switchDebugMode();
|
||||
void writeInstallBetaVersionsSetting();
|
||||
|
||||
@@ -444,6 +447,8 @@ private:
|
||||
|
||||
rpl::event_stream<Media::View::OpenRequest> _openInMediaViewRequests;
|
||||
|
||||
rpl::event_stream<> _materializeLocalDraftsRequests;
|
||||
|
||||
rpl::lifetime _lifetime;
|
||||
|
||||
crl::time _lastNonIdleTime = 0;
|
||||
|
@@ -146,7 +146,7 @@ void HiddenUrlClickHandler::Open(QString url, QVariant context) {
|
||||
if (my.show) {
|
||||
my.show->showBox(std::move(box));
|
||||
} else if (use) {
|
||||
use->show(std::move(box), Ui::LayerOption::KeepOther);
|
||||
use->show(std::move(box));
|
||||
}
|
||||
} else {
|
||||
open();
|
||||
@@ -335,16 +335,13 @@ void MonospaceClickHandler::onClick(ClickContext context) const {
|
||||
const auto hasCopyRestriction = item
|
||||
&& (!item->history()->peer->allowsForwarding()
|
||||
|| item->forbidsForward());
|
||||
const auto toastParent = Window::Show(controller).toastParent();
|
||||
if (hasCopyRestriction) {
|
||||
Ui::Toast::Show(
|
||||
toastParent,
|
||||
item->history()->peer->isBroadcast()
|
||||
? tr::lng_error_nocopy_channel(tr::now)
|
||||
: tr::lng_error_nocopy_group(tr::now));
|
||||
controller->showToast(item->history()->peer->isBroadcast()
|
||||
? tr::lng_error_nocopy_channel(tr::now)
|
||||
: tr::lng_error_nocopy_group(tr::now));
|
||||
return;
|
||||
}
|
||||
Ui::Toast::Show(toastParent, tr::lng_text_copied(tr::now));
|
||||
controller->showToast(tr::lng_text_copied(tr::now));
|
||||
}
|
||||
TextUtilities::SetClipboardText(TextForMimeData::Simple(_text.trimmed()));
|
||||
}
|
||||
|
@@ -100,7 +100,7 @@ bool ShowStickerSet(
|
||||
}
|
||||
Core::App().hideMediaView();
|
||||
controller->show(Box<StickerSetBox>(
|
||||
controller,
|
||||
controller->uiShow(),
|
||||
StickerSetIdentifier{ .shortName = match->captured(2) },
|
||||
(match->captured(1) == "addemoji"
|
||||
? Data::StickersType::Emoji
|
||||
@@ -607,9 +607,7 @@ bool ShowInviteLink(
|
||||
return false;
|
||||
}
|
||||
QGuiApplication::clipboard()->setText(link);
|
||||
Ui::Toast::Show(
|
||||
Window::Show(controller).toastParent(),
|
||||
tr::lng_group_invite_copied(tr::now));
|
||||
controller->showToast(tr::lng_group_invite_copied(tr::now));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -626,12 +624,12 @@ void ExportTestChatTheme(
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<const Data::CloudTheme*> theme) {
|
||||
const auto session = &controller->session();
|
||||
const auto show = std::make_shared<Window::Show>(controller);
|
||||
const auto show = controller->uiShow();
|
||||
const auto inputSettings = [&](Data::CloudThemeType type)
|
||||
-> std::optional<MTPInputThemeSettings> {
|
||||
const auto i = theme->settings.find(type);
|
||||
if (i == end(theme->settings)) {
|
||||
Ui::Toast::Show(show->toastParent(), "Something went wrong :(");
|
||||
show->showToast(u"Something went wrong :("_q);
|
||||
return std::nullopt;
|
||||
}
|
||||
const auto &fields = i->second;
|
||||
@@ -639,17 +637,15 @@ void ExportTestChatTheme(
|
||||
|| !fields.paper->isPattern()
|
||||
|| fields.paper->backgroundColors().empty()
|
||||
|| !fields.paper->hasShareUrl()) {
|
||||
Ui::Toast::Show(show->toastParent(), "Something went wrong :(");
|
||||
show->showToast(u"Something went wrong :("_q);
|
||||
return std::nullopt;
|
||||
}
|
||||
const auto &bg = fields.paper->backgroundColors();
|
||||
const auto url = fields.paper->shareUrl(session);
|
||||
const auto url = fields.paper->shareUrl(&show->session());
|
||||
const auto from = url.indexOf("bg/");
|
||||
const auto till = url.indexOf("?");
|
||||
if (from < 0 || till <= from) {
|
||||
Ui::Toast::Show(
|
||||
show->toastParent(),
|
||||
"Bad WallPaper link: " + url);
|
||||
show->showToast(u"Bad WallPaper link: "_q + url);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
@@ -731,15 +727,9 @@ void ExportTestChatTheme(
|
||||
const auto slug = Data::CloudTheme::Parse(session, result, true).slug;
|
||||
QGuiApplication::clipboard()->setText(
|
||||
session->createInternalLinkFull("addtheme/" + slug));
|
||||
if (show->valid()) {
|
||||
Ui::Toast::Show(
|
||||
show->toastParent(),
|
||||
tr::lng_background_link_copied(tr::now));
|
||||
}
|
||||
show->showToast(tr::lng_background_link_copied(tr::now));
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
if (show->valid()) {
|
||||
Ui::Toast::Show(show->toastParent(), "Error: " + error.type());
|
||||
}
|
||||
show->showToast(u"Error: "_q + error.type());
|
||||
}).send();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user