-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add Firebase info to checkin requests (b/124533860) #2500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
maksymmalyhin
commented
Mar 8, 2019
- Send Firebase info in the request header
…ckinService to be sent to the server
…ervice tests. Style.
There was a problem hiding this 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
There was a problem hiding this 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]]); |
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 👍
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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]; |
There was a problem hiding this comment.
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??
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
Closing it in favor of #2509 |