Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added application object back to notifications #900

Merged
merged 1 commit into from
Jun 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Analytics/Classes/Integrations/SEGIntegrationsManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ - (instancetype _Nonnull)initWithAnalytics:(SEGAnalytics *_Nonnull)analytics
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];

// Update settings on foreground
[nc addObserver:self selector:@selector(onAppForeground:) name:UIApplicationWillEnterForegroundNotification object:nil];
id<SEGApplicationProtocol> application = configuration.application;
if (application) {
[nc addObserver:self selector:@selector(onAppForeground:) name:UIApplicationWillEnterForegroundNotification object:application];
}
}
return self;
}
Expand Down
17 changes: 10 additions & 7 deletions Analytics/Classes/SEGAnalytics.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,16 @@ - (instancetype)initWithConfiguration:(SEGAnalyticsConfiguration *)configuration
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];

// Pass through for application state change events
for (NSString *name in @[ UIApplicationDidEnterBackgroundNotification,
UIApplicationDidFinishLaunchingNotification,
UIApplicationWillEnterForegroundNotification,
UIApplicationWillTerminateNotification,
UIApplicationWillResignActiveNotification,
UIApplicationDidBecomeActiveNotification ]) {
[nc addObserver:self selector:@selector(handleAppStateNotification:) name:name object:nil];
id<SEGApplicationProtocol> application = configuration.application;
if (application) {
for (NSString *name in @[ UIApplicationDidEnterBackgroundNotification,
UIApplicationDidFinishLaunchingNotification,
UIApplicationWillEnterForegroundNotification,
UIApplicationWillTerminateNotification,
UIApplicationWillResignActiveNotification,
UIApplicationDidBecomeActiveNotification ]) {
[nc addObserver:self selector:@selector(handleAppStateNotification:) name:name object:application];
}
}

if (configuration.recordScreenViews) {
Expand Down