From bf01b8f1fbb8c2fa5a8ecf94eefc1373c71e7b1b Mon Sep 17 00:00:00 2001 From: kean Date: Fri, 3 Jan 2025 09:33:22 -0500 Subject: [PATCH 1/3] Fix an issue with clear navigation bar background in revision browser --- RELEASE-NOTES.txt | 1 + .../Post/Revisions/Browser/RevisionsNavigationController.swift | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) 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/RevisionsNavigationController.swift b/WordPress/Classes/ViewRelated/Post/Revisions/Browser/RevisionsNavigationController.swift index 8c9e9154e089..dd9c9e81b6a7 100644 --- a/WordPress/Classes/ViewRelated/Post/Revisions/Browser/RevisionsNavigationController.swift +++ b/WordPress/Classes/ViewRelated/Post/Revisions/Browser/RevisionsNavigationController.swift @@ -10,8 +10,7 @@ class RevisionsNavigationController: UINavigationController { override func viewDidLoad() { super.viewDidLoad() - navigationBar.setBackgroundImage(UIImage(color: UIAppColor.neutral(.shade70)), for: .default) - navigationBar.shadowImage = UIImage(color: UIAppColor.neutral(.shade60)) + view.backgroundColor = .systemBackground // important as the content view go below it } private func setupForBrowserState() { From a337327d269a9bf43a78feacf585f3f07dd654aa Mon Sep 17 00:00:00 2001 From: kean Date: Fri, 3 Jan 2025 09:45:07 -0500 Subject: [PATCH 2/3] Fix toolbar inset to safe area in revision browser --- .../Revisions/Browser/Revisions.storyboard | 179 ++++++++++-------- 1 file changed, 99 insertions(+), 80 deletions(-) diff --git a/WordPress/Classes/ViewRelated/Post/Revisions/Browser/Revisions.storyboard b/WordPress/Classes/ViewRelated/Post/Revisions/Browser/Revisions.storyboard index b9bf3148048a..5648d954471a 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,113 @@ - + - + + + + + + + + - - - - - - - - - - - + + - - + - - - - - - - - + + + + + + + + + + - + - - - - - - - - - - + + + - - - - - - - + - - - + + - + + + - @@ -158,7 +171,7 @@ - + @@ -190,6 +203,7 @@ Nulla sodales mauris ullamcorper massa tincidunt, eu pretium erat fringilla. Sed + @@ -197,7 +211,6 @@ Nulla sodales mauris ullamcorper massa tincidunt, eu pretium erat fringilla. Sed - @@ -216,8 +229,8 @@ Nulla sodales mauris ullamcorper massa tincidunt, eu pretium erat fringilla. Sed - + @@ -231,8 +244,8 @@ Nulla sodales mauris ullamcorper massa tincidunt, eu pretium erat fringilla. Sed - + @@ -250,7 +263,13 @@ Nulla sodales mauris ullamcorper massa tincidunt, eu pretium erat fringilla. Sed - + + + + + + + From 56ef3a78444932b9e28a0ea0ffa8b5c8402cb660 Mon Sep 17 00:00:00 2001 From: kean Date: Fri, 3 Jan 2025 09:55:48 -0500 Subject: [PATCH 3/3] Modernize menus and stuff --- .../RevisionDiffsBrowserViewController.swift | 51 ++++++++----------- .../Revisions/Browser/Revisions.storyboard | 14 ++--- 2 files changed, 29 insertions(+), 36 deletions(-) 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 5648d954471a..e1df51970ded 100644 --- a/WordPress/Classes/ViewRelated/Post/Revisions/Browser/Revisions.storyboard +++ b/WordPress/Classes/ViewRelated/Post/Revisions/Browser/Revisions.storyboard @@ -35,14 +35,14 @@ - + - + @@ -53,6 +53,7 @@ + @@ -69,7 +71,7 @@ - + - + @@ -92,7 +94,7 @@ - + @@ -132,7 +134,7 @@ - +