From e798cf6526441ea05641926b9355dc299cf80e40 Mon Sep 17 00:00:00 2001 From: Nikita Vasilev Date: Fri, 22 Dec 2023 21:33:58 +0100 Subject: [PATCH] Fix brave/brave-ios#8526: Fix the issue of the share button disappearing (brave/brave-ios#8572) --- .../Brave/Frontend/Browser/BrowserViewController.swift | 10 +++++++++- .../BrowserViewController+WKNavigationDelegate.swift | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Sources/Brave/Frontend/Browser/BrowserViewController.swift b/Sources/Brave/Frontend/Browser/BrowserViewController.swift index 7a65c1c8daf1..ebb7874e503a 100644 --- a/Sources/Brave/Frontend/Browser/BrowserViewController.swift +++ b/Sources/Brave/Frontend/Browser/BrowserViewController.swift @@ -651,7 +651,7 @@ public class BrowserViewController: UIViewController { let webView = tab.webView { updateURLBar() navigationToolbar.updateBackStatus(webView.canGoBack) - navigationToolbar.updateForwardStatus(webView.canGoForward) + updateForwardStatusIfNeeded(webView: webView) topToolbar.locationView.loading = tab.loading } @@ -1921,6 +1921,14 @@ public class BrowserViewController: UIViewController { } } + func updateForwardStatusIfNeeded(webView: WKWebView) { + if let forwardListItem = webView.backForwardList.forwardList.first, forwardListItem.url.isReaderModeURL { + navigationToolbar.updateForwardStatus(false) + } else { + navigationToolbar.updateForwardStatus(webView.canGoForward) + } + } + func updateUIForReaderHomeStateForTab(_ tab: Tab) { updateURLBar() toolbarVisibilityViewModel.toolbarState = .expanded diff --git a/Sources/Brave/Frontend/Browser/BrowserViewController/BrowserViewController+WKNavigationDelegate.swift b/Sources/Brave/Frontend/Browser/BrowserViewController/BrowserViewController+WKNavigationDelegate.swift index 11968302b838..c257a185b5b9 100644 --- a/Sources/Brave/Frontend/Browser/BrowserViewController/BrowserViewController+WKNavigationDelegate.swift +++ b/Sources/Brave/Frontend/Browser/BrowserViewController/BrowserViewController+WKNavigationDelegate.swift @@ -666,6 +666,8 @@ extension BrowserViewController: WKNavigationDelegate { if tabManager.selectedTab === tab { updateUIForReaderHomeStateForTab(tab) } + + updateForwardStatusIfNeeded(webView: webView) } public func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {