Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions FirebaseDynamicLinks/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# 10.0.0
- [removed] Removed bare initializer from `DynamicLink`. (#10000)
- [fixed] Added app.google (1p domain) support in FDL SDK which was missing.

# 9.0.0
- [fixed] Fixed async/await crash when retrieving a dynamic link from a universal link fails. (#9612)
Expand Down
20 changes: 13 additions & 7 deletions FirebaseDynamicLinks/Sources/Utilities/FDLUtilities.m
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,14 @@ BOOL FIRDLIsAValidDLWithFDLDomain(NSURL *_Nullable URL) {
BOOL matchesRegularExpression = false;
NSString *urlStr = URL.absoluteString;

if ([URL.host containsString:@".page.link"] || [URL.host containsString:@".app.goo.gl"]) {
if ([URL.host containsString:@".page.link"] || [URL.host containsString:@".app.goo.gl"] ||
[URL.host containsString:@".app.google"]) {
// Matches the *.page.link and *.app.goo.gl domains.
matchesRegularExpression =
([urlStr rangeOfString:@"^https?://[a-zA-Z0-9]+((\\.app\\.goo\\.gl)|(\\.page\\.link))((\\/"
@"?\\?.*link=https?.*)|(\\/[a-zA-Z0-9-_]+)((\\/?\\?.*=.*)?$|$))"
([urlStr rangeOfString:
@"^https?://"
@"[a-zA-Z0-9]+((\\.app\\.goo\\.gl)|(\\.page\\.link)|(\\.app\\.google))((\\/"
@"?\\?.*link=https?.*)|(\\/[a-zA-Z0-9-_]+)((\\/?\\?.*=.*)?$|$))"
options:NSRegularExpressionSearch]
.location != NSNotFound);

Expand All @@ -266,9 +269,11 @@ BOOL FIRDLIsAValidDLWithFDLDomain(NSURL *_Nullable URL) {
// Checks whether the URL is of the format :
// http(s)://$DOMAIN(.page.link or .app.goo.gl)/i/$ANYTHING
matchesRegularExpression =
([urlStr rangeOfString:
@"^https?:\\/\\/[a-zA-Z0-9]+((\\.app\\.goo\\.gl)|(\\.page\\.link))\\/i\\/.*$"
options:NSRegularExpressionSearch]
([urlStr
rangeOfString:
@"^https?:\\/\\/"
@"[a-zA-Z0-9]+((\\.app\\.goo\\.gl)|(\\.page\\.link)|(\\.app\\.google))\\/i\\/.*$"
options:NSRegularExpressionSearch]
.location != NSNotFound);
}
}
Expand All @@ -286,7 +291,8 @@ BOOL FIRDLIsAValidDLWithFDLDomain(NSURL *_Nullable URL) {
BOOL FIRDLCanParseUniversalLinkURL(NSURL *_Nullable URL) {
// Handle universal links with format |https://goo.gl/app/<appcode>?<parameters>|.
// Also support page.link format.
BOOL isDDLWithAppcodeInPath = ([URL.host isEqual:@"goo.gl"] || [URL.host isEqual:@"page.link"]) &&
BOOL isDDLWithAppcodeInPath = ([URL.host isEqual:@"goo.gl"] || [URL.host isEqual:@"page.link"] ||
[URL.host isEqual:@"app.google"]) &&
[URL.path hasPrefix:@"/app"];

return isDDLWithAppcodeInPath || FIRDLIsAValidDLWithFDLDomain(URL) ||
Expand Down
33 changes: 27 additions & 6 deletions FirebaseDynamicLinks/Tests/Unit/FIRDynamicLinksTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -1100,17 +1100,27 @@ - (void)testResolveLinkRespectsResponseErrorStatusCode {

- (void)testPassMatchesShortLinkFormatForDDLDomains {
NSArray<NSString *> *urlStrings = @[
@"https://someapp.app.goo.gl/somepath", @"https://someapp.app.goo.gl/link",
@"https://someapp.app.goo.gl/somepath",
@"https://someapp.app.goo.gl/link",
@"https://someapp.app.goo.gl/somepath?link=https://somedomain",
@"https://someapp.app.goo.gl/somepath?somekey=somevalue",
@"https://someapp.app.goo.gl/somepath/?link=https://somedomain",
@"https://someapp.app.goo.gl/somepath/?somekey=somevalue",
@"https://someapp.page.link/somepath", @"https://someapp.page.link/link",
@"https://someapp.app.google/somepath",
@"https://someapp.app.google/link",
@"https://someapp.app.google/somepath?link=https://somedomain",
@"https://someapp.app.google/somepath?somekey=somevalue",
@"https://someapp.app.google/somepath/?link=https://somedomain",
@"https://someapp.app.google/somepath/?somekey=somevalue",
@"https://someapp.page.link/somepath",
@"https://someapp.page.link/link",
@"https://someapp.page.link/somepath?link=https://somedomain",
@"https://someapp.page.link/somepath?somekey=somevalue",
@"https://someapp.page.link/somepath/?link=https://somedomain",
@"https://someapp.page.link/somepath/?somekey=somevalue", @"http://someapp.page.link/somepath",
@"http://someapp.page.link/link", @"http://someapp.page.link/somepath?link=https://somedomain",
@"https://someapp.page.link/somepath/?somekey=somevalue",
@"http://someapp.page.link/somepath",
@"http://someapp.page.link/link",
@"http://someapp.page.link/somepath?link=https://somedomain",
@"http://someapp.page.link/somepath?somekey=somevalue",
@"http://someapp.page.link/somepath/?link=http://somedomain",
@"http://someapp.page.link/somepath/?somekey=somevalue"
Expand All @@ -1136,6 +1146,15 @@ - (void)testFailMatchesShortLinkFormat {
@"https://someapp.app.goo.gl/somepath/somepath2",
@"https://someapp.app.goo.gl/somepath/somepath2?somekey=somevalue",
@"https://someapp.app.goo.gl/somepath/somepath2?link=https://somedomain",
@"https://someapp.app.google",
@"https://someapp.app.google/",
@"https://someapp.app.google?",
@"https://someapp.app.google/?",
@"https://someapp.app.google?somekey=somevalue",
@"https://someapp.app.google/?somekey=somevalue",
@"https://someapp.app.google/somepath/somepath2",
@"https://someapp.app.google/somepath/somepath2?somekey=somevalue",
@"https://someapp.app.google/somepath/somepath2?link=https://somedomain",
@"https://someapp.page.link",
@"https://someapp.page.link/",
@"https://someapp.page.link?",
Expand Down Expand Up @@ -1376,9 +1395,11 @@ - (void)testHandleUniversalLinkCompletionReturnsYesForValidDDL {
NSArray<NSString *> *urlStrings = @[
@"https://some.page.link/test", @"https://some.page.link/test-test",
@"https://some.page.link/test_test", @"https://some.page.link/test_test-test",
@"https://some.app.goo.gl/test_test-test",
@"https://some.app.goo.gl/test_test-test", @"https://some.app.google/test_test-test",
@"https://n8r9f.app.goo.gl/?ibi=com%2Egoogle%2EGCMTestApp%2Edev&amv=0&imv=1%2E0&link=https%3A%2F%2Fwww%2Egoogle%2Ecom",
@"https://n8r9f.app.goo.gl/?link=https%3A%2F%2Fwww%2Egoogle%2Ecom&ibi=com%2Egoogle%2EGCMTestApp%2Edev&amv=0&imv=1%2E0"
@"https://n8r9f.app.goo.gl/?link=https%3A%2F%2Fwww%2Egoogle%2Ecom&ibi=com%2Egoogle%2EGCMTestApp%2Edev&amv=0&imv=1%2E0",
@"https://n8r9f.app.google/?ibi=com%2Egoogle%2EGCMTestApp%2Edev&amv=0&imv=1%2E0&link=https%3A%2F%2Fwww%2Egoogle%2Ecom",
@"https://n8r9f.app.google/?link=https%3A%2F%2Fwww%2Egoogle%2Ecom&ibi=com%2Egoogle%2EGCMTestApp%2Edev&amv=0&imv=1%2E0"
];

for (NSString *urlString in urlStrings) {
Expand Down