Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SDK-2474] Fix for sending URI scheme as universal_link_url #1420

Merged
merged 3 commits into from
Aug 20, 2024
Merged
Changes from all commits
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
17 changes: 15 additions & 2 deletions Sources/BranchSDK/BNCRequestFactory.m
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,14 @@ - (NSDictionary *)dataForInstallWithURLString:(NSString *)urlString {
[self addAppleReceiptSourceToJSON:json];
[self addTimestampsToJSON:json];

// Check if the urlString is a valid URL to ensure it's a universal link, not the external intent uri
if (urlString) {
[self safeSetValue:urlString forKey:BRANCH_REQUEST_KEY_UNIVERSAL_LINK_URL onDict:json];
NSURL *url = [NSURL URLWithString:urlString];
if (url && ([url.scheme isEqualToString:@"http"] || [url.scheme isEqualToString:@"https"])) {
[self safeSetValue:urlString forKey:BRANCH_REQUEST_KEY_UNIVERSAL_LINK_URL onDict:json];
} else {
[self safeSetValue:urlString forKey:BRANCH_REQUEST_KEY_EXTERNAL_INTENT_URI onDict:json];
}
}

[self addAppleAttributionTokenToJSON:json];
Expand Down Expand Up @@ -147,8 +153,15 @@ - (NSDictionary *)dataForOpenWithURLString:(NSString *)urlString {
[self addAppleReceiptSourceToJSON:json];
[self addTimestampsToJSON:json];


// Check if the urlString is a valid URL to ensure it's a universal link, not the external intent uri
if (urlString) {
[self safeSetValue:urlString forKey:BRANCH_REQUEST_KEY_UNIVERSAL_LINK_URL onDict:json];
NSURL *url = [NSURL URLWithString:urlString];
if (url && ([url.scheme isEqualToString:@"http"] || [url.scheme isEqualToString:@"https"])) {
[self safeSetValue:urlString forKey:BRANCH_REQUEST_KEY_UNIVERSAL_LINK_URL onDict:json];
} else {
[self safeSetValue:urlString forKey:BRANCH_REQUEST_KEY_EXTERNAL_INTENT_URI onDict:json];
}
}

// Usually sent with install, but retry on open if it didn't get sent
Expand Down
Loading