Skip to content

Commit 46cb564

Browse files
authored
Revert premature api changes (#2097)
* Revert "Add warning for deprecated API to indicate that the passed in domain name's scheme will deduced as https (#2078)" This reverts commit ceb8392. * Revert "Allow setting the domainURIPrefix for custom domain names/paths when creating dynamic links (#2071)" This reverts commit d917bac. * Revert "Minor edits: change domain names in test app plist, fix warnings." This reverts commit 15f5d46. * Revert "Fix style. Run ./scripts/style.sh" This reverts commit 0e16e6c. * Revert "Allow for custom domains in the FDL iOS SDK" This reverts commit 5e33153. * Version is still 3.2.0
1 parent 50d27eb commit 46cb564

File tree

14 files changed

+48
-323
lines changed

14 files changed

+48
-323
lines changed

Example/DynamicLinks/App/iOS/DL-Info.plist

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,5 @@
5050
<string>UIInterfaceOrientationLandscapeLeft</string>
5151
<string>UIInterfaceOrientationLandscapeRight</string>
5252
</array>
53-
<key>FirebaseDynamicLinksCustomDomains</key>
54-
<array>
55-
<string>https://google.com</string>
56-
<string>https://google.com/one</string>
57-
<string>https://a.firebase.com/mypath</string>
58-
</array>
5953
</dict>
6054
</plist>

Example/DynamicLinks/FDLBuilderTestAppObjC/Info.plist

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,6 @@
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
5-
<key>CFBundleDevelopmentRegion</key>
6-
<string>en</string>
7-
<key>CFBundleExecutable</key>
8-
<string>$(EXECUTABLE_NAME)</string>
9-
<key>CFBundleIdentifier</key>
10-
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11-
<key>CFBundleInfoDictionaryVersion</key>
12-
<string>6.0</string>
13-
<key>CFBundleName</key>
14-
<string>$(PRODUCT_NAME)</string>
15-
<key>CFBundlePackageType</key>
16-
<string>APPL</string>
17-
<key>CFBundleShortVersionString</key>
18-
<string>1.0</string>
195
<key>CFBundleURLTypes</key>
206
<array>
217
<dict>
@@ -69,22 +55,22 @@
6955
</array>
7056
</dict>
7157
</array>
58+
<key>CFBundleDevelopmentRegion</key>
59+
<string>en</string>
60+
<key>CFBundleExecutable</key>
61+
<string>$(EXECUTABLE_NAME)</string>
62+
<key>CFBundleIdentifier</key>
63+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
64+
<key>CFBundleInfoDictionaryVersion</key>
65+
<string>6.0</string>
66+
<key>CFBundleName</key>
67+
<string>$(PRODUCT_NAME)</string>
68+
<key>CFBundlePackageType</key>
69+
<string>APPL</string>
70+
<key>CFBundleShortVersionString</key>
71+
<string>1.0</string>
7272
<key>CFBundleVersion</key>
7373
<string>1</string>
74-
<key>FirebaseDynamicLinksCustomDomains</key>
75-
<array>
76-
<string>https://mydomain.com</string>
77-
<string>https://mydomain2.com</string>
78-
<string>https://google.com</string>
79-
<string>https://google.com</string>
80-
<string>google</string>
81-
<string>mydomain.com</string>
82-
<string>https://mydomain</string>
83-
<string>https://mydomain3.com</string>
84-
<string>https://google.com/one</string>
85-
<string>https://custom.com/one/two</string>
86-
<string>https://custom1.com/one/</string>
87-
</array>
8874
<key>LSRequiresIPhoneOS</key>
8975
<true/>
9076
<key>UILaunchStoryboardName</key>

Example/DynamicLinks/FDLBuilderTestAppObjC/ViewController.m

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ - (void)_initDefaultValues {
155155
},
156156
// The default value of domain appcode belongs to project: app-invites-qa
157157
@{
158-
@"id" : @"domainURIPrefix",
159-
@"label" : @"App domainURIPrefix (required)",
160-
@"defaultValue" : @"https://testfdl.page.link",
158+
@"id" : @"domain",
159+
@"label" : @"App domain (required)",
160+
@"defaultValue" : @"testfdl.page.link",
161161
},
162162
// analytics params
163163
@{
@@ -289,8 +289,7 @@ - (void)_initDefaultValues {
289289
- (void)_buildFDLLink {
290290
NSURL *link = [NSURL URLWithString:_paramValues[@"linkString"]];
291291
FIRDynamicLinkComponents *components =
292-
[FIRDynamicLinkComponents componentsWithLink:link
293-
domainURIPrefix:_paramValues[@"https://domain"]];
292+
[FIRDynamicLinkComponents componentsWithLink:link domain:_paramValues[@"domain"]];
294293

295294
FIRDynamicLinkGoogleAnalyticsParameters *analyticsParams =
296295
[FIRDynamicLinkGoogleAnalyticsParameters

Example/DynamicLinks/FDLBuilderTestAppObjCTests/Info.plist

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,5 @@
1818
<string>1.0</string>
1919
<key>CFBundleVersion</key>
2020
<string>1</string>
21-
<key>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
22-
&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;
23-
&lt;plist version=&quot;1.0&quot;&gt;
24-
&lt;array&gt;
25-
&lt;string&gt;https://mydomain.com&lt;/string&gt;
26-
&lt;string&gt;https://mydomain2.com&lt;/string&gt;
27-
&lt;string&gt;https://google.com&lt;/string&gt;
28-
&lt;string&gt;https://google.com&lt;/string&gt;
29-
&lt;string&gt;go&lt;/string&gt;
30-
&lt;string&gt;g.co&lt;/string&gt;
31-
&lt;string&gt;https://go&lt;/string&gt;
32-
&lt;string&gt;https://g.co&lt;/string&gt;
33-
&lt;string&gt;https://google.com/one&lt;/string&gt;
34-
&lt;string&gt;https://custom.com/one/two&lt;/string&gt;
35-
&lt;string&gt;https://custom1.com/one/&lt;/string&gt;
36-
&lt;/array&gt;
37-
&lt;/plist&gt;
38-
</key>
39-
<string></string>
4021
</dict>
4122
</plist>

Example/DynamicLinks/Tests/FDLURLComponentsTests.m

Lines changed: 21 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121

2222
#import <OCMock/OCMock.h>
2323

24-
static NSString *const kFDLURLDomain = @"https://xyz.page.link";
25-
static NSString *const kFDLURLCustomDomain = @"https://foo.com/path";
24+
static NSString *const kFDLURLDomain = @"xyz.page.link";
2625

2726
@interface FDLURLComponentsTests : XCTestCase
2827
@end
@@ -462,14 +461,14 @@ - (void)testLinkOptionsParamsPropertiesSetProperly {
462461

463462
- (void)testFDLComponentsFactoryReturnsInstanceOfCorrectClass {
464463
NSURL *link = [NSURL URLWithString:@"https://google.com"];
465-
id returnValue = [FIRDynamicLinkComponents componentsWithLink:link domainURIPrefix:kFDLURLDomain];
464+
id returnValue = [FIRDynamicLinkComponents componentsWithLink:link domain:kFDLURLDomain];
466465
XCTAssertTrue([returnValue isKindOfClass:[FIRDynamicLinkComponents class]]);
467466
}
468467

469468
- (void)testFDLComponentsFactoryReturnsInstanceWithAllNilProperties {
470469
NSURL *link = [NSURL URLWithString:@"https://google.com"];
471470
FIRDynamicLinkComponents *components =
472-
[FIRDynamicLinkComponents componentsWithLink:link domainURIPrefix:kFDLURLDomain];
471+
[FIRDynamicLinkComponents componentsWithLink:link domain:kFDLURLDomain];
473472

474473
XCTAssertNil(components.analyticsParameters);
475474
XCTAssertNil(components.socialMetaTagParameters);
@@ -485,27 +484,11 @@ - (void)testFDLComponentsCreatesSimplestLinkCorrectly {
485484
NSURL *link = [NSURL URLWithString:linkString];
486485

487486
NSString *expectedURLString =
488-
[NSString stringWithFormat:@"%@/?link=%@", kFDLURLDomain, endcodedLinkString];
487+
[NSString stringWithFormat:@"https://%@/?link=%@", kFDLURLDomain, endcodedLinkString];
489488
NSURL *expectedURL = [NSURL URLWithString:expectedURLString];
490489

491490
FIRDynamicLinkComponents *components =
492-
[FIRDynamicLinkComponents componentsWithLink:link domainURIPrefix:kFDLURLDomain];
493-
NSURL *actualURL = components.url;
494-
495-
XCTAssertEqualObjects(actualURL, expectedURL);
496-
}
497-
498-
- (void)testFDLComponentsCustomDomainWithPath {
499-
NSString *linkString = @"https://google.com";
500-
NSString *endcodedLinkString = @"https%3A%2F%2Fgoogle%2Ecom";
501-
NSURL *link = [NSURL URLWithString:linkString];
502-
503-
NSString *expectedURLString =
504-
[NSString stringWithFormat:@"%@/?link=%@", kFDLURLCustomDomain, endcodedLinkString];
505-
NSURL *expectedURL = [NSURL URLWithString:expectedURLString];
506-
507-
FIRDynamicLinkComponents *components =
508-
[FIRDynamicLinkComponents componentsWithLink:link domainURIPrefix:kFDLURLCustomDomain];
491+
[FIRDynamicLinkComponents componentsWithLink:link domain:kFDLURLDomain];
509492
NSURL *actualURL = components.url;
510493

511494
XCTAssertEqualObjects(actualURL, expectedURL);
@@ -516,8 +499,7 @@ - (void)testFDLComponentsFailsOnMalformedDomain {
516499
NSURL *link = [NSURL URLWithString:linkString];
517500

518501
FIRDynamicLinkComponents *components =
519-
[FIRDynamicLinkComponents componentsWithLink:link
520-
domainURIPrefix:@"this is invalid domain URI Prefix"];
502+
[FIRDynamicLinkComponents componentsWithLink:link domain:@"this is invalid domain"];
521503

522504
XCTAssertNil(components.url);
523505
}
@@ -571,7 +553,7 @@ - (void)testFDLComponentsCreatesFullLinkCorrectly {
571553

572554
NSURL *link = [NSURL URLWithString:@"https://google.com"];
573555
FIRDynamicLinkComponents *fdlComponents =
574-
[FIRDynamicLinkComponents componentsWithLink:link domainURIPrefix:kFDLURLDomain];
556+
[FIRDynamicLinkComponents componentsWithLink:link domain:kFDLURLDomain];
575557
fdlComponents.analyticsParameters = analyticsParams;
576558
fdlComponents.iOSParameters = iosParams;
577559
fdlComponents.iTunesConnectParameters = itcParams;
@@ -660,43 +642,7 @@ - (void)testShortenURL {
660642
XCTestExpectation *expectation = [self expectationWithDescription:@"completion called"];
661643
NSURL *link = [NSURL URLWithString:@"https://google.com/abc"];
662644
FIRDynamicLinkComponents *components =
663-
[FIRDynamicLinkComponents componentsWithLink:link domainURIPrefix:kFDLURLDomain];
664-
[components
665-
shortenWithCompletion:^(NSURL *_Nullable shortURL, NSArray<NSString *> *_Nullable warnings,
666-
NSError *_Nullable error) {
667-
XCTAssertEqualObjects(shortURL.absoluteString, shortURLString);
668-
[expectation fulfill];
669-
}];
670-
[self waitForExpectationsWithTimeout:0.1 handler:nil];
671-
672-
[keyProviderClassMock verify];
673-
[keyProviderClassMock stopMocking];
674-
[componentsClassMock verify];
675-
[componentsClassMock stopMocking];
676-
}
677-
678-
- (void)testDeprecatedMethodComponentsWithLinkForDomain {
679-
NSString *shortURLString = @"https://xyz.page.link/abcd";
680-
681-
// Mock key provider
682-
id keyProviderClassMock = OCMClassMock([FIRDynamicLinkComponentsKeyProvider class]);
683-
[[[keyProviderClassMock expect] andReturn:@"fake-api-key"] APIKey];
684-
685-
id componentsClassMock = OCMClassMock([FIRDynamicLinkComponents class]);
686-
[[componentsClassMock expect]
687-
sendHTTPRequest:OCMOCK_ANY
688-
completion:[OCMArg checkWithBlock:^BOOL(id obj) {
689-
void (^completion)(NSData *_Nullable, NSError *_Nullable) = obj;
690-
NSDictionary *JSON = @{@"shortLink" : shortURLString};
691-
NSData *JSONData = [NSJSONSerialization dataWithJSONObject:JSON options:0 error:0];
692-
completion(JSONData, nil);
693-
return YES;
694-
}]];
695-
696-
XCTestExpectation *expectation = [self expectationWithDescription:@"completion called"];
697-
NSURL *link = [NSURL URLWithString:@"https://google.com/abc"];
698-
FIRDynamicLinkComponents *components =
699-
[FIRDynamicLinkComponents componentsWithLink:link domain:@"xyz.page.link"];
645+
[FIRDynamicLinkComponents componentsWithLink:link domain:kFDLURLDomain];
700646
[components
701647
shortenWithCompletion:^(NSURL *_Nullable shortURL, NSArray<NSString *> *_Nullable warnings,
702648
NSError *_Nullable error) {
@@ -733,7 +679,7 @@ - (void)testShortenURLReturnsErrorWhenAPIKeyMissing {
733679
[self expectationWithDescription:@"completion called with error"];
734680
NSURL *link = [NSURL URLWithString:@"https://google.com/abc"];
735681
FIRDynamicLinkComponents *components =
736-
[FIRDynamicLinkComponents componentsWithLink:link domainURIPrefix:kFDLURLDomain];
682+
[FIRDynamicLinkComponents componentsWithLink:link domain:kFDLURLDomain];
737683
[components
738684
shortenWithCompletion:^(NSURL *_Nullable shortURL, NSArray<NSString *> *_Nullable warnings,
739685
NSError *_Nullable error) {
@@ -768,11 +714,20 @@ - (void)testShortenURLReturnsErrorWhenDomainIsMalformed {
768714
return YES;
769715
}]];
770716

717+
XCTestExpectation *expectation =
718+
[self expectationWithDescription:@"completion called with error"];
771719
NSURL *link = [NSURL URLWithString:@"https://google.com/abc"];
772720
FIRDynamicLinkComponents *components =
773-
[FIRDynamicLinkComponents componentsWithLink:link
774-
domainURIPrefix:@"this is invalid domain URI Prefix"];
775-
XCTAssertNil(components);
721+
[FIRDynamicLinkComponents componentsWithLink:link domain:@"this is invalid domain"];
722+
[components
723+
shortenWithCompletion:^(NSURL *_Nullable shortURL, NSArray<NSString *> *_Nullable warnings,
724+
NSError *_Nullable error) {
725+
XCTAssertNil(shortURL);
726+
if (error) {
727+
[expectation fulfill];
728+
}
729+
}];
730+
[self waitForExpectationsWithTimeout:0.1 handler:nil];
776731

777732
[keyProviderClassMock verify];
778733
[keyProviderClassMock stopMocking];

Example/DynamicLinks/Tests/FIRDynamicLinkNetworkingTests.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#import <XCTest/XCTest.h>
1818

19-
#import <OCMock/OCMock.h>
19+
#import "OCMock.h"
2020

2121
#import <GoogleUtilities/GULSwizzler.h>
2222
#import "DynamicLinks/FIRDynamicLinkNetworking+Private.h"

Example/DynamicLinks/Tests/FIRDynamicLinksTest.m

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,57 +1015,6 @@ - (void)testSelfDiagnoseCompletionCalled {
10151015
[self waitForExpectationsWithTimeout:2.0 handler:nil];
10161016
}
10171017

1018-
#pragma mark - Custom domain tests
1019-
- (void)testValidCustomDomainNames {
1020-
// Entries in plist file:
1021-
// https://google.com
1022-
// https://google.com/one
1023-
// https://a.firebase.com/mypath
1024-
1025-
NSArray<NSString *> *urlStrings = @[
1026-
@"https://google.com/1", // Valid domain. Any path.
1027-
@"https://google.com/2", // Valid domain. Any path.
1028-
@"https://google.com/one", // Valid domain. Specified path.
1029-
@"https://a.firebase.com/mypath/", // Valid subdomain.
1030-
@"https://a.firebase.com/mypath/abcd/efgh", // Long path.
1031-
@"https://a.firebase.com/mypath?link=abcd&test=1", // Long path.
1032-
];
1033-
1034-
for (NSString *urlString in urlStrings) {
1035-
NSURL *url = [NSURL URLWithString:urlString];
1036-
BOOL matchesShortLinkFormat = [self.service matchesShortLinkFormat:url];
1037-
1038-
XCTAssertTrue(matchesShortLinkFormat,
1039-
@"Non-DDL domain URL matched short link format with URL: %@", url);
1040-
}
1041-
}
1042-
1043-
- (void)testInvalidCustomDomainNames {
1044-
// Entries in plist file:
1045-
// https://google.com
1046-
// https://google.com/one
1047-
// https://a.firebase.com/mypath
1048-
1049-
NSArray<NSString *> *urlStrings = @[
1050-
@"mydomain.com", // Domain not in plist. Also, no scheme.
1051-
@"http://mydomain", // Domain not in plist. No path.
1052-
@"google.com", // Valid domain. No scheme.
1053-
@"https://google.com", // Valid domain. No path.
1054-
@"http://google.com", // Valid domain. Invalid scheme.
1055-
@"https://google.co.in/abc", // Invalid domain starts with valid domain name.
1056-
@"https://firebase.com/mypath", // Invalid (sub)domain.
1057-
@"https://b.firebase.com/mypath" // Invalid subdomain.
1058-
];
1059-
1060-
for (NSString *urlString in urlStrings) {
1061-
NSURL *url = [NSURL URLWithString:urlString];
1062-
BOOL matchesShortLinkFormat = [self.service matchesShortLinkFormat:url];
1063-
1064-
XCTAssertFalse(matchesShortLinkFormat,
1065-
@"Non-DDL domain URL matched short link format with URL: %@", url);
1066-
}
1067-
}
1068-
10691018
#pragma mark - Private Helpers
10701019

10711020
- (void)removeAllFIRApps {

Firebase/DynamicLinks/CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# v3.2.0
2-
- Add support for creating and receiving dynamic links from custom domains. This feature is not yet available for public consumption. (#1962, #2017, #2078)
32
- Delete deprecated source files. (#2038)
43

54
# v3.1.1

0 commit comments

Comments
 (0)