Skip to content

Commit 3234674

Browse files
[MOB-1589] Configured user prompt
[MOB-1589] MOB-1589: App Store rating prompt improvements
1 parent 543163b commit 3234674

File tree

4 files changed

+59
-2
lines changed

4 files changed

+59
-2
lines changed

firefox-ios/Client/Frontend/Settings/Main/AppSettingsTableViewController.swift

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ class AppSettingsTableViewController: SettingsTableViewController,
4444
DebugSettingsDelegate,
4545
SearchBarLocationProvider,
4646
SharedSettingsDelegate {
47+
48+
enum activityType: String {
49+
case openURL = "org.mozilla.ios.Firefox.newTab"
50+
}
51+
4752
// MARK: - Properties
4853
private var showDebugSettings = false
4954
private var debugSettingsClickCount: Int = 0
@@ -137,7 +142,7 @@ class AppSettingsTableViewController: SettingsTableViewController,
137142
case .creditCard:
138143
authenticateUserFor(route: route)
139144
case .rateApp:
140-
RatingPromptManager.goToAppStoreReview()
145+
interceptNegativeReviews()
141146
default:
142147
break
143148
}
@@ -153,7 +158,25 @@ class AppSettingsTableViewController: SettingsTableViewController,
153158
}
154159
}
155160

156-
// MARK: - User Authentication
161+
// MARK: Ecosia
162+
163+
private func interceptNegativeReviews() {
164+
let rateAction = UIAlertAction(title: .localized("Yes"), style: .default) { _ in
165+
RatingPromptManager.goToAppStoreReview()
166+
}
167+
168+
let helpAction = UIAlertAction(title: .localized("No"), style: .destructive) { _ in
169+
let helpActivity = NSUserActivity(activityType: activityType.openURL.rawValue)
170+
// TODO: open help page
171+
}
172+
173+
let alertController = UIAlertController(title: .SettingsRatingPromptTitle, message: nil, preferredStyle: .alert)
174+
alertController.addAction(rateAction)
175+
alertController.addAction(helpAction)
176+
present(alertController, animated: true)
177+
}
178+
179+
// MARK: - User AutheSntication
157180

158181
// Authenticates the user prior to allowing access to sensitive sections
159182
private func authenticateUserFor(route: Route.SettingsSection) {
@@ -387,6 +410,8 @@ class AppSettingsTableViewController: SettingsTableViewController,
387410
}
388411

389412
private func getAboutSettings() -> [SettingSection] {
413+
414+
390415
let aboutSettings = [
391416
AppStoreReviewSetting(settingsDelegate: parentCoordinator),
392417
VersionSetting(settingsDelegate: self),

firefox-ios/Client/Frontend/Strings.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2829,6 +2829,21 @@ extension String {
28292829
tableName: "Settings",
28302830
value: "Addresses",
28312831
comment: "Label used as an item in Settings screen. When touched, it will take user to address autofill settings page to that will allow user to add or modify saved addresses to allow for autofill in a webpage.")
2832+
public static let SettingsRatingPromptTitle = MZLocalizedString(
2833+
key: "Settings.RatingPrompt.Title",
2834+
tableName: "Settings",
2835+
value: "Do you enjoy Ecosia?",
2836+
comment: "This is what we prompt our users if they hit the rate button from within the settings")
2837+
public static let SettingsRatingPromptYes = MZLocalizedString(
2838+
key: "Settings.RatingPrompt.Yes",
2839+
tableName: "Settings",
2840+
value: "Yes",
2841+
comment: "When hit will redirect the user to rate the app on the app store")
2842+
public static let SettingsRatingPromptNo = MZLocalizedString(
2843+
key: "Settings.RatingPrompt.No",
2844+
tableName: "Settings",
2845+
value: "No",
2846+
comment: "Used to indicate the user does not like ecosia and will redirect them to our help pages")
28322847
}
28332848

28342849
// MARK: - Error pages

firefox-ios/Ecosia/Core/Environment/URLProvider.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,15 @@ public enum URLProvider {
155155
]
156156
return components.url!
157157
}
158+
159+
public var storePage: URL {
160+
switch Language.current {
161+
case .de:
162+
return URL(string: "https://apps.apple.com/de/app/ecosia/id1474845552")!
163+
case .fr:
164+
return URL(string: "https://apps.apple.com/fr/app/ecosia/id1474845552")!
165+
default:
166+
return URL(string: "https://apps.apple.com/us/app/ecosia/id1474845552")!
167+
}
168+
}
158169
}

firefox-ios/Ecosia/L10N/en.lproj/Ecosia.strings

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@
6565
"Show on homepage" = "Show on homepage";
6666
"Top Sites" = "Top Sites";
6767
"Not now" = "Not now";
68+
"Do you enjoy Ecosia?" = "Do you enjoy Ecosia?";
69+
"Yes" = "Yes";
70+
"No" = "No";
6871

6972
// Impact
7073
"A friend accepted your invitation and each of you will help plant 1 tree!" = "A friend has accepted your invite! You have each helped plant 1 extra tree.";
@@ -227,3 +230,6 @@
227230
"Select **Default Browser App**" = "Select **Default Browser App**";
228231
"Choose **Ecosia**" = "Choose **Ecosia**";
229232
"Make default in settings" = "Make default in settings";
233+
"Do you enjoy Ecosia?" = "Do you enjoy Ecosia?";
234+
"Yes" = "Yes";
235+
"No" = "No";

0 commit comments

Comments
 (0)