Skip to content
Permalink
Browse files

Resolve Promise to YES for Linking.openURL (#24955)

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 4a5d0bdbd75c433d2f51f160657a0ad91e440272
Showing with 2 additions and 2 deletions.
  1. +2 −2 Libraries/LinkingIOS/RCTLinkingManager.m
@@ -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);
}

0 comments on commit 4a5d0bd

Please sign in to comment.
You can’t perform that action at this time.