|
|
|
@ -7,7 +7,6 @@ package org.mozilla.fenix.components
|
|
|
|
|
import android.app.Activity
|
|
|
|
|
import android.content.Context
|
|
|
|
|
import androidx.annotation.VisibleForTesting
|
|
|
|
|
import com.google.android.play.core.review.ReviewManagerFactory
|
|
|
|
|
import kotlinx.coroutines.Dispatchers.Main
|
|
|
|
|
import kotlinx.coroutines.withContext
|
|
|
|
|
import org.mozilla.fenix.utils.Settings
|
|
|
|
@ -44,17 +43,7 @@ class ReviewPromptController(
|
|
|
|
|
private val context: Context,
|
|
|
|
|
private val reviewSettings: ReviewSettings,
|
|
|
|
|
private val timeNowInMillis: () -> Long = { System.currentTimeMillis() },
|
|
|
|
|
private val tryPromptReview: suspend (Activity) -> Unit = { activity ->
|
|
|
|
|
val manager = ReviewManagerFactory.create(context)
|
|
|
|
|
val flow = manager.requestReviewFlow()
|
|
|
|
|
|
|
|
|
|
withContext(Main) {
|
|
|
|
|
flow.addOnCompleteListener {
|
|
|
|
|
if (it.isSuccessful) {
|
|
|
|
|
manager.launchReviewFlow(activity, it.result)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private val tryPromptReview: suspend (Activity) -> Unit = { _ ->
|
|
|
|
|
}
|
|
|
|
|
) {
|
|
|
|
|
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
|
|
|
|
|