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

Fall back to using Segment integration when we cannot get settings #636

Merged
merged 4 commits into from
Nov 23, 2016
Merged
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
10 changes: 9 additions & 1 deletion Analytics/Classes/SEGAnalytics.m
Original file line number Diff line number Diff line change
Expand Up @@ -562,8 +562,16 @@ - (void)refreshSettings
self.settingsRequest = [self.httpClient settingsForWriteKey:self.configuration.writeKey completionHandler:^(BOOL success, NSDictionary *settings) {
if (success) {
[self setCachedSettings:settings];
} else {
// TODO: If settings request fail, fall back to using just Segment integration
// Won't catch situation where this callback never gets called - that will get addressed separately in regular dev
[self setCachedSettings:@{
@"integrations": @{
@"Segment.io": @{ @"apiKey": self.configuration.writeKey },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually instead of doing setCachedSettings we should do updateIntegrationWithSettings (can't do this yet because the code references self.cachedSettings directly in a few places)>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Wanted to change as few lines as possible since this is a hotfix. It'll become a lot more clear in dev.

},
@"plan": @{ @"track": @{} }
}];
}

self.settingsRequest = nil;
}];
}
Expand Down