Fixes for Mac Catalyst

Summary: When building for Mac Catalyst, it mostly appears as if it's targeting iOS (`TARGET_OS_OSX` is `0`) and the behavior should be aligned with iOS Simulator builds.

Reviewed By: lblasa

Differential Revision: D34413681

fbshipit-source-id: 1e56bbb3f16f8cd78e77771ff641c5cfcbc49955
This commit is contained in:
Scott Kyle
2022-02-23 09:07:15 -08:00
committed by Facebook GitHub Bot
parent faddf82317
commit c15605afd3

View File

@@ -23,7 +23,7 @@
#if !TARGET_OS_OSX #if !TARGET_OS_OSX
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#if !TARGET_OS_SIMULATOR #if !TARGET_OS_SIMULATOR && !TARGET_OS_MACCATALYST
#import <FKPortForwarding/FKPortForwardingServer.h> #import <FKPortForwarding/FKPortForwardingServer.h>
#endif #endif
#endif #endif
@@ -35,7 +35,7 @@ using WrapperPlugin = facebook::flipper::FlipperCppWrapperPlugin;
folly::ScopedEventBaseThread sonarThread; folly::ScopedEventBaseThread sonarThread;
folly::ScopedEventBaseThread connectionThread; folly::ScopedEventBaseThread connectionThread;
id<FlipperKitCertificateProvider> _certProvider; id<FlipperKitCertificateProvider> _certProvider;
#if !TARGET_OS_OSX && !TARGET_OS_SIMULATOR #if !TARGET_OS_OSX && !TARGET_OS_SIMULATOR && !TARGET_OS_MACCATALYST
FKPortForwardingServer* _secureServer; FKPortForwardingServer* _secureServer;
FKPortForwardingServer* _insecureServer; FKPortForwardingServer* _insecureServer;
#endif #endif
@@ -74,7 +74,11 @@ using WrapperPlugin = facebook::flipper::FlipperCppWrapperPlugin;
NSString* deviceOS; NSString* deviceOS;
NSString* deviceName; NSString* deviceName;
#if !TARGET_OS_OSX #if !TARGET_OS_OSX
#if !TARGET_OS_MACCATALYST
deviceOS = @"iOS"; deviceOS = @"iOS";
#else
deviceOS = @"MacOS";
#endif
deviceName = [[UIDevice currentDevice] name]; deviceName = [[UIDevice currentDevice] name];
#if TARGET_OS_SIMULATOR #if TARGET_OS_SIMULATOR
deviceName = [NSString stringWithFormat:@"%@ %@", deviceName = [NSString stringWithFormat:@"%@ %@",
@@ -152,7 +156,7 @@ using WrapperPlugin = facebook::flipper::FlipperCppWrapperPlugin;
} }
- (void)start { - (void)start {
#if !TARGET_OS_OSX && !TARGET_OS_SIMULATOR #if !TARGET_OS_OSX && !TARGET_OS_SIMULATOR && !TARGET_OS_MACCATALYST
_secureServer = [FKPortForwardingServer new]; _secureServer = [FKPortForwardingServer new];
[_secureServer forwardConnectionsFromPort:9088]; [_secureServer forwardConnectionsFromPort:9088];
[_secureServer listenForMultiplexingChannelOnPort:9078]; [_secureServer listenForMultiplexingChannelOnPort:9078];
@@ -165,7 +169,7 @@ using WrapperPlugin = facebook::flipper::FlipperCppWrapperPlugin;
- (void)stop { - (void)stop {
_cppClient->stop(); _cppClient->stop();
#if !TARGET_OS_OSX && !TARGET_OS_SIMULATOR #if !TARGET_OS_OSX && !TARGET_OS_SIMULATOR && !TARGET_OS_MACCATALYST
[_secureServer close]; [_secureServer close];
_secureServer = nil; _secureServer = nil;
[_insecureServer close]; [_insecureServer close];