Skip to content

Commit

Permalink
Merge pull request #418 from radarlabs/logging-verify-fixes
Browse files Browse the repository at this point in the history
Suppress first run debug logs, add verified error callbacks
  • Loading branch information
nickpatrick authored Dec 4, 2024
2 parents ba6b0ff + 86598d7 commit b37f4ae
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 20 deletions.
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.1'
s.version = '3.19.2'
s.summary = 'iOS SDK for Radar, the leading geofencing and location tracking platform'
s.homepage = 'https://radar.com'
s.author = { 'Radar Labs, Inc.' => 'support@radar.com' }
Expand Down
6 changes: 3 additions & 3 deletions RadarSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -483,11 +483,11 @@
825732502B72BE1900DF8B88 /* PrivacyInfo.xcprivacy */,
96A5A0D827AD9F7F007B960B /* Include */,
DD236C792308797B00EB88F9 /* Info.plist */,
532FC303277A783900989279 /* Radar+Internal.h */,
DD236C9023087A3500EB88F9 /* Radar.m */,
DD236C9823087F9200EB88F9 /* RadarAPIClient.h */,
82DF18772C5830C300301B17 /* RadarActivityManager.h */,
82DF18782C5830C300301B17 /* RadarActivityManager.m */,
532FC303277A783900989279 /* Radar+Internal.h */,
DD236C9923087F9200EB88F9 /* RadarAPIClient.m */,
DD633EC1237C5B800026C91A /* RadarAPIHelper.h */,
E6B93B732C90E5B8003CB858 /* RadarInitializeOptions.m */,
Expand Down Expand Up @@ -1064,7 +1064,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 3.19.1;
MARKETING_VERSION = 3.19.2;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -1122,7 +1122,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 3.19.1;
MARKETING_VERSION = 3.19.2;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
OTHER_CFLAGS = "-fembed-bitcode";
Expand Down
2 changes: 1 addition & 1 deletion RadarSDK/Radar.m
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ + (void)initializeWithPublishableKey:(NSString *)publishableKey options:(RadarIn

[[RadarLocationManager sharedInstance] updateTrackingFromInitialize];

[RadarNotificationHelper checkNotificationPermissionsWithCompletionHandler:^(BOOL granted) {
[RadarNotificationHelper checkNotificationPermissionsWithCompletionHandler:^(BOOL granted) {
[[RadarAPIClient sharedInstance] getConfigForUsage:@"initialize"
verified:NO
completionHandler:^(RadarStatus status, RadarConfig *config) {
Expand Down
1 change: 0 additions & 1 deletion RadarSDK/RadarDelegateHolder.m
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,4 @@ - (void)didUpdateToken:(RadarVerifiedLocationToken *)token {
[[RadarLogger sharedInstance] logWithLevel:RadarLogLevelInfo message:[NSString stringWithFormat:@"📍 Radar token updated | passed = %d; expiresAt = %@; expiresIn = %f; token = %@", token.passed, token.expiresAt, token.expiresIn, token.token]];
}


@end
2 changes: 1 addition & 1 deletion RadarSDK/RadarSettings.m
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ + (NSString *)verifiedHost {

+ (BOOL)userDebug {
NSNumber *userDebug = [[NSUserDefaults standardUserDefaults] objectForKey:kUserDebug];
return userDebug ? [userDebug boolValue] : YES;
return userDebug ? [userDebug boolValue] : NO;
}

+ (void)setUserDebug:(BOOL)userDebug {
Expand Down
2 changes: 1 addition & 1 deletion RadarSDK/RadarUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ + (NSNumber *)timeZoneOffset {
}

+ (NSString *)sdkVersion {
return @"3.19.1";
return @"3.19.2";
}

+ (NSString *)deviceId {
Expand Down
38 changes: 26 additions & 12 deletions RadarSDK/RadarVerificationManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#import "Radar+Internal.h"
#import "RadarAPIClient.h"
#import "RadarBeaconManager.h"
#import "RadarDelegateHolder.h"
#import "RadarLocationManager.h"
#import "RadarLogger.h"
#import "RadarState.h"
Expand Down Expand Up @@ -79,23 +80,30 @@ - (void)trackVerifiedWithBeacons:(BOOL)beacons completionHandler:(RadarTrackVeri
verified:YES
completionHandler:^(RadarStatus status, RadarConfig *_Nullable config) {
if (status != RadarStatusSuccess || !config) {
if (completionHandler) {
[RadarUtils runOnMainThread:^{
[RadarUtils runOnMainThread:^{
if (status != RadarStatusSuccess) {
[[RadarDelegateHolder sharedInstance] didFailWithStatus:status];
}

if (completionHandler) {
completionHandler(status, nil);
}];
}
}
}];

return;
}

[[RadarLocationManager sharedInstance]
getLocationWithDesiredAccuracy:RadarTrackingOptionsDesiredAccuracyMedium
completionHandler:^(RadarStatus status, CLLocation *_Nullable location, BOOL stopped) {
if (status != RadarStatusSuccess) {
if (completionHandler) {
[RadarUtils runOnMainThread:^{
[RadarUtils runOnMainThread:^{
[[RadarDelegateHolder sharedInstance] didFailWithStatus:status];

if (completionHandler) {
completionHandler(status, nil);
}];
}
}
}];

return;
}
Expand Down Expand Up @@ -123,16 +131,22 @@ - (void)trackVerifiedWithBeacons:(BOOL)beacons completionHandler:(RadarTrackVeri
if (status == RadarStatusSuccess && config != nil) {
[[RadarLocationManager sharedInstance] updateTrackingFromMeta:config.meta];
}

if (token) {
self.lastToken = token;
self.lastTokenSystemUptime = [NSProcessInfo processInfo].systemUptime;
self.lastTokenBeacons = lastTokenBeacons;
}
if (completionHandler) {
[RadarUtils runOnMainThread:^{

[RadarUtils runOnMainThread:^{
if (status != RadarStatusSuccess) {
[[RadarDelegateHolder sharedInstance] didFailWithStatus:status];
}

if (completionHandler) {
completionHandler(status, token);
}];
}
}
}];
}];
};

Expand Down

0 comments on commit b37f4ae

Please sign in to comment.