Skip to content

Conversation

anhappdev
Copy link
Collaborator

@anhappdev anhappdev commented Oct 5, 2025

Screenshot_1759668660

If users tap on "Update Now," they will be redirected to the app store page of the app, where they can tap on the update button to update the app.

Integrate the `upgrader` package to prompt users to update the app when a new version is available. Wrap the main application widget with `UpgradeAlert` to enable the update check functionality.
Allow the app to handle HTTPS URLs with specified actions and categories by adding intent filters in the AndroidManifest.xml.
Add version and build number display in the app drawer using the `package_info_plus` package. Include dynamic rendering through `FutureBuilder`.
@anhappdev anhappdev requested a review from a team as a code owner October 5, 2025 15:14
Copy link

github-actions bot commented Oct 5, 2025

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

@anhappdev anhappdev changed the title feat: prompting users to upgrade when newer app version released feat: prompting users to upgrade when newer app version available Oct 5, 2025
Copy link
Contributor

@farook-edev farook-edev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR only works with play store. Users who download the app from Github will still be prompted to go to the play store for updates.

@anhappdev anhappdev marked this pull request as draft October 6, 2025 04:15
@anhappdev
Copy link
Collaborator Author

This PR only works with play store. Users who download the app from Github will still be prompted to go to the play store for updates.

I'm not sure how to easily determine if the app is installed from an APK or from the Google Play Store (or other app stores). Therefore, we have two options:

  1. We can assume that the user installed the app from the Play Store and redirect them to it.
  2. Alternatively, we can omit the "Update Now" button and simply inform them that a new version is available.

I would prefer the second option. Is there any better option available?

@farook-edev
Copy link
Contributor

farook-edev commented Oct 6, 2025

Is there any better option available?

package_info_plus provides this parameter which tells you the ID of the store that installed the app. We can check if it's com.android.vending as mentioned here to confirm whether or not the app was installed via the PlayStore.

Once we know where the user installed the app from, we can either use the updater or a request to GitHub's API to get the latest version and set up the URL for the button.

What do you think @anhappdev?

Replace `UpgradeAlert` with a new `UpgradeDialog` widget to customize the "Update now" button functionality. Redirect users to the appropriate app store or GitHub Releases page based on the installer source.
@anhappdev
Copy link
Collaborator Author

@farook-edev Yes, the installerStore appears to be a suitable method for identifying the store. Thank you.

Adjust the "Update now" functionality to handle updates differently for Android by introducing a custom URL resolution method and preventing default behavior when the update action is handled.
Copy link

sonarqubecloud bot commented Oct 6, 2025

Copy link
Contributor

@farook-edev farook-edev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the couple items I noticed in the comments below, LGTM 🚀👍

child: Text(
versionText,
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: AppColors.drawerForeground.withOpacity(0.6),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO it would be best to avoid using non-opaque colors unless necessary. They're much more costly to render than simple 0xFF###### colors.


@override
Widget build(BuildContext context) {
final upgrader = Upgrader(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A nice to have here would be an UpgraderStore that checks the version on github releases, but this isn't absolutely necessary, we can rely on play store version for now.

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.

implement checking if the app is update-to-date

2 participants