mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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(
|
void ApiWrap::markContentsRead(
|
||||||
const base::flat_set<not_null<HistoryItem*>> &items) {
|
const base::flat_set<not_null<HistoryItem*>> &items) {
|
||||||
|
const auto settings = &AyuSettings::getInstance();
|
||||||
|
|
||||||
auto markedIds = QVector<MTPint>();
|
auto markedIds = QVector<MTPint>();
|
||||||
auto channelMarkedIds = base::flat_map<
|
auto channelMarkedIds = base::flat_map<
|
||||||
not_null<ChannelData*>,
|
not_null<ChannelData*>,
|
||||||
QVector<MTPint>>();
|
QVector<MTPint>>();
|
||||||
markedIds.reserve(items.size());
|
markedIds.reserve(items.size());
|
||||||
for (const auto &item : items) {
|
for (const auto &item : items) {
|
||||||
|
const auto passthrough = (item->isUnreadMention() || item->hasUnreadReaction()) && !item->isUnreadMedia();
|
||||||
|
|
||||||
if (!item->markContentsRead(true) || !item->isRegular()) {
|
if (!item->markContentsRead(true) || !item->isRegular()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!settings->sendReadMessages && !passthrough) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (const auto channel = item->history()->peer->asChannel()) {
|
if (const auto channel = item->history()->peer->asChannel()) {
|
||||||
channelMarkedIds[channel].push_back(MTP_int(item->id));
|
channelMarkedIds[channel].push_back(MTP_int(item->id));
|
||||||
} else {
|
} else {
|
||||||
markedIds.push_back(MTP_int(item->id));
|
markedIds.push_back(MTP_int(item->id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto settings = &AyuSettings::getInstance();
|
|
||||||
if (!settings->sendReadMessages) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!markedIds.isEmpty()) {
|
if (!markedIds.isEmpty()) {
|
||||||
request(MTPmessages_ReadMessageContents(
|
request(MTPmessages_ReadMessageContents(
|
||||||
MTP_vector<MTPint>(markedIds)
|
MTP_vector<MTPint>(markedIds)
|
||||||
|
@ -1389,12 +1392,14 @@ void ApiWrap::markContentsRead(
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApiWrap::markContentsRead(not_null<HistoryItem*> item) {
|
void ApiWrap::markContentsRead(not_null<HistoryItem*> item) {
|
||||||
|
const auto passthrough = (item->isUnreadMention() || item->hasUnreadReaction()) && !item->isUnreadMedia();
|
||||||
|
|
||||||
if (!item->markContentsRead(true) || !item->isRegular()) {
|
if (!item->markContentsRead(true) || !item->isRegular()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto settings = &AyuSettings::getInstance();
|
const auto settings = &AyuSettings::getInstance();
|
||||||
if (!settings->sendReadMessages) {
|
if (!settings->sendReadMessages && !passthrough) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,10 @@ void enable() {
|
||||||
auto handle = Core::App().activeWindow()->widget()->psHwnd();
|
auto handle = Core::App().activeWindow()->widget()->psHwnd();
|
||||||
SetWindowDisplayAffinity(handle, WDA_EXCLUDEFROMCAPTURE);
|
SetWindowDisplayAffinity(handle, WDA_EXCLUDEFROMCAPTURE);
|
||||||
|
|
||||||
|
Core::App().enumerateWindows([&](not_null<Window::Controller*> w) {
|
||||||
|
SetWindowDisplayAffinity(w->widget()->psHwnd(), WDA_EXCLUDEFROMCAPTURE);
|
||||||
|
});
|
||||||
|
|
||||||
isEnabledVal = true;
|
isEnabledVal = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +35,10 @@ void disable() {
|
||||||
auto handle = Core::App().activeWindow()->widget()->psHwnd();
|
auto handle = Core::App().activeWindow()->widget()->psHwnd();
|
||||||
SetWindowDisplayAffinity(handle, WDA_NONE);
|
SetWindowDisplayAffinity(handle, WDA_NONE);
|
||||||
|
|
||||||
|
Core::App().enumerateWindows([&](not_null<Window::Controller*> w) {
|
||||||
|
SetWindowDisplayAffinity(w->widget()->psHwnd(), WDA_NONE);
|
||||||
|
});
|
||||||
|
|
||||||
isEnabledVal = false;
|
isEnabledVal = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -517,10 +517,10 @@ QString getMediaDC(not_null<HistoryItem*> message) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
QString getUserDC(not_null<UserData*> user) {
|
QString getPeerDC(not_null<PeerData*> peer) {
|
||||||
if (user->hasUserpic()) {
|
if (peer->hasUserpic()) {
|
||||||
const auto dc = v::match(
|
const auto dc = v::match(
|
||||||
user->userpicLocation().file().data,
|
peer->userpicLocation().file().data,
|
||||||
[&](const StorageFileLocation &data)
|
[&](const StorageFileLocation &data)
|
||||||
{
|
{
|
||||||
return data.dcId();
|
return data.dcId();
|
||||||
|
|
|
@ -43,7 +43,7 @@ QString getMediaName(not_null<HistoryItem*> message);
|
||||||
QString getMediaResolution(not_null<HistoryItem*> message);
|
QString getMediaResolution(not_null<HistoryItem*> message);
|
||||||
QString getMediaDC(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);
|
int getScheduleTime(int64 sumSize);
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
// AyuGram includes
|
// AyuGram includes
|
||||||
#include "ayu/utils/telegram_helpers.h"
|
#include "ayu/utils/telegram_helpers.h"
|
||||||
|
#include "styles/style_ayu_styles.h"
|
||||||
#include "window/window_session_controller.h"
|
#include "window/window_session_controller.h"
|
||||||
#include "data/data_user.h"
|
#include "data/data_user.h"
|
||||||
|
|
||||||
|
@ -1392,6 +1393,18 @@ void StickerSetBox::Inner::paintSticker(
|
||||||
(_singleSize.width() - size.width()) / 2,
|
(_singleSize.width() - size.width()) / 2,
|
||||||
(_singleSize.height() - size.height()) / 2);
|
(_singleSize.height() - size.height()) / 2);
|
||||||
auto lottieFrame = QImage();
|
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) {
|
if (element.emoji) {
|
||||||
element.emoji->paint(p, {
|
element.emoji->paint(p, {
|
||||||
.textColor = st::windowFg->c,
|
.textColor = st::windowFg->c,
|
||||||
|
@ -1425,6 +1438,11 @@ void StickerSetBox::Inner::paintSticker(
|
||||||
QRect(ppos, size),
|
QRect(ppos, size),
|
||||||
_pathGradient.get());
|
_pathGradient.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sticker->setType == Data::StickersType::Stickers) {
|
||||||
|
p.restore();
|
||||||
|
}
|
||||||
|
|
||||||
if (premium) {
|
if (premium) {
|
||||||
_premiumMark.paint(
|
_premiumMark.paint(
|
||||||
p,
|
p,
|
||||||
|
|
|
@ -109,6 +109,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include <QtGui/QScreen>
|
#include <QtGui/QScreen>
|
||||||
#include <QtGui/QWindow>
|
#include <QtGui/QWindow>
|
||||||
|
|
||||||
|
// AyuGram includes
|
||||||
|
#include "ayu/features/streamer_mode/streamer_mode.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -505,6 +509,10 @@ void Application::processCreatedWindow(
|
||||||
not_null<Window::Controller*> window) {
|
not_null<Window::Controller*> window) {
|
||||||
window->openInMediaViewRequests(
|
window->openInMediaViewRequests(
|
||||||
) | rpl::start_to_stream(_openInMediaViewRequests, window->lifetime());
|
) | rpl::start_to_stream(_openInMediaViewRequests, window->lifetime());
|
||||||
|
|
||||||
|
if (AyuFeatures::StreamerMode::isEnabled()) {
|
||||||
|
AyuFeatures::StreamerMode::hideWidgetWindow(window->widget());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::startMediaView() {
|
void Application::startMediaView() {
|
||||||
|
|
|
@ -334,6 +334,9 @@ public:
|
||||||
|
|
||||||
void preventOrInvoke(Fn<void()> &&callback);
|
void preventOrInvoke(Fn<void()> &&callback);
|
||||||
|
|
||||||
|
void enumerateWindows(
|
||||||
|
Fn<void(not_null<Window::Controller*>)> callback) const;
|
||||||
|
|
||||||
// Global runtime variables.
|
// Global runtime variables.
|
||||||
void setScreenIsLocked(bool locked);
|
void setScreenIsLocked(bool locked);
|
||||||
bool screenIsLocked() const;
|
bool screenIsLocked() const;
|
||||||
|
@ -364,8 +367,6 @@ private:
|
||||||
void updateWindowTitles();
|
void updateWindowTitles();
|
||||||
void setLastActiveWindow(Window::Controller *window);
|
void setLastActiveWindow(Window::Controller *window);
|
||||||
void showAccount(not_null<Main::Account*> account);
|
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 processCreatedWindow(not_null<Window::Controller*> window);
|
||||||
void refreshApplicationIcon(Main::Session *session);
|
void refreshApplicationIcon(Main::Session *session);
|
||||||
|
|
||||||
|
|
|
@ -516,7 +516,7 @@ void Launcher::processArguments() {
|
||||||
{ "-tosettings" , KeyFormat::NoValues },
|
{ "-tosettings" , KeyFormat::NoValues },
|
||||||
{ "-startintray" , KeyFormat::NoValues },
|
{ "-startintray" , KeyFormat::NoValues },
|
||||||
{ "-quit" , KeyFormat::NoValues },
|
{ "-quit" , KeyFormat::NoValues },
|
||||||
{ "-ghost" , KeyFormat::NoValues },
|
{ "-ghost" , KeyFormat::NoValues },
|
||||||
{ "-sendpath" , KeyFormat::AllLeftValues },
|
{ "-sendpath" , KeyFormat::AllLeftValues },
|
||||||
{ "-workdir" , KeyFormat::OneValue },
|
{ "-workdir" , KeyFormat::OneValue },
|
||||||
{ "--" , KeyFormat::OneValue },
|
{ "--" , KeyFormat::OneValue },
|
||||||
|
|
|
@ -1156,7 +1156,7 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings->showPeerId != 0) {
|
if (settings->showPeerId != 0) {
|
||||||
const auto dataCenter = getUserDC(user);
|
const auto dataCenter = getPeerDC(_peer);
|
||||||
const auto idLabel = dataCenter.isEmpty() ? QString("ID") : dataCenter;
|
const auto idLabel = dataCenter.isEmpty() ? QString("ID") : dataCenter;
|
||||||
|
|
||||||
auto idDrawableText = IDValue(
|
auto idDrawableText = IDValue(
|
||||||
|
@ -1277,6 +1277,9 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings->showPeerId != 0 && !_topic) {
|
if (settings->showPeerId != 0 && !_topic) {
|
||||||
|
const auto dataCenter = getPeerDC(_peer);
|
||||||
|
const auto idLabel = dataCenter.isEmpty() ? QString("ID") : dataCenter;
|
||||||
|
|
||||||
auto idDrawableText = IDValue(
|
auto idDrawableText = IDValue(
|
||||||
_peer
|
_peer
|
||||||
) | rpl::map([](TextWithEntities &&text)
|
) | rpl::map([](TextWithEntities &&text)
|
||||||
|
@ -1284,7 +1287,7 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
|
||||||
return Ui::Text::Code(text.text);
|
return Ui::Text::Code(text.text);
|
||||||
});
|
});
|
||||||
auto idInfo = addInfoOneLine(
|
auto idInfo = addInfoOneLine(
|
||||||
rpl::single(QString("ID")),
|
idLabel,
|
||||||
std::move(idDrawableText),
|
std::move(idDrawableText),
|
||||||
tr::ayu_ContextCopyID(tr::now)
|
tr::ayu_ContextCopyID(tr::now)
|
||||||
);
|
);
|
||||||
|
|
|
@ -1138,7 +1138,7 @@ void Filler::addJumpToBeginning() {
|
||||||
} else if (group && !chat) {
|
} else if (group && !chat) {
|
||||||
jumpToDate(controller->session().data().history(group), showPeerHistory);
|
jumpToDate(controller->session().data().history(group), showPeerHistory);
|
||||||
} else if (chat && !topic) {
|
} else if (chat && !topic) {
|
||||||
if (!chat->migrateFrom()) {
|
if (!chat->migrateFrom() && chat->availableMinId() == 1) {
|
||||||
showPeerHistory(chat, 1);
|
showPeerHistory(chat, 1);
|
||||||
} else {
|
} else {
|
||||||
jumpToDate(controller->session().data().history(chat), showPeerHistory);
|
jumpToDate(controller->session().data().history(chat), showPeerHistory);
|
||||||
|
|
Loading…
Add table
Reference in a new issue