Skip to content
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 rawDict for RadarVerifiedLocationToken #422

Merged
merged 6 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion RadarSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'RadarSDK'
s.version = '3.19.5-beta.1'
s.version = '3.19.5-beta.2'
s.summary = 'iOS SDK for Radar, the leading geofencing and location tracking platform'
s.homepage = 'https://radar.com'
s.author = { 'Radar Labs, Inc.' => '[email protected]' }
Expand Down
4 changes: 2 additions & 2 deletions RadarSDK/Include/RadarVerifiedLocationToken.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@
@property (nullable, copy, nonatomic, readonly) NSString *_id;

/**
The raw dictionary value of the token.
The full dictionary value of the token.
*/
@property (nullable, copy, nonatomic, readonly) NSDictionary *rawDict;
@property (nullable, copy, nonatomic, readonly) NSDictionary *fullDict;

- (NSDictionary *_Nonnull)dictionaryValue;

Expand Down
2 changes: 1 addition & 1 deletion RadarSDK/RadarVerifiedLocationToken+Internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
passed:(BOOL)passed
failureReasons:(NSArray<NSString *> *_Nonnull)failureReasons
_id:(NSString *_Nonnull)_id
rawDict:(NSDictionary *_Nonnull)rawDict;
fullDict:(NSDictionary *_Nonnull)fullDict;
- (instancetype _Nullable)initWithObject:(id _Nonnull)object;

@end
17 changes: 8 additions & 9 deletions RadarSDK/RadarVerifiedLocationToken.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ - (instancetype _Nullable)initWithUser:(RadarUser *_Nonnull)user
passed:(BOOL)passed
failureReasons:(NSArray<NSString *> * _Nonnull)failureReasons
_id:(NSString * _Nonnull)_id
rawDict:(NSDictionary *_Nonnull)rawDict {
fullDict:(NSDictionary *_Nonnull)fullDict {
self = [super init];
if (self) {
_user = user;
Expand All @@ -32,7 +32,7 @@ - (instancetype _Nullable)initWithUser:(RadarUser *_Nonnull)user
_passed = passed;
_failureReasons = failureReasons;
__id = _id;
_rawDict = rawDict;
_fullDict = fullDict;
}
return self;
}
Expand Down Expand Up @@ -70,11 +70,10 @@ - (instancetype _Nullable)initWithObject:(id _Nonnull)object {
expiresIn = [expiresInNumber floatValue];
}

id userObj = dict[@"user"];
if (userObj && [userObj isKindOfClass:[NSDictionary class]]) {
user = [[RadarUser alloc] initWithObject:userObj];

passed = user && user.fraud && user.fraud.passed && user.country && user.country.passed && user.state && user.state.passed;
id passedObj = dict[@"passed"];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Use server-side passed flag rather than calculating client-side

if (passedObj && [passedObj isKindOfClass:[NSNumber class]]) {
NSNumber *passedNumber = (NSNumber *)passedObj;
passed = [passedNumber boolValue];
}

id eventsObj = dict[@"events"];
Expand All @@ -93,14 +92,14 @@ - (instancetype _Nullable)initWithObject:(id _Nonnull)object {
}

if (user && events && token && expiresAt) {
return [[RadarVerifiedLocationToken alloc] initWithUser:user events:events token:token expiresAt:expiresAt expiresIn:expiresIn passed:passed failureReasons:failureReasons _id:_id rawDict:dict];
return [[RadarVerifiedLocationToken alloc] initWithUser:user events:events token:token expiresAt:expiresAt expiresIn:expiresIn passed:passed failureReasons:failureReasons _id:_id fullDict:dict];
}

return nil;
}

- (NSDictionary *)dictionaryValue {
return self.rawDict;
return self.fullDict;
}

@end
2 changes: 1 addition & 1 deletion RadarSDKMotion.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'RadarSDKMotion'
s.version = '3.19.5-beta.1'
s.version = '3.19.5-beta.2'
s.summary = 'Motion detection plugin for RadarSDK, the leading geofencing and location tracking platform'
s.homepage = 'https://radar.com'
s.author = { 'Radar Labs, Inc.' => '[email protected]' }
Expand Down
Loading