Skip to content

feat: add support for custom async condition before showing review dialog#18

Open
benco8186 wants to merge 5 commits into
eeoom:mainfrom
benco8186:main
Open

feat: add support for custom async condition before showing review dialog#18
benco8186 wants to merge 5 commits into
eeoom:mainfrom
benco8186:main

Conversation

@benco8186

Copy link
Copy Markdown

📌 Description

This PR adds support for custom asynchronous conditions before displaying the in-app review dialog using InAppReviewManager.

Developers can now register app-specific conditions (e.g., minimum score, feature usage, session count) that must return true before the rating dialog is shown. This provides greater flexibility and control over when and how to prompt users for reviews.

✅ What's Included

- New method:
addCustomConditionBeforeShowDialog(AsyncValueGetter condition)
Allows registering async conditions to be evaluated before triggering the dialog.

- New private method:
_checkCustomConditions()
Executes all added conditions before allowing the dialog to appear.
Integration into _shouldShowRateDialog() logic.

🧪 How to Use

InAppReviewManager()
  ..addCustomConditionBeforeShowDialog(() async {
    return await myCustomLogic(); // returns true or false
  });

🔍 Notes

All custom conditions are evaluated in order.

If any condition returns false, the review dialog will not be shown.

Maintains method chaining and backward compatibility.

Let me know if you want to include screenshots, test results, or additional usage examples!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants