Skip to content

Commit 74736d6

Browse files
committed
Fix status bar not hiding
Closes #741
1 parent cfdc279 commit 74736d6

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

detox/ios/Detox/DetoxAppDelegateProxy.m

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@
1414

1515
#import <Detox/Detox-Swift.h>
1616

17+
@interface COSTouchVisualizerWindow () @end
18+
@interface DTXTouchVisualizerWindow : COSTouchVisualizerWindow @end
19+
@implementation DTXTouchVisualizerWindow
20+
21+
- (UIWindow *)overlayWindow
22+
{
23+
return self;
24+
}
25+
26+
@end
27+
1728
@class DetoxAppDelegateProxy;
1829

1930
static DetoxAppDelegateProxy* _currentAppDelegateProxy;
@@ -25,7 +36,7 @@
2536
static DetoxUserActivityDispatcher* _pendingLaunchUserActivityDispatcher;
2637
#endif
2738

28-
static COSTouchVisualizerWindow* _touchVisualizerWindow;
39+
static DTXTouchVisualizerWindow* _touchVisualizerWindow;
2940

3041
static NSURL* _launchUserNotificationDataURL()
3142
{
@@ -178,12 +189,15 @@ - (void)__dtx_canaryInTheCoalMine {}
178189
- (void)__dtx_applicationDidLaunchNotification:(NSNotification*)notification
179190
{
180191
dispatch_async(dispatch_get_main_queue(), ^{
181-
_touchVisualizerWindow = [[COSTouchVisualizerWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
192+
_touchVisualizerWindow = [[DTXTouchVisualizerWindow alloc] initWithFrame:CGRectZero];
182193
_touchVisualizerWindow.windowLevel = 100000000000;
183194
_touchVisualizerWindow.backgroundColor = [UIColor.greenColor colorWithAlphaComponent:0.0];
184195
_touchVisualizerWindow.hidden = NO;
185196
_touchVisualizerWindow.touchVisualizerWindowDelegate = self;
186197
_touchVisualizerWindow.userInteractionEnabled = NO;
198+
CGRect statusBarFrame = UIApplication.sharedApplication.statusBarFrame;
199+
CGRect screenBounds = UIScreen.mainScreen.bounds;
200+
_touchVisualizerWindow.frame = CGRectMake(0, statusBarFrame.size.height, screenBounds.size.width, screenBounds.size.height - statusBarFrame.size.height);
187201
});
188202
}
189203

detox/test/ios/example/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
<string>UIInterfaceOrientationLandscapeRight</string>
6262
</array>
6363
<key>UIViewControllerBasedStatusBarAppearance</key>
64-
<false/>
64+
<true/>
6565
<key>WKBackgroundModes</key>
6666
<array>
6767
<string>remote-notification</string>

0 commit comments

Comments
 (0)