-
Notifications
You must be signed in to change notification settings - Fork 244
/
CountlyConfig.m
148 lines (120 loc) · 4.2 KB
/
CountlyConfig.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
148
// CountlyConfig.m
//
// This code is provided under the MIT License.
//
// Please visit www.count.ly for more information.
#import "CountlyCommon.h"
@interface CountlyConfig ()
@property (nonatomic) NSMutableArray<RCDownloadCallback> *remoteConfigGlobalCallbacks;
@end
@interface CountlyAPMConfig ()
- (void)enableAPMInternal:(BOOL)enableAPM;
@end
@implementation CountlyConfig
//NOTE: Countly features
#if (TARGET_OS_IOS || TARGET_OS_VISION)
CLYFeature const CLYPushNotifications = @"CLYPushNotifications";
CLYFeature const CLYCrashReporting = @"CLYCrashReporting";
// CLYAutoViewTracking is deprecated, Use 'config.enableAutomaticViewTracking' instead
CLYFeature const CLYAutoViewTracking = @"CLYAutoViewTracking" ;
#elif (TARGET_OS_WATCH)
CLYFeature const CLYCrashReporting = @"CLYCrashReporting";
#elif (TARGET_OS_TV)
CLYFeature const CLYCrashReporting = @"CLYCrashReporting";
// CLYAutoViewTracking is deprecated, Use 'config.enableAutomaticViewTracking' instead
CLYFeature const CLYAutoViewTracking = @"CLYAutoViewTracking";
#elif (TARGET_OS_OSX)
CLYFeature const CLYPushNotifications = @"CLYPushNotifications";
CLYFeature const CLYCrashReporting = @"CLYCrashReporting";
#endif
CountlyAPMConfig *apmConfig = nil;
CountlyCrashesConfig *crashes = nil;
CountlySDKLimitsConfig *sdkLimitsConfig = nil;
CountlyExperimentalConfig *experimental = nil;
#if (TARGET_OS_IOS)
CountlyContentConfig *content = nil;
#endif
//NOTE: Device ID options
NSString* const CLYDefaultDeviceID = @""; //NOTE: It will be overridden to default device ID mechanism, depending on platform.
NSString* const CLYTemporaryDeviceID = @"CLYTemporaryDeviceID";
//NOTE: Device ID Types
CLYDeviceIDType const CLYDeviceIDTypeCustom = @"CLYDeviceIDTypeCustom";
CLYDeviceIDType const CLYDeviceIDTypeTemporary = @"CLYDeviceIDTypeTemporary";
CLYDeviceIDType const CLYDeviceIDTypeIDFV = @"CLYDeviceIDTypeIDFV";
CLYDeviceIDType const CLYDeviceIDTypeNSUUID = @"CLYDeviceIDTypeNSUUID";
- (instancetype)init
{
if (self = [super init])
{
#if (TARGET_OS_WATCH)
self.updateSessionPeriod = 20.0;
#else
self.updateSessionPeriod = 60.0;
#endif
self.eventSendThreshold = 100;
self.storedRequestsLimit = 1000;
self.crashLogLimit = kCountlyMaxBreadcrumbCount;
self.maxKeyLength = kCountlyMaxKeyLength;
self.maxValueLength = kCountlyMaxValueSize;
self.maxSegmentationValues = kCountlyMaxSegmentationValues;
self.location = kCLLocationCoordinate2DInvalid;
self.URLSessionConfiguration = NSURLSessionConfiguration.defaultSessionConfiguration;
self.internalLogLevel = CLYInternalLogLevelDebug;
self.enableOrientationTracking = YES;
self.enableServerConfiguration = NO;
self.remoteConfigGlobalCallbacks = NSMutableArray.new;
}
return self;
}
- (void)enableTemporaryDeviceIDMode
{
self.deviceID = CLYTemporaryDeviceID;
}
-(void)remoteConfigRegisterGlobalCallback:(RCDownloadCallback) callback
{
[self.remoteConfigGlobalCallbacks addObject:callback];
}
- (NSMutableArray<RCDownloadCallback> *) getRemoteConfigGlobalCallbacks
{
return self.remoteConfigGlobalCallbacks;
}
- (void)setEnablePerformanceMonitoring:(BOOL)enablePerformanceMonitoring
{
if (apmConfig == nil) {
apmConfig = CountlyAPMConfig.new;
}
[apmConfig enableAPMInternal:enablePerformanceMonitoring];
}
- (nonnull CountlyAPMConfig *)apm {
if (apmConfig == nil) {
apmConfig = CountlyAPMConfig.new;
}
return apmConfig;
}
- (nonnull CountlySDKLimitsConfig *)sdkInternalLimits {
if (sdkLimitsConfig == nil) {
sdkLimitsConfig = CountlySDKLimitsConfig.new;
}
return sdkLimitsConfig;
}
- (nonnull CountlyCrashesConfig *)crashes {
if (crashes == nil) {
crashes = CountlyCrashesConfig.new;
}
return crashes;
}
- (nonnull CountlyExperimentalConfig *)experimental {
if (experimental == nil) {
experimental = CountlyExperimentalConfig.new;
}
return experimental;
}
#if (TARGET_OS_IOS)
- (nonnull CountlyContentConfig *)content {
if (content == nil) {
content = CountlyContentConfig.new;
}
return content;
}
#endif
@end