diff --git a/CHANGELOG.md b/CHANGELOG.md index 704bb98d6..166d37e25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - #2390 - Adds Onboarding for Fenix - #2531 - Adds link to privacy policy in settings - #225 - Adds the ability to delete all browsing data +- #2903 - Fixed crash when trying to rate the app on a devices without the play store app. ### Changed - #2673 - Fixed can't upload files using third party apps from the file manager. diff --git a/app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt b/app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt index 24e61d204..60364d67f 100644 --- a/app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt @@ -4,6 +4,7 @@ package org.mozilla.fenix.settings +import android.content.ActivityNotFoundException import android.content.Intent import android.net.Uri import android.os.Bundle @@ -154,7 +155,17 @@ class SettingsFragment : PreferenceFragmentCompat(), CoroutineScope, AccountObse ) } resources.getString(pref_key_rate) -> { - startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(SupportUtils.RATE_APP_URL))) + try { + startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(SupportUtils.RATE_APP_URL))) + } catch (e: ActivityNotFoundException) { + // Device without the play store installed. + // Opening the play store website. + (activity as HomeActivity).openToBrowserAndLoad( + searchTermOrURL = SupportUtils.FENIX_PLAY_STORE_URL, + newTab = true, + from = BrowserDirection.FromSettings + ) + } } resources.getString(pref_key_about) -> { navigateToAbout() diff --git a/app/src/main/java/org/mozilla/fenix/settings/SupportUtils.kt b/app/src/main/java/org/mozilla/fenix/settings/SupportUtils.kt index 9b3b4f48f..adfd62909 100644 --- a/app/src/main/java/org/mozilla/fenix/settings/SupportUtils.kt +++ b/app/src/main/java/org/mozilla/fenix/settings/SupportUtils.kt @@ -17,6 +17,7 @@ import java.util.Locale object SupportUtils { const val RATE_APP_URL = "market://details?id=" + BuildConfig.APPLICATION_ID const val MOZILLA_MANIFESTO_URL = "https://www.mozilla.org/en-GB/about/manifesto/" + const val FENIX_PLAY_STORE_URL = "https://play.google.com/store/apps/details?id=${BuildConfig.APPLICATION_ID}" val PRIVACY_NOTICE_URL: String get() = "https://www.mozilla.org/${getLanguageTag(Locale.getDefault())}/privacy/firefox/"