[Option][GUI] Disable notifications from top bar

This commit is contained in:
Eric Kotato 2022-09-09 20:07:36 +03:00
parent e68f31f573
commit 316b8a3004
9 changed files with 14 additions and 5 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

@ -91,6 +91,7 @@
"ktg_settings_filters_only_unmuted_counter": "Do not count muted chats",
"ktg_settings_filters_hide_edit": "Hide Edit button",
"ktg_settings_filters_hide_folder_names": "Compact folders",
"ktg_settings_top_bar_mute": "Mute in profile top bar",
"ktg_settings_messages": "Messages",
"ktg_settings_filters_hide_all": "Hide \"All chats\" folder",
"ktg_settings_userpic_rounding": "Profile pictures rounding",

View file

@ -144,7 +144,7 @@ infoTopBarNotifications: IconButton(infoTopBarMenu) {
rippleAreaPosition: point(0px, 6px);
}
infoNotificationsActive: icon {{
"info_notifications",
"info_notifications_active",
windowBgActive
}};
infoTopBarCall: IconButton(infoTopBarNotifications) {

View file

@ -392,7 +392,6 @@ void WrapWidget::createTopBar() {
&& (wrapValue != Wrap::Side || hasStackHistory())) {
addTopBarMenuButton();
addProfileCallsButton();
// addProfileNotificationsButton();
} else if (section.type() == Section::Type::Settings
&& (section.settingsType() == Section::SettingsType::Main
|| section.settingsType() == Section::SettingsType::Chat
@ -403,6 +402,11 @@ void WrapWidget::createTopBar() {
addContentSaveButton();
}
if (section.type() == Section::Type::Profile
&& ::Kotato::JsonSettings::GetBool("profile_top_mute")) {
addProfileNotificationsButton();
}
_topBar->lower();
_topBar->resizeToWidth(width());
_topBar->finishAnimating();
@ -505,7 +509,7 @@ void WrapWidget::addProfileNotificationsButton() {
Expects(_topBar != nullptr);
const auto peer = key().peer();
if (!peer) {
if (!peer || peer->isSelf()) {
return;
}
auto notifications = _topBar->addButton(

View file

@ -407,7 +407,7 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
addInfoLine(tr::lng_info_about_label(), AboutValue(_peer));
}
if (!_peer->isSelf()) {
if (!_peer->isSelf() && !::Kotato::JsonSettings::GetBool("profile_top_mute")) {
// No notifications toggle for Self => no separator.
result->add(object_ptr<Ui::SlideWrap<>>(
result,
@ -548,7 +548,7 @@ object_ptr<Ui::RpWidget> DetailsFiller::fill() {
add(object_ptr<Ui::BoxContentDivider>(_wrap));
add(CreateSkipWidget(_wrap));
add(setupInfo());
if (!_peer->isSelf()) {
if (!_peer->isSelf() && !::Kotato::JsonSettings::GetBool("profile_top_mute")) {
add(setupMuteToggle());
}
setupMainButtons();

View file

@ -424,6 +424,9 @@ const std::map<QString, Definition, std::greater<QString>> DefinitionMap {
{ "folders/hide_all_chats", {
.type = SettingType::BoolSetting,
.defaultValue = false, }},
{ "profile_top_mute", {
.type = SettingType::BoolSetting,
.defaultValue = false, }},
{ "folders/local", {
.scope = SettingScope::Account,
.type = SettingType::QJsonArraySetting, }},

View file

@ -213,6 +213,7 @@ void SetupKotatoChats(
updateRecentStickersLimitHeight);
updateRecentStickersLimitLabel(::Kotato::JsonSettings::GetInt("recent_stickers_limit"));
SettingsMenuJsonSwitch(ktg_settings_top_bar_mute, profile_top_mute);
SettingsMenuJsonSwitch(ktg_settings_disable_up_edit, disable_up_edit);
AddButton(