Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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 Example/Core/Tests/FIRAppTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ - (void)setUp {
_observerMock = OCMObserverMock();
_mockCoreDiagnosticsConnector = OCMClassMock([FIRCoreDiagnosticsConnector class]);

OCMStub(ClassMethod([self.mockCoreDiagnosticsConnector logCoreDataWithOptions:[OCMArg any]]))
.andDo(^(NSInvocation *invocation){
});

// TODO: Remove all usages of defaultCenter in Core, then we can instantiate an instance here to
// inject instead of using defaultCenter.
_notificationCenter = [NSNotificationCenter defaultCenter];
Expand Down Expand Up @@ -769,8 +773,12 @@ - (void)expectNotificationForObserver:(id)observer
}

- (void)expectCoreDiagnosticsDataLogWithOptions:(nullable FIROptions *)expectedOptions {
[self.mockCoreDiagnosticsConnector stopMocking];
self.mockCoreDiagnosticsConnector = nil;
self.mockCoreDiagnosticsConnector = OCMClassMock([FIRCoreDiagnosticsConnector class]);

OCMExpect(ClassMethod([self.mockCoreDiagnosticsConnector
logConfigureCoreWithOptions:[OCMArg checkWithBlock:^BOOL(FIROptions *options) {
logCoreDataWithOptions:[OCMArg checkWithBlock:^BOOL(FIROptions *options) {
if (!expectedOptions) {
return YES;
}
Expand Down
8 changes: 4 additions & 4 deletions Firebase/Core/FIRApp.m
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ - (BOOL)configureCore {
return NO;
}

[self logDiagnostics];
[self logDiagnosticsIfEnabled];

#if TARGET_OS_IOS
// Initialize the Analytics once there is a valid options under default app. Analytics should
Expand Down Expand Up @@ -824,12 +824,12 @@ - (void)subscribeForAppDidBecomeActiveNotifications {
}

- (void)appDidBecomeActive:(NSNotification *)notification {
[self logDiagnostics];
[self logDiagnosticsIfEnabled];
}

- (void)logDiagnostics {
- (void)logDiagnosticsIfEnabled {
if ([self isDataCollectionDefaultEnabled]) {
[FIRCoreDiagnosticsConnector logConfigureCoreWithOptions:_options];
[FIRCoreDiagnosticsConnector logCoreDataWithOptions:_options];
}
}

Expand Down
2 changes: 1 addition & 1 deletion Firebase/Core/FIRCoreDiagnosticsConnector.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ + (void)initialize {
}
}

+ (void)logConfigureCoreWithOptions:(FIROptions *)options {
+ (void)logCoreDataWithOptions:(FIROptions *)options {
if (FIRCoreDiagnosticsImplementation) {
FIRDiagnosticsData *diagnosticsData = [[FIRDiagnosticsData alloc] init];
[diagnosticsData insertValue:@(YES) forKey:kFIRCDIsDataCollectionDefaultEnabledKey];
Expand Down
4 changes: 2 additions & 2 deletions Firebase/Core/Private/FIRCoreDiagnosticsConnector.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ NS_ASSUME_NONNULL_BEGIN
/** Connects FIRCore with the CoreDiagnostics library. */
@interface FIRCoreDiagnosticsConnector : NSObject

/** Logs data related to a -configureCore call.
/** Logs FirebaseCore related data.
*
* @param options The options object containing data to log.
*/
+ (void)logConfigureCoreWithOptions:(FIROptions *)options;
+ (void)logCoreDataWithOptions:(FIROptions *)options;
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe logCoreTelemetry? CoreData has a pretty specific meaning in iOS.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, logCoreTelemetry sounds better, thanks


@end

Expand Down