[ReactNative] Add deep linking api

This commit is contained in:
Tadeu Zagallo
2015-03-25 18:59:42 -07:00
parent f53510a2af
commit 8679c0bc96
20 changed files with 646 additions and 121 deletions

View File

@@ -13,7 +13,6 @@
#import "RCTEventDispatcher.h"
NSString *const RCTRemoteNotificationReceived = @"RemoteNotificationReceived";
NSString *const RCTOpenURLNotification = @"RCTOpenURLNotification";
@implementation RCTPushNotificationManager
{
@@ -35,10 +34,6 @@ NSString *const RCTOpenURLNotification = @"RCTOpenURLNotification";
selector:@selector(handleRemoteNotificationReceived:)
name:RCTRemoteNotificationReceived
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleOpenURLNotification:)
name:RCTOpenURLNotification
object:nil];
}
return self;
}
@@ -62,30 +57,12 @@ NSString *const RCTOpenURLNotification = @"RCTOpenURLNotification";
userInfo:notification];
}
+ (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation
{
NSDictionary *payload = @{@"url": [url absoluteString]};
[[NSNotificationCenter defaultCenter] postNotificationName:RCTOpenURLNotification
object:self
userInfo:payload];
return YES;
}
- (void)handleRemoteNotificationReceived:(NSNotification *)notification
{
[_bridge.eventDispatcher sendDeviceEventWithName:@"remoteNotificationReceived"
body:[notification userInfo]];
}
- (void)handleOpenURLNotification:(NSNotification *)notification
{
[_bridge.eventDispatcher sendDeviceEventWithName:@"openURL"
body:[notification userInfo]];
}
/**
* Update the application icon badge number on the home screen
*/