Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -31,11 +31,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}`);
}
async _registerInstallation() {
let pushToken = await AsyncStorage.getItem('pushToken');
Expand Down