diff --git a/app/build.gradle b/app/build.gradle index a794e8f..e428eda 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,8 +12,8 @@ android { minSdkVersion 21 targetSdkVersion 30 - versionCode 17 - versionName "1.7.0" + versionCode 18 + versionName "1.7.1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" @@ -98,7 +98,4 @@ dependencies { // Image viewer implementation 'com.github.stfalcon-studio:StfalconImageViewer:v1.0.1' - - // For "Rate this app" menu item (Google Play only) - playImplementation 'com.google.android.play:core-ktx:1.8.1' } diff --git a/app/src/fdroid/java/io/heckel/ntfy/util/RateHelper.kt b/app/src/fdroid/java/io/heckel/ntfy/util/RateHelper.kt deleted file mode 100644 index a83273e..0000000 --- a/app/src/fdroid/java/io/heckel/ntfy/util/RateHelper.kt +++ /dev/null @@ -1,7 +0,0 @@ -package io.heckel.ntfy.util - -import android.app.Activity - -fun rateApp(activity: Activity) { - // Dummy to keep F-Droid flavor happy -} diff --git a/app/src/main/java/io/heckel/ntfy/ui/MainActivity.kt b/app/src/main/java/io/heckel/ntfy/ui/MainActivity.kt index 325cf3c..e9b0e83 100644 --- a/app/src/main/java/io/heckel/ntfy/ui/MainActivity.kt +++ b/app/src/main/java/io/heckel/ntfy/ui/MainActivity.kt @@ -3,6 +3,7 @@ package io.heckel.ntfy.ui import android.animation.Animator import android.animation.AnimatorListenerAdapter import android.app.AlertDialog +import android.content.ActivityNotFoundException import android.content.Intent import android.net.Uri import android.os.Build @@ -300,7 +301,11 @@ class MainActivity : AppCompatActivity(), ActionMode.Callback, AddFragment.Subsc true } R.id.main_menu_rate -> { - rateApp(this) + try { + startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=$packageName"))) + } catch (e: ActivityNotFoundException) { + startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=$packageName"))) + } true } R.id.main_menu_docs -> { diff --git a/app/src/play/java/io/heckel/ntfy/util/RateHelper.kt b/app/src/play/java/io/heckel/ntfy/util/RateHelper.kt deleted file mode 100644 index dfcca8b..0000000 --- a/app/src/play/java/io/heckel/ntfy/util/RateHelper.kt +++ /dev/null @@ -1,16 +0,0 @@ -package io.heckel.ntfy.util - -import android.app.Activity -import com.google.android.play.core.review.ReviewManagerFactory -import io.heckel.ntfy.log.Log - -// Open the in-app rate dialog, see https://developer.android.com/guide/playcore/in-app-review/kotlin-java -fun rateApp(activity: Activity) { - val manager = ReviewManagerFactory.create(activity) - val request = manager.requestReviewFlow() - request.addOnCompleteListener { task -> - if (task.isSuccessful) { - manager.launchReviewFlow(activity, task.result) - } - } -}