diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index fc129132b0f5..0be968bb772f 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -10,6 +10,7 @@ * [*] Add "Share" action to site link context menu on dashboard [#23935] * [*] Fix layout issues in Privacy Settings section of App Settings [#23936] * [*] Fix incorrect chevron icons direction in RTL languages [#23940] +* [*] Fix an issue with clear navigation bar background in revision browser [#23941] 25.6 ----- diff --git a/WordPress/Classes/ViewRelated/Post/Revisions/Browser/RevisionDiffsBrowserViewController.swift b/WordPress/Classes/ViewRelated/Post/Revisions/Browser/RevisionDiffsBrowserViewController.swift index c250ed35bdac..f7f4ecc8f573 100644 --- a/WordPress/Classes/ViewRelated/Post/Revisions/Browser/RevisionDiffsBrowserViewController.swift +++ b/WordPress/Classes/ViewRelated/Post/Revisions/Browser/RevisionDiffsBrowserViewController.swift @@ -18,28 +18,7 @@ class RevisionDiffsBrowserViewController: UIViewController { @IBOutlet private var previousButton: UIButton! @IBOutlet private var nextButton: UIButton! - private lazy var doneBarButtonItem: UIBarButtonItem = { - let doneItem = UIBarButtonItem(barButtonSystemItem: .done, target: nil, action: nil) - doneItem.title = NSLocalizedString("Done", comment: "Label on button to dismiss revisions view") - doneItem.on() { [weak self] _ in - WPAnalytics.track(.postRevisionsDetailCancelled) - self?.dismiss(animated: true) - } - return doneItem - }() - - private lazy var moreBarButtonItem: UIBarButtonItem = { - let image = UIImage(systemName: "ellipsis") - let button = UIButton(type: .system) - button.setImage(image, for: .normal) - button.frame = CGRect(origin: .zero, size: image?.size ?? .zero) - button.accessibilityLabel = NSLocalizedString("More", comment: "Action button to display more available options") - button.on(.touchUpInside) { [weak self] _ in - self?.moreWasPressed() - } - button.setContentHuggingPriority(.required, for: .horizontal) - return UIBarButtonItem(customView: button) - }() + private lazy var moreBarButtonItem = UIBarButtonItem(image: UIImage(systemName: "ellipsis"), menu: makeMoreMenu()) private lazy var loadBarButtonItem: UIBarButtonItem = { let title = NSLocalizedString("Load", comment: "Title of the screen that load selected the revisions.") @@ -111,6 +90,13 @@ class RevisionDiffsBrowserViewController: UIViewController { } } } + + // MARK: - Actions + + @objc private func buttonCloseTapped() { + WPAnalytics.track(.postRevisionsDetailCancelled) + dismiss(animated: true) + } } private extension RevisionDiffsBrowserViewController { @@ -141,7 +127,7 @@ private extension RevisionDiffsBrowserViewController { } private func setupNavbarItems() { - navigationItem.leftBarButtonItems = [doneBarButtonItem] + navigationItem.leftBarButtonItem = UIBarButtonItem(title: SharedStrings.Button.close, style: .plain, target: self, action: #selector(buttonCloseTapped)) navigationItem.rightBarButtonItems = [moreBarButtonItem, loadBarButtonItem] navigationItem.title = NSLocalizedString("Revision", comment: "Title of the screen that shows the revisions.") strokeView.backgroundColor = .separator @@ -234,14 +220,19 @@ private extension RevisionDiffsBrowserViewController { }) } - private func moreWasPressed() { - let alert = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) - alert.addDefaultActionWithTitle(contentPreviewState.toggle().title) { [unowned self] _ in - self.triggerPreviewState() + private func makeMoreMenu() -> UIMenu { + UIMenu(options: .displayInline, children: [ + UIDeferredMenuElement.uncached { [weak self] in + $0(self?.makeMoreMenuActions() ?? []) + } + ]) + } + + private func makeMoreMenuActions() -> [UIAction] { + let toggleMode = UIAction(title: contentPreviewState.toggle().title) { [weak self] _ in + self?.triggerPreviewState() } - alert.addCancelActionWithTitle(NSLocalizedString("Not Now", comment: "Nicer dialog answer for \"No\".")) - alert.popoverPresentationController?.barButtonItem = moreBarButtonItem - present(alert, animated: true) + return [toggleMode] } private func trackRevisionsDetailViewed(with source: ShowRevisionSource) { diff --git a/WordPress/Classes/ViewRelated/Post/Revisions/Browser/Revisions.storyboard b/WordPress/Classes/ViewRelated/Post/Revisions/Browser/Revisions.storyboard index b9bf3148048a..e1df51970ded 100644 --- a/WordPress/Classes/ViewRelated/Post/Revisions/Browser/Revisions.storyboard +++ b/WordPress/Classes/ViewRelated/Post/Revisions/Browser/Revisions.storyboard @@ -1,11 +1,12 @@ - + - + + @@ -14,7 +15,7 @@ - + @@ -30,101 +31,115 @@ - + - - + + + + + + + + + - - - - - - - - - - - + + - - + - - - - - - - - + + + + + + + + + + - + - - - - - - - - - - + + + - - - - - - - + - - - + + - + + + - @@ -158,7 +173,7 @@ - + @@ -190,6 +205,7 @@ Nulla sodales mauris ullamcorper massa tincidunt, eu pretium erat fringilla. Sed + @@ -197,7 +213,6 @@ Nulla sodales mauris ullamcorper massa tincidunt, eu pretium erat fringilla. Sed - @@ -216,8 +231,8 @@ Nulla sodales mauris ullamcorper massa tincidunt, eu pretium erat fringilla. Sed - + @@ -231,8 +246,8 @@ Nulla sodales mauris ullamcorper massa tincidunt, eu pretium erat fringilla. Sed - + @@ -250,7 +265,13 @@ Nulla sodales mauris ullamcorper massa tincidunt, eu pretium erat fringilla. Sed - + + + + + + + diff --git a/WordPress/Classes/ViewRelated/Post/Revisions/Browser/RevisionsNavigationController.swift b/WordPress/Classes/ViewRelated/Post/Revisions/Browser/RevisionsNavigationController.swift index 24caada86816..dd9c9e81b6a7 100644 --- a/WordPress/Classes/ViewRelated/Post/Revisions/Browser/RevisionsNavigationController.swift +++ b/WordPress/Classes/ViewRelated/Post/Revisions/Browser/RevisionsNavigationController.swift @@ -7,6 +7,12 @@ class RevisionsNavigationController: UINavigationController { } } + override func viewDidLoad() { + super.viewDidLoad() + + view.backgroundColor = .systemBackground // important as the content view go below it + } + private func setupForBrowserState() { guard let revisionView = viewControllers.first as? RevisionDiffsBrowserViewController else { return