From 63f8c47cfa491646d86357384471d6bb3e89b69a Mon Sep 17 00:00:00 2001 From: Lorenzo Blasa Date: Tue, 20 Jun 2023 00:46:55 -0700 Subject: [PATCH] New 'isConnected' API Summary: Expose the newly created `isConnected` API to iOS FlipperClient API. Reviewed By: antonk52 Differential Revision: D46841190 fbshipit-source-id: c36eb08427d60c73fad8f92100df5d012149b4a8 --- iOS/FlipperKit/FlipperClient.h | 25 ++++++++++++++++--------- iOS/FlipperKit/FlipperClient.mm | 4 ++++ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/iOS/FlipperKit/FlipperClient.h b/iOS/FlipperKit/FlipperClient.h index a5d2f69cc..b08f1b6e0 100644 --- a/iOS/FlipperKit/FlipperClient.h +++ b/iOS/FlipperKit/FlipperClient.h @@ -13,7 +13,7 @@ #import "FlipperStateUpdateListener.h" /** -Represents a connection between the Sonar desktop och client side. Manages the +Represents a connection between the Flipper desktop client side. Manages the lifecycle of attached plugin instances. */ @interface FlipperClient : NSObject @@ -41,41 +41,48 @@ this client. - (NSObject*)pluginWithIdentifier:(NSString*)identifier; /** -Establish a connection to the Sonar desktop. +Establish a connection to the Flipper desktop. */ - (void)start; /** -Stop the connection to the Sonar desktop. +Stop the connection to the Flipper desktop. */ - (void)stop; /** -Get the log of state changes from the sonar client +Get the log of state changes from the Flipper client. */ - (NSString*)getState; /** - Get the current summarized state of the sonar client +Get the current summarized state of the Flipper client. */ - (NSArray*)getStateElements; /** -Subscribe a ViewController to state update change notifications + Return true if the app is connected to Flipper desktop. Otherwise, returns + false. + + */ +- (BOOL)isConnected; + +/** +Subscribe a ViewController to state update change notifications. */ - (void)subscribeForUpdates:(id)controller; /** -Sets the certificate provider responsible for obtaining certificates +Sets the certificate provider responsible for obtaining certificates. */ - (void)setCertificateProvider:(id)provider; /** - Get the certificate provider of Flipper Client + Get the certificate provider of Flipper Client. */ - (id)getCertificateProvider; -// initializers are disabled. You must use `+[FlipperClient sharedClient]` +// Initializers are disabled. You must use `+[FlipperClient sharedClient]` // instance. - (instancetype)init NS_UNAVAILABLE; + (instancetype)new NS_UNAVAILABLE; diff --git a/iOS/FlipperKit/FlipperClient.mm b/iOS/FlipperKit/FlipperClient.mm index 10e6ec70e..2c0c1e0ae 100644 --- a/iOS/FlipperKit/FlipperClient.mm +++ b/iOS/FlipperKit/FlipperClient.mm @@ -182,6 +182,10 @@ using WrapperPlugin = facebook::flipper::FlipperCppWrapperPlugin; #endif } +- (BOOL)isConnected { + return _cppClient->isConnected(); +} + - (NSString*)getState { return @(_cppClient->getState().c_str()); }