Skip to content

Commit

Permalink
Fix #8526: Fix the issue of the share button disappearing
Browse files Browse the repository at this point in the history
  • Loading branch information
ns-vasilev committed Dec 17, 2023
1 parent a9f0557 commit fd063e3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Sources/Brave/Frontend/Browser/BrowserViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -1792,7 +1792,7 @@ public class BrowserViewController: UIViewController {
guard tab === tabManager.selectedTab, let canGoForward = change?[.newKey] as? Bool else {
break
}

navigationToolbar.updateForwardStatus(canGoForward)
case .hasOnlySecureContent:
guard let tab = tabManager[webView] else {
Expand Down Expand Up @@ -1913,6 +1913,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,8 @@ extension BrowserViewController: WKNavigationDelegate {
if tabManager.selectedTab === tab {
updateUIForReaderHomeStateForTab(tab)
}

updateForwardStatusIfNeeded(webView: webView)
}

public func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
Expand Down

0 comments on commit fd063e3

Please sign in to comment.