Skip to content

Commit

Permalink
change name and usage of useOpenedAppConversion
Browse files Browse the repository at this point in the history
  • Loading branch information
KennyHuRadar committed Sep 11, 2024
1 parent 041bc57 commit c1daefa
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 17 deletions.
4 changes: 4 additions & 0 deletions RadarSDK/Radar.m
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,10 @@ + (void)sendLogConversionRequestWithName:(NSString * _Nonnull) name
}

+ (void)logOpenedAppConversion {
if (![RadarSettings useOpenedAppConversion]) {
return;
}

// Perform a non-blocking sleep for 1 second before starting, this is to address the fact that swizzled notification method may be called at a different relative live as compared to this method depending on framework.
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// if opened_app has been logged within the last second, don't log it again
Expand Down
2 changes: 1 addition & 1 deletion RadarSDK/RadarNotificationHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ - (void)swizzled_userNotificationCenter:(UNUserNotificationCenter *)center
}

+ (void)logConversionWithNotificationResponse:(UNNotificationResponse *)response {
if ([RadarSettings useOnPremiseNotificationsConversion]) {
if ([RadarSettings useOpenedAppConversion]) {
[RadarSettings updateLastAppOpenTime];

if ([response.notification.request.identifier hasPrefix:@"radar_"]) {
Expand Down
2 changes: 1 addition & 1 deletion RadarSDK/RadarSdkConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ NS_ASSUME_NONNULL_BEGIN

@property (nonatomic, assign) BOOL useLocationMetadata;

@property (nonatomic, assign) BOOL useOnPremiseNotificationsConversion;
@property (nonatomic, assign) BOOL useOpenedAppConversion;
/**
Initializes a new RadarSdkConfiguration object with given value.
*/
Expand Down
10 changes: 5 additions & 5 deletions RadarSDK/RadarSdkConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ - (instancetype)initWithDict:(NSDictionary *)dict {
_useLocationMetadata = [(NSNumber *)useLocationMetadataObj boolValue];
}

NSObject *useOnPremiseNotificationsConversion = dict[@"useOnPremiseNotificationsConversion"];
_useOnPremiseNotificationsConversion = NO;
if (useOnPremiseNotificationsConversion && [useOnPremiseNotificationsConversion isKindOfClass:[NSNumber class]]) {
_useOnPremiseNotificationsConversion = [(NSNumber *)useOnPremiseNotificationsConversion boolValue];
NSObject *useOpenedAppConversion = dict[@"useOpenedAppConversion"];
_useOpenedAppConversion = NO;
if (useOpenedAppConversion && [useOpenedAppConversion isKindOfClass:[NSNumber class]]) {
_useOpenedAppConversion = [(NSNumber *)useOpenedAppConversion boolValue];
}

return self;
Expand All @@ -89,7 +89,7 @@ - (NSDictionary *)dictionaryValue {
dict[@"useLogPersistence"] = @(_useLogPersistence);
dict[@"useRadarModifiedBeacon"] = @(_useRadarModifiedBeacon);
dict[@"useLocationMetadata"] = @(_useLocationMetadata);
dict[@"useOnPremiseNotificationsConversion"] = @(_useOnPremiseNotificationsConversion);
dict[@"useOpenedAppConversion"] = @(_useOpenedAppConversion);

return dict;
}
Expand Down
2 changes: 1 addition & 1 deletion RadarSDK/RadarSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (BOOL)xPlatform;
+ (NSString *)xPlatformSDKType;
+ (NSString *)xPlatformSDKVersion;
+ (BOOL)useOnPremiseNotificationsConversion;
+ (BOOL)useOpenedAppConversion;

@end

Expand Down
11 changes: 2 additions & 9 deletions RadarSDK/RadarSettings.m
Original file line number Diff line number Diff line change
Expand Up @@ -333,15 +333,8 @@ + (NSString *)xPlatformSDKVersion {
return [[NSUserDefaults standardUserDefaults] stringForKey:kXPlatformSDKVersion];
}

+ (BOOL)useOnPremiseNotificationsConversion {

if ([self sdkConfiguration] == nil) {
return YES;
}
if ([self sdkConfiguration].startTrackingOnInitialize || [self sdkConfiguration].trackOnceOnAppOpen || [[self sdkConfiguration] useOnPremiseNotificationsConversion]) {
return YES;
}
return [[self sdkConfiguration] useOnPremiseNotificationsConversion];
+ (BOOL)useOpenedAppConversion {
return [[self sdkConfiguration] useOpenedAppConversion];
}

@end

0 comments on commit c1daefa

Please sign in to comment.