DownloadManager: add files with correct size and downloaded_size.

This commit is contained in:
levlam 2022-03-01 16:01:40 +03:00
parent 60c35f2192
commit f6d71f8b9d
2 changed files with 6 additions and 1 deletions

View File

@ -377,6 +377,11 @@ class DownloadManagerImpl final : public DownloadManager {
CHECK(file_info != nullptr);
auto download_id = file_info->download_id;
file_info->internal_file_id = callback_->dup_file_id(file_info->file_id);
auto file_view = callback_->get_file_view(file_info->file_id);
CHECK(!file_view.empty());
file_info->size = file_view.expected_size();
file_info->downloaded_size = file_view.local_total_size();
by_internal_file_id_[file_info->internal_file_id] = download_id;
by_file_id_[file_info->file_id] = download_id;
hints_.add(download_id, search_text.empty() ? string(" ") : search_text);

View File

@ -4027,7 +4027,7 @@ void Td::init_managers() {
auto td = G()->td().get_actor_unsafe();
auto file_view = td->file_manager_->get_file_view(file_id);
send_closure(download_manager_, &DownloadManager::update_file_download_state, file_id,
file_view.local_total_size(), file_view.size(), !file_view.is_downloading());
file_view.local_total_size(), file_view.expected_size(), !file_view.is_downloading());
// TODO: handle deleted state?
}
void on_download_ok(FileId file_id) final {