File tree Expand file tree Collapse file tree 2 files changed +42
-6
lines changed
Example/DynamicLinks/Tests Expand file tree Collapse file tree 2 files changed +42
-6
lines changed Original file line number Diff line number Diff line change @@ -513,6 +513,27 @@ - (void)testUniversalLink_NoDeepLink {
513
513
XCTAssertNil (dynamicLink, @" invite should be nil since there is no parameter." );
514
514
}
515
515
516
+ // Custom domain entries in plist file:
517
+ // https://google.com
518
+ // https://google.com/one
519
+ // https://a.firebase.com/mypath
520
+ - (void )testDynamicLinkFromUniversalLinkURLWithCustomDomainLink {
521
+ self.service = [[FIRDynamicLinks alloc ] init ];
522
+ NSString *durableDeepLinkString = @" https://a.firebase.com/mypath/?link=abcd" ;
523
+ NSURL *durabledeepLinkURL = [NSURL URLWithString: durableDeepLinkString];
524
+
525
+ SwizzleDynamicLinkNetworkingWithMock ();
526
+
527
+ FIRDynamicLink *dynamicLink = [self .service dynamicLinkFromUniversalLinkURL: durabledeepLinkURL];
528
+
529
+ XCTAssertNotNil (dynamicLink);
530
+ NSString *deepLinkURLString = dynamicLink.url .absoluteString ;
531
+
532
+ XCTAssertEqualObjects (@" abcd" , deepLinkURLString,
533
+ @" ddl url parameter and deep link url should be the same" );
534
+ UnswizzleDynamicLinkNetworking ();
535
+ }
536
+
516
537
- (void )testDynamicLinkFromUniversalLinkURLWithSpecialCharacters {
517
538
NSString *durableDeepLinkString =
518
539
[NSString stringWithFormat: @" https://xyz.page.link/?link=%@ " , kEncodedComplicatedURLString ];
Original file line number Diff line number Diff line change @@ -220,12 +220,7 @@ - (void)configureDynamicLinks:(FIRApp *)app {
220
220
}
221
221
[NSException raise:kFirebaseDurableDeepLinkErrorDomain format:@"%@", message];
222
222
}
223
- // Check to see if FirebaseDynamicLinksCustomDomains array is present.
224
- NSDictionary *infoDictionary = [NSBundle mainBundle].infoDictionary;
225
- NSArray *customDomains = infoDictionary[kInfoPlistCustomDomainsKey];
226
- if (customDomains) {
227
- FIRDLAddToAllowListForCustomDomainsArray(customDomains);
228
- }
223
+ [self checkForCustomDomainEntriesInInfoPlist];
229
224
}
230
225
231
226
- (instancetype)initWithAnalytics:(nullable id<FIRAnalyticsInterop>)analytics {
@@ -254,6 +249,26 @@ + (instancetype)dynamicLinks {
254
249
}
255
250
#endif
256
251
252
+ #pragma mark - Custom domains
253
+
254
+ - (instancetype)init {
255
+ self = [super init];
256
+ if (self) {
257
+ [self checkForCustomDomainEntriesInInfoPlist];
258
+ }
259
+ return self;
260
+ }
261
+
262
+ // Check for custom domains entry in PLIST file.
263
+ - (void)checkForCustomDomainEntriesInInfoPlist {
264
+ // Check to see if FirebaseDynamicLinksCustomDomains array is present.
265
+ NSDictionary *infoDictionary = [NSBundle mainBundle].infoDictionary;
266
+ NSArray *customDomains = infoDictionary[kInfoPlistCustomDomainsKey];
267
+ if (customDomains) {
268
+ FIRDLAddToAllowListForCustomDomainsArray(customDomains);
269
+ }
270
+ }
271
+
257
272
#pragma mark - First party interface
258
273
259
274
- (BOOL)setUpWithLaunchOptions:(nullable NSDictionary *)launchOptions
You can’t perform that action at this time.
0 commit comments