mirror of
https://github.com/firebase/firebase-ios-sdk
synced 2026-11-11 22:55:59 +05:45
Add support for initializing custom domains without Core. This is required for 1P. (#3540)
This commit is contained in:
1 parent
0358696d8e
commit
b3bebbdc3f
2 files changed
+42
-6
No files matched your search
@@ -513,6 +513,27 @@ static NSString *const kInfoPlistCustomDomainsKey = @"FirebaseDynamicLinksCustom
|
||||
XCTAssertNil(dynamicLink, @"invite should be nil since there is no parameter.");
|
||||
}
|
||||
|
||||
// Custom domain entries in plist file:
|
||||
// https://google.com
|
||||
// https://google.com/one
|
||||
// https://a.firebase.com/mypath
|
||||
- (void)testDynamicLinkFromUniversalLinkURLWithCustomDomainLink {
|
||||
self.service = [[FIRDynamicLinks alloc] init];
|
||||
NSString *durableDeepLinkString = @"https://a.firebase.com/mypath/?link=abcd";
|
||||
NSURL *durabledeepLinkURL = [NSURL URLWithString:durableDeepLinkString];
|
||||
|
||||
SwizzleDynamicLinkNetworkingWithMock();
|
||||
|
||||
FIRDynamicLink *dynamicLink = [self.service dynamicLinkFromUniversalLinkURL:durabledeepLinkURL];
|
||||
|
||||
XCTAssertNotNil(dynamicLink);
|
||||
NSString *deepLinkURLString = dynamicLink.url.absoluteString;
|
||||
|
||||
XCTAssertEqualObjects(@"abcd", deepLinkURLString,
|
||||
@"ddl url parameter and deep link url should be the same");
|
||||
UnswizzleDynamicLinkNetworking();
|
||||
}
|
||||
|
||||
- (void)testDynamicLinkFromUniversalLinkURLWithSpecialCharacters {
|
||||
NSString *durableDeepLinkString =
|
||||
[NSString stringWithFormat:@"https://xyz.page.link/?link=%@", kEncodedComplicatedURLString];
|
||||
|
||||
@@ -220,12 +220,7 @@ static const NSInteger FIRErrorCodeDurableDeepLinkFailed = -119;
|
||||
}
|
||||
[NSException raise:kFirebaseDurableDeepLinkErrorDomain format:@"%@", message];
|
||||
}
|
||||
// Check to see if FirebaseDynamicLinksCustomDomains array is present.
|
||||
NSDictionary *infoDictionary = [NSBundle mainBundle].infoDictionary;
|
||||
NSArray *customDomains = infoDictionary[kInfoPlistCustomDomainsKey];
|
||||
if (customDomains) {
|
||||
FIRDLAddToAllowListForCustomDomainsArray(customDomains);
|
||||
}
|
||||
[self checkForCustomDomainEntriesInInfoPlist];
|
||||
}
|
||||
|
||||
- (instancetype)initWithAnalytics:(nullable id<FIRAnalyticsInterop>)analytics {
|
||||
@@ -254,6 +249,26 @@ static const NSInteger FIRErrorCodeDurableDeepLinkFailed = -119;
|
||||
}
|
||||
#endif
|
||||
|
||||
#pragma mark - Custom domains
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
[self checkForCustomDomainEntriesInInfoPlist];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
// Check for custom domains entry in PLIST file.
|
||||
- (void)checkForCustomDomainEntriesInInfoPlist {
|
||||
// Check to see if FirebaseDynamicLinksCustomDomains array is present.
|
||||
NSDictionary *infoDictionary = [NSBundle mainBundle].infoDictionary;
|
||||
NSArray *customDomains = infoDictionary[kInfoPlistCustomDomainsKey];
|
||||
if (customDomains) {
|
||||
FIRDLAddToAllowListForCustomDomainsArray(customDomains);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - First party interface
|
||||
|
||||
- (BOOL)setUpWithLaunchOptions:(nullable NSDictionary *)launchOptions
|
||||
|
||||
Reference in new issue
Block a user