mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
feat: hide stories (thx 64Gram)
This commit is contained in:
parent
576671e222
commit
5a0a93d8d4
7 changed files with 84 additions and 5 deletions
|
@ -211,6 +211,11 @@ namespace AyuSettings
|
|||
enableAds = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_disableStories(bool val)
|
||||
{
|
||||
disableStories = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_deletedMark(QString val)
|
||||
{
|
||||
deletedMark = std::move(val);
|
||||
|
|
|
@ -104,6 +104,10 @@ namespace AyuSettings
|
|||
|
||||
void set_enableAds(bool val);
|
||||
|
||||
void set_disableStories(bool val);
|
||||
|
||||
void set_copyUsernameAsLink(bool val);
|
||||
|
||||
void set_deletedMark(QString val);
|
||||
|
||||
void set_editedMark(QString val);
|
||||
|
@ -121,8 +125,6 @@ namespace AyuSettings
|
|||
void set_gifConfirmation(bool val);
|
||||
|
||||
void set_voiceConfirmation(bool val);
|
||||
|
||||
void set_copyUsernameAsLink(bool val);
|
||||
};
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(
|
||||
|
@ -137,6 +139,8 @@ namespace AyuSettings
|
|||
saveDeletedMessages,
|
||||
saveMessagesHistory,
|
||||
enableAds,
|
||||
disableStories,
|
||||
copyUsernameAsLink,
|
||||
deletedMark,
|
||||
editedMark,
|
||||
recentStickersCount,
|
||||
|
@ -145,8 +149,7 @@ namespace AyuSettings
|
|||
showMessageSeconds,
|
||||
stickerConfirmation,
|
||||
gifConfirmation,
|
||||
voiceConfirmation,
|
||||
copyUsernameAsLink
|
||||
voiceConfirmation
|
||||
);
|
||||
|
||||
AyuGramSettings& getInstance();
|
||||
|
|
|
@ -228,6 +228,22 @@ namespace Settings
|
|||
AyuSettings::save();
|
||||
}, container->lifetime());
|
||||
|
||||
AddButton(
|
||||
container,
|
||||
tr::ayu_DisableStories(),
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(
|
||||
rpl::single(settings->disableStories)
|
||||
)->toggledValue(
|
||||
) | rpl::filter([=](bool enabled)
|
||||
{
|
||||
return (enabled != settings->disableStories);
|
||||
}) | start_with_next([=](bool enabled)
|
||||
{
|
||||
settings->set_disableStories(enabled);
|
||||
AyuSettings::save();
|
||||
}, container->lifetime());
|
||||
|
||||
AddButton(
|
||||
container,
|
||||
tr::ayu_CopyUsernameAsLink(),
|
||||
|
|
|
@ -320,7 +320,12 @@ Session::Session(not_null<Main::Session*> session)
|
|||
}
|
||||
}, _lifetime);
|
||||
|
||||
_stories->loadMore(Data::StorySourcesList::NotHidden);
|
||||
// AyuGram disableStories
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (!settings->disableStories)
|
||||
{
|
||||
_stories->loadMore(Data::StorySourcesList::NotHidden);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -126,6 +126,13 @@ 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 = peerFromUser(data.vuser_id());
|
||||
const auto user = not_null(_owner->peer(peerId)->asUser());
|
||||
const auto now = base::unixtime::now();
|
||||
|
@ -175,10 +182,24 @@ void Stories::apply(const MTPDupdateStory &data) {
|
|||
}
|
||||
|
||||
void Stories::apply(const MTPDupdateReadStories &data) {
|
||||
// AyuGram disableStories
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->disableStories)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bumpReadTill(peerFromUser(data.vuser_id()), data.vmax_id().v);
|
||||
}
|
||||
|
||||
void Stories::apply(not_null<PeerData*> peer, const MTPUserStories *data) {
|
||||
// AyuGram disableStories
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->disableStories)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data) {
|
||||
applyDeletedFromSources(peer->id, StorySourcesList::NotHidden);
|
||||
applyDeletedFromSources(peer->id, StorySourcesList::Hidden);
|
||||
|
@ -191,6 +212,13 @@ void Stories::apply(not_null<PeerData*> peer, const MTPUserStories *data) {
|
|||
}
|
||||
|
||||
Story *Stories::applyFromWebpage(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,
|
||||
|
|
|
@ -79,6 +79,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include <QtCore/QMimeData>
|
||||
#include <QtWidgets/QScrollBar>
|
||||
|
||||
// AyuGram includes
|
||||
#include "ayu/ayu_settings.h"
|
||||
|
||||
|
||||
namespace Dialogs {
|
||||
namespace {
|
||||
|
||||
|
@ -793,6 +797,13 @@ void Widget::setupMainMenuToggle() {
|
|||
}
|
||||
|
||||
void Widget::setupStories() {
|
||||
// AyuGram disableStories
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->disableStories)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_stories->verticalScrollEvents(
|
||||
) | rpl::start_with_next([=](not_null<QWheelEvent*> e) {
|
||||
_scroll->viewportEvent(e);
|
||||
|
|
|
@ -35,6 +35,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "styles/style_dialogs.h"
|
||||
#include "styles/style_info.h"
|
||||
|
||||
// AyuGram includes
|
||||
#include "ayu/ayu_settings.h"
|
||||
|
||||
|
||||
namespace Info {
|
||||
|
||||
TopBar::TopBar(
|
||||
|
@ -453,6 +457,13 @@ void TopBar::updateControlsVisibility(anim::type animated) {
|
|||
}
|
||||
|
||||
void TopBar::setStories(rpl::producer<Dialogs::Stories::Content> content) {
|
||||
// AyuGram disableStories
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->disableStories)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_storiesLifetime.destroy();
|
||||
delete _storiesWrap.data();
|
||||
if (content) {
|
||||
|
|
Loading…
Add table
Reference in a new issue