Skip to content

Commit

Permalink
Fixes Skyost#76.
Browse files Browse the repository at this point in the history
  • Loading branch information
Skyost committed Sep 15, 2020
1 parent 56b00f0 commit 846ed47
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions android/src/main/kotlin/fr/skyost/rate_my_app/RateMyAppPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -166,21 +166,21 @@ public class RateMyAppPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
*/

private fun goToPlayStore(applicationId: String?): Int {
if (context == null) {
if (activity == null) {
return 2
}

val id: String = applicationId ?: context!!.applicationContext.packageName
val id: String = applicationId ?: activity!!.applicationContext.packageName

val marketIntent = Intent(Intent.ACTION_VIEW, Uri.parse("market:https://details?id=$id"))
if (marketIntent.resolveActivity(context!!.packageManager) != null) {
context!!.startActivity(marketIntent)
if (marketIntent.resolveActivity(activity!!.packageManager) != null) {
activity!!.startActivity(marketIntent)
return 0
}

val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=$id"))
if (browserIntent.resolveActivity(context!!.packageManager) != null) {
context!!.startActivity(browserIntent)
if (browserIntent.resolveActivity(activity!!.packageManager) != null) {
activity!!.startActivity(browserIntent)
return 1
}

Expand Down

0 comments on commit 846ed47

Please sign in to comment.