From fddf95e91f3f8e9a43302c2c5d8dfca15bb7b86e Mon Sep 17 00:00:00 2001 From: Wilson Page Date: Tue, 15 Nov 2016 18:17:25 +0000 Subject: [PATCH] Add native linking logic for ios --- ios/Magnet.xcodeproj/project.pbxproj | 4 ++++ ios/Magnet/AppDelegate.m | 6 ++++++ ios/Magnet/Info.plist | 11 +++++++++++ lib/store/reducer.js | 2 +- 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/ios/Magnet.xcodeproj/project.pbxproj b/ios/Magnet.xcodeproj/project.pbxproj index 3ec1c17b..2af18cc4 100644 --- a/ios/Magnet.xcodeproj/project.pbxproj +++ b/ios/Magnet.xcodeproj/project.pbxproj @@ -972,6 +972,7 @@ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, "$(SRCROOT)/../node_modules/react-native/React/**", "$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient", + "$(SRCROOT)/../node_modules/react-native/Libraries/LinkingIOS", ); INFOPLIST_FILE = Magnet/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; @@ -1006,6 +1007,7 @@ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, "$(SRCROOT)/../node_modules/react-native/React/**", "$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient", + "$(SRCROOT)/../node_modules/react-native/Libraries/LinkingIOS", ); INFOPLIST_FILE = Magnet/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; @@ -1063,6 +1065,7 @@ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, "$(SRCROOT)/../node_modules/react-native/React/**", "$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient", + "$(SRCROOT)/../node_modules/react-native/Libraries/LinkingIOS/RCTLinkingManager.h", ); IPHONEOS_DEPLOYMENT_TARGET = 7.0; MTL_ENABLE_DEBUG_INFO = YES; @@ -1105,6 +1108,7 @@ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, "$(SRCROOT)/../node_modules/react-native/React/**", "$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient", + "$(SRCROOT)/../node_modules/react-native/Libraries/LinkingIOS/RCTLinkingManager.h", ); IPHONEOS_DEPLOYMENT_TARGET = 7.0; MTL_ENABLE_DEBUG_INFO = NO; diff --git a/ios/Magnet/AppDelegate.m b/ios/Magnet/AppDelegate.m index bc5ffade..e201c68f 100644 --- a/ios/Magnet/AppDelegate.m +++ b/ios/Magnet/AppDelegate.m @@ -11,6 +11,7 @@ #import "RCTBundleURLProvider.h" #import "RCTRootView.h" #import "RCTBridge.h" +#import "RCTLinkingManager.h" // Include the project headers for swift code. (-Swift.h) #import "magnet-Swift.h" @@ -67,4 +68,9 @@ -(void)application:(UIApplication *)application didReceiveLocalNotification:(UIL [self.bridge.eventDispatcher sendDeviceEventWithName:@"notification:applaunch" body:nil]; } +- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { + return [RCTLinkingManager application:application openURL:url sourceApplication:sourceApplication annotation:annotation]; +} + + @end diff --git a/ios/Magnet/Info.plist b/ios/Magnet/Info.plist index df5bbb35..90138c64 100644 --- a/ios/Magnet/Info.plist +++ b/ios/Magnet/Info.plist @@ -18,6 +18,17 @@ 1.2.1 CFBundleSignature ???? + CFBundleURLTypes + + + CFBundleURLName + org.mozilla.magnet + CFBundleURLSchemes + + mozilla-magnet + + + CFBundleVersion 7 LSRequiresIPhoneOS diff --git a/lib/store/reducer.js b/lib/store/reducer.js index a31ff56c..3723c4f0 100644 --- a/lib/store/reducer.js +++ b/lib/store/reducer.js @@ -4,7 +4,7 @@ * Dependencies */ -const debug = require('../debug')('reducer', 1); +const debug = require('../debug')('reducer'); const config = require('../../config'); const {