2 * Copyright 2017 Google
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #import "FIRAnalyticsConfiguration.h"
19 /// Values stored in analyticsEnabledState. Never alter these constants since they must match with
20 /// values persisted to disk.
21 typedef NS_ENUM(int64_t, FIRAnalyticsEnabledState) {
22 // 0 is the default value for keys not found stored in persisted config, so it cannot represent
23 // kFIRAnalyticsEnabledStateSetNo. It must represent kFIRAnalyticsEnabledStateNotSet.
24 kFIRAnalyticsEnabledStateNotSet = 0,
25 kFIRAnalyticsEnabledStateSetYes = 1,
26 kFIRAnalyticsEnabledStateSetNo = 2,
29 /// The user defaults key for the persisted measurementEnabledState value. FIRAPersistedConfig reads
30 /// measurementEnabledState using this same key.
31 static NSString *const kFIRAPersistedConfigMeasurementEnabledStateKey =
32 @"/google/measurement/measurement_enabled_state";
34 static NSString *const kFIRAnalyticsConfigurationSetEnabledNotification =
35 @"FIRAnalyticsConfigurationSetEnabledNotification";
36 static NSString *const kFIRAnalyticsConfigurationSetMinimumSessionIntervalNotification =
37 @"FIRAnalyticsConfigurationSetMinimumSessionIntervalNotification";
38 static NSString *const kFIRAnalyticsConfigurationSetSessionTimeoutIntervalNotification =
39 @"FIRAnalyticsConfigurationSetSessionTimeoutIntervalNotification";
41 @interface FIRAnalyticsConfiguration (Internal)
43 /// Sets whether analytics collection is enabled for this app on this device, and a flag to persist
44 /// the value or not. The setting should not be persisted if being set by the global data collection
46 - (void)setAnalyticsCollectionEnabled:(BOOL)analyticsCollectionEnabled
47 persistSetting:(BOOL)shouldPersist;