mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
feat: disable similar channels
This commit is contained in:
parent
d6457ebcc7
commit
29dd896c83
7 changed files with 153 additions and 180 deletions
|
@ -4645,7 +4645,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"ayu_HideNextViewsDescriptionAyu" = "Hide my views forever, until Ghost Mode disabled.";
|
"ayu_HideNextViewsDescriptionAyu" = "Hide my views forever, until Ghost Mode disabled.";
|
||||||
"ayu_EnableGhostModeStories" = "Enable Ghost Mode";
|
"ayu_EnableGhostModeStories" = "Enable Ghost Mode";
|
||||||
"ayu_GhostModeIsActive" = "Ghost Mode Is Active";
|
"ayu_GhostModeIsActive" = "Ghost Mode Is Active";
|
||||||
"ayu_SimpleQuotesAndReplies" = "Simple quotes & replies";
|
"ayu_SimpleQuotesAndReplies" = "Disable colorful replies";
|
||||||
|
"ayu_DisableSimilarChannels" = "Disable similar channels";
|
||||||
|
"ayu_CollapseSimilarChannels" = "Collapse similar channels";
|
||||||
|
"ayu_HideSimilarChannelsTab" = "Hide similar channels tab";
|
||||||
"ayu_MainFont" = "Application font";
|
"ayu_MainFont" = "Application font";
|
||||||
"ayu_MonospaceFont" = "Monospace font";
|
"ayu_MonospaceFont" = "Monospace font";
|
||||||
"ayu_FontDefault" = "Default";
|
"ayu_FontDefault" = "Default";
|
||||||
|
|
|
@ -1749,7 +1749,11 @@ void ApiWrap::joinChannel(not_null<ChannelData*> channel) {
|
||||||
|
|
||||||
using Flag = ChannelDataFlag;
|
using Flag = ChannelDataFlag;
|
||||||
chatParticipants().loadSimilarChannels(channel);
|
chatParticipants().loadSimilarChannels(channel);
|
||||||
channel->setFlags(channel->flags() | Flag::SimilarExpanded);
|
|
||||||
|
const auto settings = &AyuSettings::getInstance();
|
||||||
|
if (!settings->collapseSimilarChannels) {
|
||||||
|
channel->setFlags(channel->flags() | Flag::SimilarExpanded);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -225,12 +225,12 @@ void AyuGramSettings::set_useScheduledMessages(bool val)
|
||||||
useScheduledMessages = val;
|
useScheduledMessages = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AyuGramSettings::set_keepDeletedMessages(bool val)
|
void AyuGramSettings::set_saveDeletedMessages(bool val)
|
||||||
{
|
{
|
||||||
saveDeletedMessages = val;
|
saveDeletedMessages = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AyuGramSettings::set_keepMessagesHistory(bool val)
|
void AyuGramSettings::set_saveMessagesHistory(bool val)
|
||||||
{
|
{
|
||||||
saveMessagesHistory = val;
|
saveMessagesHistory = val;
|
||||||
}
|
}
|
||||||
|
@ -245,6 +245,16 @@ void AyuGramSettings::set_disableStories(bool val)
|
||||||
disableStories = val;
|
disableStories = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AyuGramSettings::set_collapseSimilarChannels(bool val)
|
||||||
|
{
|
||||||
|
collapseSimilarChannels = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AyuGramSettings::set_hideSimilarChannels(bool val)
|
||||||
|
{
|
||||||
|
hideSimilarChannels = val;
|
||||||
|
}
|
||||||
|
|
||||||
void AyuGramSettings::set_disableNotificationsDelay(bool val)
|
void AyuGramSettings::set_disableNotificationsDelay(bool val)
|
||||||
{
|
{
|
||||||
disableNotificationsDelay = val;
|
disableNotificationsDelay = val;
|
||||||
|
|
|
@ -54,6 +54,8 @@ public:
|
||||||
// ~ QoL toggles
|
// ~ QoL toggles
|
||||||
disableAds = true;
|
disableAds = true;
|
||||||
disableStories = false;
|
disableStories = false;
|
||||||
|
collapseSimilarChannels = true;
|
||||||
|
hideSimilarChannels = false;
|
||||||
disableNotificationsDelay = false;
|
disableNotificationsDelay = false;
|
||||||
localPremium = false;
|
localPremium = false;
|
||||||
copyUsernameAsLink = true;
|
copyUsernameAsLink = true;
|
||||||
|
@ -105,6 +107,8 @@ public:
|
||||||
bool saveMessagesHistory;
|
bool saveMessagesHistory;
|
||||||
bool disableAds;
|
bool disableAds;
|
||||||
bool disableStories;
|
bool disableStories;
|
||||||
|
bool collapseSimilarChannels;
|
||||||
|
bool hideSimilarChannels;
|
||||||
bool disableNotificationsDelay;
|
bool disableNotificationsDelay;
|
||||||
bool localPremium;
|
bool localPremium;
|
||||||
bool copyUsernameAsLink;
|
bool copyUsernameAsLink;
|
||||||
|
@ -149,14 +153,18 @@ public:
|
||||||
|
|
||||||
void set_useScheduledMessages(bool val);
|
void set_useScheduledMessages(bool val);
|
||||||
|
|
||||||
void set_keepDeletedMessages(bool val);
|
void set_saveDeletedMessages(bool val);
|
||||||
|
|
||||||
void set_keepMessagesHistory(bool val);
|
void set_saveMessagesHistory(bool val);
|
||||||
|
|
||||||
void set_disableAds(bool val);
|
void set_disableAds(bool val);
|
||||||
|
|
||||||
void set_disableStories(bool val);
|
void set_disableStories(bool val);
|
||||||
|
|
||||||
|
void set_collapseSimilarChannels(bool val);
|
||||||
|
|
||||||
|
void set_hideSimilarChannels(bool val);
|
||||||
|
|
||||||
void set_disableNotificationsDelay(bool val);
|
void set_disableNotificationsDelay(bool val);
|
||||||
|
|
||||||
void set_localPremium(bool val);
|
void set_localPremium(bool val);
|
||||||
|
@ -217,6 +225,8 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(
|
||||||
saveMessagesHistory,
|
saveMessagesHistory,
|
||||||
disableAds,
|
disableAds,
|
||||||
disableStories,
|
disableStories,
|
||||||
|
collapseSimilarChannels,
|
||||||
|
hideSimilarChannels,
|
||||||
disableNotificationsDelay,
|
disableNotificationsDelay,
|
||||||
localPremium,
|
localPremium,
|
||||||
copyUsernameAsLink,
|
copyUsernameAsLink,
|
||||||
|
|
|
@ -40,9 +40,9 @@ void AddHideMessageAction(not_null<Ui::PopupMenu *> menu, HistoryItem *item)
|
||||||
{
|
{
|
||||||
const auto initSaveDeleted = settings->saveDeletedMessages;
|
const auto initSaveDeleted = settings->saveDeletedMessages;
|
||||||
|
|
||||||
settings->set_keepDeletedMessages(false);
|
settings->set_saveDeletedMessages(false);
|
||||||
history->destroyMessage(item);
|
history->destroyMessage(item);
|
||||||
settings->set_keepDeletedMessages(initSaveDeleted);
|
settings->set_saveDeletedMessages(initSaveDeleted);
|
||||||
}, &st::menuIconClear);
|
}, &st::menuIconClear);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -247,35 +247,18 @@ not_null<Ui::RpWidget *> AddInnerToggle(not_null<Ui::VerticalLayout *> container
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Settings
|
struct NestedEntry
|
||||||
{
|
{
|
||||||
|
QString checkboxLabel;
|
||||||
|
bool initial;
|
||||||
|
std::function<void(bool)> callback;
|
||||||
|
};
|
||||||
|
|
||||||
rpl::producer<QString> Ayu::title()
|
void AddCollapsibleToggle(not_null<Ui::VerticalLayout *> container,
|
||||||
|
rpl::producer<QString> title,
|
||||||
|
std::vector<NestedEntry> checkboxes,
|
||||||
|
bool toggledWhenAll)
|
||||||
{
|
{
|
||||||
return tr::ayu_AyuPreferences();
|
|
||||||
}
|
|
||||||
|
|
||||||
Ayu::Ayu(
|
|
||||||
QWidget *parent,
|
|
||||||
not_null<Window::SessionController *> controller)
|
|
||||||
: Section(parent)
|
|
||||||
{
|
|
||||||
setupContent(controller);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Ayu::SetupGhostModeToggle(not_null<Ui::VerticalLayout *> container)
|
|
||||||
{
|
|
||||||
auto settings = &AyuSettings::getInstance();
|
|
||||||
|
|
||||||
const auto widget = object_ptr<Ui::VerticalLayout>(this);
|
|
||||||
|
|
||||||
widget->add(
|
|
||||||
object_ptr<Ui::FlatLabel>(
|
|
||||||
container,
|
|
||||||
tr::ayu_GhostEssentialsHeader(),
|
|
||||||
st::rightsHeaderLabel),
|
|
||||||
st::rightsHeaderMargin);
|
|
||||||
|
|
||||||
const auto addCheckbox = [&](
|
const auto addCheckbox = [&](
|
||||||
not_null<Ui::VerticalLayout *> verticalLayout,
|
not_null<Ui::VerticalLayout *> verticalLayout,
|
||||||
const QString &label,
|
const QString &label,
|
||||||
|
@ -320,12 +303,59 @@ void Ayu::SetupGhostModeToggle(not_null<Ui::VerticalLayout *> container)
|
||||||
return checkView;
|
return checkView;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct NestedEntry
|
auto wrap = object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
||||||
{
|
container,
|
||||||
QString checkboxLabel;
|
object_ptr<Ui::VerticalLayout>(container));
|
||||||
bool initial;
|
const auto verticalLayout = wrap->entity();
|
||||||
std::function<void(bool)> callback;
|
auto innerChecks = std::vector<not_null<Ui::AbstractCheckView *>>();
|
||||||
};
|
for (const auto &entry : checkboxes) {
|
||||||
|
const auto c = addCheckbox(verticalLayout, entry.checkboxLabel, entry.initial);
|
||||||
|
c->checkedValue(
|
||||||
|
) | start_with_next([=](bool enabled)
|
||||||
|
{
|
||||||
|
entry.callback(enabled);
|
||||||
|
}, container->lifetime());
|
||||||
|
innerChecks.push_back(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto raw = wrap.data();
|
||||||
|
raw->hide(anim::type::instant);
|
||||||
|
AddInnerToggle(
|
||||||
|
container,
|
||||||
|
st::powerSavingButtonNoIcon,
|
||||||
|
innerChecks,
|
||||||
|
raw,
|
||||||
|
std::move(title),
|
||||||
|
toggledWhenAll);
|
||||||
|
container->add(std::move(wrap));
|
||||||
|
container->widthValue(
|
||||||
|
) | start_with_next([=](int w)
|
||||||
|
{
|
||||||
|
raw->resizeToWidth(w);
|
||||||
|
}, raw->lifetime());
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Settings
|
||||||
|
{
|
||||||
|
|
||||||
|
rpl::producer<QString> Ayu::title()
|
||||||
|
{
|
||||||
|
return tr::ayu_AyuPreferences();
|
||||||
|
}
|
||||||
|
|
||||||
|
Ayu::Ayu(
|
||||||
|
QWidget *parent,
|
||||||
|
not_null<Window::SessionController *> controller)
|
||||||
|
: Section(parent)
|
||||||
|
{
|
||||||
|
setupContent(controller);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Ayu::SetupGhostModeToggle(not_null<Ui::VerticalLayout *> container)
|
||||||
|
{
|
||||||
|
auto settings = &AyuSettings::getInstance();
|
||||||
|
|
||||||
|
AddSubsectionTitle(container, tr::ayu_GhostEssentialsHeader());
|
||||||
|
|
||||||
std::vector checkboxes{
|
std::vector checkboxes{
|
||||||
NestedEntry{
|
NestedEntry{
|
||||||
|
@ -365,102 +395,13 @@ void Ayu::SetupGhostModeToggle(not_null<Ui::VerticalLayout *> container)
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
auto wrap = object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
AddCollapsibleToggle(container, tr::ayu_GhostEssentialsHeader(), checkboxes, true);
|
||||||
container,
|
|
||||||
object_ptr<Ui::VerticalLayout>(container));
|
|
||||||
const auto verticalLayout = wrap->entity();
|
|
||||||
auto innerChecks = std::vector<not_null<Ui::AbstractCheckView *>>();
|
|
||||||
for (const auto &entry : checkboxes) {
|
|
||||||
const auto c = addCheckbox(verticalLayout, entry.checkboxLabel, entry.initial);
|
|
||||||
c->checkedValue(
|
|
||||||
) | start_with_next([=](bool enabled)
|
|
||||||
{
|
|
||||||
entry.callback(enabled);
|
|
||||||
}, container->lifetime());
|
|
||||||
innerChecks.push_back(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto raw = wrap.data();
|
|
||||||
raw->hide(anim::type::instant);
|
|
||||||
AddInnerToggle(
|
|
||||||
container,
|
|
||||||
st::powerSavingButtonNoIcon,
|
|
||||||
innerChecks,
|
|
||||||
raw,
|
|
||||||
tr::ayu_GhostModeToggle(),
|
|
||||||
true);
|
|
||||||
container->add(std::move(wrap));
|
|
||||||
container->widthValue(
|
|
||||||
) | start_with_next([=](int w)
|
|
||||||
{
|
|
||||||
raw->resizeToWidth(w);
|
|
||||||
}, raw->lifetime());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ayu::SetupReadAfterActionToggle(not_null<Ui::VerticalLayout *> container)
|
void Ayu::SetupReadAfterActionToggle(not_null<Ui::VerticalLayout *> container)
|
||||||
{
|
{
|
||||||
auto settings = &AyuSettings::getInstance();
|
auto settings = &AyuSettings::getInstance();
|
||||||
|
|
||||||
const auto widget = object_ptr<Ui::VerticalLayout>(this);
|
|
||||||
|
|
||||||
widget->add(
|
|
||||||
object_ptr<Ui::FlatLabel>(
|
|
||||||
container,
|
|
||||||
tr::ayu_MarkReadAfterAction(),
|
|
||||||
st::rightsHeaderLabel),
|
|
||||||
st::rightsHeaderMargin);
|
|
||||||
|
|
||||||
const auto addCheckbox = [&](
|
|
||||||
not_null<Ui::VerticalLayout *> verticalLayout,
|
|
||||||
const QString &label,
|
|
||||||
const bool isCheckedOrig)
|
|
||||||
{
|
|
||||||
const auto checkView = [&]() -> not_null<Ui::AbstractCheckView *>
|
|
||||||
{
|
|
||||||
const auto checkbox = verticalLayout->add(
|
|
||||||
object_ptr<Ui::Checkbox>(
|
|
||||||
verticalLayout,
|
|
||||||
label,
|
|
||||||
isCheckedOrig,
|
|
||||||
st::settingsCheckbox),
|
|
||||||
st::powerSavingButton.padding);
|
|
||||||
const auto button = Ui::CreateChild<Ui::RippleButton>(
|
|
||||||
verticalLayout.get(),
|
|
||||||
st::defaultRippleAnimation);
|
|
||||||
button->stackUnder(checkbox);
|
|
||||||
combine(
|
|
||||||
verticalLayout->widthValue(),
|
|
||||||
checkbox->geometryValue()
|
|
||||||
) | start_with_next([=](int w, const QRect &r)
|
|
||||||
{
|
|
||||||
button->setGeometry(0, r.y(), w, r.height());
|
|
||||||
}, button->lifetime());
|
|
||||||
checkbox->setAttribute(Qt::WA_TransparentForMouseEvents);
|
|
||||||
const auto checkView = checkbox->checkView();
|
|
||||||
button->setClickedCallback([=]
|
|
||||||
{
|
|
||||||
checkView->setChecked(
|
|
||||||
!checkView->checked(),
|
|
||||||
anim::type::normal);
|
|
||||||
});
|
|
||||||
|
|
||||||
return checkView;
|
|
||||||
}();
|
|
||||||
checkView->checkedChanges(
|
|
||||||
) | start_with_next([=](bool checked)
|
|
||||||
{
|
|
||||||
}, verticalLayout->lifetime());
|
|
||||||
|
|
||||||
return checkView;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct NestedEntry
|
|
||||||
{
|
|
||||||
QString checkboxLabel;
|
|
||||||
bool initial;
|
|
||||||
std::function<void(bool)> callback;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::vector checkboxes{
|
std::vector checkboxes{
|
||||||
NestedEntry{
|
NestedEntry{
|
||||||
tr::ayu_MarkReadAfterSend(tr::now), settings->markReadAfterSend, [=](bool enabled)
|
tr::ayu_MarkReadAfterSend(tr::now), settings->markReadAfterSend, [=](bool enabled)
|
||||||
|
@ -485,44 +426,13 @@ void Ayu::SetupReadAfterActionToggle(not_null<Ui::VerticalLayout *> container)
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
auto wrap = object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
AddCollapsibleToggle(container, tr::ayu_MarkReadAfterAction(), checkboxes, false);
|
||||||
container,
|
|
||||||
object_ptr<Ui::VerticalLayout>(container));
|
|
||||||
const auto verticalLayout = wrap->entity();
|
|
||||||
auto innerChecks = std::vector<not_null<Ui::AbstractCheckView *>>();
|
|
||||||
for (const auto &entry : checkboxes) {
|
|
||||||
const auto c = addCheckbox(verticalLayout, entry.checkboxLabel, entry.initial);
|
|
||||||
c->checkedValue(
|
|
||||||
) | start_with_next([=](bool enabled)
|
|
||||||
{
|
|
||||||
entry.callback(enabled);
|
|
||||||
}, container->lifetime());
|
|
||||||
innerChecks.push_back(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto raw = wrap.data();
|
|
||||||
raw->hide(anim::type::instant);
|
|
||||||
AddInnerToggle(
|
|
||||||
container,
|
|
||||||
st::powerSavingButtonNoIcon,
|
|
||||||
innerChecks,
|
|
||||||
raw,
|
|
||||||
tr::ayu_MarkReadAfterAction(),
|
|
||||||
false);
|
|
||||||
container->add(std::move(wrap));
|
|
||||||
container->widthValue(
|
|
||||||
) | start_with_next([=](int w)
|
|
||||||
{
|
|
||||||
raw->resizeToWidth(w);
|
|
||||||
}, raw->lifetime());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ayu::SetupGhostEssentials(not_null<Ui::VerticalLayout *> container)
|
void Ayu::SetupGhostEssentials(not_null<Ui::VerticalLayout *> container)
|
||||||
{
|
{
|
||||||
auto settings = &AyuSettings::getInstance();
|
auto settings = &AyuSettings::getInstance();
|
||||||
|
|
||||||
AddSubsectionTitle(container, tr::ayu_GhostEssentialsHeader());
|
|
||||||
|
|
||||||
SetupGhostModeToggle(container);
|
SetupGhostModeToggle(container);
|
||||||
SetupReadAfterActionToggle(container);
|
SetupReadAfterActionToggle(container);
|
||||||
|
|
||||||
|
@ -564,7 +474,7 @@ void Ayu::SetupSpyEssentials(not_null<Ui::VerticalLayout *> container)
|
||||||
return (enabled != settings->saveDeletedMessages);
|
return (enabled != settings->saveDeletedMessages);
|
||||||
}) | start_with_next([=](bool enabled)
|
}) | start_with_next([=](bool enabled)
|
||||||
{
|
{
|
||||||
settings->set_keepDeletedMessages(enabled);
|
settings->set_saveDeletedMessages(enabled);
|
||||||
AyuSettings::save();
|
AyuSettings::save();
|
||||||
}, container->lifetime());
|
}, container->lifetime());
|
||||||
|
|
||||||
|
@ -580,7 +490,7 @@ void Ayu::SetupSpyEssentials(not_null<Ui::VerticalLayout *> container)
|
||||||
return (enabled != settings->saveMessagesHistory);
|
return (enabled != settings->saveMessagesHistory);
|
||||||
}) | start_with_next([=](bool enabled)
|
}) | start_with_next([=](bool enabled)
|
||||||
{
|
{
|
||||||
settings->set_keepMessagesHistory(enabled);
|
settings->set_saveMessagesHistory(enabled);
|
||||||
AyuSettings::save();
|
AyuSettings::save();
|
||||||
}, container->lifetime());
|
}, container->lifetime());
|
||||||
}
|
}
|
||||||
|
@ -623,6 +533,45 @@ void Ayu::SetupQoLToggles(not_null<Ui::VerticalLayout *> container)
|
||||||
AyuSettings::save();
|
AyuSettings::save();
|
||||||
}, container->lifetime());
|
}, container->lifetime());
|
||||||
|
|
||||||
|
AddButtonWithIcon(
|
||||||
|
container,
|
||||||
|
tr::ayu_SimpleQuotesAndReplies(),
|
||||||
|
st::settingsButtonNoIcon
|
||||||
|
)->toggleOn(
|
||||||
|
rpl::single(settings->simpleQuotesAndReplies)
|
||||||
|
)->toggledValue(
|
||||||
|
) | rpl::filter([=](bool enabled)
|
||||||
|
{
|
||||||
|
return (enabled != settings->simpleQuotesAndReplies);
|
||||||
|
}) | start_with_next([=](bool enabled)
|
||||||
|
{
|
||||||
|
settings->set_simpleQuotesAndReplies(enabled);
|
||||||
|
AyuSettings::save();
|
||||||
|
}, container->lifetime());
|
||||||
|
|
||||||
|
std::vector checkboxes = {
|
||||||
|
NestedEntry{
|
||||||
|
tr::ayu_CollapseSimilarChannels(tr::now), settings->collapseSimilarChannels, [=](bool enabled)
|
||||||
|
{
|
||||||
|
settings->set_collapseSimilarChannels(enabled);
|
||||||
|
AyuSettings::save();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
NestedEntry{
|
||||||
|
tr::ayu_HideSimilarChannelsTab(tr::now), settings->hideSimilarChannels, [=](bool enabled)
|
||||||
|
{
|
||||||
|
settings->set_hideSimilarChannels(enabled);
|
||||||
|
AyuSettings::save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
AddCollapsibleToggle(container, tr::ayu_DisableSimilarChannels(), checkboxes, true);
|
||||||
|
|
||||||
|
AddSkip(container);
|
||||||
|
AddDivider(container);
|
||||||
|
AddSkip(container);
|
||||||
|
|
||||||
AddButtonWithIcon(
|
AddButtonWithIcon(
|
||||||
container,
|
container,
|
||||||
tr::ayu_DisableNotificationsDelay(),
|
tr::ayu_DisableNotificationsDelay(),
|
||||||
|
@ -688,6 +637,9 @@ void Ayu::SetupCustomization(not_null<Ui::VerticalLayout *> container,
|
||||||
|
|
||||||
SetupAppIcon(container);
|
SetupAppIcon(container);
|
||||||
|
|
||||||
|
AddDivider(container);
|
||||||
|
AddSkip(container);
|
||||||
|
|
||||||
auto btn = AddButtonWithLabel(
|
auto btn = AddButtonWithLabel(
|
||||||
container,
|
container,
|
||||||
tr::ayu_DeletedMarkText(),
|
tr::ayu_DeletedMarkText(),
|
||||||
|
@ -740,22 +692,6 @@ void Ayu::SetupCustomization(not_null<Ui::VerticalLayout *> container,
|
||||||
AyuSettings::save();
|
AyuSettings::save();
|
||||||
}, container->lifetime());
|
}, container->lifetime());
|
||||||
|
|
||||||
AddButtonWithIcon(
|
|
||||||
container,
|
|
||||||
tr::ayu_SimpleQuotesAndReplies(),
|
|
||||||
st::settingsButtonNoIcon
|
|
||||||
)->toggleOn(
|
|
||||||
rpl::single(settings->simpleQuotesAndReplies)
|
|
||||||
)->toggledValue(
|
|
||||||
) | rpl::filter([=](bool enabled)
|
|
||||||
{
|
|
||||||
return (enabled != settings->simpleQuotesAndReplies);
|
|
||||||
}) | start_with_next([=](bool enabled)
|
|
||||||
{
|
|
||||||
settings->set_simpleQuotesAndReplies(enabled);
|
|
||||||
AyuSettings::save();
|
|
||||||
}, container->lifetime());
|
|
||||||
|
|
||||||
AddButtonWithIcon(
|
AddButtonWithIcon(
|
||||||
container,
|
container,
|
||||||
tr::ayu_SettingsShowMessageSeconds(),
|
tr::ayu_SettingsShowMessageSeconds(),
|
||||||
|
|
|
@ -44,6 +44,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "styles/style_info.h"
|
#include "styles/style_info.h"
|
||||||
#include "styles/style_boxes.h"
|
#include "styles/style_boxes.h"
|
||||||
|
|
||||||
|
// AyuGram includes
|
||||||
|
#include "ayu/ayu_settings.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Info {
|
namespace Info {
|
||||||
namespace Profile {
|
namespace Profile {
|
||||||
|
|
||||||
|
@ -155,6 +159,8 @@ object_ptr<Ui::RpWidget> InnerWidget::setupSharedMedia(
|
||||||
using namespace rpl::mappers;
|
using namespace rpl::mappers;
|
||||||
using MediaType = Media::Type;
|
using MediaType = Media::Type;
|
||||||
|
|
||||||
|
const auto settings = &AyuSettings::getInstance();
|
||||||
|
|
||||||
auto content = object_ptr<Ui::VerticalLayout>(parent);
|
auto content = object_ptr<Ui::VerticalLayout>(parent);
|
||||||
auto tracker = Ui::MultiSlideTracker();
|
auto tracker = Ui::MultiSlideTracker();
|
||||||
auto addMediaButton = [&](
|
auto addMediaButton = [&](
|
||||||
|
@ -189,6 +195,10 @@ object_ptr<Ui::RpWidget> InnerWidget::setupSharedMedia(
|
||||||
const auto addSimilarChannelsButton = [&](
|
const auto addSimilarChannelsButton = [&](
|
||||||
not_null<ChannelData*> channel,
|
not_null<ChannelData*> channel,
|
||||||
const style::icon &icon) {
|
const style::icon &icon) {
|
||||||
|
if (settings->hideSimilarChannels) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto result = Media::AddSimilarChannelsButton(
|
auto result = Media::AddSimilarChannelsButton(
|
||||||
content,
|
content,
|
||||||
_controller,
|
_controller,
|
||||||
|
|
Loading…
Add table
Reference in a new issue