From dd8fb412baa5e61ffb63ec350d064a4007d5287d Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sat, 11 Jan 2025 22:01:27 -0800 Subject: [PATCH] =?UTF-8?q?Create=20and=20use=20logicalArticleFullscreenEn?= =?UTF-8?q?abled=20=E2=80=94=C2=A0so=20it=20can=E2=80=99t=20think=20it?= =?UTF-8?q?=E2=80=99s=20in=20fullscreen=20mode=20without=20fullscreen=20mo?= =?UTF-8?q?de=20being=20allowed.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- iOS/AppDefaults.swift | 6 +++++- iOS/Article/ArticleViewController.swift | 6 +++--- iOS/Article/WebViewController.swift | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/iOS/AppDefaults.swift b/iOS/AppDefaults.swift index 8fc8e11ae..35ffe3df4 100644 --- a/iOS/AppDefaults.swift +++ b/iOS/AppDefaults.swift @@ -169,13 +169,17 @@ final class AppDefaults { var articleFullscreenEnabled: Bool { get { - return AppDefaults.bool(for: Key.articleFullscreenEnabled) + return articleFullscreenAvailable && AppDefaults.bool(for: Key.articleFullscreenEnabled) } set { AppDefaults.setBool(for: Key.articleFullscreenEnabled, newValue) } } + var logicalArticleFullscreenEnabled: Bool { + articleFullscreenAvailable && articleFullscreenEnabled + } + var confirmMarkAllAsRead: Bool { get { return AppDefaults.bool(for: Key.confirmMarkAllAsRead) diff --git a/iOS/Article/ArticleViewController.swift b/iOS/Article/ArticleViewController.swift index e84167bb4..ae6e73837 100644 --- a/iOS/Article/ArticleViewController.swift +++ b/iOS/Article/ArticleViewController.swift @@ -147,7 +147,7 @@ class ArticleViewController: UIViewController { articleExtractorButton.buttonState = controller.articleExtractorButtonState self.pageViewController.setViewControllers([controller], direction: .forward, animated: false, completion: nil) - if AppDefaults.shared.articleFullscreenEnabled { + if AppDefaults.shared.logicalArticleFullscreenEnabled { controller.hideBars() } @@ -163,7 +163,7 @@ class ArticleViewController: UIViewController { } override func viewWillAppear(_ animated: Bool) { - let hideToolbars = AppDefaults.shared.articleFullscreenEnabled + let hideToolbars = AppDefaults.shared.logicalArticleFullscreenEnabled if hideToolbars { currentWebViewController?.hideBars() } else { @@ -255,7 +255,7 @@ class ArticleViewController: UIViewController { @objc func willEnterForeground(_ note: Notification) { // The toolbar will come back on you if you don't hide it again - if AppDefaults.shared.articleFullscreenEnabled { + if AppDefaults.shared.logicalArticleFullscreenEnabled { currentWebViewController?.hideBars() } } diff --git a/iOS/Article/WebViewController.swift b/iOS/Article/WebViewController.swift index 7b9702be4..c5048bf09 100644 --- a/iOS/Article/WebViewController.swift +++ b/iOS/Article/WebViewController.swift @@ -675,7 +675,7 @@ private extension WebViewController { topShowBarsView.translatesAutoresizingMaskIntoConstraints = false view.addSubview(topShowBarsView) - if AppDefaults.shared.articleFullscreenEnabled { + if AppDefaults.shared.logicalArticleFullscreenEnabled { topShowBarsViewConstraint = view.topAnchor.constraint(equalTo: topShowBarsView.bottomAnchor, constant: -44.0) } else { topShowBarsViewConstraint = view.topAnchor.constraint(equalTo: topShowBarsView.bottomAnchor, constant: 0.0) @@ -695,7 +695,7 @@ private extension WebViewController { topShowBarsView.backgroundColor = .clear bottomShowBarsView.translatesAutoresizingMaskIntoConstraints = false view.addSubview(bottomShowBarsView) - if AppDefaults.shared.articleFullscreenEnabled { + if AppDefaults.shared.logicalArticleFullscreenEnabled { bottomShowBarsViewConstraint = view.bottomAnchor.constraint(equalTo: bottomShowBarsView.topAnchor, constant: 44.0) } else { bottomShowBarsViewConstraint = view.bottomAnchor.constraint(equalTo: bottomShowBarsView.topAnchor, constant: 0.0)