network_reachability.h 687 B

123456789101112131415161718192021222324252627
  1. // This file is part of Desktop App Toolkit,
  2. // a set of libraries for developing nice desktop applications.
  3. //
  4. // For license and copyright information please follow this link:
  5. // https://github.com/desktop-app/legal/blob/master/LEGAL
  6. //
  7. #pragma once
  8. namespace base {
  9. class NetworkReachability final {
  10. public:
  11. NetworkReachability();
  12. ~NetworkReachability();
  13. [[nodiscard]] static std::shared_ptr<NetworkReachability> Instance();
  14. [[nodiscard]] bool available() const;
  15. [[nodiscard]] rpl::producer<bool> availableChanges() const;
  16. [[nodiscard]] rpl::producer<bool> availableValue() const;
  17. private:
  18. struct Private;
  19. const std::unique_ptr<Private> _private;
  20. };
  21. } // namespace base