mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-13 04:37:11 +02:00
feat: rework disableStories
This commit is contained in:
parent
115517fae1
commit
74abaccab3
3 changed files with 17 additions and 29 deletions
|
@ -152,13 +152,6 @@ Main::Session &Stories::session() const {
|
|||
}
|
||||
|
||||
void Stories::apply(const MTPDupdateStory &data) {
|
||||
// AyuGram disableStories
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->disableStories)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const auto peerId = peerFromMTP(data.vpeer());
|
||||
const auto peer = _owner->peer(peerId);
|
||||
const auto now = base::unixtime::now();
|
||||
|
@ -208,13 +201,6 @@ void Stories::apply(const MTPDupdateStory &data) {
|
|||
}
|
||||
|
||||
void Stories::apply(const MTPDupdateReadStories &data) {
|
||||
// AyuGram disableStories
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->disableStories)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bumpReadTill(peerFromMTP(data.vpeer()), data.vmax_id().v);
|
||||
}
|
||||
|
||||
|
@ -227,13 +213,6 @@ void Stories::apply(const MTPStoriesStealthMode &stealthMode) {
|
|||
}
|
||||
|
||||
void Stories::apply(not_null<PeerData*> peer, const MTPPeerStories *data) {
|
||||
// AyuGram disableStories
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->disableStories)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data) {
|
||||
applyDeletedFromSources(peer->id, StorySourcesList::NotHidden);
|
||||
applyDeletedFromSources(peer->id, StorySourcesList::Hidden);
|
||||
|
@ -246,12 +225,6 @@ void Stories::apply(not_null<PeerData*> peer, const MTPPeerStories *data) {
|
|||
}
|
||||
|
||||
Story *Stories::applySingle(PeerId peerId, const MTPstoryItem &story) {
|
||||
// AyuGram disableStories
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->disableStories)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
const auto idDates = parseAndApply(
|
||||
_owner->peer(peerId),
|
||||
story,
|
||||
|
|
|
@ -31,6 +31,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "base/unixtime.h"
|
||||
#include "styles/style_dialogs.h"
|
||||
|
||||
// AyuGram includes
|
||||
#include "ayu/ayu_settings.h"
|
||||
|
||||
|
||||
namespace Dialogs {
|
||||
namespace {
|
||||
|
||||
|
@ -444,10 +448,12 @@ void Row::paintUserpic(
|
|||
updateCornerBadgeShown(peer);
|
||||
}
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
|
||||
const auto cornerBadgeShown = !_cornerBadgeUserpic
|
||||
? _cornerBadgeShown
|
||||
: !_cornerBadgeUserpic->layersManager.isDisplayedNone();
|
||||
const auto storiesPeer = peer
|
||||
const auto storiesPeer = settings->disableStories ? nullptr : peer
|
||||
? ((peer->isUser() || peer->isBroadcast()) ? peer : nullptr)
|
||||
: nullptr;
|
||||
const auto storiesFolder = peer ? nullptr : _id.folder();
|
||||
|
|
|
@ -558,11 +558,13 @@ void Widget::chosenRow(const ChosenRow &row) {
|
|||
}
|
||||
return;
|
||||
} else if (history) {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto peer = history->peer;
|
||||
if (row.message.fullId.msg == ShowAtUnreadMsgId) {
|
||||
if (row.userpicClick
|
||||
&& peer->hasActiveStories()
|
||||
&& !peer->isSelf()) {
|
||||
&& !peer->isSelf()
|
||||
&& !settings->disableStories) {
|
||||
controller()->openPeerStories(peer->id);
|
||||
return;
|
||||
}
|
||||
|
@ -1519,6 +1521,13 @@ void Widget::updateStoriesVisibility() {
|
|||
if (!_stories) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->disableStories) {
|
||||
_stories->setVisible(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto hidden = (_showAnimation != nullptr)
|
||||
|| _openedForum
|
||||
|| !_widthAnimationCache.isNull()
|
||||
|
|
Loading…
Add table
Reference in a new issue