mirror of https://github.com/procxx/kepka.git
parent
e0d4884351
commit
af85aec33b
|
@ -288,6 +288,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_settings_count_unread" = "Count unread messages";
|
"lng_settings_count_unread" = "Count unread messages";
|
||||||
"lng_settings_events_title" = "Events";
|
"lng_settings_events_title" = "Events";
|
||||||
"lng_settings_events_joined" = "Contact joined Telegram";
|
"lng_settings_events_joined" = "Contact joined Telegram";
|
||||||
|
"lng_settings_events_pinned" = "Pinned messages";
|
||||||
|
|
||||||
"lng_notification_preview" = "You have a new message";
|
"lng_notification_preview" = "You have a new message";
|
||||||
"lng_notification_reply" = "Reply";
|
"lng_notification_reply" = "Reply";
|
||||||
|
|
|
@ -94,6 +94,7 @@ QByteArray AuthSessionSettings::serialize() const {
|
||||||
stream << autoDownload;
|
stream << autoDownload;
|
||||||
stream << qint32(_variables.supportAllSearchResults.current() ? 1 : 0);
|
stream << qint32(_variables.supportAllSearchResults.current() ? 1 : 0);
|
||||||
stream << qint32(_variables.archiveCollapsed.current() ? 1 : 0);
|
stream << qint32(_variables.archiveCollapsed.current() ? 1 : 0);
|
||||||
|
stream << qint32(_variables.notifyAboutPinned.current() ? 1 : 0);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -131,6 +132,7 @@ void AuthSessionSettings::constructFromSerialized(const QByteArray &serialized)
|
||||||
QByteArray autoDownload;
|
QByteArray autoDownload;
|
||||||
qint32 supportAllSearchResults = _variables.supportAllSearchResults.current() ? 1 : 0;
|
qint32 supportAllSearchResults = _variables.supportAllSearchResults.current() ? 1 : 0;
|
||||||
qint32 archiveCollapsed = _variables.archiveCollapsed.current() ? 1 : 0;
|
qint32 archiveCollapsed = _variables.archiveCollapsed.current() ? 1 : 0;
|
||||||
|
qint32 notifyAboutPinned = _variables.notifyAboutPinned.current() ? 1 : 0;
|
||||||
|
|
||||||
stream >> selectorTab;
|
stream >> selectorTab;
|
||||||
stream >> lastSeenWarningSeen;
|
stream >> lastSeenWarningSeen;
|
||||||
|
@ -213,6 +215,9 @@ void AuthSessionSettings::constructFromSerialized(const QByteArray &serialized)
|
||||||
if (!stream.atEnd()) {
|
if (!stream.atEnd()) {
|
||||||
stream >> archiveCollapsed;
|
stream >> archiveCollapsed;
|
||||||
}
|
}
|
||||||
|
if (!stream.atEnd()) {
|
||||||
|
stream >> notifyAboutPinned;
|
||||||
|
}
|
||||||
if (stream.status() != QDataStream::Ok) {
|
if (stream.status() != QDataStream::Ok) {
|
||||||
LOG(("App Error: "
|
LOG(("App Error: "
|
||||||
"Bad data for AuthSessionSettings::constructFromSerialized()"));
|
"Bad data for AuthSessionSettings::constructFromSerialized()"));
|
||||||
|
@ -283,6 +288,7 @@ void AuthSessionSettings::constructFromSerialized(const QByteArray &serialized)
|
||||||
_variables.exeLaunchWarning = (exeLaunchWarning == 1);
|
_variables.exeLaunchWarning = (exeLaunchWarning == 1);
|
||||||
_variables.supportAllSearchResults = (supportAllSearchResults == 1);
|
_variables.supportAllSearchResults = (supportAllSearchResults == 1);
|
||||||
_variables.archiveCollapsed = (archiveCollapsed == 1);
|
_variables.archiveCollapsed = (archiveCollapsed == 1);
|
||||||
|
_variables.notifyAboutPinned = (notifyAboutPinned == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AuthSessionSettings::setSupportChatsTimeSlice(int slice) {
|
void AuthSessionSettings::setSupportChatsTimeSlice(int slice) {
|
||||||
|
@ -389,6 +395,18 @@ rpl::producer<bool> AuthSessionSettings::archiveCollapsedChanges() const {
|
||||||
return _variables.archiveCollapsed.changes();
|
return _variables.archiveCollapsed.changes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AuthSessionSettings::setNotifyAboutPinned(bool notify) {
|
||||||
|
_variables.notifyAboutPinned = notify;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AuthSessionSettings::notifyAboutPinned() const {
|
||||||
|
return _variables.notifyAboutPinned.current();
|
||||||
|
}
|
||||||
|
|
||||||
|
rpl::producer<bool> AuthSessionSettings::notifyAboutPinnedChanges() const {
|
||||||
|
return _variables.notifyAboutPinned.changes();
|
||||||
|
}
|
||||||
|
|
||||||
AuthSession &Auth() {
|
AuthSession &Auth() {
|
||||||
const auto result = Core::App().authSession();
|
const auto result = Core::App().authSession();
|
||||||
Assert(result != nullptr);
|
Assert(result != nullptr);
|
||||||
|
|
|
@ -192,6 +192,10 @@ public:
|
||||||
bool archiveCollapsed() const;
|
bool archiveCollapsed() const;
|
||||||
rpl::producer<bool> archiveCollapsedChanges() const;
|
rpl::producer<bool> archiveCollapsedChanges() const;
|
||||||
|
|
||||||
|
void setNotifyAboutPinned(bool notify);
|
||||||
|
bool notifyAboutPinned() const;
|
||||||
|
rpl::producer<bool> notifyAboutPinnedChanges() const;
|
||||||
|
|
||||||
bool hadLegacyCallsPeerToPeerNobody() const {
|
bool hadLegacyCallsPeerToPeerNobody() const {
|
||||||
return _variables.hadLegacyCallsPeerToPeerNobody;
|
return _variables.hadLegacyCallsPeerToPeerNobody;
|
||||||
}
|
}
|
||||||
|
@ -245,6 +249,7 @@ private:
|
||||||
bool exeLaunchWarning = true;
|
bool exeLaunchWarning = true;
|
||||||
Data::AutoDownload::Full autoDownload;
|
Data::AutoDownload::Full autoDownload;
|
||||||
rpl::variable<bool> archiveCollapsed = false;
|
rpl::variable<bool> archiveCollapsed = false;
|
||||||
|
rpl::variable<bool> notifyAboutPinned = true;
|
||||||
|
|
||||||
static constexpr auto kDefaultSupportChatsLimitSlice
|
static constexpr auto kDefaultSupportChatsLimitSlice
|
||||||
= 7 * 24 * 60 * 60;
|
= 7 * 24 * 60 * 60;
|
||||||
|
|
|
@ -281,6 +281,14 @@ bool HistoryItem::isUnreadMention() const {
|
||||||
return mentionsMe() && (_flags & MTPDmessage::Flag::f_media_unread);
|
return mentionsMe() && (_flags & MTPDmessage::Flag::f_media_unread);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HistoryItem::mentionsMe() const {
|
||||||
|
if (Has<HistoryServicePinned>()
|
||||||
|
&& !history()->session().settings().notifyAboutPinned()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return _flags & MTPDmessage::Flag::f_mentioned;
|
||||||
|
}
|
||||||
|
|
||||||
bool HistoryItem::isUnreadMedia() const {
|
bool HistoryItem::isUnreadMedia() const {
|
||||||
if (!hasUnreadMediaFlag()) {
|
if (!hasUnreadMediaFlag()) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -116,9 +116,7 @@ public:
|
||||||
}
|
}
|
||||||
[[nodiscard]] bool unread() const;
|
[[nodiscard]] bool unread() const;
|
||||||
void markClientSideAsRead();
|
void markClientSideAsRead();
|
||||||
[[nodiscard]] bool mentionsMe() const {
|
[[nodiscard]] bool mentionsMe() const;
|
||||||
return _flags & MTPDmessage::Flag::f_mentioned;
|
|
||||||
}
|
|
||||||
[[nodiscard]] bool isUnreadMention() const;
|
[[nodiscard]] bool isUnreadMention() const;
|
||||||
[[nodiscard]] bool isUnreadMedia() const;
|
[[nodiscard]] bool isUnreadMedia() const;
|
||||||
[[nodiscard]] bool hasUnreadMediaFlag() const;
|
[[nodiscard]] bool hasUnreadMediaFlag() const;
|
||||||
|
|
|
@ -565,6 +565,7 @@ void SetupNotificationsContent(not_null<Ui::VerticalLayout*> container) {
|
||||||
AddDivider(container);
|
AddDivider(container);
|
||||||
AddSkip(container, st::settingsCheckboxesSkip);
|
AddSkip(container, st::settingsCheckboxesSkip);
|
||||||
AddSubsectionTitle(container, lng_settings_events_title);
|
AddSubsectionTitle(container, lng_settings_events_title);
|
||||||
|
|
||||||
const auto joined = addCheckbox(
|
const auto joined = addCheckbox(
|
||||||
lng_settings_events_joined,
|
lng_settings_events_joined,
|
||||||
!Auth().api().contactSignupSilentCurrent().value_or(false));
|
!Auth().api().contactSignupSilentCurrent().value_or(false));
|
||||||
|
@ -580,6 +581,21 @@ void SetupNotificationsContent(not_null<Ui::VerticalLayout*> container) {
|
||||||
Auth().api().saveContactSignupSilent(!enabled);
|
Auth().api().saveContactSignupSilent(!enabled);
|
||||||
}, joined->lifetime());
|
}, joined->lifetime());
|
||||||
|
|
||||||
|
const auto pinned = addCheckbox(
|
||||||
|
lng_settings_events_pinned,
|
||||||
|
Auth().settings().notifyAboutPinned());
|
||||||
|
Auth().settings().notifyAboutPinnedChanges(
|
||||||
|
) | rpl::start_with_next([=](bool notify) {
|
||||||
|
pinned->setChecked(notify);
|
||||||
|
}, pinned->lifetime());
|
||||||
|
pinned->checkedChanges(
|
||||||
|
) | rpl::filter([](bool notify) {
|
||||||
|
return (notify != Auth().settings().notifyAboutPinned());
|
||||||
|
}) | rpl::start_with_next([=](bool notify) {
|
||||||
|
Auth().settings().setNotifyAboutPinned(notify);
|
||||||
|
Auth().saveSettingsDelayed();
|
||||||
|
}, joined->lifetime());
|
||||||
|
|
||||||
const auto nativeKey = [&] {
|
const auto nativeKey = [&] {
|
||||||
if (!Platform::Notifications::Supported()) {
|
if (!Platform::Notifications::Supported()) {
|
||||||
return LangKey();
|
return LangKey();
|
||||||
|
|
Loading…
Reference in New Issue