-
Notifications
You must be signed in to change notification settings - Fork 27
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
use none-deprecated archive functions when possible #394
base: master
Are you sure you want to change the base?
use none-deprecated archive functions when possible #394
Conversation
758811d
to
7e87e5e
Compare
[[NSUserDefaults standardUserDefaults] setObject:replaysData forKey:@"radar-replays"]; | ||
} | ||
|
||
- (void)loadReplaysFromPersistentStore { | ||
NSData *replaysData = [[NSUserDefaults standardUserDefaults] objectForKey:@"radar-replays"]; | ||
if (replaysData) { | ||
NSArray *replays = [NSKeyedUnarchiver unarchiveObjectWithData:replaysData]; | ||
NSArray *replays; | ||
if (@available(iOS 11.0, *)) { |
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'm a little confused about iOS 11 version gate since NSSecureCoding is available from iOS 6
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.
the archivedDataWithRootObject: requireingSecureCoding:
function is only introduced in iOS 11.0. the function that we were using (without the second param) is the one raising security alerts.
@@ -18,4 +18,181 @@ + (NSDictionary *)jsonDictionaryFromResource:(NSString *)resource { | |||
return jsonDict; | |||
} | |||
|
|||
+ (NSMutableDictionary *)createTrackParamWithLocation:(CLLocation *_Nonnull)location |
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 guess using the default values returned by radarState
and radarSettings
is perfectly fine in this case, but can we just put a comment noting that?
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.
added function docstring in the header file for this behaviour
@@ -1489,6 +1490,22 @@ - (void)test_RadarLogBuffer_purge { | |||
[[RadarLogBuffer sharedInstance]clearBuffer]; | |||
} | |||
|
|||
- (void)test_RadarReplayBuffer_writeAndRead { |
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.
thank you for adding this test
…used for RadarTestUtils.createTrackParamWithLocation
The archive function that we were using was deprecated, and it was giving security warnings to customers integrating the SDK. The new, secure archive functions were introduces with iOS 11.0. So for iOS 11.0 +, we are switching to using the secure archive functions in order to avoid security issues.
I the archiving and unarchiving of RadarLog is already tested. I tested it with original archiving with new unarchiving just to make sure that previously saved data do not become invalid after this function change.
For RadarReplay, I added the test for archiving and unarchiving by creating the replayParam the same way it was created in /track, then using the
writeNewReplayToBuffer
andloadReplaysFromPersistentStore
methods to verify the archiving/unarchiving is working. Same test with old archiving to verify updating sdk doesn't invalidate existing stored data.(+267 lines might look scary, but most of it is in
RadarTestUtil
to construct the track param for replay test)