diff options
author | Ryan Wilson <wilsonryan@google.com> | 2018-01-15 08:46:22 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-15 08:46:22 -0500 |
commit | 2c0cacd3ee9d78a095de6069f7b59415f647718b (patch) | |
tree | fbef8a168be7d60c315b904b2ff23839b1088185 /Firebase/Core/FIROptions.m | |
parent | b15283bd27d6ac5eb784efc52ab13bc40b35a625 (diff) |
Inject infoDictionary to fix flakey tests. (#664)
* Inject infoDictionary to fix flakey tests.
* Remove outdated comment, update format.
Diffstat (limited to 'Firebase/Core/FIROptions.m')
-rw-r--r-- | Firebase/Core/FIROptions.m | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/Firebase/Core/FIROptions.m b/Firebase/Core/FIROptions.m index b60ccdd..95c486b 100644 --- a/Firebase/Core/FIROptions.m +++ b/Firebase/Core/FIROptions.m @@ -62,12 +62,19 @@ NSString *const kFIRExceptionBadModification = @property(nonatomic, readwrite) NSMutableDictionary *optionsDictionary; /** - * Combination of analytics options from both the main plist and the GoogleService-Info.plist. + * Calls `analyticsOptionsDictionaryWithInfoDictionary:` using [NSBundle mainBundle].infoDictionary. + * It combines analytics options from both the infoDictionary and the GoogleService-Info.plist. * Values which are present in the main plist override values from the GoogleService-Info.plist. */ @property(nonatomic, readonly) NSDictionary *analyticsOptionsDictionary; /** + * Combination of analytics options from both the infoDictionary and the GoogleService-Info.plist. + * Values which are present in the infoDictionary override values from the GoogleService-Info.plist. + */ +- (NSDictionary *)analyticsOptionsDictionaryWithInfoDictionary:(NSDictionary *)infoDictionary; + +/** * Throw exception if editing is locked when attempting to modify an option. */ - (void)checkEditingLocked; @@ -346,16 +353,15 @@ static NSDictionary *sDefaultOptionsDictionary = nil; #pragma mark - Internal instance methods -- (NSDictionary *)analyticsOptionsDictionary { +- (NSDictionary *)analyticsOptionsDictionaryWithInfoDictionary:(NSDictionary *)infoDictionary { dispatch_once(&_createAnalyticsOptionsDictionaryOnce, ^{ NSMutableDictionary *tempAnalyticsOptions = [[NSMutableDictionary alloc] init]; - NSDictionary *mainInfoDictionary = [NSBundle mainBundle].infoDictionary; NSArray *measurementKeys = @[ kFIRIsMeasurementEnabled, kFIRIsAnalyticsCollectionEnabled, kFIRIsAnalyticsCollectionDeactivated ]; for (NSString *key in measurementKeys) { - id value = mainInfoDictionary[key] ?: self.optionsDictionary[key] ?: nil; + id value = infoDictionary[key] ?: self.optionsDictionary[key] ?: nil; if (!value) { continue; } @@ -366,6 +372,10 @@ static NSDictionary *sDefaultOptionsDictionary = nil; return _analyticsOptionsDictionary; } +- (NSDictionary *)analyticsOptionsDictionary { + return [self analyticsOptionsDictionaryWithInfoDictionary:[NSBundle mainBundle].infoDictionary]; +} + /** * Whether or not Measurement was enabled. Measurement is enabled unless explicitly disabled in * GoogleService-Info.plist. This uses the old plist flag IS_MEASUREMENT_ENABLED, which should still |