Skip to content

Commit 0891ee3

Browse files
authored
Look at previously cached settings before blowing them away. (#866)
1 parent 3ed8340 commit 0891ee3

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

Analytics/Classes/Integrations/SEGIntegrationsManager.m

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -394,14 +394,19 @@ - (void)refreshSettings
394394
if (success) {
395395
[self setCachedSettings:settings];
396396
} else {
397-
// If settings request fail, fall back to using just Segment integration.
398-
// Doesn't address situations where this callback never gets called (though we don't expect that to ever happen).
399-
[self setCachedSettings:@{
400-
@"integrations" : @{
401-
@"Segment.io" : @{@"apiKey" : self.configuration.writeKey},
402-
},
403-
@"plan" : @{@"track" : @{}}
404-
}];
397+
NSDictionary *previouslyCachedSettings = [self cachedSettings];
398+
if (previouslyCachedSettings) {
399+
[self setCachedSettings:previouslyCachedSettings];
400+
} else {
401+
// If settings request fail, fall back to using just Segment integration.
402+
// Doesn't address situations where this callback never gets called (though we don't expect that to ever happen).
403+
[self setCachedSettings:@{
404+
@"integrations" : @{
405+
@"Segment.io" : @{@"apiKey" : self.configuration.writeKey},
406+
},
407+
@"plan" : @{@"track" : @{}}
408+
}];
409+
}
405410
}
406411
self.settingsRequest = nil;
407412
});

0 commit comments

Comments
 (0)