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
64 lines
1.5 KiB
Plaintext
64 lines
1.5 KiB
Plaintext
/*
|
|
* 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 "FlipperKitUIDebuggerPlugin.h"
|
|
#import <UIKit/UIKit.h>
|
|
|
|
#import <FlipperKit/FlipperClient.h>
|
|
#import <FlipperKit/FlipperConnection.h>
|
|
#import <FlipperKit/FlipperResponder.h>
|
|
|
|
#import "Core/UIDContext.h"
|
|
|
|
#import "Descriptors/UIDDescriptorRegister.h"
|
|
#import "Observer/UIDTreeObserverFactory.h"
|
|
#import "Observer/UIDTreeObserverManager.h"
|
|
|
|
@implementation FlipperKitUIDebuggerPlugin {
|
|
UIDContext* _context;
|
|
}
|
|
|
|
- (instancetype)initWithContext:(UIDContext*)context {
|
|
if (self = [super init]) {
|
|
self->_context = context;
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (instancetype)init {
|
|
UIDContext* context = [[UIDContext alloc]
|
|
initWithApplication:[UIApplication sharedApplication]
|
|
descriptorRegister:[UIDDescriptorRegister defaultRegister]
|
|
observerFactory:[UIDTreeObserverFactory shared]];
|
|
return [self initWithContext:context];
|
|
}
|
|
|
|
- (NSString*)identifier {
|
|
return @"ui-debugger";
|
|
}
|
|
|
|
- (void)didConnect:(id<FlipperConnection>)connection {
|
|
if (!_context.application) {
|
|
_context.application = [UIApplication sharedApplication];
|
|
}
|
|
|
|
_context.connection = connection;
|
|
|
|
[[UIDTreeObserverManager shared] startWithContext:_context];
|
|
}
|
|
|
|
- (void)didDisconnect {
|
|
_context.connection = nil;
|
|
[[UIDTreeObserverManager shared] stop];
|
|
}
|
|
|
|
@end
|
|
|
|
#endif
|