mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 13:17:08 +02:00
feat: hide folder notification counters
This commit is contained in:
parent
2aef563374
commit
115517fae1
6 changed files with 181 additions and 158 deletions
|
@ -4623,9 +4623,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"ayu_MaximumMediaSizeCellular" = "Media size limit (cellular data)";
|
||||
"ayu_MaximumMediaSizeWiFi" = "Media size limit (WiFi)";
|
||||
"ayu_MessageSavingOtherHeader" = "Other";
|
||||
"ayu_MessageSavingSaveFormatting" = "Save formatting";
|
||||
"ayu_MessageSavingSaveReactions" = "Save reactions";
|
||||
"ayu_MessageSavingSaveForBots" = "Save in bot dialogs";
|
||||
"ayu_MessageSavingSavePath" = "Attachments folder";
|
||||
"ayu_MessageSavingSavePathTitle" = "Choose folder";
|
||||
"ayu_SpyAllToggle" = "Spy on people";
|
||||
"ayu_SpySaveReadMarks" = "Save read date";
|
||||
"ayu_SpySaveLastActivity" = "Save last activity";
|
||||
|
@ -4639,6 +4640,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"ayu_CustomizationHeader" = "Customization";
|
||||
"ayu_DeletedMarkText" = "Deleted mark";
|
||||
"ayu_EditedMarkText" = "Edited mark";
|
||||
"ayu_HideNotificationCounters" = "Hide notification counters";
|
||||
"ayu_HideAllChats" = "Hide \"All chats\" folder";
|
||||
"ayu_ShowGhostToggleInDrawer" = "Show ghost mode toggle";
|
||||
"ayu_ShowKllButtonInDrawer" = "Show kill app button";
|
||||
|
@ -4660,6 +4662,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"ayu_RegexFiltersAmount" = "filters";
|
||||
"ayu_RegexFiltersHeader" = "Filters";
|
||||
"ayu_RegexFiltersShared" = "Shared filters";
|
||||
"ayu_RegexFiltersExcluded" = "Excluded filters";
|
||||
"ayu_FiltersHideFromBlocked" = "Hide from blocked users";
|
||||
"ayu_FiltersHideFromBlockedNote" = "Message filters were enabled.";
|
||||
"ayu_RegexFiltersEnableSharedInChats" = "Enable shared filters in chats";
|
||||
|
|
|
@ -383,9 +383,9 @@ void AyuGramSettings::set_showPeerId(int val)
|
|||
showPeerIdReactive = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_showMessageSeconds(bool val)
|
||||
void AyuGramSettings::set_hideNotificationCounters(bool val)
|
||||
{
|
||||
showMessageSeconds = val;
|
||||
hideNotificationCounters = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_hideAllChatsFolder(bool val)
|
||||
|
@ -393,6 +393,11 @@ void AyuGramSettings::set_hideAllChatsFolder(bool val)
|
|||
hideAllChatsFolder = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_showMessageSeconds(bool val)
|
||||
{
|
||||
showMessageSeconds = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_stickerConfirmation(bool val)
|
||||
{
|
||||
stickerConfirmation = val;
|
||||
|
|
|
@ -88,14 +88,15 @@ public:
|
|||
mainFont = "";
|
||||
monoFont = "";
|
||||
|
||||
hideNotificationCounters = false;
|
||||
hideAllChatsFolder = false;
|
||||
|
||||
/*
|
||||
* showPeerId = 0 means no ID shown
|
||||
* showPeerId = 1 means ID shown as for Telegram API devs
|
||||
* showPeerId = 2 means ID shown as for Bot API devs (-100)
|
||||
*/
|
||||
showPeerId = 2;
|
||||
|
||||
hideAllChatsFolder = false;
|
||||
showMessageSeconds = false;
|
||||
|
||||
// ~ Confirmations
|
||||
|
@ -149,8 +150,10 @@ public:
|
|||
QString mainFont;
|
||||
QString monoFont;
|
||||
|
||||
int showPeerId;
|
||||
bool hideNotificationCounters;
|
||||
bool hideAllChatsFolder;
|
||||
|
||||
int showPeerId;
|
||||
bool showMessageSeconds;
|
||||
|
||||
bool stickerConfirmation;
|
||||
|
@ -205,9 +208,11 @@ public:
|
|||
void set_mainFont(QString val);
|
||||
void set_monoFont(QString val);
|
||||
|
||||
void set_hideNotificationCounters(bool val);
|
||||
void set_hideAllChatsFolder(bool val);
|
||||
|
||||
void set_showPeerId(int val);
|
||||
void set_showMessageSeconds(bool val);
|
||||
void set_hideAllChatsFolder(bool val);
|
||||
|
||||
void set_stickerConfirmation(bool val);
|
||||
void set_gifConfirmation(bool val);
|
||||
|
@ -252,9 +257,10 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(
|
|||
showStreamerToggleInTray,
|
||||
mainFont,
|
||||
monoFont,
|
||||
hideNotificationCounters,
|
||||
hideAllChatsFolder,
|
||||
showPeerId,
|
||||
showMessageSeconds,
|
||||
hideAllChatsFolder,
|
||||
stickerConfirmation,
|
||||
gifConfirmation,
|
||||
voiceConfirmation
|
||||
|
|
|
@ -394,7 +394,7 @@ Ayu::Ayu(
|
|||
setupContent(controller);
|
||||
}
|
||||
|
||||
void Ayu::SetupGhostModeToggle(not_null<Ui::VerticalLayout *> container)
|
||||
void SetupGhostModeToggle(not_null<Ui::VerticalLayout *> container)
|
||||
{
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
|
@ -441,7 +441,7 @@ void Ayu::SetupGhostModeToggle(not_null<Ui::VerticalLayout *> container)
|
|||
AddCollapsibleToggle(container, tr::ayu_GhostEssentialsHeader(), checkboxes, true);
|
||||
}
|
||||
|
||||
void Ayu::SetupReadAfterActionToggle(not_null<Ui::VerticalLayout *> container)
|
||||
void SetupReadAfterActionToggle(not_null<Ui::VerticalLayout *> container)
|
||||
{
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
|
@ -472,7 +472,7 @@ void Ayu::SetupReadAfterActionToggle(not_null<Ui::VerticalLayout *> container)
|
|||
AddCollapsibleToggle(container, tr::ayu_MarkReadAfterAction(), checkboxes, false);
|
||||
}
|
||||
|
||||
void Ayu::SetupGhostEssentials(not_null<Ui::VerticalLayout *> container)
|
||||
void SetupGhostEssentials(not_null<Ui::VerticalLayout *> container)
|
||||
{
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
|
@ -502,7 +502,7 @@ void Ayu::SetupGhostEssentials(not_null<Ui::VerticalLayout *> container)
|
|||
}, container->lifetime());
|
||||
}
|
||||
|
||||
void Ayu::SetupSpyEssentials(not_null<Ui::VerticalLayout *> container)
|
||||
void SetupSpyEssentials(not_null<Ui::VerticalLayout *> container)
|
||||
{
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
|
@ -549,7 +549,7 @@ void Ayu::SetupSpyEssentials(not_null<Ui::VerticalLayout *> container)
|
|||
}, container->lifetime());
|
||||
}
|
||||
|
||||
void Ayu::SetupQoLToggles(not_null<Ui::VerticalLayout *> container)
|
||||
void SetupQoLToggles(not_null<Ui::VerticalLayout *> container)
|
||||
{
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
|
@ -687,113 +687,14 @@ void Ayu::SetupQoLToggles(not_null<Ui::VerticalLayout *> container)
|
|||
}, container->lifetime());
|
||||
}
|
||||
|
||||
void Ayu::SetupAppIcon(not_null<Ui::VerticalLayout *> container)
|
||||
void SetupAppIcon(not_null<Ui::VerticalLayout *> container)
|
||||
{
|
||||
container->add(
|
||||
object_ptr<IconPicker>(container),
|
||||
st::settingsCheckboxPadding);
|
||||
}
|
||||
|
||||
void Ayu::SetupCustomization(not_null<Ui::VerticalLayout *> container,
|
||||
not_null<Window::SessionController *> controller)
|
||||
{
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
AddSubsectionTitle(container, tr::ayu_CustomizationHeader());
|
||||
|
||||
SetupAppIcon(container);
|
||||
|
||||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
|
||||
auto btn = AddButtonWithLabel(
|
||||
container,
|
||||
tr::ayu_DeletedMarkText(),
|
||||
AyuSettings::get_deletedMarkReactive(),
|
||||
st::settingsButtonNoIcon
|
||||
);
|
||||
btn->addClickHandler(
|
||||
[=]()
|
||||
{
|
||||
auto box = Box<EditDeletedMarkBox>();
|
||||
Ui::show(std::move(box));
|
||||
});
|
||||
|
||||
auto btn2 = AddButtonWithLabel(
|
||||
container,
|
||||
tr::ayu_EditedMarkText(),
|
||||
AyuSettings::get_editedMarkReactive(),
|
||||
st::settingsButtonNoIcon
|
||||
);
|
||||
btn2->addClickHandler(
|
||||
[=]()
|
||||
{
|
||||
auto box = Box<EditEditedMarkBox>();
|
||||
Ui::show(std::move(box));
|
||||
});
|
||||
|
||||
AddSkip(container);
|
||||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
|
||||
SetupRecentStickersLimitSlider(container);
|
||||
|
||||
AddSkip(container);
|
||||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
|
||||
SetupShowPeerId(container, controller);
|
||||
|
||||
AddButtonWithIcon(
|
||||
container,
|
||||
tr::ayu_HideAllChats(),
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(
|
||||
rpl::single(settings->hideAllChatsFolder)
|
||||
)->toggledValue(
|
||||
) | rpl::filter(
|
||||
[=](bool enabled)
|
||||
{
|
||||
return (enabled != settings->hideAllChatsFolder);
|
||||
}) | start_with_next(
|
||||
[=](bool enabled)
|
||||
{
|
||||
settings->set_hideAllChatsFolder(enabled);
|
||||
AyuSettings::save();
|
||||
}, container->lifetime());
|
||||
|
||||
AddButtonWithIcon(
|
||||
container,
|
||||
tr::ayu_SettingsShowMessageSeconds(),
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(
|
||||
rpl::single(settings->showMessageSeconds)
|
||||
)->toggledValue(
|
||||
) | rpl::filter(
|
||||
[=](bool enabled)
|
||||
{
|
||||
return (enabled != settings->showMessageSeconds);
|
||||
}) | start_with_next(
|
||||
[=](bool enabled)
|
||||
{
|
||||
settings->set_showMessageSeconds(enabled);
|
||||
AyuSettings::save();
|
||||
}, container->lifetime());
|
||||
|
||||
AddSkip(container);
|
||||
AddDivider(container);
|
||||
SetupContextMenuElements(container, controller);
|
||||
SetupDrawerElements(container);
|
||||
AddSkip(container);
|
||||
AddDivider(container);
|
||||
SetupTrayElements(container);
|
||||
AddSkip(container);
|
||||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
SetupFonts(container, controller);
|
||||
}
|
||||
|
||||
void Ayu::SetupContextMenuElements(not_null<Ui::VerticalLayout *> container,
|
||||
void SetupContextMenuElements(not_null<Ui::VerticalLayout *> container,
|
||||
not_null<Window::SessionController *> controller)
|
||||
{
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
@ -878,7 +779,7 @@ void Ayu::SetupContextMenuElements(not_null<Ui::VerticalLayout *> container,
|
|||
AddDividerText(container, tr::ayu_SettingsContextMenuDescription());
|
||||
}
|
||||
|
||||
void Ayu::SetupDrawerElements(not_null<Ui::VerticalLayout *> container)
|
||||
void SetupDrawerElements(not_null<Ui::VerticalLayout *> container)
|
||||
{
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
|
@ -964,7 +865,7 @@ void Ayu::SetupDrawerElements(not_null<Ui::VerticalLayout *> container)
|
|||
#endif
|
||||
}
|
||||
|
||||
void Ayu::SetupTrayElements(not_null<Ui::VerticalLayout *> container)
|
||||
void SetupTrayElements(not_null<Ui::VerticalLayout *> container)
|
||||
{
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
|
@ -1010,7 +911,7 @@ void Ayu::SetupTrayElements(not_null<Ui::VerticalLayout *> container)
|
|||
#endif
|
||||
}
|
||||
|
||||
void Ayu::SetupShowPeerId(not_null<Ui::VerticalLayout *> container,
|
||||
void SetupShowPeerId(not_null<Ui::VerticalLayout *> container,
|
||||
not_null<Window::SessionController *> controller)
|
||||
{
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
@ -1053,7 +954,7 @@ void Ayu::SetupShowPeerId(not_null<Ui::VerticalLayout *> container,
|
|||
});
|
||||
}
|
||||
|
||||
void Ayu::SetupRecentStickersLimitSlider(not_null<Ui::VerticalLayout *> container)
|
||||
void SetupRecentStickersLimitSlider(not_null<Ui::VerticalLayout *> container)
|
||||
{
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
|
@ -1095,7 +996,7 @@ void Ayu::SetupRecentStickersLimitSlider(not_null<Ui::VerticalLayout *> containe
|
|||
});
|
||||
}
|
||||
|
||||
void Ayu::SetupFonts(not_null<Ui::VerticalLayout *> container, not_null<Window::SessionController *> controller)
|
||||
void SetupFonts(not_null<Ui::VerticalLayout *> container, not_null<Window::SessionController *> controller)
|
||||
{
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
|
||||
|
@ -1143,7 +1044,7 @@ void Ayu::SetupFonts(not_null<Ui::VerticalLayout *> container, not_null<Window::
|
|||
|
||||
}
|
||||
|
||||
void Ayu::SetupAyuSync(not_null<Ui::VerticalLayout *> container)
|
||||
void SetupAyuSync(not_null<Ui::VerticalLayout *> container)
|
||||
{
|
||||
AddSubsectionTitle(container, tr::ayu_AyuSyncHeader());
|
||||
|
||||
|
@ -1161,7 +1062,7 @@ void Ayu::SetupAyuSync(not_null<Ui::VerticalLayout *> container)
|
|||
});
|
||||
}
|
||||
|
||||
void Ayu::SetupSendConfirmations(not_null<Ui::VerticalLayout *> container)
|
||||
void SetupSendConfirmations(not_null<Ui::VerticalLayout *> container)
|
||||
{
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
|
@ -1222,7 +1123,142 @@ void Ayu::SetupSendConfirmations(not_null<Ui::VerticalLayout *> container)
|
|||
}, container->lifetime());
|
||||
}
|
||||
|
||||
void Ayu::SetupAyuGramSettings(not_null<Ui::VerticalLayout *> container,
|
||||
void SetupMarks(not_null<Ui::VerticalLayout *> container) {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
AddButtonWithLabel(
|
||||
container,
|
||||
tr::ayu_DeletedMarkText(),
|
||||
AyuSettings::get_deletedMarkReactive(),
|
||||
st::settingsButtonNoIcon
|
||||
)->addClickHandler(
|
||||
[=]()
|
||||
{
|
||||
auto box = Box<EditDeletedMarkBox>();
|
||||
Ui::show(std::move(box));
|
||||
});
|
||||
|
||||
AddButtonWithLabel(
|
||||
container,
|
||||
tr::ayu_EditedMarkText(),
|
||||
AyuSettings::get_editedMarkReactive(),
|
||||
st::settingsButtonNoIcon
|
||||
)->addClickHandler(
|
||||
[=]()
|
||||
{
|
||||
auto box = Box<EditEditedMarkBox>();
|
||||
Ui::show(std::move(box));
|
||||
});
|
||||
}
|
||||
|
||||
void SetupFolderSettings(not_null<Ui::VerticalLayout *> container) {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
AddButtonWithIcon(
|
||||
container,
|
||||
tr::ayu_HideNotificationCounters(),
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(
|
||||
rpl::single(settings->hideNotificationCounters)
|
||||
)->toggledValue(
|
||||
) | rpl::filter(
|
||||
[=](bool enabled)
|
||||
{
|
||||
return (enabled != settings->hideNotificationCounters);
|
||||
}) | start_with_next(
|
||||
[=](bool enabled)
|
||||
{
|
||||
settings->set_hideNotificationCounters(enabled);
|
||||
AyuSettings::save();
|
||||
}, container->lifetime());
|
||||
|
||||
AddButtonWithIcon(
|
||||
container,
|
||||
tr::ayu_HideAllChats(),
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(
|
||||
rpl::single(settings->hideAllChatsFolder)
|
||||
)->toggledValue(
|
||||
) | rpl::filter(
|
||||
[=](bool enabled)
|
||||
{
|
||||
return (enabled != settings->hideAllChatsFolder);
|
||||
}) | start_with_next(
|
||||
[=](bool enabled)
|
||||
{
|
||||
settings->set_hideAllChatsFolder(enabled);
|
||||
AyuSettings::save();
|
||||
}, container->lifetime());
|
||||
}
|
||||
|
||||
void SetupNerdSettings(not_null<Ui::VerticalLayout *> container, not_null<Window::SessionController *> controller) {
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
SetupShowPeerId(container, controller);
|
||||
|
||||
AddButtonWithIcon(
|
||||
container,
|
||||
tr::ayu_SettingsShowMessageSeconds(),
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(
|
||||
rpl::single(settings->showMessageSeconds)
|
||||
)->toggledValue(
|
||||
) | rpl::filter(
|
||||
[=](bool enabled)
|
||||
{
|
||||
return (enabled != settings->showMessageSeconds);
|
||||
}) | start_with_next(
|
||||
[=](bool enabled)
|
||||
{
|
||||
settings->set_showMessageSeconds(enabled);
|
||||
AyuSettings::save();
|
||||
}, container->lifetime());
|
||||
|
||||
}
|
||||
|
||||
void SetupCustomization(not_null<Ui::VerticalLayout *> container,
|
||||
not_null<Window::SessionController *> controller)
|
||||
{
|
||||
AddSubsectionTitle(container, tr::ayu_CustomizationHeader());
|
||||
|
||||
SetupAppIcon(container);
|
||||
|
||||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
|
||||
SetupMarks(container);
|
||||
|
||||
AddSkip(container);
|
||||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
|
||||
SetupRecentStickersLimitSlider(container);
|
||||
|
||||
AddSkip(container);
|
||||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
|
||||
SetupFolderSettings(container);
|
||||
AddSkip(container);
|
||||
AddDivider(container);
|
||||
|
||||
AddSkip(container);
|
||||
SetupNerdSettings(container, controller);
|
||||
|
||||
AddSkip(container);
|
||||
AddDivider(container);
|
||||
SetupContextMenuElements(container, controller);
|
||||
SetupDrawerElements(container);
|
||||
AddSkip(container);
|
||||
AddDivider(container);
|
||||
SetupTrayElements(container);
|
||||
AddSkip(container);
|
||||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
SetupFonts(container, controller);
|
||||
}
|
||||
|
||||
void SetupAyuGramSettings(not_null<Ui::VerticalLayout *> container,
|
||||
not_null<Window::SessionController *> controller)
|
||||
{
|
||||
AddSkip(container);
|
||||
|
|
|
@ -29,40 +29,6 @@ public:
|
|||
[[nodiscard]] rpl::producer<QString> title() override;
|
||||
|
||||
private:
|
||||
void SetupGhostModeToggle(not_null<Ui::VerticalLayout *> container);
|
||||
|
||||
void SetupReadAfterActionToggle(not_null<Ui::VerticalLayout *> container);
|
||||
|
||||
void SetupGhostEssentials(not_null<Ui::VerticalLayout *> container);
|
||||
|
||||
void SetupSpyEssentials(not_null<Ui::VerticalLayout *> container);
|
||||
|
||||
void SetupQoLToggles(not_null<Ui::VerticalLayout *> container);
|
||||
|
||||
void SetupAppIcon(not_null<Ui::VerticalLayout *> container);
|
||||
|
||||
void SetupCustomization(not_null<Ui::VerticalLayout *> container,
|
||||
not_null<Window::SessionController *> controller);
|
||||
|
||||
void SetupContextMenuElements(not_null<Ui::VerticalLayout *> container,
|
||||
not_null<Window::SessionController *> controller);
|
||||
|
||||
void SetupDrawerElements(not_null<Ui::VerticalLayout *> container);
|
||||
|
||||
void SetupTrayElements(not_null<Ui::VerticalLayout *> container);
|
||||
|
||||
void SetupShowPeerId(not_null<Ui::VerticalLayout *> container, not_null<Window::SessionController *> controller);
|
||||
|
||||
void SetupRecentStickersLimitSlider(not_null<Ui::VerticalLayout *> container);
|
||||
|
||||
void SetupFonts(not_null<Ui::VerticalLayout *> container, not_null<Window::SessionController *> controller);
|
||||
|
||||
void SetupAyuSync(not_null<Ui::VerticalLayout *> container);
|
||||
|
||||
void SetupSendConfirmations(not_null<Ui::VerticalLayout *> container);
|
||||
|
||||
void SetupAyuGramSettings(not_null<Ui::VerticalLayout *> container, not_null<Window::SessionController *> null);
|
||||
|
||||
void setupContent(not_null<Window::SessionController *> controller);
|
||||
};
|
||||
|
||||
|
|
|
@ -313,8 +313,15 @@ base::unique_qptr<Ui::SideBarButton> FiltersMenu::prepareButton(
|
|||
&_session->session(),
|
||||
id
|
||||
) | rpl::start_with_next([=](const Dialogs::UnreadState &state) {
|
||||
const auto count = (state.chats + state.marks);
|
||||
const auto muted = (state.chatsMuted + state.marksMuted);
|
||||
auto count = (state.chats + state.marks);
|
||||
auto muted = (state.chatsMuted + state.marksMuted);
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->hideNotificationCounters) {
|
||||
count = 0;
|
||||
muted = 0;
|
||||
}
|
||||
|
||||
const auto string = !count
|
||||
? QString()
|
||||
: (count > 99)
|
||||
|
|
Loading…
Add table
Reference in a new issue