-
Notifications
You must be signed in to change notification settings - Fork 244
/
CountlyRemoteConfig.m
147 lines (111 loc) · 4.34 KB
/
CountlyRemoteConfig.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
// CountlyRemoteConfig.m
//
// This code is provided under the MIT License.
//
// Please visit www.count.ly for more information.
#import "CountlyCommon.h"
@implementation CountlyRemoteConfig
+ (instancetype)sharedInstance
{
if (!CountlyCommon.sharedInstance.hasStarted)
return nil;
static CountlyRemoteConfig* s_sharedInstance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{s_sharedInstance = self.new;});
return s_sharedInstance;
}
- (instancetype)init
{
if (self = [super init])
{
}
return self;
}
- (NSDictionary *)testingGetAllVariants
{
CLY_LOG_I(@"%s", __FUNCTION__);
return [CountlyRemoteConfigInternal.sharedInstance testingGetAllVariants];
}
- (NSArray *)testingGetVariantsForKey:(NSString *)key {
CLY_LOG_I(@"%s %@", __FUNCTION__, key);
return [CountlyRemoteConfigInternal.sharedInstance testingGetVariantsForKey:key];
}
- (void)testingEnrollIntoVariant:(NSString *)key variantName:(NSString *)variantName completionHandler:(RCVariantCallback)completionHandler {
CLY_LOG_I(@"%s %@ %@ %@", __FUNCTION__, key, variantName , completionHandler);
[CountlyRemoteConfigInternal.sharedInstance testingEnrollIntoVariant:key variantName:variantName completionHandler:completionHandler];
}
- (void)testingDownloadVariantInformation:(RCVariantCallback)completionHandler
{
CLY_LOG_I(@"%s %@", __FUNCTION__, completionHandler);
[CountlyRemoteConfigInternal.sharedInstance testingDownloadAllVariants:completionHandler];
}
- (CountlyRCData *)getValue:(NSString *)key
{
CLY_LOG_I(@"%s %@", __FUNCTION__, key);
return [CountlyRemoteConfigInternal.sharedInstance getValue:key];
}
- (NSDictionary<NSString*, CountlyRCData *> *)getAllValues
{
CLY_LOG_I(@"%s", __FUNCTION__);
return [CountlyRemoteConfigInternal.sharedInstance getAllValues];
}
- (CountlyRCData *)getValueAndEnroll:(NSString *)key
{
CLY_LOG_I(@"%s %@", __FUNCTION__, key);
return [CountlyRemoteConfigInternal.sharedInstance getValueAndEnroll:key];
}
- (NSDictionary<NSString*, CountlyRCData *> *)getAllValuesAndEnroll
{
CLY_LOG_I(@"%s", __FUNCTION__);
return [CountlyRemoteConfigInternal.sharedInstance getAllValuesAndEnroll];
}
- (void)enrollIntoABTestsForKeys:(NSArray *)keys
{
CLY_LOG_I(@"%s %@", __FUNCTION__, keys);
[CountlyRemoteConfigInternal.sharedInstance enrollIntoABTestsForKeys:keys];
}
- (void)exitABTestsForKeys:(NSArray *)keys
{
CLY_LOG_I(@"%s %@", __FUNCTION__, keys);
[CountlyRemoteConfigInternal.sharedInstance exitABTestsForKeys:keys];
}
-(void)registerDownloadCallback:(RCDownloadCallback) callback
{
CLY_LOG_I(@"%s %@", __FUNCTION__, callback);
[CountlyRemoteConfigInternal.sharedInstance registerDownloadCallback:callback];
}
-(void)removeDownloadCallback:(RCDownloadCallback) callback
{
CLY_LOG_I(@"%s %@", __FUNCTION__, callback);
[CountlyRemoteConfigInternal.sharedInstance removeDownloadCallback:callback];
}
- (void)downloadKeys:(RCDownloadCallback)completionHandler
{
CLY_LOG_I(@"%s %@", __FUNCTION__, completionHandler);
[CountlyRemoteConfigInternal.sharedInstance downloadValuesForKeys:nil omitKeys:nil completionHandler:completionHandler];
}
- (void)downloadSpecificKeys:(NSArray *)keys completionHandler:(RCDownloadCallback)completionHandler
{
CLY_LOG_I(@"%s %@ %@", __FUNCTION__, keys, completionHandler);
[CountlyRemoteConfigInternal.sharedInstance downloadValuesForKeys:keys omitKeys:nil completionHandler:completionHandler];
}
- (void)downloadOmittingKeys:(NSArray *)omitKeys completionHandler:(RCDownloadCallback)completionHandler
{
CLY_LOG_I(@"%s %@ %@", __FUNCTION__, omitKeys, completionHandler);
[CountlyRemoteConfigInternal.sharedInstance downloadValuesForKeys:nil omitKeys:omitKeys completionHandler:completionHandler];
}
- (void) testingDownloadExperimentInformation:(RCVariantCallback)completionHandler;
{
CLY_LOG_I(@"%s %@", __FUNCTION__, completionHandler);
[CountlyRemoteConfigInternal.sharedInstance testingDownloadExperimentInformation:completionHandler];
}
- (NSDictionary<NSString*, CountlyExperimentInformation*> *) testingGetAllExperimentInfo
{
CLY_LOG_I(@"%s", __FUNCTION__);
return [CountlyRemoteConfigInternal.sharedInstance testingGetAllExperimentInfo];
}
- (void)clearAll
{
[CountlyRemoteConfigInternal.sharedInstance clearAll];
}
@end