Skip to content

Commit

Permalink
fix(dynamic-links,ios): resolveLink() does not always resolve (#3870)
Browse files Browse the repository at this point in the history
[publish]

Co-authored-by: Mike Hardy <[email protected]>
  • Loading branch information
melvynhills and mikehardy authored Jul 5, 2020
1 parent f9d2588 commit f10658e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
11 changes: 11 additions & 0 deletions packages/dynamic-links/e2e/dynamicLinks.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const TEST_LINK =
'https://reactnativefirebase.page.link/?link=https://rnfirebase.io&apn=com.invertase.testing';
const TEST_LINK2 =
'https://reactnativefirebase.page.link/?link=https://invertase.io/hire-us&apn=com.invertase.testing';
const TEST_LINK3 = 'https://invertase.io';

module.exports.baseParams = baseParams;

Expand Down Expand Up @@ -127,6 +128,16 @@ describe('dynamicLinks()', () => {
}
});

it('throws on static links', async () => {
try {
await firebase.dynamicLinks().resolveLink(TEST_LINK3);
return Promise.reject(new Error('Did not throw Error.'));
} catch (e) {
e.message.should.containEql('Dynamic link not found');
return Promise.resolve();
}
});

it('throws on invalid links', async () => {
try {
await firebase.dynamicLinks().resolveLink(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,16 @@ - (id)init {
@"message":[error localizedDescription]
}];
}
};
};

NSURL *linkURL = [NSURL URLWithString:link];
[[FIRDynamicLinks dynamicLinks] handleUniversalLink:linkURL completion:completion];
BOOL success = [[FIRDynamicLinks dynamicLinks] handleUniversalLink:linkURL completion:completion];
if (!success) {
[RNFBSharedUtils rejectPromiseWithUserInfo:reject userInfo:(NSMutableDictionary *) @{
@"code": @"not-found",
@"message": @"Dynamic link not found"
}];
}
}

- (FIRDynamicLinkComponents *)createDynamicLinkComponents:(NSDictionary *)dynamicLinkDict {
Expand Down

0 comments on commit f10658e

Please sign in to comment.