larryaasen / upgrader

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

Appcast different version for iOS vs. web #277

Closed mattostanik closed 3 months ago

mattostanik commented 1 year ago

I really like this package. I am using it in a Flutter app published on web, iOS and Android, and I am using an appcast file. Here is my Appcast.xml content:

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
  xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle">
  <channel>
    <title>Releases</title>
    <item>
      <title>Android Release</title>
      <enclosure sparkle:version="2.4.4" sparkle:os="android"/>
    </item>
    <item>
      <title>iOS Release</title>
      <enclosure sparkle:version="2.4.4" sparkle:os="ios"/>
    </item>
    <item>
      <title>Web Release</title>
      <enclosure sparkle:version="2.4.5" />
    </item>
  </channel>
</rss>

Recently I needed to require a different minimum version (2.4.5) on web vs. the minimum version for iOS (2.4.4).

When I published the above Appcast.xml, the iOS app then started showing the upgrade alert and requiring users to install 2.4.5 even though the iOS version in the file was supposed to be 2.4.4. This was a problem because I had not yet released 2.4.5 on iOS.

Is it possible to have different minimum versions for web vs. iOS vs. Android?

Here is how I have implemented the package in my main.dart:

  final appCastConfiguration =
      AppcastConfiguration(url: "https://appcast.mydomain.org/appcast.xml");

[...]

          home: UpgradeAlert(
            upgrader: Upgrader(
                appcastConfig: appCastConfiguration,
                canDismissDialog: false,
                showIgnore: false,
                showLater: false,
                durationUntilAlertAgain: Duration.zero,
                onUpdate: () {

Is there a way to modify either my Appcast.xml content or my Flutter implementation to support different minimum versions per platform? Or is it only possible to have one minimum version across all platforms with this package?

Thank you.

larryaasen commented 1 year ago

@mattostanik Your Appcast file is missing the OS: <enclosure sparkle:version="2.4.5" /> Perhaps you should add the web OS to avoid iOS picking up that version: <enclosure sparkle:version="2.4.5" sparkle:os="web" />

larryaasen commented 1 year ago

@mattostanik Did my suggestion above work for you?