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
Update SDLTouch to handle NSNull occurence #1539
Update SDLTouch to handle NSNull occurence #1539
Conversation
Hi @kshala-ford, can you please fill out the "Testing Plan" section with the results of your running the unit tests and the Core tests / warnings, in addition to the sections that you deleted about what you tested against? Thanks! |
@joeljfischer Sorry, I missed this. Please check the edit of the description. |
SmartDeviceLink/SDLTouch.m
Outdated
// In the event we receive a null timestamp, we will supply a device timestamp. | ||
if ([firstTimeStamp isKindOfClass:[NSNull class]] && [firstTimeStamp isEqual:[NSNull null]]) { | ||
if (!timestamp || ![timestamp isKindOfClass:[NSArray class]]) { |
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.
Is it still possible for it to not be an NSArray
?
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.
That was the reason I used id
to be sure if we ever change the store extension of the NSDictionary... but it's not needed especially as you suggest timestamp
to be type specific.
Co-Authored-By: Joel Fischer <joeljfischer@gmail.com>
@joeljfischer I added a condition if |
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 I'd still like it removed, because it can never be false. I'd rather have the explicit fail than an implicit one if we ever changed that method, though I don't think we'll be changing it anytime soon.
Co-Authored-By: Joel Fischer <joeljfischer@gmail.com>
@joeljfischer I agree. thanks for the suggestion. |
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.
Sorry, I missed one last thing. I've tested and will approve after this.
Co-Authored-By: Joel Fischer <joeljfischer@gmail.com>
Fixes #1534
This PR is ready for review.
Risk
This PR makes no API changes.
Testing Plan
Unit Tests
Running all existing unit tests validating no existing test fails. Adding new tests resulted into assertion crashes therefore checking that this PR doesn't harm any valid touch event json was the testing focus.
Core Tests
Tested against
Core version: 4.2 Ford
HMI name: SYNC 3.0 (MY18) which can cause the issue of sending "null" for timestamps.
Test steps on affected IVI:
Test steps on functional IVI:
Summary
The changes are very small. Basically the change is to read the "timeStamp" param from the TouchEvent struct. Now with the new type checking, the param may return
nil
instead of whatever the head unit sent (previously it might have been [NSNull]).The issue of wrong JSON data is already known. This PR replaces an old and outdated workaround with a new workaround.
Bug Fixes
CLA