mirror of
https://github.com/status-im/react-native-webview.git
synced 2025-02-23 17:28:37 +00:00
UIWindowDidBecomeVisibleNotification and UIWindowDidBecomeHiddenNotification seem far more reliable at detecting fullscreen video. Tested on iOS 11, 12 and 13
This commit is contained in:
parent
401277fd17
commit
05e2d27662
@ -92,7 +92,15 @@ static NSDictionary* customCertificatesForHost;
|
|||||||
|
|
||||||
// Workaround for StatusBar appearance bug for iOS 12
|
// Workaround for StatusBar appearance bug for iOS 12
|
||||||
// https://github.com/react-native-community/react-native-webview/issues/62
|
// https://github.com/react-native-community/react-native-webview/issues/62
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(toggleFullScreenVideoStatusBars) name:@"_MRMediaRemotePlayerSupportedCommandsDidChangeNotification" object:nil];
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
|
selector:@selector(showFullScreenVideoStatusBars)
|
||||||
|
name:UIWindowDidBecomeVisibleNotification
|
||||||
|
object:nil];
|
||||||
|
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
|
selector:@selector(hideFullScreenVideoStatusBars)
|
||||||
|
name:UIWindowDidBecomeHiddenNotification
|
||||||
|
object:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
@ -275,21 +283,24 @@ static NSDictionary* customCertificatesForHost;
|
|||||||
[super removeFromSuperview];
|
[super removeFromSuperview];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)toggleFullScreenVideoStatusBars
|
-(void)showFullScreenVideoStatusBars
|
||||||
{
|
{
|
||||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
if (!_isFullScreenVideoOpen) {
|
|
||||||
_isFullScreenVideoOpen = YES;
|
_isFullScreenVideoOpen = YES;
|
||||||
RCTUnsafeExecuteOnMainQueueSync(^{
|
RCTUnsafeExecuteOnMainQueueSync(^{
|
||||||
[RCTSharedApplication() setStatusBarStyle:UIStatusBarStyleLightContent animated:YES];
|
[RCTSharedApplication() setStatusBarStyle:UIStatusBarStyleLightContent animated:YES];
|
||||||
});
|
});
|
||||||
} else {
|
#pragma clang diagnostic pop
|
||||||
|
}
|
||||||
|
|
||||||
|
-(void)hideFullScreenVideoStatusBars
|
||||||
|
{
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
_isFullScreenVideoOpen = NO;
|
_isFullScreenVideoOpen = NO;
|
||||||
RCTUnsafeExecuteOnMainQueueSync(^{
|
RCTUnsafeExecuteOnMainQueueSync(^{
|
||||||
[RCTSharedApplication() setStatusBarHidden:self->_savedStatusBarHidden animated:YES];
|
[RCTSharedApplication() setStatusBarHidden:self->_savedStatusBarHidden animated:YES];
|
||||||
[RCTSharedApplication() setStatusBarStyle:self->_savedStatusBarStyle animated:YES];
|
[RCTSharedApplication() setStatusBarStyle:self->_savedStatusBarStyle animated:YES];
|
||||||
});
|
});
|
||||||
}
|
|
||||||
#pragma clang diagnostic pop
|
#pragma clang diagnostic pop
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user