larryaasen / upgrader

A Flutter package for prompting users to upgrade when there is a newer version of the app in the store.
MIT License
547 stars 268 forks source link

[Question] Does the update dialog show once in the application lifecycle or everytime I want? #272

Closed phamquoctrongnta closed 1 year ago

phamquoctrongnta commented 1 year ago

Firstly, sorry because my English is not good. I have a question: Does the update dialog show once in the application lifecycle or everytime I want? Is there a limit to the number of impressions per day? If it will show up everytime I want what function do I need to use? @larryaasen Sorry for mentioning you. Thank you!

dwzrlp commented 1 year ago

For me it only shows once and I need to force quit the app and reopen it for it to show again.

larryaasen commented 1 year ago

Look at the README for this parameter: durationUntilAlertAgain.

dwzrlp commented 1 year ago

thank you for your reply. What I want to talk about is not a matter of durationUntilAlertAgain, but when the application is not completely exited and is still in the background and then opened.

phamquoctrongnta commented 1 year ago

Look at the README for this parameter: durationUntilAlertAgain.

Thank for response. My mean is how do I call check new version everytime I want? For example, the Upgrader().checkNewVersion() function.

ChauCM commented 1 year ago

yes, a function that programmatically checks the new version is very much needed, especially for a device that uses for a specific app that never close.

larryaasen commented 1 year ago

This might work with the existing code:

final upgrader = Upgrader(debugLogging: true);
await upgrader.initialize();
final shouldDisplay = upgrader.shouldDisplayUpgrade();

You could also call checkVersion() instead of shouldDisplayUpgrade() to display an alert if needed like this:

final upgrader = Upgrader(debugLogging: true);
await upgrader.initialize();
upgrader.checkVersion(context: context);
larryaasen commented 1 year ago

I have a fix for this issue now. Look at this version preview version: 8.0.0-alpha.1

larryaasen commented 1 year ago

The original fix was not working, so I made another fix and released it in this version: 8.0.0-alpha.2