Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion React/CoreModules/RCTLogBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#if RCT_DEV_MENU

- (void)setRCTLogBoxWindow:(RCTLogBoxWindow *)window; // TODO(macOS GH#774) Renamed from _view to _window
- (void)setRCTLogBoxView:(RCTLogBoxView *)view;

#endif

Expand Down
20 changes: 10 additions & 10 deletions React/CoreModules/RCTLogBox.mm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ @interface RCTLogBox () <NativeLogBoxSpec, RCTBridgeModule>
@end

@implementation RCTLogBox {
RCTLogBoxWindow *_window; // TODO(macOS GH#774) Renamed from _view to _window
RCTLogBoxView *_view;
}

@synthesize bridge = _bridge;
Expand All @@ -44,20 +44,20 @@ + (BOOL)requiresMainQueueSetup
return;
}

if (strongSelf->_window) { // TODO(macOS GH#774) Renamed from _view to _window
[strongSelf->_window show]; // TODO(macOS GH#774) Renamed from _view to _window
if (strongSelf->_view) {
[strongSelf->_view show];
return;
}

if (strongSelf->_bridge) {
if (strongSelf->_bridge.valid) {
#if !TARGET_OS_OSX // TODO(macOS GH#774)
strongSelf->_window = [[RCTLogBoxWindow alloc] initWithFrame:[UIScreen mainScreen].bounds // TODO(macOS GH#774) Renamed from _view to _window
strongSelf->_view = [[RCTLogBoxView alloc] initWithFrame:[UIScreen mainScreen].bounds
bridge:strongSelf->_bridge];
#else // [TODO(macOS GH#774)
strongSelf->_window = [[RCTLogBoxWindow alloc] initWithBridge:self->_bridge]; // TODO(macOS GH#774) Renamed from _view to _window
strongSelf->_view = [[RCTLogBoxView alloc] initWithBridge:self->_bridge]; // TODO(macOS GH#774)
#endif // ]TODO(macOS GH#774)
[strongSelf->_window show]; // TODO(macOS GH#774) Renamed from _view to _window
[strongSelf->_view show];
}
} else {
NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:strongSelf, @"logbox", nil];
Expand All @@ -76,8 +76,8 @@ + (BOOL)requiresMainQueueSetup
if (!strongSelf) {
return;
}
[strongSelf->_window hide]; // TODO(macOS GH#774) setHidden: -> hide
strongSelf->_window = nil;
[strongSelf->_view setHidden:YES];
strongSelf->_view = nil;
});
}
}
Expand All @@ -88,9 +88,9 @@ + (BOOL)requiresMainQueueSetup
return std::make_shared<facebook::react::NativeLogBoxSpecJSI>(params);
}

- (void)setRCTLogBoxWindow:(RCTLogBoxWindow *)window // TODO(macOS GH#774) Renamed from _view to _window
- (void)setRCTLogBoxView:(RCTLogBoxView *)view
{
self->_window = window;
self->_view = view;
}

@end
Expand Down
8 changes: 3 additions & 5 deletions React/CoreModules/RCTLogBoxView.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,25 @@

#if !TARGET_OS_OSX // TODO(macOS GH#774)

@interface RCTLogBoxWindow : UIWindow // TODO(macOS GH#774) Renamed from _view to _window
@interface RCTLogBoxView : UIWindow

- (instancetype)initWithFrame:(CGRect)frame;

- (void)createRootViewController:(UIView *)view;

- (instancetype)initWithFrame:(CGRect)frame bridge:(RCTBridge *)bridge;

- (void)hide; // TODO(macOS GH#774)

- (void)show;

@end

#else // [TODO(macOS GH#774)

@interface RCTLogBoxWindow : NSWindow // TODO(macOS GH#774) Renamed from _view to _window
@interface RCTLogBoxView : NSWindow // TODO(macOS GH#774)

- (instancetype)initWithBridge:(RCTBridge *)bridge;

- (void)hide;
- (void)setHidden:(BOOL)hidden;

- (void)show;

Expand Down
21 changes: 9 additions & 12 deletions React/CoreModules/RCTLogBoxView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#if !TARGET_OS_OSX // TODO(macOS GH#774)

@implementation RCTLogBoxWindow { // TODO(macOS GH#774) Renamed from _view to _window
@implementation RCTLogBoxView {
RCTSurface *_surface;
}

Expand Down Expand Up @@ -59,11 +59,6 @@ - (void)dealloc
[RCTSharedApplication().delegate.window makeKeyWindow];
}

- (void)hide // [TODO(macOS GH#774)
{
[self setHidden:YES];
} // ]TODO(macOS GH#774)

- (void)show
{
[self becomeFirstResponder];
Expand All @@ -74,7 +69,7 @@ - (void)show

#else // [TODO(macOS GH#774)

@implementation RCTLogBoxWindow { // TODO(macOS GH#774) Renamed from _view to _window
@implementation RCTLogBoxView {
RCTSurface *_surface;
}

Expand All @@ -100,13 +95,15 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge
return self;
}

- (void)hide
- (void)setHidden:(BOOL)hidden // [TODO(macOS GH#774)
{
if (NSApp.modalWindow == self) {
[NSApp stopModal];
if (hidden) {
if (NSApp.modalWindow == self) {
[NSApp stopModal];
}
[self orderOut:nil];
}
[self orderOut:nil];
}
} // ]TODO(macOS GH#774)

- (void)show
{
Expand Down