Skip to content

Commit

Permalink
Merge pull request #995 from kiwix/994-top-bar-should-be-masked-disap…
Browse files Browse the repository at this point in the history
…pearing-during-reading

994 - Extend 'immerse reading' for iPad as well
  • Loading branch information
kelson42 authored Oct 1, 2024
2 parents b0db47c + cbbcd29 commit 2ff9049
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 2ff9049

Please sign in to comment.