Internal/External init

Summary:
UI Debugger initialisation is defined in two places. Internally, done inside:
    fb/FlipperKitUIDebuggerPluginInit.mm
OSS:
    FlipperKitUIDebuggerPluginInit.mm

Contents of `fb/` directory are not synced in OSS. OSS file is excluded internally as it doesn't use the XPlugins.

Reviewed By: aigoncharov

Differential Revision: D47759035

fbshipit-source-id: 3578be076525f05b530a0d129b5c37e48572d58e
This commit is contained in:
Lorenzo Blasa
2023-07-26 05:01:58 -07:00
committed by Facebook GitHub Bot
parent 60016e69f5
commit b5d51a047b
3 changed files with 39 additions and 26 deletions

View File

@@ -16,10 +16,12 @@
@end @end
FB_EXTERN_C_BEGIN #ifdef __cplusplus
extern "C" {
#endif
void FlipperKitUIDebuggerAddPlugin(FlipperClient*); void FlipperKitUIDebuggerAddPlugin(FlipperClient*);
#ifdef __cplusplus
FB_EXTERN_C_END }
#endif
#endif #endif

View File

@@ -15,8 +15,6 @@
#import <FlipperKit/FlipperResponder.h> #import <FlipperKit/FlipperResponder.h>
#import "Core/UIDContext.h" #import "Core/UIDContext.h"
#import "PluginSockets.h"
#import "Plugins.h"
#import "Descriptors/UIDDescriptorRegister.h" #import "Descriptors/UIDDescriptorRegister.h"
#import "Observer/UIDTreeObserverFactory.h" #import "Observer/UIDTreeObserverFactory.h"
@@ -62,24 +60,4 @@
@end @end
void FlipperKitUIDebuggerAddPlugin(FlipperClient* client) {
UIDContext* context = [[UIDContext alloc]
initWithApplication:[UIApplication sharedApplication]
descriptorRegister:[UIDDescriptorRegister defaultRegister]
observerFactory:[UIDTreeObserverFactory shared]];
FlipperKitUIDebuggerPlugin* plugin =
[[FlipperKitUIDebuggerPlugin alloc] initWithContext:context];
for (const auto& p : FlipperUIDebuggerDescriptorRegisterSocket_Plugins()) {
FlipperUIDebuggerDescriptorRegisterSocket_InvokeConfigure(p, context);
}
[client addPlugin:plugin];
}
void FlipperKitUIDebuggerPluginInit(FlipperClient* client) {
FlipperKitUIDebuggerAddPlugin(client);
}
#endif #endif

View File

@@ -0,0 +1,33 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#if FB_SONARKIT_ENABLED
#import <FlipperKit/FlipperClient.h>
#import "FlipperKitUIDebuggerPlugin.h"
#import "UIDContext.h"
#import "UIDDescriptorRegister.h"
#import "UIDTreeObserverFactory.h"
#ifdef __cplusplus
extern "C" {
#endif
void FlipperKitUIDebuggerAddPlugin(FlipperClient* client) {
UIDContext* context = [[UIDContext alloc]
initWithApplication:[UIApplication sharedApplication]
descriptorRegister:[UIDDescriptorRegister defaultRegister]
observerFactory:[UIDTreeObserverFactory shared]];
FlipperKitUIDebuggerPlugin* plugin =
[[FlipperKitUIDebuggerPlugin alloc] initWithContext:context];
[client addPlugin:plugin];
}
#ifdef __cplusplus
}
#endif
#endif