Add get_file_view for DownloadManager::callback.

This commit is contained in:
levlam 2022-03-01 15:54:04 +03:00
parent 9ead1f0b34
commit 60c35f2192
3 changed files with 5 additions and 4 deletions

View File

@ -295,7 +295,7 @@ class DownloadManagerImpl final : public DownloadManager {
to_save.priority = file_info.priority;
to_save.created_at = file_info.created_at;
to_save.completed_at = file_info.completed_at;
to_save.unique_file_id = callback_->get_unique_file_id(file_info.file_id);
to_save.unique_file_id = callback_->get_file_view(file_info.file_id).get_unique_file_id();
G()->td_db()->get_binlog_pmc()->set(pmc_key(file_info), log_event_store(to_save).as_slice().str());
}
static void remove_from_db(const FileInfo &file_info) {

View File

@ -7,6 +7,7 @@
#pragma once
#include "td/telegram/files/FileId.h"
#include "td/telegram/files/FileManager.h"
#include "td/telegram/files/FileSourceId.h"
#include "td/telegram/td_api.h"
@ -53,7 +54,7 @@ class DownloadManager : public Actor {
virtual void delete_file(FileId file_id) = 0;
virtual FileId dup_file_id(FileId file_id) = 0;
virtual string get_unique_file_id(FileId file_id) = 0;
virtual FileView get_file_view(FileId file_id) = 0;
virtual td_api::object_ptr<td_api::fileDownload> get_file_download_object(FileId file_id,
FileSourceId file_source_id,
int32 add_date, int32 complete_date,

View File

@ -4000,9 +4000,9 @@ void Td::init_managers() {
auto td = G()->td().get_actor_unsafe();
return td->file_manager_->dup_file_id(file_id);
}
string get_unique_file_id(FileId file_id) final {
FileView get_file_view(FileId file_id) final {
auto td = G()->td().get_actor_unsafe();
return td->file_manager_->get_file_view(file_id).get_unique_file_id();
return td->file_manager_->get_file_view(file_id);
}
td_api::object_ptr<td_api::fileDownload> get_file_download_object(FileId file_id, FileSourceId file_source_id,
int32 add_date, int32 complete_date,