diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 8a2fc0de7..9e465962b 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -1352,27 +1352,30 @@ void ApiWrap::migrateFail(not_null peer, const QString &error) { void ApiWrap::markContentsRead( const base::flat_set> &items) { + const auto settings = &AyuSettings::getInstance(); + auto markedIds = QVector(); auto channelMarkedIds = base::flat_map< not_null, QVector>(); markedIds.reserve(items.size()); for (const auto &item : items) { + const auto passthrough = (item->isUnreadMention() || item->hasUnreadReaction()) && !item->isUnreadMedia(); + if (!item->markContentsRead(true) || !item->isRegular()) { continue; } + + if (!settings->sendReadMessages && !passthrough) { + continue; + } + if (const auto channel = item->history()->peer->asChannel()) { channelMarkedIds[channel].push_back(MTP_int(item->id)); } else { markedIds.push_back(MTP_int(item->id)); } } - - const auto settings = &AyuSettings::getInstance(); - if (!settings->sendReadMessages) { - return; - } - if (!markedIds.isEmpty()) { request(MTPmessages_ReadMessageContents( MTP_vector(markedIds) @@ -1389,12 +1392,14 @@ void ApiWrap::markContentsRead( } void ApiWrap::markContentsRead(not_null item) { + const auto passthrough = (item->isUnreadMention() || item->hasUnreadReaction()) && !item->isUnreadMedia(); + if (!item->markContentsRead(true) || !item->isRegular()) { return; } const auto settings = &AyuSettings::getInstance(); - if (!settings->sendReadMessages) { + if (!settings->sendReadMessages && !passthrough) { return; } diff --git a/Telegram/SourceFiles/ayu/features/streamer_mode/streamer_mode_windows.cpp b/Telegram/SourceFiles/ayu/features/streamer_mode/streamer_mode_windows.cpp index f389797d3..600394fa6 100644 --- a/Telegram/SourceFiles/ayu/features/streamer_mode/streamer_mode_windows.cpp +++ b/Telegram/SourceFiles/ayu/features/streamer_mode/streamer_mode_windows.cpp @@ -24,6 +24,10 @@ void enable() { auto handle = Core::App().activeWindow()->widget()->psHwnd(); SetWindowDisplayAffinity(handle, WDA_EXCLUDEFROMCAPTURE); + Core::App().enumerateWindows([&](not_null w) { + SetWindowDisplayAffinity(w->widget()->psHwnd(), WDA_EXCLUDEFROMCAPTURE); + }); + isEnabledVal = true; } @@ -31,6 +35,10 @@ void disable() { auto handle = Core::App().activeWindow()->widget()->psHwnd(); SetWindowDisplayAffinity(handle, WDA_NONE); + Core::App().enumerateWindows([&](not_null w) { + SetWindowDisplayAffinity(w->widget()->psHwnd(), WDA_NONE); + }); + isEnabledVal = false; } diff --git a/Telegram/SourceFiles/ayu/utils/telegram_helpers.cpp b/Telegram/SourceFiles/ayu/utils/telegram_helpers.cpp index 62eb2787b..5567ab8d2 100644 --- a/Telegram/SourceFiles/ayu/utils/telegram_helpers.cpp +++ b/Telegram/SourceFiles/ayu/utils/telegram_helpers.cpp @@ -517,10 +517,10 @@ QString getMediaDC(not_null message) { return {}; } -QString getUserDC(not_null user) { - if (user->hasUserpic()) { +QString getPeerDC(not_null peer) { + if (peer->hasUserpic()) { const auto dc = v::match( - user->userpicLocation().file().data, + peer->userpicLocation().file().data, [&](const StorageFileLocation &data) { return data.dcId(); diff --git a/Telegram/SourceFiles/ayu/utils/telegram_helpers.h b/Telegram/SourceFiles/ayu/utils/telegram_helpers.h index f026f3542..e416b1f93 100644 --- a/Telegram/SourceFiles/ayu/utils/telegram_helpers.h +++ b/Telegram/SourceFiles/ayu/utils/telegram_helpers.h @@ -43,7 +43,7 @@ QString getMediaName(not_null message); QString getMediaResolution(not_null message); QString getMediaDC(not_null message); -QString getUserDC(not_null user); +QString getPeerDC(not_null peer); int getScheduleTime(int64 sumSize); diff --git a/Telegram/SourceFiles/boxes/sticker_set_box.cpp b/Telegram/SourceFiles/boxes/sticker_set_box.cpp index f3c02c2d1..0a98761ff 100644 --- a/Telegram/SourceFiles/boxes/sticker_set_box.cpp +++ b/Telegram/SourceFiles/boxes/sticker_set_box.cpp @@ -63,6 +63,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL // AyuGram includes #include "ayu/utils/telegram_helpers.h" +#include "styles/style_ayu_styles.h" #include "window/window_session_controller.h" #include "data/data_user.h" @@ -1392,6 +1393,18 @@ void StickerSetBox::Inner::paintSticker( (_singleSize.width() - size.width()) / 2, (_singleSize.height() - size.height()) / 2); auto lottieFrame = QImage(); + + if (sticker->setType == Data::StickersType::Stickers) { + QPainterPath path; + path.addRoundedRect(QRectF(ppos, size), st::stickerRoundingSize, st::stickerRoundingSize); + + p.save(); + + p.setRenderHint(QPainter::Antialiasing, true); + p.setClipPath(path); + p.setRenderHint(QPainter::Antialiasing, false); + } + if (element.emoji) { element.emoji->paint(p, { .textColor = st::windowFg->c, @@ -1425,6 +1438,11 @@ void StickerSetBox::Inner::paintSticker( QRect(ppos, size), _pathGradient.get()); } + + if (sticker->setType == Data::StickersType::Stickers) { + p.restore(); + } + if (premium) { _premiumMark.paint( p, diff --git a/Telegram/SourceFiles/core/application.cpp b/Telegram/SourceFiles/core/application.cpp index 372aa8d21..db9a85b88 100644 --- a/Telegram/SourceFiles/core/application.cpp +++ b/Telegram/SourceFiles/core/application.cpp @@ -109,6 +109,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include +// AyuGram includes +#include "ayu/features/streamer_mode/streamer_mode.h" + + namespace Core { namespace { @@ -505,6 +509,10 @@ void Application::processCreatedWindow( not_null window) { window->openInMediaViewRequests( ) | rpl::start_to_stream(_openInMediaViewRequests, window->lifetime()); + + if (AyuFeatures::StreamerMode::isEnabled()) { + AyuFeatures::StreamerMode::hideWidgetWindow(window->widget()); + } } void Application::startMediaView() { diff --git a/Telegram/SourceFiles/core/application.h b/Telegram/SourceFiles/core/application.h index 77fe09b7f..28975d474 100644 --- a/Telegram/SourceFiles/core/application.h +++ b/Telegram/SourceFiles/core/application.h @@ -334,6 +334,9 @@ public: void preventOrInvoke(Fn &&callback); + void enumerateWindows( + Fn)> callback) const; + // Global runtime variables. void setScreenIsLocked(bool locked); bool screenIsLocked() const; @@ -364,8 +367,6 @@ private: void updateWindowTitles(); void setLastActiveWindow(Window::Controller *window); void showAccount(not_null account); - void enumerateWindows( - Fn)> callback) const; void processCreatedWindow(not_null window); void refreshApplicationIcon(Main::Session *session); diff --git a/Telegram/SourceFiles/core/launcher.cpp b/Telegram/SourceFiles/core/launcher.cpp index 50af38902..518b7d05b 100644 --- a/Telegram/SourceFiles/core/launcher.cpp +++ b/Telegram/SourceFiles/core/launcher.cpp @@ -516,7 +516,7 @@ void Launcher::processArguments() { { "-tosettings" , KeyFormat::NoValues }, { "-startintray" , KeyFormat::NoValues }, { "-quit" , KeyFormat::NoValues }, - { "-ghost" , KeyFormat::NoValues }, + { "-ghost" , KeyFormat::NoValues }, { "-sendpath" , KeyFormat::AllLeftValues }, { "-workdir" , KeyFormat::OneValue }, { "--" , KeyFormat::OneValue }, diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index ea1b66983..5996f889e 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -1156,7 +1156,7 @@ object_ptr DetailsFiller::setupInfo() { } if (settings->showPeerId != 0) { - const auto dataCenter = getUserDC(user); + const auto dataCenter = getPeerDC(_peer); const auto idLabel = dataCenter.isEmpty() ? QString("ID") : dataCenter; auto idDrawableText = IDValue( @@ -1277,6 +1277,9 @@ object_ptr DetailsFiller::setupInfo() { } if (settings->showPeerId != 0 && !_topic) { + const auto dataCenter = getPeerDC(_peer); + const auto idLabel = dataCenter.isEmpty() ? QString("ID") : dataCenter; + auto idDrawableText = IDValue( _peer ) | rpl::map([](TextWithEntities &&text) @@ -1284,7 +1287,7 @@ object_ptr DetailsFiller::setupInfo() { return Ui::Text::Code(text.text); }); auto idInfo = addInfoOneLine( - rpl::single(QString("ID")), + idLabel, std::move(idDrawableText), tr::ayu_ContextCopyID(tr::now) ); diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index f05e40fa1..e4b892a3e 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -1138,7 +1138,7 @@ void Filler::addJumpToBeginning() { } else if (group && !chat) { jumpToDate(controller->session().data().history(group), showPeerHistory); } else if (chat && !topic) { - if (!chat->migrateFrom()) { + if (!chat->migrateFrom() && chat->availableMinId() == 1) { showPeerHistory(chat, 1); } else { jumpToDate(controller->session().data().history(chat), showPeerHistory);