Skip to content

Commit

Permalink
Fix brave/brave-ios#8526: Fix the issue of the share button disappear…
Browse files Browse the repository at this point in the history
  • Loading branch information
nik3212 authored Dec 22, 2023
1 parent 0412f51 commit e798cf6
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 e798cf6

Please sign in to comment.