Skip to content

Commit 4efb515

Browse files
authored
Merge 1c0dd10 into b904e6f
2 parents b904e6f + 1c0dd10 commit 4efb515

File tree

3 files changed

+43
-13
lines changed

3 files changed

+43
-13
lines changed

FirebaseDynamicLinks/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 10.0.1
2+
- [fixed] Added app.google (1p domain) support in FDL SDK which was missing.
3+
14
# 10.0.0
25
- [removed] Removed bare initializer from `DynamicLink`. (#10000)
36

FirebaseDynamicLinks/Sources/Utilities/FDLUtilities.m

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,14 @@ BOOL FIRDLIsAValidDLWithFDLDomain(NSURL *_Nullable URL) {
253253
BOOL matchesRegularExpression = false;
254254
NSString *urlStr = URL.absoluteString;
255255

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

@@ -266,9 +269,11 @@ BOOL FIRDLIsAValidDLWithFDLDomain(NSURL *_Nullable URL) {
266269
// Checks whether the URL is of the format :
267270
// http(s)://$DOMAIN(.page.link or .app.goo.gl)/i/$ANYTHING
268271
matchesRegularExpression =
269-
([urlStr rangeOfString:
270-
@"^https?:\\/\\/[a-zA-Z0-9]+((\\.app\\.goo\\.gl)|(\\.page\\.link))\\/i\\/.*$"
271-
options:NSRegularExpressionSearch]
272+
([urlStr
273+
rangeOfString:
274+
@"^https?:\\/\\/"
275+
@"[a-zA-Z0-9]+((\\.app\\.goo\\.gl)|(\\.page\\.link)|(\\.app\\.google))\\/i\\/.*$"
276+
options:NSRegularExpressionSearch]
272277
.location != NSNotFound);
273278
}
274279
}
@@ -286,7 +291,8 @@ BOOL FIRDLIsAValidDLWithFDLDomain(NSURL *_Nullable URL) {
286291
BOOL FIRDLCanParseUniversalLinkURL(NSURL *_Nullable URL) {
287292
// Handle universal links with format |https://goo.gl/app/<appcode>?<parameters>|.
288293
// Also support page.link format.
289-
BOOL isDDLWithAppcodeInPath = ([URL.host isEqual:@"goo.gl"] || [URL.host isEqual:@"page.link"]) &&
294+
BOOL isDDLWithAppcodeInPath = ([URL.host isEqual:@"goo.gl"] || [URL.host isEqual:@"page.link"] ||
295+
[URL.host isEqual:@"app.google"]) &&
290296
[URL.path hasPrefix:@"/app"];
291297

292298
return isDDLWithAppcodeInPath || FIRDLIsAValidDLWithFDLDomain(URL) ||

FirebaseDynamicLinks/Tests/Unit/FIRDynamicLinksTest.m

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,17 +1100,27 @@ - (void)testResolveLinkRespectsResponseErrorStatusCode {
11001100

11011101
- (void)testPassMatchesShortLinkFormatForDDLDomains {
11021102
NSArray<NSString *> *urlStrings = @[
1103-
@"https://someapp.app.goo.gl/somepath", @"https://someapp.app.goo.gl/link",
1103+
@"https://someapp.app.goo.gl/somepath",
1104+
@"https://someapp.app.goo.gl/link",
11041105
@"https://someapp.app.goo.gl/somepath?link=https://somedomain",
11051106
@"https://someapp.app.goo.gl/somepath?somekey=somevalue",
11061107
@"https://someapp.app.goo.gl/somepath/?link=https://somedomain",
11071108
@"https://someapp.app.goo.gl/somepath/?somekey=somevalue",
1108-
@"https://someapp.page.link/somepath", @"https://someapp.page.link/link",
1109+
@"https://someapp.app.google/somepath",
1110+
@"https://someapp.app.google/link",
1111+
@"https://someapp.app.google/somepath?link=https://somedomain",
1112+
@"https://someapp.app.google/somepath?somekey=somevalue",
1113+
@"https://someapp.app.google/somepath/?link=https://somedomain",
1114+
@"https://someapp.app.google/somepath/?somekey=somevalue",
1115+
@"https://someapp.page.link/somepath",
1116+
@"https://someapp.page.link/link",
11091117
@"https://someapp.page.link/somepath?link=https://somedomain",
11101118
@"https://someapp.page.link/somepath?somekey=somevalue",
11111119
@"https://someapp.page.link/somepath/?link=https://somedomain",
1112-
@"https://someapp.page.link/somepath/?somekey=somevalue", @"http://someapp.page.link/somepath",
1113-
@"http://someapp.page.link/link", @"http://someapp.page.link/somepath?link=https://somedomain",
1120+
@"https://someapp.page.link/somepath/?somekey=somevalue",
1121+
@"http://someapp.page.link/somepath",
1122+
@"http://someapp.page.link/link",
1123+
@"http://someapp.page.link/somepath?link=https://somedomain",
11141124
@"http://someapp.page.link/somepath?somekey=somevalue",
11151125
@"http://someapp.page.link/somepath/?link=http://somedomain",
11161126
@"http://someapp.page.link/somepath/?somekey=somevalue"
@@ -1136,6 +1146,15 @@ - (void)testFailMatchesShortLinkFormat {
11361146
@"https://someapp.app.goo.gl/somepath/somepath2",
11371147
@"https://someapp.app.goo.gl/somepath/somepath2?somekey=somevalue",
11381148
@"https://someapp.app.goo.gl/somepath/somepath2?link=https://somedomain",
1149+
@"https://someapp.app.google",
1150+
@"https://someapp.app.google/",
1151+
@"https://someapp.app.google?",
1152+
@"https://someapp.app.google/?",
1153+
@"https://someapp.app.google?somekey=somevalue",
1154+
@"https://someapp.app.google/?somekey=somevalue",
1155+
@"https://someapp.app.google/somepath/somepath2",
1156+
@"https://someapp.app.google/somepath/somepath2?somekey=somevalue",
1157+
@"https://someapp.app.google/somepath/somepath2?link=https://somedomain",
11391158
@"https://someapp.page.link",
11401159
@"https://someapp.page.link/",
11411160
@"https://someapp.page.link?",
@@ -1376,9 +1395,11 @@ - (void)testHandleUniversalLinkCompletionReturnsYesForValidDDL {
13761395
NSArray<NSString *> *urlStrings = @[
13771396
@"https://some.page.link/test", @"https://some.page.link/test-test",
13781397
@"https://some.page.link/test_test", @"https://some.page.link/test_test-test",
1379-
@"https://some.app.goo.gl/test_test-test",
1398+
@"https://some.app.goo.gl/test_test-test", @"https://some.app.google/test_test-test",
13801399
@"https://n8r9f.app.goo.gl/?ibi=com%2Egoogle%2EGCMTestApp%2Edev&amv=0&imv=1%2E0&link=https%3A%2F%2Fwww%2Egoogle%2Ecom",
1381-
@"https://n8r9f.app.goo.gl/?link=https%3A%2F%2Fwww%2Egoogle%2Ecom&ibi=com%2Egoogle%2EGCMTestApp%2Edev&amv=0&imv=1%2E0"
1400+
@"https://n8r9f.app.goo.gl/?link=https%3A%2F%2Fwww%2Egoogle%2Ecom&ibi=com%2Egoogle%2EGCMTestApp%2Edev&amv=0&imv=1%2E0",
1401+
@"https://n8r9f.app.google/?ibi=com%2Egoogle%2EGCMTestApp%2Edev&amv=0&imv=1%2E0&link=https%3A%2F%2Fwww%2Egoogle%2Ecom",
1402+
@"https://n8r9f.app.google/?link=https%3A%2F%2Fwww%2Egoogle%2Ecom&ibi=com%2Egoogle%2EGCMTestApp%2Edev&amv=0&imv=1%2E0"
13821403
];
13831404

13841405
for (NSString *urlString in urlStrings) {

0 commit comments

Comments
 (0)