Skip to content
Merged
Changes from 1 commit
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
12 changes: 6 additions & 6 deletions Sources/BranchSDK/BNCServerAPI.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,20 @@ - (NSString *)customEventServiceURL{
}

- (NSString *)linkServiceURL {
return [[self getBaseURLForLinkingEndpoints] stringByAppendingString: @"/v1/url"];
return [[self getBaseURLForLinkingEndpoints:YES] stringByAppendingString: @"/v1/url"];
}

- (NSString *)qrcodeServiceURL {
return [[self getBaseURLForLinkingEndpoints] stringByAppendingString: @"/v1/qr-code"];
return [[self getBaseURLForLinkingEndpoints:YES] stringByAppendingString: @"/v1/qr-code"];
}

// LATD endpoint is not a data collection endpoint and will be treated like linking endpoints
- (NSString *)latdServiceURL {
return [[self getBaseURLForLinkingEndpoints] stringByAppendingString: @"/v1/cpid/latd"];
return [[self getBaseURLForLinkingEndpoints:YES] stringByAppendingString: @"/v1/cpid/latd"];
}

- (NSString *)validationServiceURL {
return [[self getBaseURLForLinkingEndpoints] stringByAppendingString: @"/v1/app-link-settings"];
return [[self getBaseURLForLinkingEndpoints:NO] stringByAppendingString: @"/v1/app-link-settings"];
}

// Currently we switch to tracking domains if we detect IDFA, indicating that Ad Tracking is enabled
Expand All @@ -78,8 +78,8 @@ - (BOOL)optedIntoIDFA {
}

// Linking endpoints are not used for Ads tracking
- (NSString *)getBaseURLForLinkingEndpoints {
if (self.customAPIURL) {
- (NSString *)getBaseURLForLinkingEndpoints: (BOOL)useCustom {
if (useCustom && self.customAPIURL) {
return self.customAPIURL;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Optional Recommendation

Issue: The code doesn't have any logging when switching between custom and standard URLs.
Fix: Consider adding debug logging to help with troubleshooting.
Impact: Would make it easier to debug URL-related issues in production environments.

Suggested change
- (NSString *)getBaseURLForLinkingEndpoints: (BOOL)useCustom {
if (useCustom && self.customAPIURL) {
return self.customAPIURL;
}
- (NSString *)getBaseURLForLinkingEndpoints: (BOOL)useCustom {
if (useCustom && self.customAPIURL) {
BNCLogDebug(@"Using custom API URL: %@", self.customAPIURL);
return self.customAPIURL;
}
BNCLogDebug(@"Using standard API URL");


Expand Down
Loading