Skip to content

Commit

Permalink
Look at previously cached settings before blowing them away. (#866)
Browse files Browse the repository at this point in the history
  • Loading branch information
bsneed authored Feb 21, 2020
1 parent 3ed8340 commit 0891ee3
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions Analytics/Classes/Integrations/SEGIntegrationsManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -394,14 +394,19 @@ - (void)refreshSettings
if (success) {
[self setCachedSettings:settings];
} else {
// If settings request fail, fall back to using just Segment integration.
// Doesn't address situations where this callback never gets called (though we don't expect that to ever happen).
[self setCachedSettings:@{
@"integrations" : @{
@"Segment.io" : @{@"apiKey" : self.configuration.writeKey},
},
@"plan" : @{@"track" : @{}}
}];
NSDictionary *previouslyCachedSettings = [self cachedSettings];
if (previouslyCachedSettings) {

This comment has been minimized.

Copy link
@asoneji

asoneji May 20, 2020

I belive this should be if (previouslyCachedSettings && [previouslyCachedSettings count] > 0) {

For us on a fresh install, it is going to this and not going to the fallback and use the barebones config.

We noticed this issue when we updated from: pod 'Analytics', '3.6.10' to: pod 'Analytics', '3.8.0'

[self setCachedSettings:previouslyCachedSettings];
} else {
// If settings request fail, fall back to using just Segment integration.
// Doesn't address situations where this callback never gets called (though we don't expect that to ever happen).
[self setCachedSettings:@{
@"integrations" : @{
@"Segment.io" : @{@"apiKey" : self.configuration.writeKey},
},
@"plan" : @{@"track" : @{}}
}];
}
}
self.settingsRequest = nil;
});
Expand Down

0 comments on commit 0891ee3

Please sign in to comment.