From d6e8b618c469d3248895f4cd11314906df44695f Mon Sep 17 00:00:00 2001 From: nsingh-branch Date: Tue, 12 Nov 2024 09:02:24 -0800 Subject: [PATCH] Updated if statements --- Sources/BranchSDK/BNCRequestFactory.m | 28 +++++++++++++-------------- Sources/BranchSDK/BNCSKAdNetwork.m | 3 ++- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Sources/BranchSDK/BNCRequestFactory.m b/Sources/BranchSDK/BNCRequestFactory.m index d9fc865cb..3f6341e85 100644 --- a/Sources/BranchSDK/BNCRequestFactory.m +++ b/Sources/BranchSDK/BNCRequestFactory.m @@ -499,8 +499,8 @@ - (void)addInstrumentationToJSON:(NSMutableDictionary *)json { // BNCReferringURLUtility requires the endpoint string to determine which query params are applied - (void)addReferringURLsToJSON:(NSMutableDictionary *)json forEndpoint:(NSString *)endpoint { // Not a singleton, but BNCReferringURLUtility does pull from storage - if ([self.preferenceHelper attributionLevel] == BranchAttributionLevelFull || - [self.preferenceHelper attributionLevelInitialized] == false) { + if ([[self.preferenceHelper attributionLevel] isEqualToString:BranchAttributionLevelFull] || + ![self.preferenceHelper attributionLevelInitialized]) { BNCReferringURLUtility *utility = [BNCReferringURLUtility new]; NSDictionary *urlQueryParams = [utility referringURLQueryParamsForEndpoint:endpoint]; [json bnc_safeAddEntriesFromDictionary:urlQueryParams]; @@ -542,13 +542,13 @@ - (NSDictionary *)v2dictionary { } else { BranchAttributionLevel attributionLevel = [self.preferenceHelper attributionLevel]; - if (attributionLevel == BranchAttributionLevelFull || - [self.preferenceHelper attributionLevelInitialized] == false) { + if ([attributionLevel isEqualToString:BranchAttributionLevelFull] || + ![self.preferenceHelper attributionLevelInitialized]) { [dictionary bnc_safeSetObject:self.deviceInfo.advertiserId forKey:@"idfa"]; } - - if (attributionLevel != BranchAttributionLevelNone || - [self.preferenceHelper attributionLevelInitialized] == false) { + + if (![attributionLevel isEqualToString:BranchAttributionLevelNone] || + ![self.preferenceHelper attributionLevelInitialized]) { [dictionary bnc_safeSetObject:self.deviceInfo.vendorId forKey:@"idfv"]; } } @@ -610,14 +610,14 @@ - (void)updateDeviceInfoToMutableDictionary:(NSMutableDictionary *)dict { [self.deviceInfo checkAdvertisingIdentifier]; // Only include hardware ID fields for Full Attribution Level - if ([self.preferenceHelper attributionLevel] == BranchAttributionLevelFull + if (([[self.preferenceHelper attributionLevel] isEqualToString:BranchAttributionLevelFull]) || [self.preferenceHelper attributionLevelInitialized] == false) { - - // hardware id information. idfa, idfv or random - NSString *hardwareId = [self.deviceInfo.hardwareId copy]; - NSString *hardwareIdType = [self.deviceInfo.hardwareIdType copy]; - NSNumber *isRealHardwareId = @(self.deviceInfo.isRealHardwareId); - + + // hardware id information. idfa, idfv or random + NSString *hardwareId = [self.deviceInfo.hardwareId copy]; + NSString *hardwareIdType = [self.deviceInfo.hardwareIdType copy]; + NSNumber *isRealHardwareId = @(self.deviceInfo.isRealHardwareId); + if (hardwareId != nil && hardwareIdType != nil && isRealHardwareId != nil) { dict[BRANCH_REQUEST_KEY_HARDWARE_ID] = hardwareId; dict[BRANCH_REQUEST_KEY_HARDWARE_ID_TYPE] = hardwareIdType; diff --git a/Sources/BranchSDK/BNCSKAdNetwork.m b/Sources/BranchSDK/BNCSKAdNetwork.m index 8e0d5eae1..da95238e9 100644 --- a/Sources/BranchSDK/BNCSKAdNetwork.m +++ b/Sources/BranchSDK/BNCSKAdNetwork.m @@ -220,7 +220,8 @@ - (BOOL) shouldCallPostbackForDataResponse:(NSDictionary *) dataResponseDictiona - (BOOL)isSKANAllowedForAttributionLevel { BranchAttributionLevel level = [[BNCPreferenceHelper sharedInstance] attributionLevel]; - return !(level == BranchAttributionLevelMinimal || level == BranchAttributionLevelNone); + return !([level isEqualToString:BranchAttributionLevelMinimal] || + [level isEqualToString:BranchAttributionLevelNone]); } @end