Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0e2899c4 authored by Philipp Heckel's avatar Philipp Heckel
Browse files

Remove in-app rating; replace with Google Play link

parent 04c4bc2d
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -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'
}
+0 −7
Original line number Diff line number Diff line
package io.heckel.ntfy.util

import android.app.Activity

fun rateApp(activity: Activity) {
    // Dummy to keep F-Droid flavor happy
}
+6 −1
Original line number Diff line number Diff line
@@ -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 -> {
+0 −16
Original line number Diff line number Diff line
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)
        }
    }
}