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

Commit

Permalink
Integrated above readermode.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon-T committed Aug 9, 2021
1 parent 1dc06a0 commit 30d171f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 3 additions & 1 deletion Client/Frontend/Browser/BrowserViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2185,7 +2185,9 @@ extension BrowserViewController: TabManagerDelegate {
navigationToolbar.updateBackStatus(selected?.canGoBack ?? false)
navigationToolbar.updateForwardStatus(selected?.canGoForward ?? false)

if let readerMode = selected?.getContentScript(name: ReaderMode.name()) as? ReaderMode {
let shouldShowPlaylistURLBarButton = selected?.url?.isPlaylistSupportedSiteURL ?? false

if let readerMode = selected?.getContentScript(name: ReaderMode.name()) as? ReaderMode, !shouldShowPlaylistURLBarButton {
topToolbar.updateReaderModeState(readerMode.state)
if readerMode.state == .active {
showReaderModeBar(animated: false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ extension BrowserViewController: ReaderModeDelegate {
// If this reader mode availability state change is for the tab that we currently show, then update
// the button. Otherwise do nothing and the button will be updated when the tab is made active.
if tabManager.selectedTab === tab {
topToolbar.updateReaderModeState(state)
let shouldShowPlaylistURLBarButton = tab.url?.isPlaylistSupportedSiteURL ?? false

if !shouldShowPlaylistURLBarButton {
topToolbar.updateReaderModeState(state)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,21 @@ extension BrowserViewController: PlaylistHelperDelegate {
selectedTab.playlistItemState = state
selectedTab.playlistItem = item

let shouldShowPlaylistURLBarButton = tab?.url?.isPlaylistSupportedSiteURL ?? false
let playlistButton = topToolbar.locationView.playlistButton
switch state {
case .none:
playlistButton.buttonState = .none
case .newItem:
playlistButton.buttonState = .addToPlaylist
playlistButton.buttonState = shouldShowPlaylistURLBarButton ? .addToPlaylist : .none
case .existingItem:
playlistButton.buttonState = .addedToPlaylist
playlistButton.buttonState = shouldShowPlaylistURLBarButton ? .addedToPlaylist : .none
}
} else {
topToolbar.locationView.playlistButton.buttonState = .none
topToolbar.menuButton.removeBadge(.playlist, animated: true)
toolbar?.menuButton.removeBadge(.playlist, animated: true)
}

//selectedTab.url?.isPlaylistSupportedSiteURL == true
}

func showPlaylistPopover(tab: Tab?, state: PlaylistPopoverState) {
Expand Down

0 comments on commit 30d171f

Please sign in to comment.