update_checker.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #pragma once
  8. #include "mtproto/dedicated_file_loader.h"
  9. namespace Main {
  10. class Session;
  11. } // namespace Main
  12. namespace Core {
  13. bool UpdaterDisabled();
  14. void SetUpdaterDisabledAtStartup();
  15. class Updater;
  16. class UpdateChecker {
  17. public:
  18. enum class State {
  19. None,
  20. Download,
  21. Ready,
  22. };
  23. using Progress = MTP::AbstractDedicatedLoader::Progress;
  24. UpdateChecker();
  25. rpl::producer<> checking() const;
  26. rpl::producer<> isLatest() const;
  27. rpl::producer<Progress> progress() const;
  28. rpl::producer<> failed() const;
  29. rpl::producer<> ready() const;
  30. void start(bool forceWait = false);
  31. void stop();
  32. void test();
  33. void setMtproto(base::weak_ptr<Main::Session> session);
  34. State state() const;
  35. int already() const;
  36. int size() const;
  37. private:
  38. const std::shared_ptr<Updater> _updater;
  39. };
  40. bool checkReadyUpdate();
  41. void UpdateApplication();
  42. QString countAlphaVersionSignature(uint64 version);
  43. } // namespace Core