Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[submodule "RadarSDKIndoors"]
path = RadarSDKIndoors
url = https://github.com/radarlabs/radar-sdk-ios-indoors.git
[submodule "RadarSDKFraud"]
path = RadarSDKFraud
url = https://github.com/radarlabs/radar-lib-fraud-ios.git
branch = initial-setup
Copy link

Copilot AI Oct 21, 2025

Choose a reason for hiding this comment

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

Submodules should typically reference a stable branch (e.g., main or a release tag) rather than a development branch like initial-setup. This could cause instability for other developers or CI/CD systems.

Suggested change
branch = initial-setup
branch = main

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

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

+1 to fixing this before shipping

4 changes: 4 additions & 0 deletions RadarSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
01F810702AF0119800BD7088 /* RadarVerifiedDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 01F8106F2AF0119800BD7088 /* RadarVerifiedDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
01F99CFB2965C182004E8CF3 /* RadarConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 01F99CFA2965C182004E8CF3 /* RadarConfig.h */; };
01F99CFD2965C1C4004E8CF3 /* RadarConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 01F99CFC2965C1C4004E8CF3 /* RadarConfig.m */; };
4B5BB8D72E7C79AF004C98C9 /* RadarSDKFraudProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B5BB8D62E7C79AF004C98C9 /* RadarSDKFraudProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
532FC304277A790600989279 /* Radar+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 532FC303277A783900989279 /* Radar+Internal.h */; };
53B3B26B23EE41B400080818 /* context.json in Resources */ = {isa = PBXBuildFile; fileRef = 53B3B26A23EE41B400080818 /* context.json */; };
53CCD783275E579800F79CC8 /* RadarLogBuffer.m in Sources */ = {isa = PBXBuildFile; fileRef = 53CCD782275E579800F79CC8 /* RadarLogBuffer.m */; };
Expand Down Expand Up @@ -208,6 +209,7 @@
01F8106F2AF0119800BD7088 /* RadarVerifiedDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RadarVerifiedDelegate.h; sourceTree = "<group>"; };
01F99CFA2965C182004E8CF3 /* RadarConfig.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RadarConfig.h; sourceTree = "<group>"; };
01F99CFC2965C1C4004E8CF3 /* RadarConfig.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RadarConfig.m; sourceTree = "<group>"; };
4B5BB8D62E7C79AF004C98C9 /* RadarSDKFraudProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RadarSDKFraudProtocol.h; sourceTree = "<group>"; };
532FC303277A783900989279 /* Radar+Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Radar+Internal.h"; sourceTree = "<group>"; };
5343FFD923E38BA300808D93 /* RadarContext.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RadarContext.m; sourceTree = "<group>"; };
53B3B26A23EE41B400080818 /* context.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = context.json; sourceTree = "<group>"; };
Expand Down Expand Up @@ -422,6 +424,7 @@
96A5A0D827AD9F7F007B960B /* Include */ = {
isa = PBXGroup;
children = (
4B5BB8D62E7C79AF004C98C9 /* RadarSDKFraudProtocol.h */,
FE9417172E1C2958008ECBEB /* RadarIndoorsProtocol.h */,
828D1A552E295FD400663787 /* RadarTripOrder.h */,
96A5A0F527AD9F7F007B960B /* Radar.h */,
Expand Down Expand Up @@ -678,6 +681,7 @@
buildActionMask = 2147483647;
files = (
96A5A0F727AD9F7F007B960B /* RadarEvent.h in Headers */,
4B5BB8D72E7C79AF004C98C9 /* RadarSDKFraudProtocol.h in Headers */,
96A5A0CD27AD9F41007B960B /* RadarRegion+Internal.h in Headers */,
0195143A2BD081630031ABA2 /* RadarVerifiedLocationToken+Internal.h in Headers */,
96A5A0FD27AD9F7F007B960B /* RadarUser.h in Headers */,
Expand Down
29 changes: 29 additions & 0 deletions RadarSDK/Include/RadarSDKFraudProtocol.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// RadarSDKFraudProtocol.h
// RadarSDK
//
// Copyright © 2025 Radar Labs, Inc. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
#import "Radar.h"

NS_ASSUME_NONNULL_BEGIN

typedef void (^RadarIPChangeCallback)(NSString *reason);
typedef void (^RadarFraudPayloadCallback)(RadarStatus status, NSString *_Nullable payload);

@protocol RadarSDKFraudProtocol<NSObject>

+ (instancetype)sharedInstance;

- (void)getFraudPayloadWithLocation:(CLLocation *_Nullable)location nonce:(NSString *_Nonnull)nonce completionHandler:(RadarFraudPayloadCallback)completionHandler;

- (void)startIPMonitoringWithCallback:(RadarIPChangeCallback)callback;

- (void)stopIPMonitoring;

@end

NS_ASSUME_NONNULL_END
5 changes: 1 addition & 4 deletions RadarSDK/RadarAPIClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,7 @@ typedef void (^_Nonnull RadarSyncLogsAPICompletionHandler)(RadarStatus status);
beacons:(NSArray<RadarBeacon *> *_Nullable)beacons
indoorScan:(NSString *_Nullable)indoorScan
verified:(BOOL)verified
attestationString:(NSString *_Nullable)attestationString
keyId:(NSString *_Nullable)keyId
attestationError:(NSString *_Nullable)attestationError
encrypted:(BOOL)encrypted
fraudPayload:(NSString *_Nullable)fraudPayload
expectedCountryCode:(NSString *_Nullable)expectedCountryCode
expectedStateCode:(NSString *_Nullable)expectedStateCode
reason:(NSString *_Nullable)reason
Expand Down
68 changes: 17 additions & 51 deletions RadarSDK/RadarAPIClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#import "RadarNotificationHelper.h"
#import "Radar-Swift.h"
#import <os/log.h>
#import "RadarSDKFraudProtocol.h"

@implementation RadarAPIClient

Expand Down Expand Up @@ -199,10 +200,7 @@ - (void)trackWithLocation:(CLLocation *_Nonnull)location
beacons:beacons
indoorScan:indoorScan
verified:NO
attestationString:nil
keyId:nil
attestationError:nil
encrypted:NO
fraudPayload:nil
expectedCountryCode:nil
expectedStateCode:nil
reason:nil
Expand All @@ -218,10 +216,7 @@ - (void)trackWithLocation:(CLLocation *_Nonnull)location
beacons:(NSArray<RadarBeacon *> *_Nullable)beacons
indoorScan:(NSString *_Nullable)indoorScan
verified:(BOOL)verified
attestationString:(NSString *_Nullable)attestationString
keyId:(NSString *_Nullable)keyId
attestationError:(NSString *_Nullable)attestationError
encrypted:(BOOL)encrypted
fraudPayload:(NSString *_Nullable)fraudPayload
expectedCountryCode:(NSString * _Nullable)expectedCountryCode
expectedStateCode:(NSString * _Nullable)expectedStateCode
reason:(NSString * _Nullable)reason
Expand Down Expand Up @@ -298,20 +293,7 @@ - (void)trackWithLocation:(CLLocation *_Nonnull)location
} else {
params[@"xPlatformType"] = @"Native";
}
NSMutableArray<NSString *> *fraudFailureReasons = [NSMutableArray new];
if (@available(iOS 15.0, *)) {
CLLocationSourceInformation *sourceInformation = location.sourceInformation;
if (sourceInformation) {
if (sourceInformation.isSimulatedBySoftware) {
params[@"mocked"] = @(YES);
[fraudFailureReasons addObject:@"fraud_mocked_from_mock_provider"];
}
if (sourceInformation.isProducedByAccessory) {
[fraudFailureReasons addObject:@"fraud_mocked_produced_by_accessory"];
}
}
}


RadarTripOptions *tripOptions = Radar.getTripOptions;

if (tripOptions) {
Expand Down Expand Up @@ -351,15 +333,6 @@ - (void)trackWithLocation:(CLLocation *_Nonnull)location

params[@"verified"] = @(verified);
if (verified) {
params[@"attestationString"] = attestationString;
params[@"keyId"] = keyId;
params[@"attestationError"] = attestationError;
params[@"encrypted"] = @(encrypted);
BOOL jailbroken = [[RadarVerificationManager sharedInstance] isJailbroken];
params[@"compromised"] = @(jailbroken);
if (jailbroken) {
[fraudFailureReasons addObject:@"fraud_compromised_jailbroken"];
}
if (expectedCountryCode) {
params[@"expectedCountryCode"] = expectedCountryCode;
}
Expand All @@ -372,14 +345,11 @@ - (void)trackWithLocation:(CLLocation *_Nonnull)location
if (transactionId) {
params[@"transactionId"] = transactionId;
}
if (UIScreen.mainScreen.isCaptured) {
[fraudFailureReasons addObject:@"fraud_sharing_capturing_screen"];
}
NSString *kDeviceId = [[RadarVerificationManager sharedInstance] kDeviceId];
if (kDeviceId) {
params[@"kDeviceId"] = kDeviceId;
if (fraudPayload) {
params[@"fraudPayload"] = fraudPayload;
}
}

params[@"appId"] = [[NSBundle mainBundle] bundleIdentifier];
NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];
if (appName) {
Expand Down Expand Up @@ -425,15 +395,13 @@ - (void)trackWithLocation:(CLLocation *_Nonnull)location
if (options.usePressure || options.useMotion) {
params[@"locationMetadata"] = locationMetadata;
}

params[@"fraudFailureReasons"] = fraudFailureReasons;

if (anonymous) {
[[RadarAPIClient sharedInstance] getConfigForUsage:@"track"
verified:verified
completionHandler:^(RadarStatus status, RadarConfig *_Nullable config){
verified:verified
completionHandler:^(RadarStatus status, RadarConfig *_Nullable config){

}];
}];
}

if (sdkConfiguration.useNotificationDiff) {
Expand All @@ -457,16 +425,14 @@ - (void)trackWithLocation:(CLLocation *_Nonnull)location
[[RadarAPIClient sharedInstance] makeTrackRequestWithParams:params
options:options
stopped:stopped
location:location
source:source
verified:verified
publishableKey:publishableKey
notificationsRemaining:@[]
locationMetadata:locationMetadata
completionHandler:completionHandler];
location:location
source:source
verified:verified
publishableKey:publishableKey
notificationsRemaining:@[]
locationMetadata:locationMetadata
completionHandler:completionHandler];
}


}

- (void)makeTrackRequestWithParams:(NSDictionary *)params
Expand Down
1 change: 0 additions & 1 deletion RadarSDK/RadarUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ typedef NS_ENUM(NSInteger, RadarConnectionType) {
+ (NSString *)deviceId;
+ (NSString *)deviceType;
+ (NSString *)deviceMake;
+ (BOOL)isSimulator;
+ (BOOL)locationBackgroundMode;
+ (NSString *)locationAuthorization;
+ (NSString *)locationAccuracyAuthorization;
Expand Down
8 changes: 0 additions & 8 deletions RadarSDK/RadarUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,6 @@ + (NSDictionary *)appInfo {
}


+ (BOOL)isSimulator {
#if TARGET_OS_SIMULATOR
return YES;
#else
return NO;
#endif
}

+ (BOOL)locationBackgroundMode {
NSArray *backgroundModes = [NSBundle mainBundle].infoDictionary[@"UIBackgroundModes"];
return backgroundModes && [backgroundModes containsObject:@"location"];
Expand Down
5 changes: 0 additions & 5 deletions RadarSDK/RadarVerificationManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ NS_ASSUME_NONNULL_BEGIN

@property (assign, nonatomic) BOOL started;

typedef void (^_Nullable RadarVerificationCompletionHandler)(NSString *_Nullable attestationString, NSString *_Nullable keyId, NSString *_Nullable attestationError);

+ (instancetype)sharedInstance;
- (void)trackVerifiedWithCompletionHandler:(RadarTrackVerifiedCompletionHandler _Nullable)completionHandler;
- (void)trackVerifiedWithBeacons:(BOOL)beacons desiredAccuracy:(RadarTrackingOptionsDesiredAccuracy)desiredAccuracy reason:(NSString *_Nullable)reason transactionId:(NSString *_Nullable)transactionId completionHandler:(RadarTrackVerifiedCompletionHandler _Nullable)completionHandler;
Expand All @@ -24,9 +22,6 @@ typedef void (^_Nullable RadarVerificationCompletionHandler)(NSString *_Nullable
- (void)getVerifiedLocationTokenWithBeacons:(BOOL)beacons desiredAccuracy:(RadarTrackingOptionsDesiredAccuracy)desiredAccuracy completionHandler:(RadarTrackVerifiedCompletionHandler _Nullable)completionHandler;
- (void)clearVerifiedLocationToken;
- (void)setExpectedJurisdictionWithCountryCode:(NSString *)countryCode stateCode:(NSString *)stateCode;
- (void)getAttestationWithNonce:(NSString *)nonce completionHandler:(RadarVerificationCompletionHandler)completionHandler;
- (BOOL)isJailbroken;
- (NSString *_Nullable)kDeviceId;

@end

Expand Down
Loading