Skip to content

[517] Add checkOnResume to stop the version check on app resume - #556

Merged
larryaasen merged 1 commit into
larryaasen:mainfrom
tologonkudaiberdiuulu:issue-517-check-on-resume
Jul 23, 2026
Merged

[517] Add checkOnResume to stop the version check on app resume#556
larryaasen merged 1 commit into
larryaasen:mainfrom
tologonkudaiberdiuulu:issue-517-check-on-resume

Conversation

@tologonkudaiberdiuulu

Copy link
Copy Markdown

Fixes #517.

Problem

Upgrader registers itself as a WidgetsBindingObserver during initialize(), and didChangeAppLifecycleState unconditionally called updateVersionInfo() on every AppLifecycleState.resumed event. That means a network request to the App Store / Play Store every time the app returns from the background, with no way to turn it off.

As noted in the issue, this is unrelated to durationUntilAlertAgain, which only controls how often the alert is displayed, not how often the version info is retrieved. The two are now decoupled.

Change

Added a checkOnResume parameter to Upgrader, defaulting to true, so existing behavior is unchanged. When false, the version info is only retrieved during initialize(), or when updateVersionInfo() is called directly.

Upgrader(checkOnResume: false)

The parameter is stored in UpgraderState, so it can also be changed at runtime:

upgrader.updateState(upgrader.state.copyWith(checkOnResume: false));

The observer is still registered in both cases; only the version check is skipped, and a debug log line is printed when debugLogging is enabled.

Tests

Two tests were added using a request counting MockClient:

  • default behavior still retrieves version info on resume
  • with checkOnResume: false, repeated resume/pause cycles make no additional requests, while the version info from initialize() remains available and shouldDisplayUpgrade() still returns true

flutter analyze is clean and all tests pass.

Upgrader retrieved the store version info on every AppLifecycleState.resumed
event, which made a network request each time the app returned from the
background. This was hardcoded and could not be turned off, and was unrelated
to durationUntilAlertAgain, which only controls how often the alert is shown.

Added the checkOnResume parameter, defaulting to true, so the existing
behavior is unchanged. When false, the version info is only retrieved during
initialize(), or when updateVersionInfo() is called directly.
@larryaasen
larryaasen merged commit 0227151 into larryaasen:main Jul 23, 2026
7 checks passed
@larryaasen larryaasen added 13.6.0 and removed 13.6.0 labels Jul 23, 2026
@larryaasen larryaasen added this to the 13.6.0 milestone Jul 23, 2026
@larryaasen larryaasen added the enhancement New feature or request label Jul 23, 2026
@larryaasen

Copy link
Copy Markdown
Owner

Thanks for this PR. It has been approved and released on pub.dev

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrader makes network requests every time the app is resumed

2 participants