Skip to content

Commit

Permalink
Extend 'immerse reading' for iPad as well
Browse files Browse the repository at this point in the history
  • Loading branch information
BPerlakiH committed Sep 30, 2024
1 parent b0db47c commit cbbcd29
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions Views/BuildingBlocks/WebView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,11 @@ final class WebViewController: UIViewController {
// MARK: - UIScrollViewDelegate
extension WebViewController: UIScrollViewDelegate {
func scrollViewDidScroll(_ scrollView: UIScrollView) {
if Device.current == .iPhone {
configureBars(on: scrollView)
}
configureBars(on: scrollView)
}

func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
if Device.current == .iPhone {
currentScrollViewOffset = scrollView.contentOffset.y
}
currentScrollViewOffset = scrollView.contentOffset.y
}

private func configureBars(on scrollView: UIScrollView) {
Expand Down Expand Up @@ -166,7 +162,9 @@ extension WebViewController: UIScrollViewDelegate {

func showBars(on navigationController: UINavigationController) {
navigationController.setNavigationBarHidden(false, animated: true)
navigationController.setToolbarHidden(false, animated: true)
if Device.current == .iPhone {
navigationController.setToolbarHidden(false, animated: true)
}
}
}

Expand All @@ -189,11 +187,9 @@ extension WebViewController {
}

private func configureImmersiveReading() {
if Device.current == .iPhone {
configureDeviceOrientationNotifications()
configureNavigationController()
}

configureDeviceOrientationNotifications()
configureNavigationController()

func configureDeviceOrientationNotifications() {
UIDevice.current.beginGeneratingDeviceOrientationNotifications()
NotificationCenter.default.addObserver(self,
Expand Down

0 comments on commit cbbcd29

Please sign in to comment.