mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
fix: a bunch of useful fixes
This commit is contained in:
parent
c4e1e8415c
commit
a851bebc75
10 changed files with 60 additions and 17 deletions
|
@ -1352,27 +1352,30 @@ void ApiWrap::migrateFail(not_null<PeerData*> peer, const QString &error) {
|
|||
|
||||
void ApiWrap::markContentsRead(
|
||||
const base::flat_set<not_null<HistoryItem*>> &items) {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
|
||||
auto markedIds = QVector<MTPint>();
|
||||
auto channelMarkedIds = base::flat_map<
|
||||
not_null<ChannelData*>,
|
||||
QVector<MTPint>>();
|
||||
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<MTPint>(markedIds)
|
||||
|
@ -1389,12 +1392,14 @@ void ApiWrap::markContentsRead(
|
|||
}
|
||||
|
||||
void ApiWrap::markContentsRead(not_null<HistoryItem*> 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,10 @@ void enable() {
|
|||
auto handle = Core::App().activeWindow()->widget()->psHwnd();
|
||||
SetWindowDisplayAffinity(handle, WDA_EXCLUDEFROMCAPTURE);
|
||||
|
||||
Core::App().enumerateWindows([&](not_null<Window::Controller*> 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<Window::Controller*> w) {
|
||||
SetWindowDisplayAffinity(w->widget()->psHwnd(), WDA_NONE);
|
||||
});
|
||||
|
||||
isEnabledVal = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -517,10 +517,10 @@ QString getMediaDC(not_null<HistoryItem*> message) {
|
|||
return {};
|
||||
}
|
||||
|
||||
QString getUserDC(not_null<UserData*> user) {
|
||||
if (user->hasUserpic()) {
|
||||
QString getPeerDC(not_null<PeerData*> peer) {
|
||||
if (peer->hasUserpic()) {
|
||||
const auto dc = v::match(
|
||||
user->userpicLocation().file().data,
|
||||
peer->userpicLocation().file().data,
|
||||
[&](const StorageFileLocation &data)
|
||||
{
|
||||
return data.dcId();
|
||||
|
|
|
@ -43,7 +43,7 @@ QString getMediaName(not_null<HistoryItem*> message);
|
|||
QString getMediaResolution(not_null<HistoryItem*> message);
|
||||
QString getMediaDC(not_null<HistoryItem*> message);
|
||||
|
||||
QString getUserDC(not_null<UserData*> user);
|
||||
QString getPeerDC(not_null<PeerData*> peer);
|
||||
|
||||
int getScheduleTime(int64 sumSize);
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -109,6 +109,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include <QtGui/QScreen>
|
||||
#include <QtGui/QWindow>
|
||||
|
||||
// AyuGram includes
|
||||
#include "ayu/features/streamer_mode/streamer_mode.h"
|
||||
|
||||
|
||||
namespace Core {
|
||||
namespace {
|
||||
|
||||
|
@ -505,6 +509,10 @@ void Application::processCreatedWindow(
|
|||
not_null<Window::Controller*> window) {
|
||||
window->openInMediaViewRequests(
|
||||
) | rpl::start_to_stream(_openInMediaViewRequests, window->lifetime());
|
||||
|
||||
if (AyuFeatures::StreamerMode::isEnabled()) {
|
||||
AyuFeatures::StreamerMode::hideWidgetWindow(window->widget());
|
||||
}
|
||||
}
|
||||
|
||||
void Application::startMediaView() {
|
||||
|
|
|
@ -334,6 +334,9 @@ public:
|
|||
|
||||
void preventOrInvoke(Fn<void()> &&callback);
|
||||
|
||||
void enumerateWindows(
|
||||
Fn<void(not_null<Window::Controller*>)> 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<Main::Account*> account);
|
||||
void enumerateWindows(
|
||||
Fn<void(not_null<Window::Controller*>)> callback) const;
|
||||
void processCreatedWindow(not_null<Window::Controller*> window);
|
||||
void refreshApplicationIcon(Main::Session *session);
|
||||
|
||||
|
|
|
@ -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 },
|
||||
|
|
|
@ -1156,7 +1156,7 @@ object_ptr<Ui::RpWidget> 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<Ui::RpWidget> 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<Ui::RpWidget> DetailsFiller::setupInfo() {
|
|||
return Ui::Text::Code(text.text);
|
||||
});
|
||||
auto idInfo = addInfoOneLine(
|
||||
rpl::single(QString("ID")),
|
||||
idLabel,
|
||||
std::move(idDrawableText),
|
||||
tr::ayu_ContextCopyID(tr::now)
|
||||
);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue