From e5ca216c993640a6c199bf8a4e94f21f05962aff Mon Sep 17 00:00:00 2001 From: AlexeyZavar Date: Mon, 7 Jul 2025 02:56:10 +0300 Subject: [PATCH] fix: make it build --- .../ayu/features/forward/ayu_forward.cpp | 8 ++++---- .../SourceFiles/ayu/features/forward/ayu_forward.h | 2 +- .../ayu/features/messageshot/message_shot.cpp | 8 +++++--- .../ayu/ui/message_history/history_inner.cpp | 5 +++-- .../ayu/ui/message_history/history_inner.h | 2 +- .../SourceFiles/ayu/utils/telegram_helpers.cpp | 7 +++++-- Telegram/SourceFiles/boxes/about_box.cpp | 14 +++++++++++++- Telegram/SourceFiles/boxes/about_box.h | 6 +++++- Telegram/SourceFiles/history/history_widget.cpp | 1 - .../platform/linux/main_window_linux.cpp | 2 +- .../SourceFiles/platform/mac/main_window_mac.mm | 2 +- Telegram/SourceFiles/window/window_main_menu.cpp | 2 +- Telegram/lib_ui | 2 +- lib/xdg/com.ayugram.desktop.desktop | 6 +++--- lib/xdg/com.ayugram.desktop.metainfo.xml | 2 +- lib/xdg/com.ayugram.desktop.service | 2 +- 16 files changed, 46 insertions(+), 25 deletions(-) diff --git a/Telegram/SourceFiles/ayu/features/forward/ayu_forward.cpp b/Telegram/SourceFiles/ayu/features/forward/ayu_forward.cpp index 651666b543..92f977e308 100644 --- a/Telegram/SourceFiles/ayu/features/forward/ayu_forward.cpp +++ b/Telegram/SourceFiles/ayu/features/forward/ayu_forward.cpp @@ -141,7 +141,7 @@ static Ui::PreparedList prepareMedia(not_null session, void sendMedia( not_null session, - std::shared_ptr bundle, + const std::shared_ptr &bundle, not_null primaryMedia, Api::MessageToSend &&message, bool sendImagesAsPhotos) { @@ -230,9 +230,9 @@ struct ForwardChunk void intelligentForward( not_null session, const Api::SendAction &action, - Data::ResolvedForwardDraft draft) { + const Data::ResolvedForwardDraft &draft) { const auto history = action.history; - history->setForwardDraft(action.replyTo.topicRootId, {}); + history->setForwardDraft(action.replyTo.topicRootId, action.replyTo.monoforumPeerId, {}); const auto items = draft.items; const auto peer = history->peer; @@ -296,7 +296,7 @@ void forwardMessages( const auto history = action.history; const auto peer = history->peer; - history->setForwardDraft(action.replyTo.topicRootId, {}); + history->setForwardDraft(action.replyTo.topicRootId, action.replyTo.monoforumPeerId, {}); std::shared_ptr state; diff --git a/Telegram/SourceFiles/ayu/features/forward/ayu_forward.h b/Telegram/SourceFiles/ayu/features/forward/ayu_forward.h index cd582624f4..08b91e7e0e 100644 --- a/Telegram/SourceFiles/ayu/features/forward/ayu_forward.h +++ b/Telegram/SourceFiles/ayu/features/forward/ayu_forward.h @@ -42,7 +42,7 @@ bool isFullAyuForwardNeeded(not_null item); void intelligentForward( not_null session, const Api::SendAction &action, - Data::ResolvedForwardDraft draft); + const Data::ResolvedForwardDraft &draft); void forwardMessages( not_null session, const Api::SendAction &action, diff --git a/Telegram/SourceFiles/ayu/features/messageshot/message_shot.cpp b/Telegram/SourceFiles/ayu/features/messageshot/message_shot.cpp index b653f6fd2f..50d012cafe 100644 --- a/Telegram/SourceFiles/ayu/features/messageshot/message_shot.cpp +++ b/Telegram/SourceFiles/ayu/features/messageshot/message_shot.cpp @@ -161,7 +161,7 @@ public: not_null elementPathShiftGradient() override; HistoryView::Context elementContext() override; bool elementHideReply(not_null view) override; - bool elementIsChatWide() override; + HistoryView::ElementChatMode elementChatMode() override; private: const not_null _parent; @@ -207,8 +207,10 @@ bool MessageShotDelegate::elementHideReply(not_null return false; } -bool MessageShotDelegate::elementIsChatWide() { - return true; +HistoryView::ElementChatMode MessageShotDelegate::elementChatMode() { + using Mode = HistoryView::ElementChatMode; + // Mode::Wide; + return Mode::Default; } QImage removeEmptySpaceAround(const QImage &original) { diff --git a/Telegram/SourceFiles/ayu/ui/message_history/history_inner.cpp b/Telegram/SourceFiles/ayu/ui/message_history/history_inner.cpp index 8065f2d577..8c12508895 100644 --- a/Telegram/SourceFiles/ayu/ui/message_history/history_inner.cpp +++ b/Telegram/SourceFiles/ayu/ui/message_history/history_inner.cpp @@ -594,8 +594,9 @@ void InnerWidget::elementSearchInList( void InnerWidget::elementHandleViaClick(not_null bot) { } -bool InnerWidget::elementIsChatWide() { - return _isChatWide; +HistoryView::ElementChatMode InnerWidget::elementChatMode() { + using Mode = HistoryView::ElementChatMode; + return _isChatWide ? Mode::Wide : Mode::Default; } not_null InnerWidget::elementPathShiftGradient() { diff --git a/Telegram/SourceFiles/ayu/ui/message_history/history_inner.h b/Telegram/SourceFiles/ayu/ui/message_history/history_inner.h index d1017d5097..3fd1fe1f4f 100644 --- a/Telegram/SourceFiles/ayu/ui/message_history/history_inner.h +++ b/Telegram/SourceFiles/ayu/ui/message_history/history_inner.h @@ -120,7 +120,7 @@ public: const QString &query, const FullMsgId &context) override; void elementHandleViaClick(not_null bot) override; - bool elementIsChatWide() override; + HistoryView::ElementChatMode elementChatMode() override; not_null elementPathShiftGradient() override; void elementReplyTo(const FullReplyTo &to) override; void elementStartInteraction( diff --git a/Telegram/SourceFiles/ayu/utils/telegram_helpers.cpp b/Telegram/SourceFiles/ayu/utils/telegram_helpers.cpp index 612cf70b9b..21b1213079 100644 --- a/Telegram/SourceFiles/ayu/utils/telegram_helpers.cpp +++ b/Telegram/SourceFiles/ayu/utils/telegram_helpers.cpp @@ -37,6 +37,7 @@ #include "ayu/ayu_settings.h" #include "ayu/ayu_state.h" #include "ayu/data/messages_storage.h" +#include "data/data_saved_sublist.h" namespace { @@ -170,13 +171,15 @@ void readReactions(base::weak_ptr weakThread) { return; } const auto topic = thread->asTopic(); + const auto sublist = thread->asSublist(); const auto peer = thread->peer(); const auto rootId = topic ? topic->rootId() : 0; using Flag = MTPmessages_ReadReactions::Flag; peer->session().api().request(MTPmessages_ReadReactions( MTP_flags(rootId ? Flag::f_top_msg_id : Flag(0)), peer->input, - MTP_int(rootId) + MTP_int(rootId), + sublist ? sublist->sublistPeer()->input : MTPInputPeer() )).done([=](const MTPmessages_AffectedHistory &result) { const auto offset = peer->session().api().applyAffectedHistory( @@ -185,7 +188,7 @@ void readReactions(base::weak_ptr weakThread) { if (offset > 0) { readReactions(weakThread); } else { - peer->owner().history(peer)->clearUnreadReactionsFor(rootId); + peer->owner().history(peer)->clearUnreadReactionsFor(rootId, sublist); } }).send(); } diff --git a/Telegram/SourceFiles/boxes/about_box.cpp b/Telegram/SourceFiles/boxes/about_box.cpp index b15f1cabde..4fdf2c7c8e 100644 --- a/Telegram/SourceFiles/boxes/about_box.cpp +++ b/Telegram/SourceFiles/boxes/about_box.cpp @@ -23,6 +23,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include +#include "window/window_session_controller.h" +#include "window/window_session_controller_link_info.h" + namespace { rpl::producer Text() { @@ -40,7 +43,7 @@ rpl::producer Text() { } // namespace -void AboutBox(not_null box) { +void AboutBox(not_null box, Window::SessionController* controller) { box->setTitle(rpl::single(u"AyuGram Desktop"_q)); auto layout = box->verticalLayout(); @@ -75,6 +78,15 @@ void AboutBox(not_null box) { addText(Text()); box->addButton(tr::lng_close(), [=] { box->closeBox(); }); + box->addLeftButton( + rpl::single(QString("@AyuGramReleases")), + [box, controller] + { + box->closeBox(); + controller->showPeerByLink(Window::PeerByLinkInfo{ + .usernameOrId = QString("ayugramreleases"), + }); + }); box->setWidth(st::aboutWidth); } diff --git a/Telegram/SourceFiles/boxes/about_box.h b/Telegram/SourceFiles/boxes/about_box.h index 9382e2d6ac..8bdb04cdd4 100644 --- a/Telegram/SourceFiles/boxes/about_box.h +++ b/Telegram/SourceFiles/boxes/about_box.h @@ -9,6 +9,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/layers/generic_box.h" -void AboutBox(not_null box); +namespace Window { +class SessionController; +} + +void AboutBox(not_null box, Window::SessionController* controller); QString currentVersionText(); diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 5405381324..1cc3d28412 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -2251,7 +2251,6 @@ void HistoryWidget::setupDirectMessageButton() { refreshDirectMessageShown(); } }, _directMessage->lifetime()); - _giftToChannelDiscuss = setupButton(_discuss); } void HistoryWidget::pushReplyReturn(not_null item) { diff --git a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp index 0abf779029..7d18a32054 100644 --- a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp @@ -431,7 +431,7 @@ void MainWindow::createGlobalMenu() { u"AyuGram"_q), [=] { ensureWindowShown(); - controller().show(Box(AboutBox)); + controller().show(Box(AboutBox, sessionController())); }); about->setMenuRole(QAction::AboutQtRole); diff --git a/Telegram/SourceFiles/platform/mac/main_window_mac.mm b/Telegram/SourceFiles/platform/mac/main_window_mac.mm index 0d11bf889d..453b8710ff 100644 --- a/Telegram/SourceFiles/platform/mac/main_window_mac.mm +++ b/Telegram/SourceFiles/platform/mac/main_window_mac.mm @@ -369,7 +369,7 @@ void MainWindow::createGlobalMenu() { { auto callback = [=] { ensureWindowShown(); - controller().show(Box(AboutBox)); + controller().show(Box(AboutBox, sessionController())); }; main->addAction( tr::lng_mac_menu_about_telegram( diff --git a/Telegram/SourceFiles/window/window_main_menu.cpp b/Telegram/SourceFiles/window/window_main_menu.cpp index e9cb5b015f..3946696ef8 100644 --- a/Telegram/SourceFiles/window/window_main_menu.cpp +++ b/Telegram/SourceFiles/window/window_main_menu.cpp @@ -402,7 +402,7 @@ MainMenu::MainMenu( _version->setLink( 2, std::make_shared([=] { - controller->show(Box(AboutBox)); + controller->show(Box(AboutBox, controller)); })); rpl::combine( diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 9523ff72ae..e459dbafe7 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 9523ff72aea22f760c9b99e98b489ced316e0cb8 +Subproject commit e459dbafe77c034b6c48b4fae94ff86e4097bffb diff --git a/lib/xdg/com.ayugram.desktop.desktop b/lib/xdg/com.ayugram.desktop.desktop index d9a12b7532..49256d8e1a 100644 --- a/lib/xdg/com.ayugram.desktop.desktop +++ b/lib/xdg/com.ayugram.desktop.desktop @@ -1,8 +1,8 @@ [Desktop Entry] Name=AyuGram Desktop Comment=Desktop version of AyuGram - ToS breaking Telegram client -TryExec=ayugram-desktop -Exec=env DESKTOPINTEGRATION=1 ayugram-desktop -- %u +TryExec=AyuGram +Exec=env DESKTOPINTEGRATION=1 AyuGram -- %u Icon=com.ayugram.desktop Terminal=false StartupWMClass=AyuGram @@ -17,6 +17,6 @@ X-GNOME-UsesNotifications=true X-GNOME-SingleWindow=true [Desktop Action quit] -Exec=ayugram-desktop -quit +Exec=AyuGram -quit Name=Quit AyuGram Icon=application-exit diff --git a/lib/xdg/com.ayugram.desktop.metainfo.xml b/lib/xdg/com.ayugram.desktop.metainfo.xml index 1eb5209df1..8921f57bf8 100644 --- a/lib/xdg/com.ayugram.desktop.metainfo.xml +++ b/lib/xdg/com.ayugram.desktop.metainfo.xml @@ -75,6 +75,6 @@ com.ayugram.desktop.desktop - ayugram-desktop + AyuGram diff --git a/lib/xdg/com.ayugram.desktop.service b/lib/xdg/com.ayugram.desktop.service index ad031ce3bc..52ec1b527d 100644 --- a/lib/xdg/com.ayugram.desktop.service +++ b/lib/xdg/com.ayugram.desktop.service @@ -1,3 +1,3 @@ [D-BUS Service] Name=com.ayugram.desktop -Exec=@CMAKE_INSTALL_FULL_BINDIR@/ayugram-desktop +Exec=@CMAKE_INSTALL_FULL_BINDIR@/AyuGram