From 95e3c22063529837281a508bb7890f08576fed0a Mon Sep 17 00:00:00 2001 From: David Calhoun Date: Thu, 16 Jan 2025 14:38:06 -0500 Subject: [PATCH] feat: Send editor feedback (#23980) * feat: Send editor feedback Collecting feedback from users while in editor may uncover valuable insights. * docs: Add release note * feat: Prefix editor feedback with tag Indicate the context for feedback submissions originating from the editor. --- RELEASE-NOTES.txt | 1 + .../SubmitFeedbackViewController.swift | 12 ++++++++---- .../NewGutenberg/NewGutenbergViewController.swift | 8 ++++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index f22f21fbe12f..fda1969c75fc 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -46,6 +46,7 @@ * [*] Fix an issue with small tap area of the ellipsis in the post list [#23973] * [*] Avoid unexpectedly marking post content as unsaved. [#23969] * [*] Fix an issue with Mastodon connection not working [#23981] +* [**] Send feedback from within the experimental editor "more" options menu. [#23980] 25.6 ----- diff --git a/WordPress/Classes/Utility/In-App Feedback/SubmitFeedbackViewController.swift b/WordPress/Classes/Utility/In-App Feedback/SubmitFeedbackViewController.swift index 0129e0cf7c38..9808ef547e0f 100644 --- a/WordPress/Classes/Utility/In-App Feedback/SubmitFeedbackViewController.swift +++ b/WordPress/Classes/Utility/In-App Feedback/SubmitFeedbackViewController.swift @@ -4,9 +4,11 @@ import WordPressShared final class SubmitFeedbackViewController: UIViewController { private var source: String + private var feedbackPrefix: String? - init(source: String) { + init(source: String, feedbackPrefix: String? = nil) { self.source = source + self.feedbackPrefix = feedbackPrefix super.init(nibName: nil, bundle: nil) self.modalPresentationStyle = .formSheet } @@ -18,7 +20,7 @@ final class SubmitFeedbackViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - let viewController = UIHostingController(rootView: SubmitFeedbackView(presentingViewController: self, source: source)) + let viewController = UIHostingController(rootView: SubmitFeedbackView(presentingViewController: self, source: source, feedbackPrefix: feedbackPrefix)) let navigationController = UINavigationController(rootViewController: viewController) @@ -33,6 +35,7 @@ final class SubmitFeedbackViewController: UIViewController { private struct SubmitFeedbackView: View { weak var presentingViewController: UIViewController? let source: String + let feedbackPrefix: String? @State private var text = "" @State private var isSubmitting = false @@ -141,9 +144,10 @@ private struct SubmitFeedbackView: View { isSubmitting = true + let descriptionPrefix = feedbackPrefix.map { "[\($0)] " } ?? "" ZendeskUtils.sharedInstance.createNewRequest( in: presentingViewController, - description: text.trim(), + description: descriptionPrefix + text.trim(), tags: ["appreview_jetpack", "in_app_feedback"], attachments: attachmentsViewModel.attachments.compactMap(\.response), alertOptions: nil @@ -195,6 +199,6 @@ private enum Strings { #Preview { NavigationView { - SubmitFeedbackView(source: "preview") + SubmitFeedbackView(source: "preview", feedbackPrefix: nil) } } diff --git a/WordPress/Classes/ViewRelated/NewGutenberg/NewGutenbergViewController.swift b/WordPress/Classes/ViewRelated/NewGutenberg/NewGutenbergViewController.swift index c326d3ebeb96..466d07ece773 100644 --- a/WordPress/Classes/ViewRelated/NewGutenberg/NewGutenbergViewController.swift +++ b/WordPress/Classes/ViewRelated/NewGutenberg/NewGutenbergViewController.swift @@ -288,6 +288,10 @@ class NewGutenbergViewController: UIViewController, PostEditor, PublishingEditor guard let url = URL(string: "https://wordpress.com/support/wordpress-editor/") else { return } present(SFSafariViewController(url: url), animated: true) } + + func showFeedbackView() { + self.present(SubmitFeedbackViewController(source: "gutenberg_kit", feedbackPrefix: "Editor"), animated: true) + } } extension NewGutenbergViewController: GutenbergKit.EditorViewControllerDelegate { @@ -706,6 +710,9 @@ extension NewGutenbergViewController { actions.append(UIAction(title: helpTitle, image: UIImage(systemName: "questionmark.circle")) { [weak self] _ in self?.showEditorHelp() }) + actions.append(UIAction(title: Strings.sendFeedback, image: UIImage(systemName: "envelope")) { [weak self] _ in + self?.showFeedbackView() + }) return actions } @@ -745,6 +752,7 @@ private enum Strings { 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 sendFeedback = NSLocalizedString("postEditor.moreMenu.sendFeedback", value: "Send Feedback", comment: "Post Editor / Button in the 'More' menu") static let saveDraft = NSLocalizedString("postEditor.moreMenu.saveDraft", value: "Save Draft", 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)") }