Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Fix #8526: Fix the issue of the share button disappearing (#8572)
Browse files Browse the repository at this point in the history
  • Loading branch information
ns-vasilev authored Dec 22, 2023
1 parent c09ee5d commit d2f2338
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 9 additions & 1 deletion 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 @@ -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
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 d2f2338

Please sign in to comment.