mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-01-13 10:34:38 +00:00
Change default autodownload settings.
This commit is contained in:
parent
a0c6104fae
commit
71cf4a4885
@ -43,8 +43,6 @@ void AutoDownloadBox::setupContent() {
|
||||
using namespace rpl::mappers;
|
||||
using Type = Data::AutoDownload::Type;
|
||||
|
||||
constexpr auto kLegacyLimit = 10 * 1024 * 1024;
|
||||
|
||||
setTitle(langFactory(lng_media_auto_title));
|
||||
|
||||
const auto settings = &Auth().settings().autoDownload();
|
||||
|
@ -17,8 +17,7 @@ namespace Data {
|
||||
namespace AutoDownload {
|
||||
namespace {
|
||||
|
||||
constexpr auto kDefaultMaxSize = 10 * 1024 * 1024;
|
||||
constexpr auto kNonCacheMaxSize = 2 * 1024 * 1024;
|
||||
constexpr auto kDefaultMaxSize = 2 * 1024 * 1024;
|
||||
constexpr auto kVersion = char(1);
|
||||
|
||||
template <typename Enum>
|
||||
@ -39,9 +38,12 @@ void SetDefaultsForSource(Full &data, Source source) {
|
||||
data.setBytesLimit(source, Type::VoiceMessage, kDefaultMaxSize);
|
||||
data.setBytesLimit(source, Type::VideoMessage, kDefaultMaxSize);
|
||||
data.setBytesLimit(source, Type::GIF, kDefaultMaxSize);
|
||||
data.setBytesLimit(source, Type::File, kNonCacheMaxSize);
|
||||
data.setBytesLimit(source, Type::Video, kNonCacheMaxSize);
|
||||
data.setBytesLimit(source, Type::Music, kNonCacheMaxSize);
|
||||
const auto channelsFileLimit = (source == Source::Channel)
|
||||
? 0
|
||||
: kDefaultMaxSize;
|
||||
data.setBytesLimit(source, Type::File, channelsFileLimit);
|
||||
data.setBytesLimit(source, Type::Video, channelsFileLimit);
|
||||
data.setBytesLimit(source, Type::Music, channelsFileLimit);
|
||||
}
|
||||
|
||||
const Full &Defaults() {
|
||||
|
@ -1064,25 +1064,19 @@ bool _readSetting(quint32 blockId, QDataStream &stream, int version, ReadSetting
|
||||
|
||||
using namespace Data::AutoDownload;
|
||||
auto &settings = GetStoredAuthSessionCache().autoDownload();
|
||||
const auto limit = [](qint32 value, qint32 mask) {
|
||||
constexpr auto kLegacyLimit = 10 * 1024 * 1024;
|
||||
return (value & mask) ? 0 : kLegacyLimit;
|
||||
const auto disabled = [](qint32 value, qint32 mask) {
|
||||
return (value & mask) != 0;
|
||||
};
|
||||
const auto set = [&](Type type, qint32 value) {
|
||||
constexpr auto kNoPrivate = qint32(0x01);
|
||||
constexpr auto kNoGroups = qint32(0x02);
|
||||
settings.setBytesLimit(
|
||||
Source::User,
|
||||
type,
|
||||
limit(value, kNoPrivate));
|
||||
settings.setBytesLimit(
|
||||
Source::Group,
|
||||
type,
|
||||
limit(value, kNoGroups));
|
||||
settings.setBytesLimit(
|
||||
Source::Channel,
|
||||
type,
|
||||
limit(value, kNoGroups));
|
||||
if (disabled(value, kNoPrivate)) {
|
||||
settings.setBytesLimit(Source::User, type, 0);
|
||||
}
|
||||
if (disabled(value, kNoGroups)) {
|
||||
settings.setBytesLimit(Source::Group, type, 0);
|
||||
settings.setBytesLimit(Source::Channel, type, 0);
|
||||
}
|
||||
};
|
||||
set(Type::Photo, photo);
|
||||
set(Type::VoiceMessage, audio);
|
||||
|
Loading…
Reference in New Issue
Block a user