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.

71 lines
1.7KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE 6 technical preview.
  4. Copyright (c) 2020 - Raw Material Software Limited
  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. namespace juce
  14. {
  15. void Analytics::addDestination (AnalyticsDestination* destination)
  16. {
  17. destinations.add (destination);
  18. }
  19. OwnedArray<AnalyticsDestination>& Analytics::getDestinations()
  20. {
  21. return destinations;
  22. }
  23. void Analytics::setUserId (String newUserId)
  24. {
  25. userId = newUserId;
  26. }
  27. void Analytics::setUserProperties (StringPairArray properties)
  28. {
  29. userProperties = properties;
  30. }
  31. void Analytics::logEvent (const String& eventName,
  32. const StringPairArray& parameters,
  33. int eventType)
  34. {
  35. if (! isSuspended)
  36. {
  37. AnalyticsDestination::AnalyticsEvent event
  38. {
  39. eventName,
  40. eventType,
  41. Time::getMillisecondCounter(),
  42. parameters,
  43. userId,
  44. userProperties
  45. };
  46. for (auto* destination : destinations)
  47. destination->logEvent (event);
  48. }
  49. }
  50. void Analytics::setSuspended (bool shouldBeSuspended)
  51. {
  52. isSuspended = shouldBeSuspended;
  53. }
  54. JUCE_IMPLEMENT_SINGLETON (Analytics)
  55. }