Skip to content

Commit

Permalink
Merge pull request #442 from kot331107/fix-tvOS-build
Browse files Browse the repository at this point in the history
Fix/tvOS build
  • Loading branch information
wvanhaevre authored Nov 20, 2024
2 parents c4e0360 + 5da7099 commit 3bb68de
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
21 changes: 12 additions & 9 deletions ios/presentationMode/THEOplayerRCTPresentationModeManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,14 @@ public class THEOplayerRCTPresentationModeManager {
self.moveView(containerView, to: fullscreenParentView)

// start hiding home indicator
if let customRootViewController = fullscreenParentView.findViewController() as? HomeIndicatorViewController {
customRootViewController.prefersAutoHidden = true
customRootViewController.setNeedsUpdateOfHomeIndicatorAutoHidden()
}
setHomeIndicatorHidden(true)
}
self.rnInlineMode = .fullscreen
}

private func exitFullscreen() {
// stop hiding home indicator
if let fullscreenParentView = self.view?.findParentViewOfType(RCTRootContentView.self),
let customRootViewController = fullscreenParentView.findViewController() as? HomeIndicatorViewController {
customRootViewController.prefersAutoHidden = false
customRootViewController.setNeedsUpdateOfHomeIndicatorAutoHidden()
}
setHomeIndicatorHidden(false)

// move the player
if let containerView = self.containerView,
Expand All @@ -89,6 +82,16 @@ public class THEOplayerRCTPresentationModeManager {
}
self.rnInlineMode = .inline
}

private func setHomeIndicatorHidden(_ hidden: Bool) {
#if os(iOS)
if let fullscreenParentView = self.view?.findParentViewOfType(RCTRootContentView.self),
let customRootViewController = fullscreenParentView.findViewController() as? HomeIndicatorViewController {
customRootViewController.prefersAutoHidden = hidden
customRootViewController.setNeedsUpdateOfHomeIndicatorAutoHidden()
}
#endif
}

func setPresentationModeFromRN(newPresentationMode: THEOplayerSDK.PresentationMode) {
guard newPresentationMode != self.presentationMode else { return }
Expand Down
2 changes: 2 additions & 0 deletions ios/viewController/HomeIndicatorViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import UIKit
public class HomeIndicatorViewController: UIViewController {
public var prefersAutoHidden = false

#if os(iOS)
public override var prefersHomeIndicatorAutoHidden: Bool {
get {
return self.prefersAutoHidden
}
}
#endif
}

0 comments on commit 3bb68de

Please sign in to comment.