The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.8KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE 6 technical preview.
  4. Copyright (c) 2017 - ROLI Ltd.
  5. You may use this code under the terms of the GPL v3
  6. (see www.gnu.org/licenses).
  7. For this technical preview, this file is not subject to commercial licensing.
  8. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  9. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  10. DISCLAIMED.
  11. ==============================================================================
  12. */
  13. #pragma once
  14. #include "jucer_Headers.h"
  15. //==============================================================================
  16. enum ProjucerAnalyticsEvent
  17. {
  18. appEvent,
  19. projectEvent,
  20. userEvent,
  21. exampleEvent,
  22. startPageEvent
  23. };
  24. //==============================================================================
  25. class ProjucerAnalyticsDestination : public ThreadedAnalyticsDestination
  26. {
  27. public:
  28. ProjucerAnalyticsDestination();
  29. ~ProjucerAnalyticsDestination() override;
  30. //==============================================================================
  31. bool logBatchedEvents (const Array<AnalyticsEvent>&) override;
  32. void stopLoggingEvents() override;
  33. int getMaximumBatchSize() override { return 20; }
  34. private:
  35. void saveUnloggedEvents (const std::deque<AnalyticsEvent>&) override;
  36. void restoreUnloggedEvents (std::deque<AnalyticsEvent>&) override;
  37. //==============================================================================
  38. String apiKey;
  39. const int initialPeriodMs = 1000;
  40. int periodMs = initialPeriodMs;
  41. CriticalSection webStreamCreation;
  42. bool shouldExit = false;
  43. std::unique_ptr<WebInputStream> webStream;
  44. File savedEventsFile;
  45. };