Add autoDownloadSettings.preload_stories.

This commit is contained in:
levlam 2023-06-27 17:37:48 +03:00
parent 3854a8b872
commit b5020a8fef
3 changed files with 10 additions and 3 deletions

View File

@ -4924,7 +4924,7 @@ storyInteractionInfo view_count:int32 recent_viewer_user_ids:vector<int53> = Sto
//@date Point in time (Unix timestamp) when the story was published //@date Point in time (Unix timestamp) when the story was published
//@is_pinned True, if the story is saved in the sender's profile and will be available there after expiration //@is_pinned True, if the story is saved in the sender's profile and will be available there after expiration
//@is_visible_only_for_self True, if the story is visible only for the current user //@is_visible_only_for_self True, if the story is visible only for the current user
//@can_be_forwarded True, if the story can be forwarded as a message. Otherwise, screenshots of the story must be also forbidden //@can_be_forwarded True, if the story can be forwarded as a message. Otherwise, screenshots and saving of the story content must be also forbidden
//@can_be_replied True, if the story can be replied in the chat with the story sender //@can_be_replied True, if the story can be replied in the chat with the story sender
//@can_get_viewers True, users viewed the story can be received through getStoryViewers //@can_get_viewers True, users viewed the story can be received through getStoryViewers
//@interaction_info Information about interactions with the story; may be null if the story isn't owned or there were no interactions //@interaction_info Information about interactions with the story; may be null if the story isn't owned or there were no interactions
@ -5082,8 +5082,9 @@ networkStatistics since_date:int32 entries:vector<NetworkStatisticsEntry> = Netw
//@video_upload_bitrate The maximum suggested bitrate for uploaded videos, in kbit/s //@video_upload_bitrate The maximum suggested bitrate for uploaded videos, in kbit/s
//@preload_large_videos True, if the beginning of video files needs to be preloaded for instant playback //@preload_large_videos True, if the beginning of video files needs to be preloaded for instant playback
//@preload_next_audio True, if the next audio track needs to be preloaded while the user is listening to an audio file //@preload_next_audio True, if the next audio track needs to be preloaded while the user is listening to an audio file
//@preload_stories True, if stories needs to be preloaded
//@use_less_data_for_calls True, if "use less data for calls" option needs to be enabled //@use_less_data_for_calls True, if "use less data for calls" option needs to be enabled
autoDownloadSettings is_auto_download_enabled:Bool max_photo_file_size:int32 max_video_file_size:int53 max_other_file_size:int53 video_upload_bitrate:int32 preload_large_videos:Bool preload_next_audio:Bool use_less_data_for_calls:Bool = AutoDownloadSettings; autoDownloadSettings is_auto_download_enabled:Bool max_photo_file_size:int32 max_video_file_size:int53 max_other_file_size:int53 video_upload_bitrate:int32 preload_large_videos:Bool preload_next_audio:Bool preload_stories:Bool use_less_data_for_calls:Bool = AutoDownloadSettings;
//@description Contains auto-download settings presets for the current user //@description Contains auto-download settings presets for the current user
//@low Preset with lowest settings; supposed to be used by default when roaming //@low Preset with lowest settings; supposed to be used by default when roaming

View File

@ -25,6 +25,7 @@ static td_api::object_ptr<td_api::autoDownloadSettings> convert_auto_download_se
auto disabled = (flags & telegram_api::autoDownloadSettings::DISABLED_MASK) != 0; auto disabled = (flags & telegram_api::autoDownloadSettings::DISABLED_MASK) != 0;
auto video_preload_large = (flags & telegram_api::autoDownloadSettings::VIDEO_PRELOAD_LARGE_MASK) != 0; auto video_preload_large = (flags & telegram_api::autoDownloadSettings::VIDEO_PRELOAD_LARGE_MASK) != 0;
auto audio_preload_next = (flags & telegram_api::autoDownloadSettings::AUDIO_PRELOAD_NEXT_MASK) != 0; auto audio_preload_next = (flags & telegram_api::autoDownloadSettings::AUDIO_PRELOAD_NEXT_MASK) != 0;
auto stories_preload = (flags & telegram_api::autoDownloadSettings::STORIES_PRELOAD_MASK) != 0;
auto phonecalls_less_data = (flags & telegram_api::autoDownloadSettings::PHONECALLS_LESS_DATA_MASK) != 0; auto phonecalls_less_data = (flags & telegram_api::autoDownloadSettings::PHONECALLS_LESS_DATA_MASK) != 0;
constexpr int32 MAX_PHOTO_SIZE = 10 * (1 << 20) /* 10 MB */; constexpr int32 MAX_PHOTO_SIZE = 10 * (1 << 20) /* 10 MB */;
constexpr int64 MAX_DOCUMENT_SIZE = (static_cast<int64>(1) << 52); constexpr int64 MAX_DOCUMENT_SIZE = (static_cast<int64>(1) << 52);
@ -32,7 +33,7 @@ static td_api::object_ptr<td_api::autoDownloadSettings> convert_auto_download_se
!disabled, clamp(settings->photo_size_max_, static_cast<int32>(0), MAX_PHOTO_SIZE), !disabled, clamp(settings->photo_size_max_, static_cast<int32>(0), MAX_PHOTO_SIZE),
clamp(settings->video_size_max_, static_cast<int64>(0), MAX_DOCUMENT_SIZE), clamp(settings->video_size_max_, static_cast<int64>(0), MAX_DOCUMENT_SIZE),
clamp(settings->file_size_max_, static_cast<int64>(0), MAX_DOCUMENT_SIZE), settings->video_upload_maxbitrate_, clamp(settings->file_size_max_, static_cast<int64>(0), MAX_DOCUMENT_SIZE), settings->video_upload_maxbitrate_,
video_preload_large, audio_preload_next, phonecalls_less_data); video_preload_large, audio_preload_next, stories_preload, phonecalls_less_data);
} }
class GetAutoDownloadSettingsQuery final : public Td::ResultHandler { class GetAutoDownloadSettingsQuery final : public Td::ResultHandler {
@ -76,6 +77,9 @@ static telegram_api::object_ptr<telegram_api::autoDownloadSettings> get_input_au
if (settings.preload_next_audio) { if (settings.preload_next_audio) {
flags |= telegram_api::autoDownloadSettings::AUDIO_PRELOAD_NEXT_MASK; flags |= telegram_api::autoDownloadSettings::AUDIO_PRELOAD_NEXT_MASK;
} }
if (settings.preload_stories) {
flags |= telegram_api::autoDownloadSettings::STORIES_PRELOAD_MASK;
}
if (settings.use_less_data_for_calls) { if (settings.use_less_data_for_calls) {
flags |= telegram_api::autoDownloadSettings::PHONECALLS_LESS_DATA_MASK; flags |= telegram_api::autoDownloadSettings::PHONECALLS_LESS_DATA_MASK;
} }
@ -129,6 +133,7 @@ AutoDownloadSettings get_auto_download_settings(const td_api::object_ptr<td_api:
result.is_enabled = settings->is_auto_download_enabled_; result.is_enabled = settings->is_auto_download_enabled_;
result.preload_large_videos = settings->preload_large_videos_; result.preload_large_videos = settings->preload_large_videos_;
result.preload_next_audio = settings->preload_next_audio_; result.preload_next_audio = settings->preload_next_audio_;
result.preload_stories = settings->preload_stories_;
result.use_less_data_for_calls = settings->use_less_data_for_calls_; result.use_less_data_for_calls = settings->use_less_data_for_calls_;
return result; return result;
} }

View File

@ -25,6 +25,7 @@ class AutoDownloadSettings {
bool is_enabled = false; bool is_enabled = false;
bool preload_large_videos = false; bool preload_large_videos = false;
bool preload_next_audio = false; bool preload_next_audio = false;
bool preload_stories = false;
bool use_less_data_for_calls = false; bool use_less_data_for_calls = false;
}; };