Skip to content

Conversation

@maksymmalyhin
Copy link
Contributor

  • Send Firebase info in the request header

Copy link
Member

@paulb777 paulb777 left a comment

Choose a reason for hiding this comment

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

LGTM on travis green and approvals from @ryanwilson and @chliangGoogle

Copy link
Member

@ryanwilson ryanwilson left a comment

Choose a reason for hiding this comment

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

LGTM with two small comments - please wait for @chliangGoogle's LGTM.

FIRApp *app = [[FIRApp alloc] initInstanceWithName:@"FIRInstanceIDTest" options:options];

NSString *expectedUserAgent = [[app class] firebaseUserAgent];
OCMExpect([self.mockTokenManager setFirebaseUserAgent:[OCMArg isEqual:expectedUserAgent]]);
Copy link
Member

Choose a reason for hiding this comment

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

I think you don't need to use OCMArg here and can directly use:

OCMExpect([self.mockTokenManager setFirebaseUserAgent:expectedUserAgent]);

I could be wrong though :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right! I'll update all [OCMArg isEqual:] I introduced. Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Though, I am just thinking, if it would be a bit more readable to keep [OCMArg isEqual:]? Then it will be obvious from the first glance that we are not passing anything to the method but just validating the input parameters.
@ryanwilson What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

Sounds reasonable to me as long as the validation is being done 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then I'll keep [OCMArg isEqual:]


/**
* A string containing info about SDK components, Xcode version, etc.
* It will be added to each token request to track stats.
Copy link
Member

Choose a reason for hiding this comment

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

Nit: expanding a bit more would be good to clarify the "stats" part. Something like:

It will be added to each token request to count third party libraries and version numbers.

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];

[request setValue:@"application/json" forHTTPHeaderField:@"content-type"];
[request setValue:firebaseUserAgent forHTTPHeaderField:kFIRInstanceIDFirebaseUserAgentKey];
Copy link
Contributor

Choose a reason for hiding this comment

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

Does firebaseUserAgent change a lot or need to query at the beginning of IID initialization? Can you just call [[firApp class] firebaseUserAgent] here instead of passing it in through all the chains??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@chliangGoogle That was my first thought - just call [FIRApp firebaseUserAgent] from FIRInstanceIDCheckinService. Though, in this case we will introduce an additional dependency for FIRInstanceIDCheckinService as well as an additional responsibility - to retrieve user agent.
It looks to me that none of the classes from the chain should depend on FIRApp or be responsible for retrieving the user-agent string.

Please let me know if it doesn't look right.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think that's bigger drawback, your code could be much simpler tho by adding a dependency of FIRApp, especially InstanceID depends on core anyway.

@maksymmalyhin
Copy link
Contributor Author

Closing it in favor of #2509

@maksymmalyhin maksymmalyhin deleted the mm-iid-platform-info-logging-124533860 branch March 25, 2019 15:47
@firebase firebase locked and limited conversation to collaborators Oct 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants