diff --git a/td/telegram/DownloadManager.cpp b/td/telegram/DownloadManager.cpp index 71e1c9fe5..91806feb2 100644 --- a/td/telegram/DownloadManager.cpp +++ b/td/telegram/DownloadManager.cpp @@ -106,6 +106,7 @@ class DownloadManagerImpl final : public DownloadManager { remove_from_db(file_info); files_.erase(file_info.download_id); + callback_->update_file_removed(file_id); return Status::OK(); } diff --git a/td/telegram/DownloadManager.h b/td/telegram/DownloadManager.h index 7424d6c59..a4e945a2f 100644 --- a/td/telegram/DownloadManager.h +++ b/td/telegram/DownloadManager.h @@ -47,6 +47,7 @@ class DownloadManager : public Actor { public: virtual ~Callback() = default; virtual void update_counters(Counters counters) = 0; + virtual void update_file_removed(FileId file_id) = 0; virtual void start_file(FileId file_id, int8 priority) = 0; virtual void pause_file(FileId file_id) = 0; virtual void delete_file(FileId file_id) = 0; diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 9b6ee881f..d26c62fb5 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -3980,6 +3980,10 @@ void Td::init_managers() { void update_counters(DownloadManager::Counters counters) final { send_closure(G()->td(), &Td::send_update, counters.get_update_file_downloads_object()); } + void update_file_removed(FileId file_id) final { + send_closure(G()->td(), &Td::send_update, + td_api::make_object(file_id.get())); + } void start_file(FileId file_id, int8 priority) final { send_closure(G()->file_manager(), &FileManager::download, file_id, make_download_file_callback(), priority, FileManager::KEEP_DOWNLOAD_OFFSET, FileManager::IGNORE_DOWNLOAD_LIMIT);