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 608db68
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
17 changes: 13 additions & 4 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 @@ -1789,11 +1789,12 @@ public class BrowserViewController: UIViewController {

navigationToolbar.updateBackStatus(canGoBack)
case .canGoForward:
guard tab === tabManager.selectedTab, let canGoForward = change?[.newKey] as? Bool else {
guard tab === tabManager.selectedTab, let canGoForward = change?[.newKey] as? Bool else {
break
}

navigationToolbar.updateForwardStatus(canGoForward)

navigationToolbar.updateForwardStatus(canGoForward)
// updateForwardStatus(canGoForward: canGoForward)
case .hasOnlySecureContent:
guard let tab = tabManager[webView] else {
break
Expand Down Expand Up @@ -1913,6 +1914,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 608db68

Please sign in to comment.