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

Support free transcribes in groups.

This commit is contained in:
John Preston
2024-02-09 18:09:48 +04:00
parent cfaef4c441
commit fc6f2520b7
8 changed files with 41 additions and 22 deletions

View File

@@ -238,6 +238,12 @@ Session::Session(not_null<Main::Session*> session)
, _bigFileCache(Core::App().databases().get(
_session->local().cacheBigFilePath(),
_session->local().cacheBigFileSettings()))
, _groupFreeTranscribeLevel(session->account().appConfig().value(
) | rpl::map([=] {
return session->account().appConfig().get<int>(
u"group_transcribe_level_min"_q,
6);
}))
, _chatsList(
session,
FilterId(),
@@ -2178,8 +2184,7 @@ rpl::producer<int> Session::maxPinnedChatsLimitValue(
// We always use premium limit in the MainList limit producer,
// because it slices the list to that limit. We don't want to slice
// premium-ly added chats from the pinned list because of sync issues.
return rpl::single(rpl::empty_value()) | rpl::then(
_session->account().appConfig().refreshed()
return _session->account().appConfig().value(
) | rpl::map([=] {
const auto limits = Data::PremiumLimits(_session);
return folder
@@ -2194,8 +2199,7 @@ rpl::producer<int> Session::maxPinnedChatsLimitValue(
// We always use premium limit in the MainList limit producer,
// because it slices the list to that limit. We don't want to slice
// premium-ly added chats from the pinned list because of sync issues.
return rpl::single(rpl::empty_value()) | rpl::then(
_session->account().appConfig().refreshed()
return _session->account().appConfig().value(
) | rpl::map([=] {
const auto limits = Data::PremiumLimits(_session);
return limits.dialogFiltersChatsPremium();
@@ -2204,8 +2208,7 @@ rpl::producer<int> Session::maxPinnedChatsLimitValue(
rpl::producer<int> Session::maxPinnedChatsLimitValue(
not_null<Data::Forum*> forum) const {
return rpl::single(rpl::empty_value()) | rpl::then(
_session->account().appConfig().refreshed()
return _session->account().appConfig().value(
) | rpl::map([=] {
const auto limits = Data::PremiumLimits(_session);
return limits.topicsPinnedCurrent();
@@ -2218,14 +2221,17 @@ rpl::producer<int> Session::maxPinnedChatsLimitValue(
// We always use premium limit in the MainList limit producer,
// because it slices the list to that limit. We don't want to slice
// premium-ly added chats from the pinned list because of sync issues.
return rpl::single(rpl::empty_value()) | rpl::then(
_session->account().appConfig().refreshed()
return _session->account().appConfig().value(
) | rpl::map([=] {
const auto limits = Data::PremiumLimits(_session);
return limits.savedSublistsPinnedPremium();
});
}
int Session::groupFreeTranscribeLevel() const {
return _groupFreeTranscribeLevel.current();
}
const std::vector<Dialogs::Key> &Session::pinnedChatsOrder(
Data::Folder *folder) const {
return chatsList(folder)->pinned()->order();