-
Notifications
You must be signed in to change notification settings - Fork 45
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
Cleans up revenue logic #40
Conversation
Build succeeds with Tests pass with
|
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!
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.
There's one potentially crash scenario that you should put some attention on.
quantity = [NSNumber numberWithInt:1]; | ||
} | ||
|
||
NSNumber *price = [properties objectForKey:@"price"] ?: revenueOrTotal; |
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 could use the shorthand properties[@"price"]
syntax here
id productId = [properties objectForKey:@"productId"] ?: [properties objectForKey:@"product_id"]; | ||
if (productId && [productId isKindOfClass:[NSString class]] && ![productId isEqualToString:@""]) { | ||
NSString *productId = [properties objectForKey:@"productId"] ?: [properties objectForKey:@"product_id"]; | ||
if (productId && ![productId isEqualToString:@""]) { |
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.
This is gonna crash if productId
is not a NSString
for some reason. You don't have compile time guarantee, so you're better off protecting against it.
useLogRevenueV2
is enabled after running throughtrackLogRevenueV2