mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 13:17:08 +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) {
|
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 peerId = peerFromMTP(data.vpeer());
|
||||||
const auto peer = _owner->peer(peerId);
|
const auto peer = _owner->peer(peerId);
|
||||||
const auto now = base::unixtime::now();
|
const auto now = base::unixtime::now();
|
||||||
|
@ -208,13 +201,6 @@ void Stories::apply(const MTPDupdateStory &data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stories::apply(const MTPDupdateReadStories &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);
|
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) {
|
void Stories::apply(not_null<PeerData*> peer, const MTPPeerStories *data) {
|
||||||
// AyuGram disableStories
|
|
||||||
const auto settings = &AyuSettings::getInstance();
|
|
||||||
if (settings->disableStories)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
applyDeletedFromSources(peer->id, StorySourcesList::NotHidden);
|
applyDeletedFromSources(peer->id, StorySourcesList::NotHidden);
|
||||||
applyDeletedFromSources(peer->id, StorySourcesList::Hidden);
|
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) {
|
Story *Stories::applySingle(PeerId peerId, const MTPstoryItem &story) {
|
||||||
// AyuGram disableStories
|
|
||||||
const auto settings = &AyuSettings::getInstance();
|
|
||||||
if (settings->disableStories)
|
|
||||||
{
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
const auto idDates = parseAndApply(
|
const auto idDates = parseAndApply(
|
||||||
_owner->peer(peerId),
|
_owner->peer(peerId),
|
||||||
story,
|
story,
|
||||||
|
|
|
@ -31,6 +31,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "base/unixtime.h"
|
#include "base/unixtime.h"
|
||||||
#include "styles/style_dialogs.h"
|
#include "styles/style_dialogs.h"
|
||||||
|
|
||||||
|
// AyuGram includes
|
||||||
|
#include "ayu/ayu_settings.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Dialogs {
|
namespace Dialogs {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -444,10 +448,12 @@ void Row::paintUserpic(
|
||||||
updateCornerBadgeShown(peer);
|
updateCornerBadgeShown(peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto settings = &AyuSettings::getInstance();
|
||||||
|
|
||||||
const auto cornerBadgeShown = !_cornerBadgeUserpic
|
const auto cornerBadgeShown = !_cornerBadgeUserpic
|
||||||
? _cornerBadgeShown
|
? _cornerBadgeShown
|
||||||
: !_cornerBadgeUserpic->layersManager.isDisplayedNone();
|
: !_cornerBadgeUserpic->layersManager.isDisplayedNone();
|
||||||
const auto storiesPeer = peer
|
const auto storiesPeer = settings->disableStories ? nullptr : peer
|
||||||
? ((peer->isUser() || peer->isBroadcast()) ? peer : nullptr)
|
? ((peer->isUser() || peer->isBroadcast()) ? peer : nullptr)
|
||||||
: nullptr;
|
: nullptr;
|
||||||
const auto storiesFolder = peer ? nullptr : _id.folder();
|
const auto storiesFolder = peer ? nullptr : _id.folder();
|
||||||
|
|
|
@ -558,11 +558,13 @@ void Widget::chosenRow(const ChosenRow &row) {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else if (history) {
|
} else if (history) {
|
||||||
|
const auto settings = &AyuSettings::getInstance();
|
||||||
const auto peer = history->peer;
|
const auto peer = history->peer;
|
||||||
if (row.message.fullId.msg == ShowAtUnreadMsgId) {
|
if (row.message.fullId.msg == ShowAtUnreadMsgId) {
|
||||||
if (row.userpicClick
|
if (row.userpicClick
|
||||||
&& peer->hasActiveStories()
|
&& peer->hasActiveStories()
|
||||||
&& !peer->isSelf()) {
|
&& !peer->isSelf()
|
||||||
|
&& !settings->disableStories) {
|
||||||
controller()->openPeerStories(peer->id);
|
controller()->openPeerStories(peer->id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1519,6 +1521,13 @@ void Widget::updateStoriesVisibility() {
|
||||||
if (!_stories) {
|
if (!_stories) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto settings = &AyuSettings::getInstance();
|
||||||
|
if (settings->disableStories) {
|
||||||
|
_stories->setVisible(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const auto hidden = (_showAnimation != nullptr)
|
const auto hidden = (_showAnimation != nullptr)
|
||||||
|| _openedForum
|
|| _openedForum
|
||||||
|| !_widthAnimationCache.isNull()
|
|| !_widthAnimationCache.isNull()
|
||||||
|
|
Loading…
Add table
Reference in a new issue