Skip to content

Commit

Permalink
Resolve Promise to YES for Linking.openURL (#24955)
Browse files Browse the repository at this point in the history
Summary:
The `Linking.openURL()` method is supposed to resolve to a `true` `Promise` when the URL was properly open. However, in iOS, the `Promise` was resolving to `nil`. So I fixed this issue by making it resolve to `YES` (`true`), just like on Android.

## Changelog

[iOS] [Fixed] - Fix return value of `Linking.openURL()`
Pull Request resolved: #24955

Differential Revision: D15411994

Pulled By: cpojer

fbshipit-source-id: 90bdd6cfae8d69d7a239a0b4c84d75859e293b32
  • Loading branch information
thib92 authored and facebook-github-bot committed May 20, 2019
1 parent 14b4668 commit 4a5d0bd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Libraries/LinkingIOS/RCTLinkingManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ - (void)handleOpenURLNotification:(NSNotification *)notification
if (@available(iOS 10.0, *)) {
[RCTSharedApplication() openURL:URL options:@{} completionHandler:^(BOOL success) {
if (success) {
resolve(nil);
resolve(@YES);
} else {
reject(RCTErrorUnspecified, [NSString stringWithFormat:@"Unable to open URL: %@", URL], nil);
}
}];
} else {
BOOL opened = [RCTSharedApplication() openURL:URL];
if (opened) {
resolve(nil);
resolve(@YES);
} else {
reject(RCTErrorUnspecified, [NSString stringWithFormat:@"Unable to open URL: %@", URL], nil);
}
Expand Down

0 comments on commit 4a5d0bd

Please sign in to comment.