fix(ios): Add safety checks and remove some of the ! in types declaration (#4182)

This commit is contained in:
Olivier Bouillet
2024-09-22 18:41:25 +02:00
committed by GitHub
parent 17dc2c064f
commit ae82c83eef
2 changed files with 31 additions and 27 deletions

View File

@@ -48,12 +48,12 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
private var _preventsDisplaySleepDuringVideoPlayback = true
private var _preferredForwardBufferDuration: Float = 0.0
private var _playWhenInactive = false
private var _ignoreSilentSwitch: String! = "inherit" // inherit, ignore, obey
private var _mixWithOthers: String! = "inherit" // inherit, mix, duck
private var _resizeMode: String! = "cover"
private var _ignoreSilentSwitch: String = "inherit" // inherit, ignore, obey
private var _mixWithOthers: String = "inherit" // inherit, mix, duck
private var _resizeMode: String = "cover"
private var _fullscreen = false
private var _fullscreenAutorotate = true
private var _fullscreenOrientation: String! = "all"
private var _fullscreenOrientation: String = "all"
private var _fullscreenPlayerPresented = false
private var _fullscreenUncontrolPlayerPresented = false // to call events switching full screen mode from player controls
private var _filterName: String!
@@ -741,14 +741,14 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
@objc
func setIgnoreSilentSwitch(_ ignoreSilentSwitch: String?) {
_ignoreSilentSwitch = ignoreSilentSwitch
_ignoreSilentSwitch = ignoreSilentSwitch ?? "inherit"
RCTPlayerOperations.configureAudio(ignoreSilentSwitch: _ignoreSilentSwitch, mixWithOthers: _mixWithOthers, audioOutput: _audioOutput)
applyModifiers()
}
@objc
func setMixWithOthers(_ mixWithOthers: String?) {
_mixWithOthers = mixWithOthers
_mixWithOthers = mixWithOthers ?? "inherit"
applyModifiers()
}
@@ -1050,9 +1050,9 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
@objc
func setFullscreenOrientation(_ orientation: String?) {
_fullscreenOrientation = orientation
_fullscreenOrientation = orientation ?? "all"
if _fullscreenPlayerPresented {
_playerViewController?.preferredOrientation = orientation
_playerViewController?.preferredOrientation = _fullscreenOrientation
}
}
@@ -1224,7 +1224,7 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
}
@objc
func setAdTagUrl(_ adTagUrl: String!) {
func setAdTagUrl(_ adTagUrl: String?) {
_adTagUrl = adTagUrl
}