britannio / in_app_review

A Flutter plugin for showing the In-App Review/System Rating pop up on Android, IOS, and MacOS. It makes it easy for users to rate your app.
306 stars 78 forks source link

Fallback to openStoreListing if the requestReview does not work #30

Closed IAmSarthakVerma closed 3 years ago

IAmSarthakVerma commented 3 years ago

There should be a parameter to set the fallback to open store listing if the requestReview function does not work because of the quota enforced by the underlying API.

Or the requestReview function should return a boolean value instead of void so that we can know if the requestReview was a success or not and can call openStoreListing in case the requestReview was unsuccessful.

IAmSarthakVerma commented 3 years ago

@britannio Can you take a look at this?

britannio commented 3 years ago

@IAmSarthakVerma Hey, unfortunately, there's no way for this plugin to determine that the aforementioned quota has been exceeded. It's a limitation of the underlying API that's present to deter misuse of the API.

IAmSarthakVerma commented 3 years ago

@britannio Can we not add a callback for android like this:

manager = ReviewManagerFactory.create(this);

private void Review(){
    manager.requestReviewFlow().addOnCompleteListener(new OnCompleteListener<ReviewInfo>() {
        @Override
        public void onComplete(@NonNull Task<ReviewInfo> task) {
            if(task.isSuccessful()){
                reviewInfo = task.getResult();
                manager.launchReviewFlow(MainActivity.this, reviewInfo).addOnFailureListener(new OnFailureListener() {
                    @Override
                    public void onFailure(Exception e) {
                        Toast.makeText(MainActivity.this, "Rating Failed", Toast.LENGTH_SHORT).show();
                    }
                }).addOnCompleteListener(new OnCompleteListener<Void>() {
                    @Override
                    public void onComplete(@NonNull Task<Void> task) {
                        Toast.makeText(MainActivity.this, "Review Completed, Thank You!", Toast.LENGTH_SHORT).show();
                    }
                });
            }

        }
    }).addOnFailureListener(new OnFailureListener() {
        @Override
        public void onFailure(Exception e) {
            Toast.makeText(MainActivity.this, "In-App Request Failed", Toast.LENGTH_SHORT).show();
        }
    });
}

Will the addOnFailureListener not work for this use ?

britannio commented 3 years ago

I don't think so according to https://developer.android.com/guide/playcore/in-app-review/kotlin-java#launch-review-flow

IAmSarthakVerma commented 3 years ago

Okay, thanks!!! Closing this issue.

Fethi-Hamdani commented 2 years ago

but why future timeout doesn't work, isn't supposed to run the given function (open store listing) when the future cross the given duration

britannio commented 2 years ago

but why future timeout doesn't work, isn't supposed to run the given function (open store listing) when the future cross the given duration

The underlying APIs cannot be used to determine if requestReview() doesn't show the rating dialog so asynchronous Dart solutions like Future won't help.