From 435ef86ae6e12ce1d3473a31b735b3620f93fb64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Pietruszewski?= Date: Fri, 28 Jun 2019 14:28:41 +0200 Subject: [PATCH 1/4] UIKitForMac support - initial commit --- Libraries/Image/RCTUIImageViewAnimated.m | 5 + Libraries/LinkingIOS/RCTLinkingManager.m | 6 ++ Libraries/Network/RCTNetInfo.m | 4 +- .../RCTPushNotificationManager.h | 2 +- .../RCTPushNotificationManager.m | 14 +-- Libraries/Text/Text/RCTTextView.m | 3 +- Libraries/WebSocket/RCTSRWebSocket.m | 4 + .../RCTWebSocket.xcodeproj/project.pbxproj | 58 +---------- RNTester/RNTester.xcodeproj/project.pbxproj | 97 +++++++++++++++---- .../xcshareddata/xcschemes/RNTester.xcscheme | 24 ++--- RNTester/RNTester/AppDelegate.mm | 4 +- RNTester/RNTester/RNTester.entitlements | 12 +++ React/Base/RCTBridge.m | 2 +- React/Base/RCTDefines.h | 2 +- React/DevSupport/RCTDevMenu.m | 2 +- .../DevSupport/RCTInspectorDevServerHelper.h | 2 +- .../DevSupport/RCTInspectorDevServerHelper.mm | 2 +- React/DevSupport/RCTPackagerConnection.h | 2 +- React/DevSupport/RCTPackagerConnection.mm | 6 +- React/Inspector/RCTInspector.mm | 2 +- .../RCTInspectorPackagerConnection.h | 2 +- .../RCTInspectorPackagerConnection.m | 4 +- React/Modules/RCTDevSettings.mm | 2 +- 23 files changed, 149 insertions(+), 112 deletions(-) create mode 100644 RNTester/RNTester/RNTester.entitlements diff --git a/Libraries/Image/RCTUIImageViewAnimated.m b/Libraries/Image/RCTUIImageViewAnimated.m index b47db503d735f6..a8f01c5bfdde41 100644 --- a/Libraries/Image/RCTUIImageViewAnimated.m +++ b/Libraries/Image/RCTUIImageViewAnimated.m @@ -173,7 +173,12 @@ - (BOOL)paused - (void)displayDidRefresh:(CADisplayLink *)displayLink { +#if TARGET_OS_UIKITFORMAC + // TODO: `displayLink.frameInterval` is not available on UIKitForMac + NSTimeInterval duration = displayLink.duration; +#else NSTimeInterval duration = displayLink.duration * displayLink.frameInterval; +#endif NSUInteger totalFrameCount = self.totalFrameCount; NSUInteger currentFrameIndex = self.currentFrameIndex; NSUInteger nextFrameIndex = (currentFrameIndex + 1) % totalFrameCount; diff --git a/Libraries/LinkingIOS/RCTLinkingManager.m b/Libraries/LinkingIOS/RCTLinkingManager.m index 0b9f6dd1ef8411..3255f5cab5491f 100644 --- a/Libraries/LinkingIOS/RCTLinkingManager.m +++ b/Libraries/LinkingIOS/RCTLinkingManager.m @@ -101,12 +101,15 @@ - (void)handleOpenURLNotification:(NSNotification *)notification } }]; } else { +#if !TARGET_OS_UIKITFORMAC + // Note: this branch will never be taken on UIKitForMac BOOL opened = [RCTSharedApplication() openURL:URL]; if (opened) { resolve(@YES); } else { reject(RCTErrorUnspecified, [NSString stringWithFormat:@"Unable to open URL: %@", URL], nil); } +#endif } } @@ -170,12 +173,15 @@ - (void)handleOpenURLNotification:(NSNotification *)notification } }]; } else { +#if !TARGET_OS_UIKITFORMAC + // Note: This branch will never be taken on UIKitForMac BOOL opened = [RCTSharedApplication() openURL:url]; if (opened) { resolve(nil); } else { reject(RCTErrorUnspecified, @"Unable to open app settings", nil); } +#endif } } diff --git a/Libraries/Network/RCTNetInfo.m b/Libraries/Network/RCTNetInfo.m index f9441f16b7af65..ab310ba1302430 100644 --- a/Libraries/Network/RCTNetInfo.m +++ b/Libraries/Network/RCTNetInfo.m @@ -7,7 +7,7 @@ #import "RCTNetInfo.h" -#if !TARGET_OS_TV +#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC #import #endif #import @@ -148,7 +148,7 @@ - (BOOL)setReachabilityStatus:(SCNetworkReachabilityFlags)flags status = RCTReachabilityStateNone; } -#if !TARGET_OS_TV +#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC else if ((flags & kSCNetworkReachabilityFlagsIsWWAN) != 0) { connectionType = RCTConnectionTypeCellular; diff --git a/Libraries/PushNotificationIOS/RCTPushNotificationManager.h b/Libraries/PushNotificationIOS/RCTPushNotificationManager.h index dc16ab488405e0..a2af5923a152d2 100644 --- a/Libraries/PushNotificationIOS/RCTPushNotificationManager.h +++ b/Libraries/PushNotificationIOS/RCTPushNotificationManager.h @@ -13,7 +13,7 @@ extern NSString *const RCTRemoteNotificationReceived; typedef void (^RCTRemoteNotificationCallback)(UIBackgroundFetchResult result); -#if !TARGET_OS_TV +#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC + (void)didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings; + (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken; + (void)didReceiveRemoteNotification:(NSDictionary *)notification; diff --git a/Libraries/PushNotificationIOS/RCTPushNotificationManager.m b/Libraries/PushNotificationIOS/RCTPushNotificationManager.m index b0280744ed4105..2095efa793bd0b 100644 --- a/Libraries/PushNotificationIOS/RCTPushNotificationManager.m +++ b/Libraries/PushNotificationIOS/RCTPushNotificationManager.m @@ -23,7 +23,7 @@ static NSString *const kErrorUnableToRequestPermissions = @"E_UNABLE_TO_REQUEST_PERMISSIONS"; -#if !TARGET_OS_TV +#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC @implementation RCTConvert (NSCalendarUnit) RCT_ENUM_CONVERTER(NSCalendarUnit, @@ -74,14 +74,14 @@ + (UILocalNotification *)UILocalNotification:(id)json }), UIBackgroundFetchResultNoData, integerValue) @end -#endif //TARGET_OS_TV +#endif //TARGET_OS_TV / TARGET_OS_UIKITFORMAC @implementation RCTPushNotificationManager { RCTPromiseResolveBlock _requestPermissionsResolveBlock; } -#if !TARGET_OS_TV +#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC static NSDictionary *RCTFormatLocalNotification(UILocalNotification *notification) { @@ -125,7 +125,7 @@ @implementation RCTPushNotificationManager return formattedNotification; } -#endif //TARGET_OS_TV +#endif //TARGET_OS_TV / TARGET_OS_UIKITFORMAC RCT_EXPORT_MODULE() @@ -134,7 +134,7 @@ - (dispatch_queue_t)methodQueue return dispatch_get_main_queue(); } -#if !TARGET_OS_TV +#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC - (void)startObserving { [[NSNotificationCenter defaultCenter] addObserver:self @@ -464,13 +464,13 @@ - (void)handleRegisterUserNotificationSettings:(NSNotification *)notification } } -#else //TARGET_OS_TV +#else //TARGET_OS_TV / TARGET_OS_UIKITFORMAC - (NSArray *)supportedEvents { return @[]; } -#endif //TARGET_OS_TV +#endif //TARGET_OS_TV / TARGET_OS_UIKITFORMAC @end diff --git a/Libraries/Text/Text/RCTTextView.m b/Libraries/Text/Text/RCTTextView.m index 4bfed21a9b6b0d..0f8f8d01058083 100644 --- a/Libraries/Text/Text/RCTTextView.m +++ b/Libraries/Text/Text/RCTTextView.m @@ -294,7 +294,8 @@ - (void)disableContextMenu - (void)handleLongPress:(UILongPressGestureRecognizer *)gesture { -#if !TARGET_OS_TV + // TODO: Adopt showMenuFromRect (necessary for UIKitForMac) +#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC UIMenuController *menuController = [UIMenuController sharedMenuController]; if (menuController.isMenuVisible) { diff --git a/Libraries/WebSocket/RCTSRWebSocket.m b/Libraries/WebSocket/RCTSRWebSocket.m index 6f1e5e8025164f..0adf808f382f7b 100644 --- a/Libraries/WebSocket/RCTSRWebSocket.m +++ b/Libraries/WebSocket/RCTSRWebSocket.m @@ -14,6 +14,8 @@ // limitations under the License. // +#if !TARGET_OS_UIKITFORMAC + #import "RCTSRWebSocket.h" #import @@ -1635,3 +1637,5 @@ - (NSRunLoop *)runLoop; } @end + +#endif diff --git a/Libraries/WebSocket/RCTWebSocket.xcodeproj/project.pbxproj b/Libraries/WebSocket/RCTWebSocket.xcodeproj/project.pbxproj index f44d7c867d3542..18da8e1484d9f7 100644 --- a/Libraries/WebSocket/RCTWebSocket.xcodeproj/project.pbxproj +++ b/Libraries/WebSocket/RCTWebSocket.xcodeproj/project.pbxproj @@ -43,7 +43,6 @@ 3C86DF7A1ADF695F0047B81A /* RCTWebSocketModule.h */, 3C86DF7B1ADF695F0047B81A /* RCTWebSocketModule.m */, 3C86DF471ADF2C930047B81A /* Products */, - 13526A501F362F7F0008EF00 /* Frameworks */, ); indentWidth = 2; sourceTree = ""; @@ -67,12 +66,10 @@ buildConfigurationList = 2D2A28901D9B049200D4039D /* Build configuration list for PBXNativeTarget "RCTWebSocket-tvOS" */; buildPhases = ( 2D2A28841D9B049200D4039D /* Sources */, - 2DC5E5151F3A6C39000EE84B /* Frameworks */, ); buildRules = ( ); dependencies = ( - 3DBE0D111F3B184D0099AA32 /* PBXTargetDependency */, ); name = "RCTWebSocket-tvOS"; productName = "RCTWebSocket-tvOS"; @@ -84,12 +81,10 @@ buildConfigurationList = 3C86DF5A1ADF2C930047B81A /* Build configuration list for PBXNativeTarget "RCTWebSocket" */; buildPhases = ( 3C86DF421ADF2C930047B81A /* Sources */, - 13526A4F1F362F770008EF00 /* Frameworks */, ); buildRules = ( ); dependencies = ( - 3DBE0D0F1F3B18490099AA32 /* PBXTargetDependency */, ); name = RCTWebSocket; productName = WebSocket; @@ -119,6 +114,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, ); mainGroup = 3C86DF3D1ADF2C930047B81A; @@ -313,6 +309,7 @@ GCC_TREAT_WARNINGS_AS_ERRORS = NO; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; + SUPPORTS_UIKITFORMAC = NO; }; name = Debug; }; @@ -324,56 +321,7 @@ GCC_TREAT_WARNINGS_AS_ERRORS = NO; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; - 3DBE0CFE1F3B181A0099AA32 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - EXECUTABLE_PREFIX = lib; - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 3DBE0CFF1F3B181A0099AA32 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - EXECUTABLE_PREFIX = lib; - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; - 3DBE0D0B1F3B181C0099AA32 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_TESTABILITY = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; - }; - name = Debug; - }; - 3DBE0D0C1F3B181C0099AA32 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_SUSPICIOUS_MOVES = YES; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos; - TVOS_DEPLOYMENT_TARGET = 9.2; + SUPPORTS_UIKITFORMAC = NO; }; name = Release; }; diff --git a/RNTester/RNTester.xcodeproj/project.pbxproj b/RNTester/RNTester.xcodeproj/project.pbxproj index 5d4dadfe341a02..e70a25f9671894 100644 --- a/RNTester/RNTester.xcodeproj/project.pbxproj +++ b/RNTester/RNTester.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 52; objects = { /* Begin PBXBuildFile section */ @@ -17,7 +17,7 @@ 134CB92A1C85A38800265FA6 /* RCTModuleInitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 134CB9291C85A38800265FA6 /* RCTModuleInitTests.m */; }; 138D6A181B53CD440074A87E /* RCTShadowViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 138D6A161B53CD440074A87E /* RCTShadowViewTests.m */; }; 1393D0381B68CD1300E1B601 /* RCTModuleMethodTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1393D0371B68CD1300E1B601 /* RCTModuleMethodTests.mm */; }; - 139FDEDB1B0651FB00C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDED91B0651EA00C62182 /* libRCTWebSocket.a */; }; + 139FDEDB1B0651FB00C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDED91B0651EA00C62182 /* libRCTWebSocket.a */; platformFilter = ios; }; 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; }; 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 13B6C1A31C34225900D3FAF5 /* RCTURLUtilsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B6C1A21C34225900D3FAF5 /* RCTURLUtilsTests.m */; }; @@ -537,6 +537,7 @@ 6862DFCD2229DFCB00684E03 /* Screenshot.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Screenshot.h; sourceTree = ""; }; 6862DFCE2229DFCC00684E03 /* Screenshot.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Screenshot.m; sourceTree = ""; }; 68FF44371CF6111500720EFD /* RCTBundleURLProviderTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBundleURLProviderTests.m; sourceTree = ""; }; + 6E00598822C62D9E0037EC55 /* RNTester.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = RNTester.entitlements; path = RNTester/RNTester.entitlements; sourceTree = ""; }; 83636F8E1B53F22C009F943E /* RCTUIManagerScenarioTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUIManagerScenarioTests.m; sourceTree = ""; }; 8385CEF41B873B5C00C6273E /* RCTImageLoaderTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageLoaderTests.m; sourceTree = ""; }; 8385CF031B87479200C6273E /* RCTImageLoaderHelpers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageLoaderHelpers.m; sourceTree = ""; }; @@ -727,6 +728,7 @@ 13B07FAE1A68108700A75B9A /* RNTester */ = { isa = PBXGroup; children = ( + 6E00598822C62D9E0037EC55 /* RNTester.entitlements */, 2DDEF00F1F84BF7B00DBDF73 /* Images.xcassets */, 272E6B3A1BEA846C001FCF37 /* NativeExampleViews */, 13B07FAF1A68108700A75B9A /* AppDelegate.h */, @@ -1186,7 +1188,7 @@ CreatedOnToolsVersion = 6.1.1; }; 13B07F861A680F5B00A75B9A = { - DevelopmentTeam = VYK7DLU38Z; + DevelopmentTeam = 3BNF2P698M; }; 143BC5941B21E3E100462512 = { CreatedOnToolsVersion = 6.3.2; @@ -1203,6 +1205,7 @@ }; 3D13F83D1D6F6AE000E69E0E = { CreatedOnToolsVersion = 7.3.1; + DevelopmentTeam = 3BNF2P698M; }; }; }; @@ -1659,7 +1662,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "export NODE_BINARY=node\nPROJECT_ROOT=$SRCROOT/.. $SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js\n"; + shellScript = "export NODE_BINARY=node\n#PROJECT_ROOT=$SRCROOT/.. $SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js\n"; }; /* End PBXShellScriptBuildPhase section */ @@ -1822,7 +1825,11 @@ ); INFOPLIST_FILE = RNTesterUnitTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/RNTesterUnitTests", @@ -1841,7 +1848,11 @@ ); INFOPLIST_FILE = RNTesterUnitTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/RNTesterUnitTests", @@ -1856,7 +1867,10 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; BUNDLE_CONFIG = "$(SRCROOT)/../metro.config.js"; - DEVELOPMENT_TEAM = VYK7DLU38Z; + CODE_SIGN_ENTITLEMENTS = RNTester/RNTester.entitlements; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; + DERIVE_UIKITFORMAC_PRODUCT_BUNDLE_IDENTIFIER = YES; + DEVELOPMENT_TEAM = 3BNF2P698M; GCC_PREPROCESSOR_DEFINITIONS = ( "RN_BUNDLE_PREFIX=$(RN_BUNDLE_PREFIX)", "DEBUG=1", @@ -1869,11 +1883,15 @@ ); INFOPLIST_FILE = "$(SRCROOT)/RNTester/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); LIBRARY_SEARCH_PATHS = "$(inherited)"; PRODUCT_BUNDLE_IDENTIFIER = com.facebook.react.uiapp; PRODUCT_NAME = RNTester; RN_BUNDLE_PREFIX = ""; + SUPPORTS_UIKITFORMAC = YES; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -1883,7 +1901,10 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; BUNDLE_CONFIG = "$(SRCROOT)/../metro.config.js"; - DEVELOPMENT_TEAM = VYK7DLU38Z; + CODE_SIGN_ENTITLEMENTS = RNTester/RNTester.entitlements; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; + DERIVE_UIKITFORMAC_PRODUCT_BUNDLE_IDENTIFIER = YES; + DEVELOPMENT_TEAM = 3BNF2P698M; GCC_PREPROCESSOR_DEFINITIONS = "RN_BUNDLE_PREFIX=$(RN_BUNDLE_PREFIX)"; HEADER_SEARCH_PATHS = ( "$(SRCROOT)/../third-party/boost_1_63_0", @@ -1892,10 +1913,14 @@ ); INFOPLIST_FILE = "$(SRCROOT)/RNTester/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); LIBRARY_SEARCH_PATHS = "$(inherited)"; PRODUCT_BUNDLE_IDENTIFIER = com.facebook.react.uiapp; PRODUCT_NAME = RNTester; + SUPPORTS_UIKITFORMAC = YES; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; @@ -1912,7 +1937,11 @@ ); INFOPLIST_FILE = RNTesterIntegrationTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.React.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RNTester.app/RNTester"; @@ -1928,7 +1957,11 @@ GCC_NO_COMMON_BLOCKS = YES; INFOPLIST_FILE = RNTesterIntegrationTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.React.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RNTester.app/RNTester"; @@ -1949,7 +1982,11 @@ "FB_REFERENCE_IMAGE_DIR=\"\\\"$(SOURCE_ROOT)/$(PROJECT_NAME)IntegrationTests/ReferenceImages\\\"\"", ); INFOPLIST_FILE = RNTesterIntegrationTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/RNTesterUnitTests", @@ -1973,7 +2010,11 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_NO_COMMON_BLOCKS = YES; INFOPLIST_FILE = RNTesterIntegrationTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/RNTesterUnitTests", @@ -1996,7 +2037,10 @@ DEBUG_INFORMATION_FORMAT = dwarf; GCC_NO_COMMON_BLOCKS = YES; INFOPLIST_FILE = "RNTester-tvOS/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.RNTester-tvOS"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; @@ -2016,7 +2060,10 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_NO_COMMON_BLOCKS = YES; INFOPLIST_FILE = "RNTester-tvOS/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.RNTester-tvOS"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; @@ -2039,7 +2086,11 @@ "$(SRCROOT)/RNTesterUnitTests/**", ); INFOPLIST_FILE = RNTesterUnitTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/RNTesterUnitTests", @@ -2067,7 +2118,11 @@ "$(SRCROOT)/RNTesterUnitTests/**", ); INFOPLIST_FILE = RNTesterUnitTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/RNTesterUnitTests", @@ -2084,12 +2139,15 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ANALYZER_NONNULL = YES; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = 3BNF2P698M; GCC_NO_COMMON_BLOCKS = YES; INFOPLIST_FILE = RNTester/RNTesterBundle/Info.plist; PRODUCT_BUNDLE_IDENTIFIER = com.facebook.RNTesterBundle; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = 1; WRAPPER_EXTENSION = bundle; }; name = Debug; @@ -2098,12 +2156,15 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_ANALYZER_NONNULL = YES; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = 3BNF2P698M; GCC_NO_COMMON_BLOCKS = YES; INFOPLIST_FILE = RNTester/RNTesterBundle/Info.plist; PRODUCT_BUNDLE_IDENTIFIER = com.facebook.RNTesterBundle; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = 1; WRAPPER_EXTENSION = bundle; }; name = Release; diff --git a/RNTester/RNTester.xcodeproj/xcshareddata/xcschemes/RNTester.xcscheme b/RNTester/RNTester.xcodeproj/xcshareddata/xcschemes/RNTester.xcscheme index ff2e9c27c1caa4..05ed10fb3eb889 100644 --- a/RNTester/RNTester.xcodeproj/xcshareddata/xcschemes/RNTester.xcscheme +++ b/RNTester/RNTester.xcodeproj/xcshareddata/xcschemes/RNTester.xcscheme @@ -83,6 +83,15 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> + + + + @@ -105,20 +114,9 @@ - - - - - - - - -#if !TARGET_OS_TV +#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC #import #endif @@ -155,7 +155,7 @@ - (void)loadSourceForBridge:(RCTBridge *)bridge # pragma mark - Push Notifications -#if !TARGET_OS_TV +#if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC // Required to register for notifications - (void)application:(__unused UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings diff --git a/RNTester/RNTester/RNTester.entitlements b/RNTester/RNTester/RNTester.entitlements new file mode 100644 index 00000000000000..8f330422e9db9f --- /dev/null +++ b/RNTester/RNTester/RNTester.entitlements @@ -0,0 +1,12 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.network.client + + com.apple.security.personal-information.photos-library + + + diff --git a/React/Base/RCTBridge.m b/React/Base/RCTBridge.m index ddfd0e5a400e93..0d51ae510bcdbf 100644 --- a/React/Base/RCTBridge.m +++ b/React/Base/RCTBridge.m @@ -286,7 +286,7 @@ - (BOOL)moduleIsInitialized:(Class)moduleClass - (void)reload { - #if RCT_ENABLE_INSPECTOR + #if RCT_ENABLE_INSPECTOR && !TARGET_OS_UIKITFORMAC // Disable debugger to resume the JsVM & avoid thread locks while reloading [RCTInspectorDevServerHelper disableDebugger]; #endif diff --git a/React/Base/RCTDefines.h b/React/Base/RCTDefines.h index 9a860ed78239a9..cdfa6279867c4e 100644 --- a/React/Base/RCTDefines.h +++ b/React/Base/RCTDefines.h @@ -55,7 +55,7 @@ #endif #ifndef ENABLE_PACKAGER_CONNECTION -#if RCT_DEV && __has_include() +#if RCT_DEV && __has_include() && !TARGET_OS_UIKITFORMAC #define ENABLE_PACKAGER_CONNECTION 1 #else #define ENABLE_PACKAGER_CONNECTION 0 diff --git a/React/DevSupport/RCTDevMenu.m b/React/DevSupport/RCTDevMenu.m index ee37aed75591ba..6a653b8a552822 100644 --- a/React/DevSupport/RCTDevMenu.m +++ b/React/DevSupport/RCTDevMenu.m @@ -241,7 +241,7 @@ - (void)setDefaultJSBundle { if (devSettings.isNuclideDebuggingAvailable && !devSettings.isDebuggingRemotely) { [items addObject:[RCTDevMenuItem buttonItemWithTitle:@"Debug with Nuclide" handler:^{ - #if RCT_ENABLE_INSPECTOR + #if RCT_ENABLE_INSPECTOR && !TARGET_OS_UIKITFORMAC [RCTInspectorDevServerHelper attachDebugger:@"ReactNative" withBundleURL:bridge.bundleURL withView: RCTPresentedViewController()]; #endif }]]; diff --git a/React/DevSupport/RCTInspectorDevServerHelper.h b/React/DevSupport/RCTInspectorDevServerHelper.h index c718dfd3b55e77..c17f0e32cf6281 100644 --- a/React/DevSupport/RCTInspectorDevServerHelper.h +++ b/React/DevSupport/RCTInspectorDevServerHelper.h @@ -9,7 +9,7 @@ #import #import -#if RCT_DEV +#if RCT_DEV && !TARGET_OS_UIKITFORMAC @interface RCTInspectorDevServerHelper : NSObject diff --git a/React/DevSupport/RCTInspectorDevServerHelper.mm b/React/DevSupport/RCTInspectorDevServerHelper.mm index f813fe11bba7f0..c29b3476e9aef8 100644 --- a/React/DevSupport/RCTInspectorDevServerHelper.mm +++ b/React/DevSupport/RCTInspectorDevServerHelper.mm @@ -5,7 +5,7 @@ #import "RCTInspectorDevServerHelper.h" -#if RCT_DEV +#if RCT_DEV && !TARGET_OS_UIKITFORMAC #import #import diff --git a/React/DevSupport/RCTPackagerConnection.h b/React/DevSupport/RCTPackagerConnection.h index 67832ca91808f1..5783a5e8a22b08 100644 --- a/React/DevSupport/RCTPackagerConnection.h +++ b/React/DevSupport/RCTPackagerConnection.h @@ -9,7 +9,7 @@ #import -#if RCT_DEV +#if RCT_DEV && !TARGET_OS_UIKITFORMAC NS_ASSUME_NONNULL_BEGIN diff --git a/React/DevSupport/RCTPackagerConnection.mm b/React/DevSupport/RCTPackagerConnection.mm index 6df2ad31f27bca..dbc9c68793b13a 100644 --- a/React/DevSupport/RCTPackagerConnection.mm +++ b/React/DevSupport/RCTPackagerConnection.mm @@ -19,10 +19,12 @@ #import #import #import -#import #import -#if RCT_DEV +#if RCT_DEV && !TARGET_OS_UIKITFORMAC + +#import + @interface RCTPackagerConnection () @end diff --git a/React/Inspector/RCTInspector.mm b/React/Inspector/RCTInspector.mm index a87a6427eb5b85..30d0933bb8a819 100644 --- a/React/Inspector/RCTInspector.mm +++ b/React/Inspector/RCTInspector.mm @@ -5,7 +5,7 @@ #import "RCTInspector.h" -#if RCT_DEV +#if RCT_DEV && !TARGET_OS_UIKITFORMAC #include diff --git a/React/Inspector/RCTInspectorPackagerConnection.h b/React/Inspector/RCTInspectorPackagerConnection.h index 2259293635db90..d791e97583970c 100644 --- a/React/Inspector/RCTInspectorPackagerConnection.h +++ b/React/Inspector/RCTInspectorPackagerConnection.h @@ -6,7 +6,7 @@ #import #import -#if RCT_DEV +#if RCT_DEV && !TARGET_OS_UIKITFORMAC @interface RCTBundleStatus : NSObject @property (atomic, assign) BOOL isLastBundleDownloadSuccess; diff --git a/React/Inspector/RCTInspectorPackagerConnection.m b/React/Inspector/RCTInspectorPackagerConnection.m index baab0fad86fb60..0fec4ed041e4c3 100644 --- a/React/Inspector/RCTInspectorPackagerConnection.m +++ b/React/Inspector/RCTInspectorPackagerConnection.m @@ -5,12 +5,14 @@ #import "RCTInspectorPackagerConnection.h" -#if RCT_DEV +#if RCT_DEV && !TARGET_OS_UIKITFORMAC #import "RCTDefines.h" #import "RCTInspector.h" #import "RCTLog.h" + #import "RCTSRWebSocket.h" + #import "RCTUtils.h" // This is a port of the Android impl, at diff --git a/React/Modules/RCTDevSettings.mm b/React/Modules/RCTDevSettings.mm index c4f5870834b706..2498053b0f39a9 100644 --- a/React/Modules/RCTDevSettings.mm +++ b/React/Modules/RCTDevSettings.mm @@ -173,7 +173,7 @@ - (void)setBridge:(RCTBridge *)bridge forMethod:@"reload"]; #endif -#if RCT_ENABLE_INSPECTOR +#if RCT_ENABLE_INSPECTOR && !TARGET_OS_UIKITFORMAC // we need this dispatch back to the main thread because even though this // is executed on the main thread, at this point the bridge is not yet // finished with its initialisation. But it does finish by the time it From dde0e7694c78b860febcc5650045badda7b9a50b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Pietruszewski?= Date: Fri, 28 Jun 2019 14:44:03 +0200 Subject: [PATCH 2/4] UIKitForMac -- clean up --- RNTester/RNTester.xcodeproj/project.pbxproj | 2 +- .../xcshareddata/xcschemes/RNTester.xcscheme | 24 +++++++++++-------- .../RCTInspectorPackagerConnection.m | 2 -- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/RNTester/RNTester.xcodeproj/project.pbxproj b/RNTester/RNTester.xcodeproj/project.pbxproj index e70a25f9671894..f08af83a2dcffe 100644 --- a/RNTester/RNTester.xcodeproj/project.pbxproj +++ b/RNTester/RNTester.xcodeproj/project.pbxproj @@ -1662,7 +1662,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "export NODE_BINARY=node\n#PROJECT_ROOT=$SRCROOT/.. $SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js\n"; + shellScript = "export NODE_BINARY=node\nPROJECT_ROOT=$SRCROOT/.. $SRCROOT/../scripts/react-native-xcode.sh RNTester/js/RNTesterApp.ios.js\n"; }; /* End PBXShellScriptBuildPhase section */ diff --git a/RNTester/RNTester.xcodeproj/xcshareddata/xcschemes/RNTester.xcscheme b/RNTester/RNTester.xcodeproj/xcshareddata/xcschemes/RNTester.xcscheme index 05ed10fb3eb889..ff2e9c27c1caa4 100644 --- a/RNTester/RNTester.xcodeproj/xcshareddata/xcschemes/RNTester.xcscheme +++ b/RNTester/RNTester.xcodeproj/xcshareddata/xcschemes/RNTester.xcscheme @@ -83,15 +83,6 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> - - - - @@ -114,9 +105,20 @@ + + + + + + + + Date: Fri, 28 Jun 2019 14:49:16 +0200 Subject: [PATCH 3/4] RNTester - fix development team --- RNTester/RNTester.xcodeproj/project.pbxproj | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/RNTester/RNTester.xcodeproj/project.pbxproj b/RNTester/RNTester.xcodeproj/project.pbxproj index f08af83a2dcffe..c09b679ca25051 100644 --- a/RNTester/RNTester.xcodeproj/project.pbxproj +++ b/RNTester/RNTester.xcodeproj/project.pbxproj @@ -1188,7 +1188,7 @@ CreatedOnToolsVersion = 6.1.1; }; 13B07F861A680F5B00A75B9A = { - DevelopmentTeam = 3BNF2P698M; + DevelopmentTeam = VYK7DLU38Z; }; 143BC5941B21E3E100462512 = { CreatedOnToolsVersion = 6.3.2; @@ -1205,7 +1205,7 @@ }; 3D13F83D1D6F6AE000E69E0E = { CreatedOnToolsVersion = 7.3.1; - DevelopmentTeam = 3BNF2P698M; + DevelopmentTeam = VYK7DLU38Z; }; }; }; @@ -1870,7 +1870,7 @@ CODE_SIGN_ENTITLEMENTS = RNTester/RNTester.entitlements; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; DERIVE_UIKITFORMAC_PRODUCT_BUNDLE_IDENTIFIER = YES; - DEVELOPMENT_TEAM = 3BNF2P698M; + DEVELOPMENT_TEAM = VYK7DLU38Z; GCC_PREPROCESSOR_DEFINITIONS = ( "RN_BUNDLE_PREFIX=$(RN_BUNDLE_PREFIX)", "DEBUG=1", @@ -1904,7 +1904,7 @@ CODE_SIGN_ENTITLEMENTS = RNTester/RNTester.entitlements; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; DERIVE_UIKITFORMAC_PRODUCT_BUNDLE_IDENTIFIER = YES; - DEVELOPMENT_TEAM = 3BNF2P698M; + DEVELOPMENT_TEAM = VYK7DLU38Z; GCC_PREPROCESSOR_DEFINITIONS = "RN_BUNDLE_PREFIX=$(RN_BUNDLE_PREFIX)"; HEADER_SEARCH_PATHS = ( "$(SRCROOT)/../third-party/boost_1_63_0", @@ -2141,7 +2141,7 @@ CLANG_ANALYZER_NONNULL = YES; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = 3BNF2P698M; + DEVELOPMENT_TEAM = VYK7DLU38Z; GCC_NO_COMMON_BLOCKS = YES; INFOPLIST_FILE = RNTester/RNTesterBundle/Info.plist; PRODUCT_BUNDLE_IDENTIFIER = com.facebook.RNTesterBundle; @@ -2158,7 +2158,7 @@ CLANG_ANALYZER_NONNULL = YES; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = 3BNF2P698M; + DEVELOPMENT_TEAM = VYK7DLU38Z; GCC_NO_COMMON_BLOCKS = YES; INFOPLIST_FILE = RNTester/RNTesterBundle/Info.plist; PRODUCT_BUNDLE_IDENTIFIER = com.facebook.RNTesterBundle; From fbedd9560ae2eae42e907f1442da1b3b037b8a9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Pietruszewski?= Date: Fri, 28 Jun 2019 14:57:08 +0200 Subject: [PATCH 4/4] [RNTester] Fix Xcode 10.2 compatibility --- RNTester/RNTester.xcodeproj/project.pbxproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RNTester/RNTester.xcodeproj/project.pbxproj b/RNTester/RNTester.xcodeproj/project.pbxproj index c09b679ca25051..27dc36afa119d0 100644 --- a/RNTester/RNTester.xcodeproj/project.pbxproj +++ b/RNTester/RNTester.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 52; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ @@ -17,7 +17,7 @@ 134CB92A1C85A38800265FA6 /* RCTModuleInitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 134CB9291C85A38800265FA6 /* RCTModuleInitTests.m */; }; 138D6A181B53CD440074A87E /* RCTShadowViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 138D6A161B53CD440074A87E /* RCTShadowViewTests.m */; }; 1393D0381B68CD1300E1B601 /* RCTModuleMethodTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1393D0371B68CD1300E1B601 /* RCTModuleMethodTests.mm */; }; - 139FDEDB1B0651FB00C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDED91B0651EA00C62182 /* libRCTWebSocket.a */; platformFilter = ios; }; + 139FDEDB1B0651FB00C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDED91B0651EA00C62182 /* libRCTWebSocket.a */; }; 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; }; 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 13B6C1A31C34225900D3FAF5 /* RCTURLUtilsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B6C1A21C34225900D3FAF5 /* RCTURLUtilsTests.m */; }; @@ -1210,7 +1210,7 @@ }; }; buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "RNTester" */; - compatibilityVersion = "Xcode 3.2"; + compatibilityVersion = "Xcode 9.3"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = (