Skip to content

Commit

Permalink
Move internal Crashlytics changes to Github (#6535)
Browse files Browse the repository at this point in the history
Move *most* internal Crashlytics changes to Github
  • Loading branch information
tejasd authored and christibbs committed Sep 28, 2020
1 parent 91688b4 commit 806c67c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,11 @@ + (BOOL)isCrashlyticsCollectionEnabledWithApp:(FIRApp *)app withAppInfo:(NSDicti
[firebaseCrashlyticsCollectionEnabled isKindOfClass:[NSNumber class]]) {
return [firebaseCrashlyticsCollectionEnabled boolValue];
}

#ifdef CRASHLYTICS_INTERNAL
return NO;
#else
return [app isDataCollectionDefaultEnabled];
#endif
}

- (BOOL)isCrashlyticsCollectionEnabled {
Expand Down
4 changes: 4 additions & 0 deletions Crashlytics/Crashlytics/Models/FIRCLSSettings.m
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,9 @@ - (BOOL)collectReportsEnabled {
}

- (BOOL)shouldUseNewReportEndpoint {
#ifdef CRASHLYTICS_INTERNAL
return YES;
#else
NSNumber *value = [self appSettings][@"report_upload_variant"];

// Default to use the new endpoint when settings were not successfully fetched
Expand All @@ -316,6 +319,7 @@ - (BOOL)shouldUseNewReportEndpoint {
// 1 - Legacy
// 2 - New
return value.intValue == 2;
#endif
}

#pragma mark - Optional Limit Overrides
Expand Down
7 changes: 5 additions & 2 deletions Crashlytics/UnitTests/FIRCLSDataCollectionArbiterTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,15 @@ - (void)tearDown {
[super tearDown];
}

// If you do nothing, it should be YES. We should not be turning Fabric
// customers off by default
- (void)testNothingSet {
self.fakeApp.isDefaultCollectionEnabled = YES;
FIRCLSDataCollectionArbiter *arbiter = [self arbiterWithDictionary:@{}];
#ifdef CRASHLYTICS_INTERNAL
XCTAssertFalse([arbiter isCrashlyticsCollectionEnabled]);
#else
// It should be YES by default for 3P users.
XCTAssertTrue([arbiter isCrashlyticsCollectionEnabled]);
#endif
}

- (void)testOnlyStickyOff {
Expand Down
4 changes: 4 additions & 0 deletions Crashlytics/UnitTests/FIRCLSSettingsTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,11 @@ - (void)testLegacyReportEndpointSettings {
[self.settings cacheSettingsWithGoogleAppID:TestGoogleAppID currentTimestamp:currentTimestamp];

XCTAssertNil(error, "%@", error);
#ifdef CRASHLYTICS_INTERNAL
XCTAssertTrue(self.settings.shouldUseNewReportEndpoint);
#else
XCTAssertFalse(self.settings.shouldUseNewReportEndpoint);
#endif
}

- (void)testLegacyReportEndpointSettingsWithNonExistentKey {
Expand Down

0 comments on commit 806c67c

Please sign in to comment.