mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Respect topic pin limit from appConfig.
This commit is contained in:
parent
f0b8ccbd71
commit
34f0aae418
3 changed files with 14 additions and 4 deletions
|
@ -101,6 +101,10 @@ int PremiumLimits::dialogsFolderPinnedCurrent() const {
|
||||||
: dialogsFolderPinnedDefault();
|
: dialogsFolderPinnedDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int PremiumLimits::topicsPinnedCurrent() const {
|
||||||
|
return appConfigLimit("topics_pinned_limit", 5);
|
||||||
|
}
|
||||||
|
|
||||||
int PremiumLimits::channelsPublicDefault() const {
|
int PremiumLimits::channelsPublicDefault() const {
|
||||||
return appConfigLimit("channels_public_limit_default", 10);
|
return appConfigLimit("channels_public_limit_default", 10);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,8 @@ public:
|
||||||
[[nodiscard]] int dialogsFolderPinnedPremium() const;
|
[[nodiscard]] int dialogsFolderPinnedPremium() const;
|
||||||
[[nodiscard]] int dialogsFolderPinnedCurrent() const;
|
[[nodiscard]] int dialogsFolderPinnedCurrent() const;
|
||||||
|
|
||||||
|
[[nodiscard]] int topicsPinnedCurrent() const;
|
||||||
|
|
||||||
[[nodiscard]] int channelsPublicDefault() const;
|
[[nodiscard]] int channelsPublicDefault() const;
|
||||||
[[nodiscard]] int channelsPublicPremium() const;
|
[[nodiscard]] int channelsPublicPremium() const;
|
||||||
[[nodiscard]] int channelsPublicCurrent() const;
|
[[nodiscard]] int channelsPublicCurrent() const;
|
||||||
|
|
|
@ -84,8 +84,6 @@ namespace {
|
||||||
|
|
||||||
using ViewElement = HistoryView::Element;
|
using ViewElement = HistoryView::Element;
|
||||||
|
|
||||||
constexpr auto kTopicsPinLimit = 5;
|
|
||||||
|
|
||||||
// s: box 100x100
|
// s: box 100x100
|
||||||
// m: box 320x320
|
// m: box 320x320
|
||||||
// x: box 800x800
|
// x: box 800x800
|
||||||
|
@ -2049,7 +2047,8 @@ int Session::pinnedChatsLimit(FilterId filterId) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
int Session::pinnedChatsLimit(not_null<Data::Forum*> forum) const {
|
int Session::pinnedChatsLimit(not_null<Data::Forum*> forum) const {
|
||||||
return kTopicsPinLimit;
|
const auto limits = Data::PremiumLimits(_session);
|
||||||
|
return limits.topicsPinnedCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<int> Session::maxPinnedChatsLimitValue(
|
rpl::producer<int> Session::maxPinnedChatsLimitValue(
|
||||||
|
@ -2084,7 +2083,12 @@ rpl::producer<int> Session::maxPinnedChatsLimitValue(
|
||||||
|
|
||||||
rpl::producer<int> Session::maxPinnedChatsLimitValue(
|
rpl::producer<int> Session::maxPinnedChatsLimitValue(
|
||||||
not_null<Data::Forum*> forum) const {
|
not_null<Data::Forum*> forum) const {
|
||||||
return rpl::single(pinnedChatsLimit(forum));
|
return rpl::single(rpl::empty_value()) | rpl::then(
|
||||||
|
_session->account().appConfig().refreshed()
|
||||||
|
) | rpl::map([=] {
|
||||||
|
const auto limits = Data::PremiumLimits(_session);
|
||||||
|
return limits.topicsPinnedCurrent();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<Dialogs::Key> &Session::pinnedChatsOrder(
|
const std::vector<Dialogs::Key> &Session::pinnedChatsOrder(
|
||||||
|
|
Loading…
Add table
Reference in a new issue