From a0e4531353355ccc08bfd17400afb3de14d39ca9 Mon Sep 17 00:00:00 2001 From: kean Date: Thu, 2 May 2024 17:47:02 -0400 Subject: [PATCH 1/6] Update Post Editor context menu --- .../Utility/Analytics/WPAnalyticsEvent.swift | 3 + .../GutenbergViewController+MoreActions.swift | 73 +++++++++++++++++++ .../Gutenberg/GutenbergViewController.swift | 9 +++ .../Post/PostEditor+MoreOptions.swift | 2 +- .../Post/PostEditorNavigationBarManager.swift | 2 +- 5 files changed, 87 insertions(+), 2 deletions(-) diff --git a/WordPress/Classes/Utility/Analytics/WPAnalyticsEvent.swift b/WordPress/Classes/Utility/Analytics/WPAnalyticsEvent.swift index 6dc775a463d6..49a3c74f93c1 100644 --- a/WordPress/Classes/Utility/Analytics/WPAnalyticsEvent.swift +++ b/WordPress/Classes/Utility/Analytics/WPAnalyticsEvent.swift @@ -41,6 +41,7 @@ import Foundation case editorPostSlugChanged case editorPostExcerptChanged case editorPostSiteChanged + case editorPostLegacyMoreMenuShown // Resolve post version conflict case resolveConflictScreenShown @@ -661,6 +662,8 @@ import Foundation return "editor_post_excerpt_changed" case .editorPostSiteChanged: return "editor_post_site_changed" + case .editorPostLegacyMoreMenuShown: + return "editor_post_legacy_more_menu_shown" case .resolveConflictScreenShown: return "resolve_conflict_screen_shown" case .resolveConflictSaveTapped: diff --git a/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController+MoreActions.swift b/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController+MoreActions.swift index c9f61cbbbfac..8e0a5727dde3 100644 --- a/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController+MoreActions.swift +++ b/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController+MoreActions.swift @@ -11,7 +11,11 @@ extension GutenbergViewController { case managedObjectContextMissing = 2 } + // - warning: deprecated (kahu-offline-mode) + // TODO: Remove when/if confirmed that this is never invoked by Gutenberg. func displayMoreSheet() { + WPAnalytics.track(.editorPostLegacyMoreMenuShown) + // Dismisses and locks the Notices Store from displaying any new notices. ActionDispatcher.dispatch(NoticeAction.lock) let alert = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) @@ -86,11 +90,68 @@ extension GutenbergViewController { present(alert, animated: true) } + + func makeMoreMenu() -> UIMenu { + UIMenu(title: "", image: nil, identifier: nil, options: [], children: [ + UIDeferredMenuElement.uncached { [weak self] in + $0(self?.makeMoreMenuSections() ?? []) + } + ]) + } + + private func makeMoreMenuSections() -> [UIMenuElement] { + var sections: [UIMenuElement] = [ + UIMenu(title: "", subtitle: "", options: .displayInline, children: makeMoreMenuActions()) + ] + if let string = makeContextStructureString() { + sections.append(UIAction(subtitle: string, attributes: [.disabled], handler: { _ in })) + } + return sections + } + + private func makeMoreMenuActions() -> [UIAction] { + var actions: [UIAction] = [] + + let toggleModeTitle = mode == .richText ? Strings.codeEditor : Strings.visualEditor + let toggleModeIconName = mode == .richText ? "ellipsis.curlybraces" : "doc.richtext" + actions.append(UIAction(title: toggleModeTitle, image: UIImage(systemName: toggleModeIconName)) { [weak self] _ in + self?.toggleEditingMode() + }) + + actions.append(UIAction(title: Strings.preview, image: UIImage(systemName: "safari")) { [weak self] _ in + self?.displayPreview() + }) + + let revisionCount = (post.revisions ?? []).count + if revisionCount > 0 { + actions.append(UIAction(title: Strings.revisions + " (\(revisionCount))", image: UIImage(systemName: "clock.arrow.circlepath")) { [weak self] _ in + self?.displayHistory() + }) + } + + let settingsTitle = self.post is Page ? Strings.pageSettings : Strings.postSettings + actions.append(UIAction(title: settingsTitle, image: UIImage(systemName: "gearshape")) { [weak self] _ in + self?.displayPostSettings() + }) + let helpTitle = JetpackFeaturesRemovalCoordinator.jetpackFeaturesEnabled() ? Strings.helpAndSupport : Strings.help + actions.append(UIAction(title: helpTitle, image: UIImage(systemName: "questionmark.circle")) { [weak self] _ in + self?.showEditorHelp() + }) + return actions + } + + private func makeContextStructureString() -> String? { + guard mode == .richText, let contentInfo = contentInfo else { + return nil + } + return String(format: Strings.contentStructure, contentInfo.blockCount, contentInfo.wordCount, contentInfo.characterCount) + } } // MARK: - Constants extension GutenbergViewController { + // - warning: deprecated (kahu-offline-mode) struct MoreSheetAlert { static let htmlTitle = NSLocalizedString("Switch to HTML Mode", comment: "Switches the Editor to HTML Mode") static let richTitle = NSLocalizedString("Switch to Visual Mode", comment: "Switches the Editor to Rich Text Mode") @@ -104,3 +165,15 @@ extension GutenbergViewController { static let editorHelpTitle = NSLocalizedString("Help", comment: "Open editor help options") } } + +private enum Strings { + static let codeEditor = NSLocalizedString("postEditor.moreMenu.codeEditor", value: "Code Editor", comment: "Post Editor / Button in the 'More' menu") + static let visualEditor = NSLocalizedString("postEditor.moreMenu.visualEditor", value: "Visual Editor", comment: "Post Editor / Button in the 'More' menu") + static let preview = NSLocalizedString("postEditor.moreMenu.preview", value: "Preview", comment: "Post Editor / Button in the 'More' menu") + static let revisions = NSLocalizedString("postEditor.moreMenu.revisions", value: "Revisions", comment: "Post Editor / Button in the 'More' menu") + static let pageSettings = NSLocalizedString("postEditor.moreMenu.pageSettings", value: "Page Settings", comment: "Post Editor / Button in the 'More' menu") + static let postSettings = NSLocalizedString("postEditor.moreMenu.postSettings", value: "Post Settings", comment: "Post Editor / Button in the 'More' menu") + static let helpAndSupport = NSLocalizedString("postEditor.moreMenu.helpAndSupport", value: "Help & Support", comment: "Post Editor / Button in the 'More' menu") + static let help = NSLocalizedString("postEditor.moreMenu.help", value: "Help", comment: "Post Editor / Button in the 'More' menu") + static let contentStructure = NSLocalizedString("postEditor.moreMenu.contentStructure", value: "Blocks: %li, Words: %li, Characters: %li", comment: "Post Editor / 'More' menu details labels with 'Blocks', 'Words' and 'Characters' counts as parameters (in that order)") +} diff --git a/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController.swift b/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController.swift index da8ac1fb1f7e..16eb9741a50a 100644 --- a/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController.swift +++ b/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController.swift @@ -449,6 +449,15 @@ class GutenbergViewController: UIViewController, PostEditor, FeaturedImageDelega borderBottom.frame = CGRect(x: 0, y: navigationController?.navigationBar.frame.size.height ?? 0 - borderWidth, width: navigationController?.navigationBar.frame.size.width ?? 0, height: borderWidth) borderBottom.autoresizingMask = [.flexibleWidth, .flexibleTopMargin] navigationController?.navigationBar.addSubview(borderBottom) + + if FeatureFlag.syncPublishing.enabled { + navigationBarManager.moreButton.menu = makeMoreMenu() + navigationBarManager.moreButton.showsMenuAsPrimaryAction = true + } + } + + @objc private func buttonMoreTapped() { + displayMoreSheet() } private func reloadBlogIconView() { diff --git a/WordPress/Classes/ViewRelated/Post/PostEditor+MoreOptions.swift b/WordPress/Classes/ViewRelated/Post/PostEditor+MoreOptions.swift index d4a93768833a..f08d52699fd9 100644 --- a/WordPress/Classes/ViewRelated/Post/PostEditor+MoreOptions.swift +++ b/WordPress/Classes/ViewRelated/Post/PostEditor+MoreOptions.swift @@ -174,7 +174,7 @@ extension PostEditor { self.post.mt_excerpt = revision.postExcerpt // It's important to clear the pending uploads associated with the -     // post. The assumption is that if the revision on the remote, + // post. The assumption is that if the revision on the remote, // its associated media has to be also uploaded. MediaCoordinator.shared.cancelUploadOfAllMedia(for: self.post) self.post.media = [] diff --git a/WordPress/Classes/ViewRelated/Post/PostEditorNavigationBarManager.swift b/WordPress/Classes/ViewRelated/Post/PostEditorNavigationBarManager.swift index db9fe23d2a50..b3be9854585d 100644 --- a/WordPress/Classes/ViewRelated/Post/PostEditorNavigationBarManager.swift +++ b/WordPress/Classes/ViewRelated/Post/PostEditorNavigationBarManager.swift @@ -117,7 +117,7 @@ class PostEditorNavigationBarManager { return button }() - private lazy var moreButton: UIButton = { + lazy var moreButton: UIButton = { let image = UIImage(named: "editor-more") let button = UIButton(type: .system) button.setImage(image, for: .normal) From e36ef840aedbc74fba7ff8dd8d03d66842ce56ee Mon Sep 17 00:00:00 2001 From: kean Date: Thu, 2 May 2024 17:50:21 -0400 Subject: [PATCH 2/6] Update table view style in revisions list --- .../Aztec/ViewControllers/AztecPostViewController.swift | 2 +- .../Gutenberg/GutenbergViewController+MoreActions.swift | 4 ++-- .../Classes/ViewRelated/Post/PostEditor+MoreOptions.swift | 2 +- .../Post/Revisions/RevisionsTableViewController.swift | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/WordPress/Classes/ViewRelated/Aztec/ViewControllers/AztecPostViewController.swift b/WordPress/Classes/ViewRelated/Aztec/ViewControllers/AztecPostViewController.swift index 3d57500e61b3..86de50e099df 100644 --- a/WordPress/Classes/ViewRelated/Aztec/ViewControllers/AztecPostViewController.swift +++ b/WordPress/Classes/ViewRelated/Aztec/ViewControllers/AztecPostViewController.swift @@ -1197,7 +1197,7 @@ private extension AztecPostViewController { if (post.revisions ?? []).count > 0 { alert.addDefaultActionWithTitle(MoreSheetAlert.historyTitle) { [unowned self] _ in - self.displayHistory() + self.displayRevisionsList() } } diff --git a/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController+MoreActions.swift b/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController+MoreActions.swift index 8e0a5727dde3..2c761c22de5c 100644 --- a/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController+MoreActions.swift +++ b/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController+MoreActions.swift @@ -56,7 +56,7 @@ extension GutenbergViewController { if (post.revisions ?? []).count > 0 { alert.addDefaultActionWithTitle(MoreSheetAlert.historyTitle) { [weak self] _ in - self?.displayHistory() + self?.displayRevisionsList() ActionDispatcher.dispatch(NoticeAction.unlock) } } @@ -125,7 +125,7 @@ extension GutenbergViewController { let revisionCount = (post.revisions ?? []).count if revisionCount > 0 { actions.append(UIAction(title: Strings.revisions + " (\(revisionCount))", image: UIImage(systemName: "clock.arrow.circlepath")) { [weak self] _ in - self?.displayHistory() + self?.displayRevisionsList() }) } diff --git a/WordPress/Classes/ViewRelated/Post/PostEditor+MoreOptions.swift b/WordPress/Classes/ViewRelated/Post/PostEditor+MoreOptions.swift index f08d52699fd9..e0e83ebfeaa4 100644 --- a/WordPress/Classes/ViewRelated/Post/PostEditor+MoreOptions.swift +++ b/WordPress/Classes/ViewRelated/Post/PostEditor+MoreOptions.swift @@ -157,7 +157,7 @@ extension PostEditor { } } - func displayHistory() { + func displayRevisionsList() { guard FeatureFlag.syncPublishing.enabled else { _displayHistory() return diff --git a/WordPress/Classes/ViewRelated/Post/Revisions/RevisionsTableViewController.swift b/WordPress/Classes/ViewRelated/Post/Revisions/RevisionsTableViewController.swift index c83410bf0356..f3e1d9a6bd0d 100644 --- a/WordPress/Classes/ViewRelated/Post/Revisions/RevisionsTableViewController.swift +++ b/WordPress/Classes/ViewRelated/Post/Revisions/RevisionsTableViewController.swift @@ -36,7 +36,7 @@ class RevisionsTableViewController: UITableViewController { required init(post: AbstractPost, onRevisionLoaded: @escaping RevisionLoadedBlock) { self.post = post self.onRevisionLoaded = onRevisionLoaded - super.init(nibName: nil, bundle: nil) + super.init(style: .insetGrouped) } required init?(coder aDecoder: NSCoder) { From 7a5576f41207edecfd2f20bae68b7fddf6a1fd04 Mon Sep 17 00:00:00 2001 From: kean Date: Thu, 2 May 2024 18:01:47 -0400 Subject: [PATCH 3/6] Update copy on the Revisions screen --- .../RevisionsTableViewController.swift | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/WordPress/Classes/ViewRelated/Post/Revisions/RevisionsTableViewController.swift b/WordPress/Classes/ViewRelated/Post/Revisions/RevisionsTableViewController.swift index f3e1d9a6bd0d..0b51c6f44c0c 100644 --- a/WordPress/Classes/ViewRelated/Post/Revisions/RevisionsTableViewController.swift +++ b/WordPress/Classes/ViewRelated/Post/Revisions/RevisionsTableViewController.swift @@ -65,7 +65,7 @@ class RevisionsTableViewController: UITableViewController { private extension RevisionsTableViewController { private func setupUI() { - navigationItem.title = NSLocalizedString("History", comment: "Title of the post history screen") + navigationItem.title = Strings.title let cellNib = UINib(nibName: RevisionsTableViewCell.classNameWithoutNamespaces(), bundle: Bundle(for: RevisionsTableViewCell.self)) @@ -113,7 +113,7 @@ private extension RevisionsTableViewController { @objc private func refreshRevisions() { if sectionCount == 0 { - configureAndDisplayNoResults(title: NoResultsText.loadingTitle, + configureAndDisplayNoResults(title: Strings.loading, accessoryView: NoResultsViewController.loadingAccessoryView()) } @@ -157,7 +157,7 @@ private extension RevisionsTableViewController { return } - SVProgressHUD.show(withStatus: NSLocalizedString("Loading...", comment: "Text displayed in HUD while a revision post is loading.")) + SVProgressHUD.show(withStatus: Strings.loading) let coreDataStack = ContextManager.shared let postRepository = PostRepository(coreDataStack: coreDataStack) @@ -287,8 +287,8 @@ extension RevisionsTableViewController: RevisionsView { case (true, let count) where count == 0: // When the API call successed but there are no revisions loaded // This is an edge cas. It shouldn't happen since we open the revisions list only if the post revisions array is not empty. - configureAndDisplayNoResults(title: NoResultsText.noResultsTitle, - subtitle: NoResultsText.noResultsSubtitle) + configureAndDisplayNoResults(title: Strings.noResultsTitle, + subtitle: Strings.noResultsSubtitle) default: hideNoResults() } @@ -326,10 +326,14 @@ private extension Date { } struct NoResultsText { - static let loadingTitle = NSLocalizedString("Loading history...", comment: "Displayed while a call is loading the history.") static let reloadButtonTitle = NSLocalizedString("Try again", comment: "Re-load the history again. It appears if the loading call fails.") - static let noResultsTitle = NSLocalizedString("No history yet", comment: "Displayed when a call is made to load the revisions but there's no result or an error.") - static let noResultsSubtitle = NSLocalizedString("When you make changes in the editor you'll be able to see the history here", comment: "Displayed when a call is made to load the history but there's no result or an error.") static let errorTitle = NSLocalizedString("Oops", comment: "Title for the view when there's an error loading the history") static let errorSubtitle = NSLocalizedString("There was an error loading the history", comment: "Text displayed when there is a failure loading the history.") } + +private enum Strings { + static let title = NSLocalizedString("revisions.title", value: "Revisions", comment: "Post revisions list screen title") + static let loading = NSLocalizedString("revisions.loadingTitle", value: "Loading…", comment: "Post revisions list screen / loading view title") + static let noResultsTitle = NSLocalizedString("revisions.emptyStateTitle", value: "No revisions yet", comment: "Displayed when a call is made to load the revisions but there's no result or an error.") + static let noResultsSubtitle = NSLocalizedString("revisions.emptyStateSubtitle", value: "When you make changes in the editor you'll be able to see the revision history here", comment: "Displayed when a call is made to load the history but there's no result or an error.") +} From fa8edb9436f06055585b33a495ee083aa81da275 Mon Sep 17 00:00:00 2001 From: kean Date: Thu, 2 May 2024 18:22:01 -0400 Subject: [PATCH 4/6] Update release notes --- RELEASE-NOTES.txt | 1 + .../Gutenberg/GutenbergViewController+MoreActions.swift | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index b4f1ba7f6e44..8da42bb3cd69 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -4,6 +4,7 @@ * [*] Add "Slug" and "Excerpt" fields to "Page Settings" [#23135] * [*] Make it easier to "Share" and "Blaze" a published post with an updated success view [##23128] * [*] Add support for viewing trashed posts and pages and restoring them from the editor [#23142] +* [*] Update the "More" menu in the Editor to use modern iOS design and update copy to match Gutenberg [#23145] 24.8 ----- diff --git a/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController+MoreActions.swift b/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController+MoreActions.swift index 2c761c22de5c..e8cf27fa7d1e 100644 --- a/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController+MoreActions.swift +++ b/WordPress/Classes/ViewRelated/Gutenberg/GutenbergViewController+MoreActions.swift @@ -113,7 +113,7 @@ extension GutenbergViewController { var actions: [UIAction] = [] let toggleModeTitle = mode == .richText ? Strings.codeEditor : Strings.visualEditor - let toggleModeIconName = mode == .richText ? "ellipsis.curlybraces" : "doc.richtext" + let toggleModeIconName = mode == .richText ? "curlybraces" : "doc.richtext" actions.append(UIAction(title: toggleModeTitle, image: UIImage(systemName: toggleModeIconName)) { [weak self] _ in self?.toggleEditingMode() }) From 838cc2b51d58f03962f58201e970261df02ad8a5 Mon Sep 17 00:00:00 2001 From: kean Date: Sat, 4 May 2024 11:26:47 -0400 Subject: [PATCH 5/6] Fix header separator in Revisions list --- .../Pages/PageListSectionHeaderView.swift | 19 ------ .../Pages/PageListSectionHeaderView.xib | 67 ------------------- .../RevisionsTableViewController.swift | 12 +--- WordPress/WordPress.xcodeproj/project.pbxproj | 12 ---- 4 files changed, 2 insertions(+), 108 deletions(-) delete mode 100644 WordPress/Classes/ViewRelated/Pages/PageListSectionHeaderView.swift delete mode 100644 WordPress/Classes/ViewRelated/Pages/PageListSectionHeaderView.xib diff --git a/WordPress/Classes/ViewRelated/Pages/PageListSectionHeaderView.swift b/WordPress/Classes/ViewRelated/Pages/PageListSectionHeaderView.swift deleted file mode 100644 index 688e5a2d43ea..000000000000 --- a/WordPress/Classes/ViewRelated/Pages/PageListSectionHeaderView.swift +++ /dev/null @@ -1,19 +0,0 @@ -import UIKit - -class PageListSectionHeaderView: UIView { - - @IBOutlet weak var titleLabel: UILabel! - @IBOutlet weak var separator: UIView! - - func setTitle(_ title: String) { - titleLabel.text = title.uppercased(with: .current) - } - - override func awakeFromNib() { - super.awakeFromNib() - - backgroundColor = .listBackground - titleLabel.backgroundColor = .listBackground - WPStyleGuide.applyBorderStyle(separator) - } -} diff --git a/WordPress/Classes/ViewRelated/Pages/PageListSectionHeaderView.xib b/WordPress/Classes/ViewRelated/Pages/PageListSectionHeaderView.xib deleted file mode 100644 index 2e5cbbcac673..000000000000 --- a/WordPress/Classes/ViewRelated/Pages/PageListSectionHeaderView.xib +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/WordPress/Classes/ViewRelated/Post/Revisions/RevisionsTableViewController.swift b/WordPress/Classes/ViewRelated/Post/Revisions/RevisionsTableViewController.swift index 0b51c6f44c0c..4b087cfc5a8f 100644 --- a/WordPress/Classes/ViewRelated/Post/Revisions/RevisionsTableViewController.swift +++ b/WordPress/Classes/ViewRelated/Post/Revisions/RevisionsTableViewController.swift @@ -229,16 +229,8 @@ extension RevisionsTableViewController: WPTableViewHandlerDelegate { return Sizes.cellEstimatedRowHeight } - override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { - guard let sectionInfo = tableViewHandler.resultsController?.sections?[section], - let headerView = Bundle.main.loadNibNamed(PageListSectionHeaderView.classNameWithoutNamespaces(), - owner: nil, - options: nil)?.first as? PageListSectionHeaderView else { - return UIView() - } - - headerView.setTitle(sectionInfo.name) - return headerView + override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { + tableViewHandler.resultsController?.sections?[section].name } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { diff --git a/WordPress/WordPress.xcodeproj/project.pbxproj b/WordPress/WordPress.xcodeproj/project.pbxproj index f0598667d2f8..54c80e9be845 100644 --- a/WordPress/WordPress.xcodeproj/project.pbxproj +++ b/WordPress/WordPress.xcodeproj/project.pbxproj @@ -1490,7 +1490,6 @@ 59ECF87B1CB7061D00E68F25 /* PostSharingControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59ECF87A1CB7061D00E68F25 /* PostSharingControllerTests.swift */; }; 59FBD5621B5684F300734466 /* ThemeServiceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 59FBD5611B5684F300734466 /* ThemeServiceTests.m */; }; 5D1181E71B4D6DEB003F3084 /* WPStyleGuide+Reader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D1181E61B4D6DEB003F3084 /* WPStyleGuide+Reader.swift */; }; - 5D13FA571AF99C2100F06492 /* PageListSectionHeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5D13FA561AF99C2100F06492 /* PageListSectionHeaderView.xib */; }; 5D146EBB189857ED0068FDC6 /* FeaturedImageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D146EBA189857ED0068FDC6 /* FeaturedImageViewController.m */; }; 5D1D04751B7A50B100CDE646 /* Reader.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5D1D04731B7A50B100CDE646 /* Reader.storyboard */; }; 5D1D04761B7A50B100CDE646 /* ReaderStreamViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D1D04741B7A50B100CDE646 /* ReaderStreamViewController.swift */; }; @@ -2391,7 +2390,6 @@ 8B92D69627CD51FA001F5371 /* DashboardGhostCardCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B92D69527CD51FA001F5371 /* DashboardGhostCardCell.swift */; }; 8B92D69727CD51FA001F5371 /* DashboardGhostCardCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B92D69527CD51FA001F5371 /* DashboardGhostCardCell.swift */; }; 8B93412F257029F60097D0AC /* FilterChipButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B93412E257029F50097D0AC /* FilterChipButton.swift */; }; - 8B93856E22DC08060010BF02 /* PageListSectionHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B93856D22DC08060010BF02 /* PageListSectionHeaderView.swift */; }; 8BA125EB27D8F5E4008B779F /* UIView+PinSubviewPriority.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8BA125EA27D8F5E4008B779F /* UIView+PinSubviewPriority.swift */; }; 8BA125EC27D8F5E4008B779F /* UIView+PinSubviewPriority.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8BA125EA27D8F5E4008B779F /* UIView+PinSubviewPriority.swift */; }; 8BA77BCB2482C52A00E1EBBF /* ReaderCardDiscoverAttributionView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8BA77BCA2482C52A00E1EBBF /* ReaderCardDiscoverAttributionView.xib */; }; @@ -4220,7 +4218,6 @@ FABB201D2602FC2C00C8785C /* PostStatsTitleCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 98FCFC222231DF43006ECDD4 /* PostStatsTitleCell.xib */; }; FABB20212602FC2C00C8785C /* ReaderDetailToolbar.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8BA77BCC248340CE00E1EBBF /* ReaderDetailToolbar.xib */; }; FABB20222602FC2C00C8785C /* RewindStatusTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4070D75B20E5F55A007CEBDA /* RewindStatusTableViewCell.xib */; }; - FABB20232602FC2C00C8785C /* PageListSectionHeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5D13FA561AF99C2100F06492 /* PageListSectionHeaderView.xib */; }; FABB20242602FC2C00C8785C /* JetpackScanThreatDetailsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = FA7AA4A625BFE0A9005E7200 /* JetpackScanThreatDetailsViewController.xib */; }; FABB20252602FC2C00C8785C /* CollabsableHeaderFilterCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 469EB16424D8B12700C764CB /* CollabsableHeaderFilterCollectionViewCell.xib */; }; FABB20262602FC2C00C8785C /* ReplyTextView.xib in Resources */ = {isa = PBXBuildFile; fileRef = B54E1DEF1A0A7BAA00807537 /* ReplyTextView.xib */; }; @@ -4502,7 +4499,6 @@ FABB21982602FC2C00C8785C /* UIViewController+Notice.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F3EFCA2208E308900268758 /* UIViewController+Notice.swift */; }; FABB21992602FC2C00C8785C /* GutenbergFileUploadProcessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E0462152566938300EB98EF /* GutenbergFileUploadProcessor.swift */; }; FABB219A2602FC2C00C8785C /* EventLoggingDataProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = F913BB0F24B3C5CE00C19032 /* EventLoggingDataProvider.swift */; }; - FABB219B2602FC2C00C8785C /* PageListSectionHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B93856D22DC08060010BF02 /* PageListSectionHeaderView.swift */; }; FABB219C2602FC2C00C8785C /* InviteLinks+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = E690F6ED25E05D170015A777 /* InviteLinks+CoreDataClass.swift */; }; FABB219D2602FC2C00C8785C /* Page+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59E1D46D1CEF77B500126697 /* Page+CoreDataProperties.swift */; }; FABB219F2602FC2C00C8785C /* RegisterDomainSectionHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 43D74AD520FB5AD5004AD934 /* RegisterDomainSectionHeaderView.swift */; }; @@ -7197,7 +7193,6 @@ 59FBD5611B5684F300734466 /* ThemeServiceTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ThemeServiceTests.m; sourceTree = ""; }; 5C1CEB34870A8BA1ED1E502B /* Pods-WordPressUITests.release-alpha.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WordPressUITests.release-alpha.xcconfig"; path = "../Pods/Target Support Files/Pods-WordPressUITests/Pods-WordPressUITests.release-alpha.xcconfig"; sourceTree = ""; }; 5D1181E61B4D6DEB003F3084 /* WPStyleGuide+Reader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "WPStyleGuide+Reader.swift"; sourceTree = ""; }; - 5D13FA561AF99C2100F06492 /* PageListSectionHeaderView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PageListSectionHeaderView.xib; sourceTree = ""; }; 5D146EB9189857ED0068FDC6 /* FeaturedImageViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FeaturedImageViewController.h; sourceTree = ""; usesTabs = 0; }; 5D146EBA189857ED0068FDC6 /* FeaturedImageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FeaturedImageViewController.m; sourceTree = ""; usesTabs = 0; }; 5D1D04731B7A50B100CDE646 /* Reader.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Reader.storyboard; sourceTree = ""; }; @@ -7796,7 +7791,6 @@ 8B8FE8562343952B00F9AD2E /* PostAutoUploadMessages.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostAutoUploadMessages.swift; sourceTree = ""; }; 8B92D69527CD51FA001F5371 /* DashboardGhostCardCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DashboardGhostCardCell.swift; sourceTree = ""; }; 8B93412E257029F50097D0AC /* FilterChipButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FilterChipButton.swift; sourceTree = ""; }; - 8B93856D22DC08060010BF02 /* PageListSectionHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PageListSectionHeaderView.swift; sourceTree = ""; }; 8B9E15DAF3E1A369E9BE3407 /* Pods-WordPressUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WordPressUITests.release.xcconfig"; path = "../Pods/Target Support Files/Pods-WordPressUITests/Pods-WordPressUITests.release.xcconfig"; sourceTree = ""; }; 8BA125EA27D8F5E4008B779F /* UIView+PinSubviewPriority.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+PinSubviewPriority.swift"; sourceTree = ""; }; 8BA77BCA2482C52A00E1EBBF /* ReaderCardDiscoverAttributionView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ReaderCardDiscoverAttributionView.xib; sourceTree = ""; }; @@ -12984,8 +12978,6 @@ children = ( 0C700B852AE1E1300085C2EE /* PageListCell.swift */, 0C700B882AE1E1940085C2EE /* PageListItemViewModel.swift */, - 8B93856D22DC08060010BF02 /* PageListSectionHeaderView.swift */, - 5D13FA561AF99C2100F06492 /* PageListSectionHeaderView.xib */, 834A49D12A0C23A90042ED3D /* TemplatePageTableViewCell.swift */, ); name = Views; @@ -19729,7 +19721,6 @@ FE015BB12ADA002400F50D7F /* ReaderTopicsNewCardCell.xib in Resources */, 8BA77BCD248340CE00E1EBBF /* ReaderDetailToolbar.xib in Resources */, 4070D75C20E5F55A007CEBDA /* RewindStatusTableViewCell.xib in Resources */, - 5D13FA571AF99C2100F06492 /* PageListSectionHeaderView.xib in Resources */, 1761F18D26209AEE000815EF /* hot-pink-icon-app-76x76.png in Resources */, FA7AA4A725BFE0A9005E7200 /* JetpackScanThreatDetailsViewController.xib in Resources */, 469EB16624D8B12700C764CB /* CollabsableHeaderFilterCollectionViewCell.xib in Resources */, @@ -20267,7 +20258,6 @@ F46597FD28E66A1100D5F49A /* white-on-black-icon-app-60@2x.png in Resources */, FABB20212602FC2C00C8785C /* ReaderDetailToolbar.xib in Resources */, FABB20222602FC2C00C8785C /* RewindStatusTableViewCell.xib in Resources */, - FABB20232602FC2C00C8785C /* PageListSectionHeaderView.xib in Resources */, 8091019629078CFE00FCB4EA /* JetpackFullscreenOverlayViewController.xib in Resources */, 98DCF4A8275945E00008630F /* ReaderDetailNoCommentCell.xib in Resources */, FABB20242602FC2C00C8785C /* JetpackScanThreatDetailsViewController.xib in Resources */, @@ -21785,7 +21775,6 @@ C3B554512965C32A00A04753 /* MenusViewController+JetpackBannerViewController.swift in Sources */, 1E0462162566938300EB98EF /* GutenbergFileUploadProcessor.swift in Sources */, F913BB1024B3C5CE00C19032 /* EventLoggingDataProvider.swift in Sources */, - 8B93856E22DC08060010BF02 /* PageListSectionHeaderView.swift in Sources */, E690F6EF25E05D180015A777 /* InviteLinks+CoreDataClass.swift in Sources */, 59E1D46F1CEF77B500126697 /* Page+CoreDataProperties.swift in Sources */, C373D6E728045281008F8C26 /* SiteIntentData.swift in Sources */, @@ -24691,7 +24680,6 @@ F4CBE3D7292597E3004FFBB6 /* SupportTableViewControllerConfiguration.swift in Sources */, FABB21992602FC2C00C8785C /* GutenbergFileUploadProcessor.swift in Sources */, FABB219A2602FC2C00C8785C /* EventLoggingDataProvider.swift in Sources */, - FABB219B2602FC2C00C8785C /* PageListSectionHeaderView.swift in Sources */, FABB219C2602FC2C00C8785C /* InviteLinks+CoreDataClass.swift in Sources */, 809101992908DE8500FCB4EA /* JetpackFullscreenOverlayViewModel.swift in Sources */, FABB219D2602FC2C00C8785C /* Page+CoreDataProperties.swift in Sources */, From 54b6b934028efbaad27a97af04b097fcf2cf42b0 Mon Sep 17 00:00:00 2001 From: kean Date: Sat, 4 May 2024 11:36:59 -0400 Subject: [PATCH 6/6] Update footer --- RELEASE-NOTES.txt | 1 + .../Revisions/RevisionsTableViewController.swift | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index 8da42bb3cd69..d138674d290c 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -5,6 +5,7 @@ * [*] Make it easier to "Share" and "Blaze" a published post with an updated success view [##23128] * [*] Add support for viewing trashed posts and pages and restoring them from the editor [#23142] * [*] Update the "More" menu in the Editor to use modern iOS design and update copy to match Gutenberg [#23145] +* [*] Update the "Revisions" list design and fix an issue with the footer displaying incorrect "Date Created" for drafts [#23145] 24.8 ----- diff --git a/WordPress/Classes/ViewRelated/Post/Revisions/RevisionsTableViewController.swift b/WordPress/Classes/ViewRelated/Post/Revisions/RevisionsTableViewController.swift index 4b087cfc5a8f..c5e40da78f4c 100644 --- a/WordPress/Classes/ViewRelated/Post/Revisions/RevisionsTableViewController.swift +++ b/WordPress/Classes/ViewRelated/Post/Revisions/RevisionsTableViewController.swift @@ -1,3 +1,5 @@ +import UIKit + class RevisionsTableViewController: UITableViewController { typealias RevisionLoadedBlock = (AbstractPost) -> Void @@ -76,7 +78,9 @@ private extension RevisionsTableViewController { refreshControl.addTarget(self, action: #selector(refreshRevisions), for: .valueChanged) self.refreshControl = refreshControl - tableView.tableFooterView = tableViewFooter + if post?.original().isStatus(in: [.draft, .pending]) == false { + tableView.tableFooterView = tableViewFooter + } tableView.separatorColor = .divider WPStyleGuide.configureColors(view: view, tableView: tableView) @@ -230,7 +234,11 @@ extension RevisionsTableViewController: WPTableViewHandlerDelegate { } override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { - tableViewHandler.resultsController?.sections?[section].name + guard let sections = tableViewHandler.resultsController?.sections, + sections.indices.contains(section) else { + return nil + } + return sections[section].name } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { @@ -303,7 +311,7 @@ private extension Date { private static let shortDateFormatter: DateFormatter = { let formatter = DateFormatter() - formatter.dateStyle = .short + formatter.dateStyle = .medium formatter.timeStyle = .none return formatter }()