mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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;
|
enableAds = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AyuGramSettings::set_disableStories(bool val)
|
||||||
|
{
|
||||||
|
disableStories = val;
|
||||||
|
}
|
||||||
|
|
||||||
void AyuGramSettings::set_deletedMark(QString val)
|
void AyuGramSettings::set_deletedMark(QString val)
|
||||||
{
|
{
|
||||||
deletedMark = std::move(val);
|
deletedMark = std::move(val);
|
||||||
|
|
|
@ -104,6 +104,10 @@ namespace AyuSettings
|
||||||
|
|
||||||
void set_enableAds(bool val);
|
void set_enableAds(bool val);
|
||||||
|
|
||||||
|
void set_disableStories(bool val);
|
||||||
|
|
||||||
|
void set_copyUsernameAsLink(bool val);
|
||||||
|
|
||||||
void set_deletedMark(QString val);
|
void set_deletedMark(QString val);
|
||||||
|
|
||||||
void set_editedMark(QString val);
|
void set_editedMark(QString val);
|
||||||
|
@ -121,8 +125,6 @@ namespace AyuSettings
|
||||||
void set_gifConfirmation(bool val);
|
void set_gifConfirmation(bool val);
|
||||||
|
|
||||||
void set_voiceConfirmation(bool val);
|
void set_voiceConfirmation(bool val);
|
||||||
|
|
||||||
void set_copyUsernameAsLink(bool val);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(
|
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(
|
||||||
|
@ -137,6 +139,8 @@ namespace AyuSettings
|
||||||
saveDeletedMessages,
|
saveDeletedMessages,
|
||||||
saveMessagesHistory,
|
saveMessagesHistory,
|
||||||
enableAds,
|
enableAds,
|
||||||
|
disableStories,
|
||||||
|
copyUsernameAsLink,
|
||||||
deletedMark,
|
deletedMark,
|
||||||
editedMark,
|
editedMark,
|
||||||
recentStickersCount,
|
recentStickersCount,
|
||||||
|
@ -145,8 +149,7 @@ namespace AyuSettings
|
||||||
showMessageSeconds,
|
showMessageSeconds,
|
||||||
stickerConfirmation,
|
stickerConfirmation,
|
||||||
gifConfirmation,
|
gifConfirmation,
|
||||||
voiceConfirmation,
|
voiceConfirmation
|
||||||
copyUsernameAsLink
|
|
||||||
);
|
);
|
||||||
|
|
||||||
AyuGramSettings& getInstance();
|
AyuGramSettings& getInstance();
|
||||||
|
|
|
@ -228,6 +228,22 @@ namespace Settings
|
||||||
AyuSettings::save();
|
AyuSettings::save();
|
||||||
}, container->lifetime());
|
}, 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(
|
AddButton(
|
||||||
container,
|
container,
|
||||||
tr::ayu_CopyUsernameAsLink(),
|
tr::ayu_CopyUsernameAsLink(),
|
||||||
|
|
|
@ -320,7 +320,12 @@ Session::Session(not_null<Main::Session*> session)
|
||||||
}
|
}
|
||||||
}, _lifetime);
|
}, _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) {
|
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 peerId = peerFromUser(data.vuser_id());
|
||||||
const auto user = not_null(_owner->peer(peerId)->asUser());
|
const auto user = not_null(_owner->peer(peerId)->asUser());
|
||||||
const auto now = base::unixtime::now();
|
const auto now = base::unixtime::now();
|
||||||
|
@ -175,10 +182,24 @@ 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(peerFromUser(data.vuser_id()), data.vmax_id().v);
|
bumpReadTill(peerFromUser(data.vuser_id()), data.vmax_id().v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stories::apply(not_null<PeerData*> peer, const MTPUserStories *data) {
|
void Stories::apply(not_null<PeerData*> peer, const MTPUserStories *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);
|
||||||
|
@ -191,6 +212,13 @@ void Stories::apply(not_null<PeerData*> peer, const MTPUserStories *data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Story *Stories::applyFromWebpage(PeerId peerId, const MTPstoryItem &story) {
|
Story *Stories::applyFromWebpage(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,
|
||||||
|
|
|
@ -79,6 +79,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include <QtCore/QMimeData>
|
#include <QtCore/QMimeData>
|
||||||
#include <QtWidgets/QScrollBar>
|
#include <QtWidgets/QScrollBar>
|
||||||
|
|
||||||
|
// AyuGram includes
|
||||||
|
#include "ayu/ayu_settings.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Dialogs {
|
namespace Dialogs {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -793,6 +797,13 @@ void Widget::setupMainMenuToggle() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::setupStories() {
|
void Widget::setupStories() {
|
||||||
|
// AyuGram disableStories
|
||||||
|
const auto settings = &AyuSettings::getInstance();
|
||||||
|
if (settings->disableStories)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_stories->verticalScrollEvents(
|
_stories->verticalScrollEvents(
|
||||||
) | rpl::start_with_next([=](not_null<QWheelEvent*> e) {
|
) | rpl::start_with_next([=](not_null<QWheelEvent*> e) {
|
||||||
_scroll->viewportEvent(e);
|
_scroll->viewportEvent(e);
|
||||||
|
|
|
@ -35,6 +35,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "styles/style_dialogs.h"
|
#include "styles/style_dialogs.h"
|
||||||
#include "styles/style_info.h"
|
#include "styles/style_info.h"
|
||||||
|
|
||||||
|
// AyuGram includes
|
||||||
|
#include "ayu/ayu_settings.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Info {
|
namespace Info {
|
||||||
|
|
||||||
TopBar::TopBar(
|
TopBar::TopBar(
|
||||||
|
@ -453,6 +457,13 @@ void TopBar::updateControlsVisibility(anim::type animated) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TopBar::setStories(rpl::producer<Dialogs::Stories::Content> content) {
|
void TopBar::setStories(rpl::producer<Dialogs::Stories::Content> content) {
|
||||||
|
// AyuGram disableStories
|
||||||
|
const auto settings = &AyuSettings::getInstance();
|
||||||
|
if (settings->disableStories)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_storiesLifetime.destroy();
|
_storiesLifetime.destroy();
|
||||||
delete _storiesWrap.data();
|
delete _storiesWrap.data();
|
||||||
if (content) {
|
if (content) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue