File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ @interface SEGAnalytics ()
2727@property (nonatomic , strong ) SEGStoreKitTracker *storeKitTracker;
2828@property (nonatomic , strong ) SEGIntegrationsManager *integrationsManager;
2929@property (nonatomic , strong ) SEGMiddlewareRunner *runner;
30+ @property (nonatomic , strong ) NSString *lastIDFA;
3031@end
3132
3233
@@ -47,6 +48,7 @@ - (instancetype)initWithConfiguration:(SEGAnalyticsConfiguration *)configuration
4748 if (self = [self init ]) {
4849 self.oneTimeConfiguration = configuration;
4950 self.enabled = YES ;
51+ self.lastIDFA = nil ;
5052
5153 // In swift this would not have been OK... But hey.. It's objc
5254 // TODO: Figure out if this is really the best way to do things here.
@@ -556,6 +558,16 @@ - (void)run:(SEGEventType)eventType payload:(SEGPayload *)payload
556558 return ;
557559 }
558560
561+ if (getAdTrackingEnabled (self.oneTimeConfiguration )) {
562+ // if idfa has changed since last we looked, we need to rebuild
563+ // the static context to pick up the change.
564+ NSString *idfa = self.oneTimeConfiguration .adSupportBlock ();
565+ if (![idfa isEqualToString: self .lastIDFA]) {
566+ self.lastIDFA = idfa;
567+ [[SEGState sharedInstance ].context updateStaticContext ];
568+ }
569+ }
570+
559571 if (self.oneTimeConfiguration .experimental .nanosecondTimestamps ) {
560572 payload.timestamp = iso8601NanoFormattedString ([NSDate date ]);
561573 } else {
You can’t perform that action at this time.
0 commit comments