Files
flipper/iOS/Plugins/FlipperKitUIDebuggerPlugin/FlipperKitUIDebuggerPlugin/Observer/UIDUIViewBasicObserver.m
Lorenzo Blasa db7aa9eeaf OSS
Summary: Move UIDebugger plugin to OSS space.

Reviewed By: passy

Differential Revision: D47634848

fbshipit-source-id: 90e8c0181a2434d0e5d76bdb99b902051e6d702e
2023-07-21 04:47:13 -07:00

64 lines
1.4 KiB
Objective-C

/*
* 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 "UIDUIViewBasicObserver.h"
#import "UIDContext.h"
#import "UIDUIKitObserver.h"
@interface UIDUIViewBasicObserver ()<UIDUIKitObserverDelegate> {
UIDContext* _context;
}
@property(nonatomic, weak) id<UIDUIViewObserverDelegate> delegate;
@end
@implementation UIDUIViewBasicObserver
- (instancetype)initWithContext:(UIDContext*)context
delegate:(id<UIDUIViewObserverDelegate>)delegate {
self = [super init];
if (self) {
_context = context;
_delegate = delegate;
[UIDUIKitObserver sharedInstance].delegate = self;
[UIDUIKitObserver enable];
}
return self;
}
- (void)dealloc {
[UIDUIKitObserver sharedInstance].delegate = nil;
}
- (void)onDisplayLayer:(nonnull UIView*)view {
[self.delegate viewUpdateWith:view];
}
- (void)onDrawLayer:(nonnull UIView*)view {
[self.delegate viewUpdateWith:view];
}
- (void)onNeedsDisplay:(nonnull UIView*)view {
[self.delegate viewUpdateWith:view];
}
- (void)onHidden:(nonnull UIView*)view {
[self.delegate viewUpdateWith:view];
}
- (void)onView:(UIView*)view didUpdateHierarchy:(UIDViewHierarchyUpdate)update {
[self.delegate viewUpdateWith:view];
}
@end
#endif