23
23
@interface SEGAnalytics ()
24
24
25
25
@property (nonatomic , assign ) BOOL enabled;
26
- @property (nonatomic , strong ) SEGAnalyticsConfiguration *configuration ;
26
+ @property (nonatomic , strong ) SEGAnalyticsConfiguration *oneTimeConfiguration ;
27
27
@property (nonatomic , strong ) SEGStoreKitTracker *storeKitTracker;
28
28
@property (nonatomic , strong ) SEGIntegrationsManager *integrationsManager;
29
29
@property (nonatomic , strong ) SEGMiddlewareRunner *runner;
30
-
31
30
@end
32
31
33
32
@@ -46,7 +45,7 @@ - (instancetype)initWithConfiguration:(SEGAnalyticsConfiguration *)configuration
46
45
NSCParameterAssert (configuration != nil );
47
46
48
47
if (self = [self init ]) {
49
- self.configuration = configuration;
48
+ self.oneTimeConfiguration = configuration;
50
49
self.enabled = YES ;
51
50
52
51
// In swift this would not have been OK... But hey.. It's objc
@@ -161,7 +160,7 @@ - (void)handleAppStateNotification:(NSNotification *)note
161
160
162
161
- (void )_applicationDidFinishLaunchingWithOptions : (NSDictionary *)launchOptions
163
162
{
164
- if (!self.configuration .trackApplicationLifecycleEvents ) {
163
+ if (!self.oneTimeConfiguration .trackApplicationLifecycleEvents ) {
165
164
return ;
166
165
}
167
166
// Previously SEGBuildKey was stored an integer. This was incorrect because the CFBundleVersion
@@ -218,7 +217,7 @@ - (void)_applicationDidFinishLaunchingWithOptions:(NSDictionary *)launchOptions
218
217
219
218
- (void )_applicationWillEnterForeground
220
219
{
221
- if (!self.configuration .trackApplicationLifecycleEvents ) {
220
+ if (!self.oneTimeConfiguration .trackApplicationLifecycleEvents ) {
222
221
return ;
223
222
}
224
223
NSString *currentVersion = [[NSBundle mainBundle ] infoDictionary ][@" CFBundleShortVersionString" ];
@@ -234,7 +233,7 @@ - (void)_applicationWillEnterForeground
234
233
235
234
- (void )_applicationDidEnterBackground
236
235
{
237
- if (!self.configuration .trackApplicationLifecycleEvents ) {
236
+ if (!self.oneTimeConfiguration .trackApplicationLifecycleEvents ) {
238
237
return ;
239
238
}
240
239
[self track: @" Application Backgrounded" ];
@@ -248,6 +247,12 @@ - (NSString *)description
248
247
return [NSString stringWithFormat: @" <%p :%@ , %@ >" , self , [self class ], [self dictionaryWithValuesForKeys: @[ @" configuration" ]]];
249
248
}
250
249
250
+ - (nullable SEGAnalyticsConfiguration *)configuration
251
+ {
252
+ // Remove deprecated configuration on 4.2+
253
+ return nil ;
254
+ }
255
+
251
256
#pragma mark - Identify
252
257
253
258
- (void )identify : (NSString *)userId
@@ -389,7 +394,7 @@ - (void)trackPushNotification:(NSDictionary *)properties fromLaunch:(BOOL)launch
389
394
390
395
- (void )receivedRemoteNotification : (NSDictionary *)userInfo
391
396
{
392
- if (self.configuration .trackPushNotifications ) {
397
+ if (self.oneTimeConfiguration .trackPushNotifications ) {
393
398
[self trackPushNotification: userInfo fromLaunch: NO ];
394
399
}
395
400
SEGRemoteNotificationPayload *payload = [[SEGRemoteNotificationPayload alloc ] init ];
@@ -427,7 +432,7 @@ - (void)continueUserActivity:(NSUserActivity *)activity
427
432
payload.activity = activity;
428
433
[self run: SEGEventTypeContinueUserActivity payload: payload];
429
434
430
- if (!self.configuration .trackDeepLinks ) {
435
+ if (!self.oneTimeConfiguration .trackDeepLinks ) {
431
436
return ;
432
437
}
433
438
@@ -442,7 +447,7 @@ - (void)continueUserActivity:(NSUserActivity *)activity
442
447
properties[@" url" ] = urlString;
443
448
properties[@" title" ] = activity.title ?: @" " ;
444
449
properties = [SEGUtils traverseJSON: properties
445
- andReplaceWithFilters: self .configuration .payloadFilters];
450
+ andReplaceWithFilters: self .oneTimeConfiguration .payloadFilters];
446
451
[self track: @" Deep Link Opened" properties: [properties copy ]];
447
452
}
448
453
}
@@ -451,11 +456,11 @@ - (void)openURL:(NSURL *)url options:(NSDictionary *)options
451
456
{
452
457
SEGOpenURLPayload *payload = [[SEGOpenURLPayload alloc ] init ];
453
458
payload.url = [NSURL URLWithString: [SEGUtils traverseJSON: url.absoluteString
454
- andReplaceWithFilters: self .configuration .payloadFilters]];
459
+ andReplaceWithFilters: self .oneTimeConfiguration .payloadFilters]];
455
460
payload.options = options;
456
461
[self run: SEGEventTypeOpenURL payload: payload];
457
462
458
- if (!self.configuration .trackDeepLinks ) {
463
+ if (!self.oneTimeConfiguration .trackDeepLinks ) {
459
464
return ;
460
465
}
461
466
@@ -468,7 +473,7 @@ - (void)openURL:(NSURL *)url options:(NSDictionary *)options
468
473
[properties addEntriesFromDictionary: options];
469
474
properties[@" url" ] = urlString;
470
475
properties = [SEGUtils traverseJSON: properties
471
- andReplaceWithFilters: self .configuration .payloadFilters];
476
+ andReplaceWithFilters: self .oneTimeConfiguration .payloadFilters];
472
477
[self track: @" Deep Link Opened" properties: [properties copy ]];
473
478
}
474
479
@@ -535,7 +540,7 @@ - (void)run:(SEGEventType)eventType payload:(SEGPayload *)payload
535
540
return ;
536
541
}
537
542
538
- if (self.configuration .experimental .nanosecondTimestamps ) {
543
+ if (self.oneTimeConfiguration .experimental .nanosecondTimestamps ) {
539
544
payload.timestamp = iso8601NanoFormattedString ([NSDate date ]);
540
545
} else {
541
546
payload.timestamp = iso8601FormattedString ([NSDate date ]);
0 commit comments