Skip to content

Commit

Permalink
Internal/External init
Browse files Browse the repository at this point in the history
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
  • Loading branch information
lblasa authored and facebook-github-bot committed Jul 26, 2023
1 parent 60016e6 commit b5d51a0
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@

@end

FB_EXTERN_C_BEGIN

#ifdef __cplusplus
extern "C" {
#endif
void FlipperKitUIDebuggerAddPlugin(FlipperClient*);

FB_EXTERN_C_END
#ifdef __cplusplus
}
#endif

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
#import <FlipperKit/FlipperResponder.h>

#import "Core/UIDContext.h"
#import "PluginSockets.h"
#import "Plugins.h"

#import "Descriptors/UIDDescriptorRegister.h"
#import "Observer/UIDTreeObserverFactory.h"
Expand Down Expand Up @@ -62,24 +60,4 @@ - (void)didDisconnect {

@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
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b5d51a0

Please sign in to comment.