FIRAnalyticsConfiguration.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright 2017 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <Foundation/Foundation.h>
  17. /// Values stored in analyticsEnabledState. Never alter these constants since they must match with
  18. /// values persisted to disk.
  19. typedef NS_ENUM(int64_t, FIRAnalyticsEnabledState) {
  20. // 0 is the default value for keys not found stored in persisted config, so it cannot represent
  21. // kFIRAnalyticsEnabledStateSetNo. It must represent kFIRAnalyticsEnabledStateNotSet.
  22. kFIRAnalyticsEnabledStateNotSet = 0,
  23. kFIRAnalyticsEnabledStateSetYes = 1,
  24. kFIRAnalyticsEnabledStateSetNo = 2,
  25. };
  26. /// The user defaults key for the persisted measurementEnabledState value. FIRAPersistedConfig reads
  27. /// measurementEnabledState using this same key.
  28. static NSString *const kFIRAPersistedConfigMeasurementEnabledStateKey =
  29. @"/google/measurement/measurement_enabled_state";
  30. static NSString *const kFIRAnalyticsConfigurationSetEnabledNotification =
  31. @"FIRAnalyticsConfigurationSetEnabledNotification";
  32. @interface FIRAnalyticsConfiguration : NSObject
  33. /// Returns the shared instance of FIRAnalyticsConfiguration.
  34. + (FIRAnalyticsConfiguration *)sharedInstance;
  35. /// Sets whether analytics collection is enabled for this app on this device, and a flag to persist
  36. /// the value or not. The setting should not be persisted if being set by the global data collection
  37. /// flag.
  38. - (void)setAnalyticsCollectionEnabled:(BOOL)analyticsCollectionEnabled
  39. persistSetting:(BOOL)shouldPersist;
  40. @end