Call FileReferenceManager::get_file_search_text through DownloadManagerCallback.
This commit is contained in:
parent
061aac58db
commit
ec19eaad65
@ -6,7 +6,6 @@
|
|||||||
//
|
//
|
||||||
#include "td/telegram/DownloadManager.h"
|
#include "td/telegram/DownloadManager.h"
|
||||||
|
|
||||||
#include "td/telegram/FileReferenceManager.h"
|
|
||||||
#include "td/telegram/files/FileId.hpp"
|
#include "td/telegram/files/FileId.hpp"
|
||||||
#include "td/telegram/files/FileSourceId.hpp"
|
#include "td/telegram/files/FileSourceId.hpp"
|
||||||
#include "td/telegram/Global.h"
|
#include "td/telegram/Global.h"
|
||||||
@ -534,13 +533,13 @@ class DownloadManagerImpl final : public DownloadManager {
|
|||||||
void prepare_hints() {
|
void prepare_hints() {
|
||||||
for (auto &it : files_) {
|
for (auto &it : files_) {
|
||||||
const auto &file_info = *it.second;
|
const auto &file_info = *it.second;
|
||||||
send_closure(G()->file_reference_manager(), &FileReferenceManager::get_file_search_text, file_info.file_source_id,
|
auto promise =
|
||||||
callback_->get_file_view(file_info.file_id).get_unique_file_id(),
|
PromiseCreator::lambda([actor_id = actor_id(this), promise = load_search_text_multipromise_.get_promise(),
|
||||||
[actor_id = actor_id(this), promise = load_search_text_multipromise_.get_promise(),
|
download_id = it.first](Result<string> r_search_text) mutable {
|
||||||
download_id = it.first](Result<string> r_search_text) mutable {
|
send_closure(actor_id, &DownloadManagerImpl::add_download_to_hints, download_id, std::move(r_search_text),
|
||||||
send_closure(actor_id, &DownloadManagerImpl::add_download_to_hints, download_id,
|
std::move(promise));
|
||||||
std::move(r_search_text), std::move(promise));
|
});
|
||||||
});
|
callback_->get_file_search_text(file_info.file_id, file_info.file_source_id, std::move(promise));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,8 @@ class DownloadManager : public Actor {
|
|||||||
virtual void delete_file(FileId file_id) = 0;
|
virtual void delete_file(FileId file_id) = 0;
|
||||||
virtual FileId dup_file_id(FileId file_id) = 0;
|
virtual FileId dup_file_id(FileId file_id) = 0;
|
||||||
|
|
||||||
virtual FileView get_file_view(FileId file_id) = 0;
|
virtual void get_file_search_text(FileId file_id, FileSourceId file_source_id, Promise<string> &&promise) = 0;
|
||||||
|
|
||||||
virtual FileView get_sync_file_view(FileId file_id) = 0;
|
virtual FileView get_sync_file_view(FileId file_id) = 0;
|
||||||
virtual td_api::object_ptr<td_api::fileDownload> get_file_download_object(FileId file_id,
|
virtual td_api::object_ptr<td_api::fileDownload> get_file_download_object(FileId file_id,
|
||||||
FileSourceId file_source_id,
|
FileSourceId file_source_id,
|
||||||
|
@ -64,6 +64,12 @@ FileId DownloadManagerCallback::dup_file_id(FileId file_id) {
|
|||||||
return td_->file_manager_->dup_file_id(file_id);
|
return td_->file_manager_->dup_file_id(file_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DownloadManagerCallback::get_file_search_text(FileId file_id, FileSourceId file_source_id,
|
||||||
|
Promise<string> &&promise) {
|
||||||
|
send_closure(td_->file_reference_manager_actor_, &FileReferenceManager::get_file_search_text, file_source_id,
|
||||||
|
get_file_view(file_id).get_unique_file_id(), std::move(promise));
|
||||||
|
}
|
||||||
|
|
||||||
FileView DownloadManagerCallback::get_file_view(FileId file_id) {
|
FileView DownloadManagerCallback::get_file_view(FileId file_id) {
|
||||||
return td_->file_manager_->get_file_view(file_id);
|
return td_->file_manager_->get_file_view(file_id);
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ class DownloadManagerCallback final : public DownloadManager::Callback {
|
|||||||
|
|
||||||
FileId dup_file_id(FileId file_id) final;
|
FileId dup_file_id(FileId file_id) final;
|
||||||
|
|
||||||
FileView get_file_view(FileId file_id) final;
|
void get_file_search_text(FileId file_id, FileSourceId file_source_id, Promise<string> &&promise) final;
|
||||||
|
|
||||||
FileView get_sync_file_view(FileId file_id) final;
|
FileView get_sync_file_view(FileId file_id) final;
|
||||||
|
|
||||||
@ -57,6 +57,8 @@ class DownloadManagerCallback final : public DownloadManager::Callback {
|
|||||||
Td *td_;
|
Td *td_;
|
||||||
ActorShared<> parent_;
|
ActorShared<> parent_;
|
||||||
|
|
||||||
|
FileView get_file_view(FileId file_id);
|
||||||
|
|
||||||
static std::shared_ptr<FileManager::DownloadCallback> make_download_file_callback(
|
static std::shared_ptr<FileManager::DownloadCallback> make_download_file_callback(
|
||||||
Td *td, ActorShared<DownloadManager> download_manager);
|
Td *td, ActorShared<DownloadManager> download_manager);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user