diff --git a/firefox-ios/Client/Frontend/Settings/Main/AppSettingsTableViewController.swift b/firefox-ios/Client/Frontend/Settings/Main/AppSettingsTableViewController.swift index 8e0f6f8dd2513..1e078958162bb 100644 --- a/firefox-ios/Client/Frontend/Settings/Main/AppSettingsTableViewController.swift +++ b/firefox-ios/Client/Frontend/Settings/Main/AppSettingsTableViewController.swift @@ -44,6 +44,7 @@ class AppSettingsTableViewController: SettingsTableViewController, DebugSettingsDelegate, SearchBarLocationProvider, SharedSettingsDelegate { + // MARK: - Properties private var showDebugSettings = false private var debugSettingsClickCount: Int = 0 @@ -137,7 +138,7 @@ class AppSettingsTableViewController: SettingsTableViewController, case .creditCard: authenticateUserFor(route: route) case .rateApp: - RatingPromptManager.goToAppStoreReview() + interceptNegativeReviews() default: break } @@ -153,7 +154,24 @@ class AppSettingsTableViewController: SettingsTableViewController, } } - // MARK: - User Authentication + // MARK: Ecosia + + private func interceptNegativeReviews() { + let rateAction = UIAlertAction(title: .localized(.settingsRatingPromptYes), style: .default) { _ in + UIApplication.shared.open(Environment.current.urlProvider.storeWriteReviewPage) + } + + let helpAction = UIAlertAction(title: .localized(.settingsRatingPromptNo), style: .destructive) { [weak self] _ in + self?.settingsDelegate?.settingsOpenURLInNewTab(Environment.current.urlProvider.helpPage) + } + + let alertController = UIAlertController(title: .localized(.settingsRatingPromptTitle), message: nil, preferredStyle: .alert) + alertController.addAction(rateAction) + alertController.addAction(helpAction) + present(alertController, animated: true) + } + + // MARK: - User AutheSntication // Authenticates the user prior to allowing access to sensitive sections private func authenticateUserFor(route: Route.SettingsSection) { @@ -387,6 +405,8 @@ class AppSettingsTableViewController: SettingsTableViewController, } private func getAboutSettings() -> [SettingSection] { + + let aboutSettings = [ AppStoreReviewSetting(settingsDelegate: parentCoordinator), VersionSetting(settingsDelegate: self), diff --git a/firefox-ios/Ecosia/Core/Environment/URLProvider.swift b/firefox-ios/Ecosia/Core/Environment/URLProvider.swift index af92a1c105bc4..e5a95f06b9c43 100644 --- a/firefox-ios/Ecosia/Core/Environment/URLProvider.swift +++ b/firefox-ios/Ecosia/Core/Environment/URLProvider.swift @@ -152,6 +152,17 @@ public enum URLProvider { return URL(string: "https://ecosia.typeform.com/to/LlUGlFT9")! } } + + public var helpPage: URL { + switch Language.current { + case .de: + return URL(string: "https://de.support.ecosia.org/category/695-ecosia-ios-app")! + case .fr: + return URL(string: "https://fr.support.ecosia.org/category/805-ecosia-ios-app")! + default: + return URL(string: "https://support.ecosia.org/category/827-ecosia-ios-app")! + } + } public var notifications: URL { var components = URLComponents(url: URL(string: "https://api.ecosia.org/v1/notifications")!, resolvingAgainstBaseURL: false)! @@ -162,4 +173,8 @@ public enum URLProvider { ] return components.url! } + + public var storeWriteReviewPage: URL { + URL(string: "https://itunes.apple.com/app/id1474845552/action=write-review")! + } } diff --git a/firefox-ios/Ecosia/L10N/String.swift b/firefox-ios/Ecosia/L10N/String.swift index 8a4c8cbf0bdd4..b5dad5bdfebd6 100644 --- a/firefox-ios/Ecosia/L10N/String.swift +++ b/firefox-ios/Ecosia/L10N/String.swift @@ -233,7 +233,7 @@ extension String { case defaultBrowserCardDetailInstructionStep2 = "Select **Default Browser App**" case defaultBrowserCardDetailInstructionStep3 = "Choose **Ecosia**" case defaultBrowserCardDetailButton = "Make default in settings" - + // MARK: - Feedback View case reportIssue = "Report an issue" case helpCenter = "Help Center" @@ -242,5 +242,8 @@ extension String { case send = "Send" case close = "Close" case thankYouForYourFeedback = "Thank you for your feedback!" + case settingsRatingPromptTitle = "Do you enjoy Ecosia?" + case settingsRatingPromptYes = "Yes" + case settingsRatingPromptNo = "No" } }