FIRCLSDataCollectionToken.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright 2019 Google
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #import <Foundation/Foundation.h>
  15. NS_ASSUME_NONNULL_BEGIN
  16. /**
  17. * A FIRCLSDataCollectionToken represents having permission to upload data. A data collection token
  18. * is either valid or nil. Every function that directly initiates a network operation that will
  19. * result in data collection must check to make sure it has been passed a valid token. Tokens should
  20. * only be created when either (1) automatic data collection is enabled, or (2) the user has
  21. * explicitly given permission to collect data for a particular purpose, using the API. For all the
  22. * functions in between, the data collection token getting passed as an argument helps to document
  23. * and enforce the flow of data collection permission through the SDK.
  24. */
  25. @interface FIRCLSDataCollectionToken : NSObject
  26. /**
  27. * Creates a valid token. Only call this method when either (1) automatic data collection is
  28. * enabled, or (2) the user has explicitly given permission to collect data for a particular
  29. * purpose, using the API.
  30. */
  31. + (instancetype)validToken;
  32. /**
  33. * Use this to verify that a token is valid. If this is called on a nil instance, it will return NO.
  34. * @return YES.
  35. */
  36. - (BOOL)isValid;
  37. @end
  38. NS_ASSUME_NONNULL_END