diff --git a/td/telegram/DownloadManager.cpp b/td/telegram/DownloadManager.cpp index fa908ba11..6787c4806 100644 --- a/td/telegram/DownloadManager.cpp +++ b/td/telegram/DownloadManager.cpp @@ -531,7 +531,7 @@ class DownloadManagerImpl final : public DownloadManager { } } else { auto search_text = r_search_text.move_as_ok(); - // TODO: This is a race. Synchronous call to MessagesManager would be better. + // TODO: This is a race. Synchronous call would be better. hints_.add(download_id, search_text.empty() ? string(" ") : search_text); } promise.set_value(Unit()); diff --git a/td/telegram/DownloadManager.h b/td/telegram/DownloadManager.h index 6d8bc239a..1b3ba51be 100644 --- a/td/telegram/DownloadManager.h +++ b/td/telegram/DownloadManager.h @@ -59,7 +59,7 @@ class DownloadManager : public Actor { void parse(ParserT &parser); }; - // to make DownloadManager testable all interactions with G() must be hidden in this probably monstrous interface + // Callback is needed to make DownloadManager testable class Callback { public: virtual ~Callback() = default; diff --git a/td/telegram/DownloadManagerCallback.cpp b/td/telegram/DownloadManagerCallback.cpp index 619d96e0a..9233a7f82 100644 --- a/td/telegram/DownloadManagerCallback.cpp +++ b/td/telegram/DownloadManagerCallback.cpp @@ -101,8 +101,7 @@ std::shared_ptr DownloadManagerCallback::make_dow ActorShared download_manager_; void send_update(FileId file_id, bool is_paused) const { - auto td = G()->td().get_actor_unsafe(); - auto file_view = td->file_manager_->get_file_view(file_id); + auto file_view = td_->file_manager_->get_file_view(file_id); send_closure_later(download_manager_, &DownloadManager::update_file_download_state, file_id, file_view.local_total_size(), file_view.size(), file_view.expected_size(), is_paused); } diff --git a/td/telegram/DownloadManagerCallback.h b/td/telegram/DownloadManagerCallback.h index abea0b6ce..145ae7f92 100644 --- a/td/telegram/DownloadManagerCallback.h +++ b/td/telegram/DownloadManagerCallback.h @@ -8,6 +8,7 @@ #include "td/telegram/DownloadManager.h" #include "td/telegram/files/FileId.h" +#include "td/telegram/files/FileManager.h" #include "td/telegram/files/FileSourceId.h" #include "td/telegram/td_api.h" @@ -15,6 +16,8 @@ #include "td/utils/common.h" +#include + namespace td { class Td; diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 7754f3529..ae98f1008 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -37486,7 +37486,7 @@ unique_ptr MessagesManager::parse_dialog(DialogId dialo LOG_CHECK(dialog_id.is_valid()) << "Can't repair " << dialog_id << ' ' << d->dialog_id << ' ' << status << ' ' << source << ' ' << format::as_hex_dump<4>(value.as_slice()); - LOG(ERROR) << "Repair broken " << dialog_id << ': ' << status << ' ' << format::as_hex_dump<4>(value.as_slice()); + LOG(ERROR) << "Repair broken " << dialog_id << ": " << status << ' ' << format::as_hex_dump<4>(value.as_slice()); // just clean all known data about the dialog d = make_unique();