2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Replaced hardcoded limitations for ringtones with server values.

This commit is contained in:
23rd
2022-04-10 22:16:15 +03:00
parent 7eacd26d70
commit a49eda44d9
5 changed files with 57 additions and 12 deletions

View File

@@ -16,6 +16,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_file_origin.h"
#include "data/data_session.h"
#include "data/notify/data_notify_settings.h"
#include "main/main_account.h"
#include "main/main_app_config.h"
#include "main/main_session.h"
#include "storage/file_upload.h"
#include "storage/localimageloader.h"
@@ -190,4 +192,22 @@ void Ringtones::remove(DocumentId id) {
}
}
int Ringtones::maxSize() const {
return int(base::SafeRound(_session->account().appConfig().get<double>(
"ringtone_size_max",
100 * 1024)));
}
int Ringtones::maxSavedCount() const {
return int(base::SafeRound(_session->account().appConfig().get<double>(
"ringtone_saved_count_max",
100)));
}
int Ringtones::maxDuration() const {
return int(base::SafeRound(_session->account().appConfig().get<double>(
"ringtone_duration_max",
5)));
}
} // namespace Api

View File

@@ -38,6 +38,10 @@ public:
[[nodiscard]] rpl::producer<QString> uploadFails() const;
[[nodiscard]] rpl::producer<DocumentId> uploadDones() const;
[[nodiscard]] int maxSize() const;
[[nodiscard]] int maxSavedCount() const;
[[nodiscard]] int maxDuration() const;
private:
struct UploadedData {
QString filename;