Skip to content

Commit

Permalink
AppDelegate must forward calls to module
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeStanton committed Jul 15, 2015
1 parent bbbf934 commit 55c7bfa
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
4 changes: 4 additions & 0 deletions LondonReact.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,7 @@
13B07F941A680F5B00A75B9A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CODE_SIGN_IDENTITY = "iPhone Developer: David Wynne (WVKX278G5W)";
Expand All @@ -683,12 +684,14 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = LondonReact;
PROVISIONING_PROFILE = "d8f23040-5086-4316-ace8-ba8530e55286";
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/node_modules/react-native/Libraries/**";
};
name = Debug;
};
13B07F951A680F5B00A75B9A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CODE_SIGN_IDENTITY = "iPhone Developer: David Wynne (WVKX278G5W)";
Expand All @@ -702,6 +705,7 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = LondonReact;
PROVISIONING_PROFILE = "d8f23040-5086-4316-ace8-ba8530e55286";
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/node_modules/react-native/Libraries/**";
};
name = Release;
};
Expand Down
11 changes: 11 additions & 0 deletions iOS/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#import "AppDelegate.h"

#import "RCTRootView.h"
#import "RCTPushNotificationManager.h"

@implementation AppDelegate

Expand Down Expand Up @@ -83,4 +84,14 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
return YES;
}

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
[RCTPushNotificationManager application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)notification
{
[RCTPushNotificationManager application:application didReceiveRemoteNotification:notification];
}

@end
3 changes: 2 additions & 1 deletion index.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ class LondonReact extends React.Component {

PushNotificationIOS.addEventListener('register', this._savePushToken);
PushNotificationIOS.addEventListener('notification', this._notificationReceived);
PushNotificationIOS.requestPermissions(this._savePushToken);
PushNotificationIOS.requestPermissions();
}
async _savePushToken(token) {
await AsyncStorage.setItem('pushToken', token);
await Parse.registerInstallation(token);
AlertIOS.alert(`Registered token: ${token}`);
}
_notificationReceived(notification) {
AlertIOS.alert(notification);
Expand Down

0 comments on commit 55c7bfa

Please sign in to comment.