1 |
efrain |
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 |
|
|
|
15 |
#import <Foundation/Foundation.h>
|
|
|
16 |
#import "FirebaseABTesting/Sources/Private/ABTExperimentPayload.h"
|
|
|
17 |
|
|
|
18 |
#import "Interop/Analytics/Public/FIRAnalyticsInterop.h"
|
|
|
19 |
|
|
|
20 |
NS_ASSUME_NONNULL_BEGIN
|
|
|
21 |
|
|
|
22 |
@class FIRLifecycleEvents;
|
|
|
23 |
|
|
|
24 |
/// This class dynamically calls Firebase Analytics API to collect or update experiments
|
|
|
25 |
/// information.
|
|
|
26 |
/// The experiment in Firebase Analytics is named as conditional user property (CUP) object defined
|
|
|
27 |
/// in FIRAConditionalUserProperty.h.
|
|
|
28 |
@interface ABTConditionalUserPropertyController : NSObject
|
|
|
29 |
|
|
|
30 |
/// Returns the ABTConditionalUserPropertyController singleton.
|
|
|
31 |
+ (instancetype)sharedInstanceWithAnalytics:(id<FIRAnalyticsInterop> _Nullable)analytics;
|
|
|
32 |
|
|
|
33 |
/// Returns the list of currently set experiments from Firebase Analytics for the provided origin.
|
|
|
34 |
- (NSArray *)experimentsWithOrigin:(NSString *)origin;
|
|
|
35 |
|
|
|
36 |
/// Returns the experiment ID from Firebase Analytics given an experiment object. Returns empty
|
|
|
37 |
/// string if can't find Firebase Analytics service.
|
|
|
38 |
- (NSString *)experimentIDOfExperiment:(nullable id)experiment;
|
|
|
39 |
|
|
|
40 |
/// Returns the variant ID from Firebase Analytics given an experiment object. Returns empty string
|
|
|
41 |
/// if can't find Firebase Analytics service.
|
|
|
42 |
- (NSString *)variantIDOfExperiment:(nullable id)experiment;
|
|
|
43 |
|
|
|
44 |
/// Returns whether the experiment is the same as the one in the provided payload.
|
|
|
45 |
- (BOOL)isExperiment:(id)experiment theSameAsPayload:(ABTExperimentPayload *)payload;
|
|
|
46 |
|
|
|
47 |
/// Clears the experiment in Firebase Analytics.
|
|
|
48 |
/// @param experimentID Experiment ID to clear.
|
|
|
49 |
/// @param variantID Variant ID to clear.
|
|
|
50 |
/// @param origin Impacted originating service, it is defined at Firebase Analytics
|
|
|
51 |
/// FIREventOrigins.h.
|
|
|
52 |
/// @param payload Payload to overwrite event name in events. DO NOT use payload's experiment
|
|
|
53 |
/// ID and variant ID as the experiment to clear.
|
|
|
54 |
/// @param events Events name for clearing the experiment.
|
|
|
55 |
- (void)clearExperiment:(NSString *)experimentID
|
|
|
56 |
variantID:(NSString *)variantID
|
|
|
57 |
withOrigin:(NSString *)origin
|
|
|
58 |
payload:(nullable ABTExperimentPayload *)payload
|
|
|
59 |
events:(FIRLifecycleEvents *)events;
|
|
|
60 |
|
|
|
61 |
/// Sets the experiment in Firebase Analytics.
|
|
|
62 |
/// @param origin Impacted originating service, it is defined at Firebase Analytics
|
|
|
63 |
/// FIREventOrigins.h.
|
|
|
64 |
/// @param payload Payload to overwrite event name in events. DO NOT use payload's experiment
|
|
|
65 |
/// ID and variant ID as the experiment to set.
|
|
|
66 |
/// @param events Events name for setting the experiment.
|
|
|
67 |
/// @param policy Overflow policy when the number of experiments is over the limit.
|
|
|
68 |
- (void)setExperimentWithOrigin:(NSString *)origin
|
|
|
69 |
payload:(ABTExperimentPayload *)payload
|
|
|
70 |
events:(FIRLifecycleEvents *)events
|
|
|
71 |
policy:(ABTExperimentPayloadExperimentOverflowPolicy)policy;
|
|
|
72 |
|
|
|
73 |
/**
|
|
|
74 |
* Unavailable. Use sharedInstanceWithAnalytics: instead.
|
|
|
75 |
*/
|
|
|
76 |
- (instancetype)init __attribute__((unavailable("Use +sharedInstanceWithAnalytics: instead.")));
|
|
|
77 |
@end
|
|
|
78 |
|
|
|
79 |
NS_ASSUME_NONNULL_END
|