Events.Consent.deprecated.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Threading.Tasks;
  4. namespace Unity.Services.Analytics
  5. {
  6. public static partial class Events
  7. {
  8. /// <summary>
  9. /// Returns identifiers of required consents we need to gather from the user
  10. /// in order to be allowed to sent analytics events.
  11. /// This method must be called every time the game starts - without checking the geolocation,
  12. /// no event will be sent (even if the consent was already given).
  13. /// If the required consent was already given, an empty list is returned.
  14. /// If the user already opted out from the current legislation, an empty list is returned.
  15. /// It involves the GeoIP call.
  16. /// `ConsentCheckException` is thrown if the GeoIP call was unsuccessful.
  17. ///
  18. /// </summary>
  19. /// <returns>A list of consent identifiers that are required for sending analytics events.</returns>
  20. /// <exception cref="ConsentCheckException">Thrown if the GeoIP call was unsuccessful.</exception>
  21. [Obsolete("The interface provided by this method has moved to AnalyticsService.Instance.CheckForRequiredConsents, and should be accessed from there instead. This API will be removed in an upcoming release.")]
  22. public static async Task<List<string>> CheckForRequiredConsents()
  23. {
  24. return await AnalyticsService.Instance.CheckForRequiredConsents();
  25. }
  26. /// <summary>
  27. /// Sets the consent status for the specified opt-in-based legislation (PIPL etc).
  28. /// The required legislation identifier can be found by calling `CheckForRequiredConsents` method.
  29. /// If this method is tried to be used for the incorrect legislation (PIPL outside China etc),
  30. /// the `ConsentCheckException` is thrown.
  31. ///
  32. /// </summary>
  33. /// <param name="identifier">The legislation identifier for which the consent status should be changed.</param>
  34. /// <param name="consent">The consent status which should be set for the specified legislation.</param>
  35. /// <exception cref="ConsentCheckException">Thrown if the incorrect legislation was being provided or
  36. /// the required consent flow cannot be determined.</exception>
  37. [Obsolete("The interface provided by this method has moved to AnalyticsService.Instance.ProvideOptInConsent, and should be accessed from there instead. This API will be removed in an upcoming release.")]
  38. public static void ProvideOptInConsent(string identifier, bool consent)
  39. {
  40. AnalyticsService.Instance.ProvideOptInConsent(identifier, consent);
  41. }
  42. }
  43. }