diff --git a/app/src/main/java/fr/free/nrw/commons/AboutActivity.kt b/app/src/main/java/fr/free/nrw/commons/AboutActivity.kt index 9603210cd..3748ac264 100644 --- a/app/src/main/java/fr/free/nrw/commons/AboutActivity.kt +++ b/app/src/main/java/fr/free/nrw/commons/AboutActivity.kt @@ -1,8 +1,11 @@ package fr.free.nrw.commons import android.annotation.SuppressLint +import android.content.ActivityNotFoundException import android.content.Intent +import android.content.Intent.ACTION_VIEW import android.net.Uri +import android.net.Uri.parse import android.os.Bundle import android.view.Menu import android.view.MenuItem @@ -16,7 +19,9 @@ import fr.free.nrw.commons.theme.BaseActivity import fr.free.nrw.commons.utils.ConfigUtils.getVersionNameWithSha import fr.free.nrw.commons.utils.DialogUtil.showAlertDialog import fr.free.nrw.commons.utils.Utils +import fr.free.nrw.commons.utils.Utils.handleWebUrl import java.util.Collections +import androidx.core.net.toUri /** * Represents about screen of this app @@ -131,7 +136,16 @@ class AboutActivity : BaseActivity() { } fun launchRatings(view: View?) { - Utils.rateApp(this) + try { + startActivity( + Intent( + ACTION_VIEW, + (Urls.PLAY_STORE_PREFIX + packageName).toUri() + ) + ) + } catch (_: ActivityNotFoundException) { + handleWebUrl(this, (Urls.PLAY_STORE_URL_PREFIX + packageName).toUri()) + } } fun launchCredits(view: View?) { diff --git a/app/src/main/java/fr/free/nrw/commons/utils/Utils.java b/app/src/main/java/fr/free/nrw/commons/utils/Utils.java index 102f2a55a..30ea7157d 100644 --- a/app/src/main/java/fr/free/nrw/commons/utils/Utils.java +++ b/app/src/main/java/fr/free/nrw/commons/utils/Utils.java @@ -16,7 +16,6 @@ import androidx.browser.customtabs.CustomTabsIntent; import androidx.core.content.ContextCompat; import fr.free.nrw.commons.R; -import fr.free.nrw.commons.Urls; import java.util.Calendar; import java.util.Date; @@ -57,20 +56,6 @@ public class Utils { return title; } - /** - * Launches intent to rate app - * @param context - */ - public static void rateApp(Context context) { - final String appPackageName = context.getPackageName(); - try { - context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(Urls.PLAY_STORE_PREFIX + appPackageName))); - } - catch (android.content.ActivityNotFoundException anfe) { - handleWebUrl(context, Uri.parse(Urls.PLAY_STORE_URL_PREFIX + appPackageName)); - } - } - /** * Opens Custom Tab Activity with in-app browser for the specified URL. * Launches intent for web URL