2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Improved birthday reminder of multiple contacts in top bar from dialogs.

This commit is contained in:
23rd
2025-04-08 00:34:53 +03:00
committed by John Preston
parent dc1dc8dffa
commit 423782fd2b
3 changed files with 49 additions and 44 deletions

View File

@@ -10,6 +10,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "apiwrap.h"
#include "base/call_delayed.h"
#include "main/main_account.h"
#include "main/main_session.h"
#include "data/data_session.h"
#include "ui/chat/chat_style.h"
namespace Main {
@@ -136,6 +138,15 @@ void AppConfig::refresh(bool force) {
}
updateIgnoredRestrictionReasons(std::move(was));
{
const auto dismissedSuggestions = get<std::vector<QString>>(
u"dismissed_suggestions"_q,
std::vector<QString>());
for (const auto &suggestion : dismissedSuggestions) {
_dismissedSuggestions.emplace(suggestion);
}
}
DEBUG_LOG(("getAppConfig result handled."));
_refreshed.fire({});
}, [](const MTPDhelp_appConfigNotModified &) {});
@@ -289,6 +300,18 @@ std::vector<int> AppConfig::getIntArray(
}
bool AppConfig::suggestionCurrent(const QString &key) const {
if (key == u"BIRTHDAY_CONTACTS_TODAY"_q) {
if (_dismissedSuggestions.contains(key)) {
return false;
} else {
const auto known
= _account->session().data().knownContactBirthdays();
if (!known) {
return true;
}
return !known->empty();
}
}
return !_dismissedSuggestions.contains(key)
&& ranges::contains(
get<std::vector<QString>>(