Skip to content

Commit

Permalink
Merge pull request #20276 from wordpress-mobile/fix/app-ratings-prompt
Browse files Browse the repository at this point in the history
Improve Formatting and Text of In-App Feedback Survey
  • Loading branch information
twstokes authored Mar 17, 2023
2 parents 3dfbb57 + 0ee205b commit cd434a2
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 10 deletions.
2 changes: 2 additions & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
* [*] [internal] Refactored updating user role in the "People" screen on the "My Sites" tab. [#20244]
* [*] [internal] Refactor managing social connections and social buttons in the "Sharing" screen. [#20265]
* [*] [internal] Refactor uploading media assets. [#20294]
* [*] Visual improvements were made to the in-app survey along with updated text to differentiate between the WordPress and Jetpack apps. [#20276]


21.9
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ extension AppConstants {
static let workWithUsURL = "https://make.wordpress.org/mobile/handbook"
}

struct AppRatings {
static let prompt = NSLocalizedString("appRatings.wordpress.prompt", value: "What do you think about WordPress?", comment: "This is the string we display when prompting the user to review the WordPress app")
}

struct PostSignUpInterstitial {
static let welcomeTitleText = NSLocalizedString("Welcome to WordPress", comment: "Post Signup Interstitial Title Text for WordPress iOS")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ extension NotificationsViewController {
static let contactURL = "https://support.wordpress.com/contact/"

func setupAppRatings() {
inlinePromptView.setupHeading(NSLocalizedString("What do you think about WordPress?",
comment: "This is the string we display when prompting the user to review the app"))
let yesTitle = NSLocalizedString("I Like It",
inlinePromptView.setupHeading(AppConstants.AppRatings.prompt)
let yesTitle = NSLocalizedString("notifications.appRatings.prompt.yes.buttonTitle", value: "I like it",
comment: "This is one of the buttons we display inside of the prompt to review the app")
let noTitle = NSLocalizedString("Could Be Better",
let noTitle = NSLocalizedString("notifications.appRatings.prompt.no.buttonTitle", value: "Could improve",
comment: "This is one of the buttons we display inside of the prompt to review the app")

inlinePromptView.setupYesButton(title: yesTitle) { [weak self] button in
Expand Down Expand Up @@ -54,9 +53,9 @@ extension NotificationsViewController {
UIView.animate(withDuration: 0.3) { [weak self] in
self?.inlinePromptView.setupHeading(NSLocalizedString("Could you tell us how we could improve?",
comment: "This is the text we display to the user when we ask them for a review and they've indicated they don't like the app"))
let yesTitle = NSLocalizedString("Send Feedback",
let yesTitle = NSLocalizedString("notifications.appRatings.sendFeedback.yes.buttonTitle", value: "Send feedback",
comment: "This is one of the buttons we display when prompting the user for a review")
let noTitle = NSLocalizedString("No Thanks",
let noTitle = NSLocalizedString("notifications.appRatings.sendFeedback.no.buttonTitle", value: "No thanks",
comment: "This is one of the buttons we display when prompting the user for a review")
self?.inlinePromptView.setupYesButton(title: yesTitle) { [weak self] button in
self?.gatherFeedback()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class AppFeedbackPromptView: UIView {
buttonStack.translatesAutoresizingMaskIntoConstraints = false
buttonStack.axis = .horizontal
buttonStack.spacing = LayoutConstants.buttonSpacing
buttonStack.isLayoutMarginsRelativeArrangement = true
addSubview(buttonStack)

// Yes Button
Expand All @@ -55,7 +56,7 @@ class AppFeedbackPromptView: UIView {
leftButton.accessibilityIdentifier = "yes-button"
buttonStack.addArrangedSubview(leftButton)

// Could be Better Button
// Could improve Button
rightButton.translatesAutoresizingMaskIntoConstraints = false
rightButton.backgroundColor = .secondaryButtonBackground
rightButton.borderWidth = 1.0
Expand All @@ -77,20 +78,23 @@ class AppFeedbackPromptView: UIView {
leftButton.removeTarget(nil, action: nil, for: .touchUpInside)
leftButton.setTitle(title, for: .normal)
leftButton.on(.touchUpInside, call: tapHandler)
evaluateStackAxisMode()
}

func setupNoButton(title: String, tapHandler: @escaping (UIControl) -> Void) {
rightButton.removeTarget(nil, action: nil, for: .touchUpInside)
rightButton.setTitle(title, for: .normal)
rightButton.on(.touchUpInside, call: tapHandler)
evaluateStackAxisMode()
}

override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
evaluateStackAxisMode()
}

buttonStack.axis = .horizontal
buttonStack.isLayoutMarginsRelativeArrangement = true

/// Evaluate the width of the buttons to determine if the stack view should go into vertical mode.
private func evaluateStackAxisMode() {
// measure the width of the view with the new font sizes to see if the buttons are too wide.
leftButton.updateFontSizeToMatchSystem()
rightButton.updateFontSizeToMatchSystem()
Expand Down
4 changes: 4 additions & 0 deletions WordPress/Jetpack/AppConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ extension AppConstants {
static let workWithUsURL = "https://automattic.com/work-with-us"
}

struct AppRatings {
static let prompt = NSLocalizedString("appRatings.jetpack.prompt", value: "What do you think about Jetpack?", comment: "This is the string we display when prompting the user to review the Jetpack app")
}

struct PostSignUpInterstitial {
static let welcomeTitleText = NSLocalizedString("Welcome to Jetpack", comment: "Post Signup Interstitial Title Text for Jetpack iOS")
}
Expand Down

0 comments on commit cd434a2

Please sign in to comment.