Skip to content

Commit

Permalink
Updated if statements
Browse files Browse the repository at this point in the history
  • Loading branch information
nsingh-branch committed Nov 12, 2024
1 parent 0b84096 commit d6e8b61
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
28 changes: 14 additions & 14 deletions Sources/BranchSDK/BNCRequestFactory.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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"];
}
}
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion Sources/BranchSDK/BNCSKAdNetwork.m
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit d6e8b61

Please sign in to comment.