larryaasen / upgrader

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

Adds platform checks and critical version checks #280

Closed ahmet-fennel closed 6 months ago

ahmet-fennel commented 1 year ago

This PR solves two different issues that we encountered during the integration of this plugin.

  1. If a single Appcast item contains 2 enclosures for each platform, plugin would always choose the latter even if it's the wrong platform.

Example Appcast:

 <item>
            <title>Version 1.3.0</title>
            <sparkle:version>1.3.0</sparkle:version>
            <enclosure url="https://play.google.com/store/apps/details?id=..."
                       sparkle:os="android"/>
            <enclosure
                    url="https://apps.apple.com/us/app/....."
                    sparkle:os="ios"/>
        </item>

So even if the application is running on android it currently chooses the appstore link.

  1. With the introduction of PR https://github.com/larryaasen/upgrader/pull/275 now critical versions will be prioritized even if there is a higher non-prioritized version.

This raises one minor issue:

If the current app version is 1.0.0, and the appcast contains 1.2.0 as a critical update and 1.2.1 as a non-critical update

The pop-up appears as 1.2.1 is a required update and the user must update, even though the reason that the pop up can't be skipped is the 1.2.0 which is the required version.

This fixes by displaying the critical version (1.2.0) in the dialog instead of the latest (1.2.1)

ahmet-fennel commented 1 year ago

@larryaasen i'll work on the tests but can you let me know if this is a change we can get merged

larryaasen commented 1 year ago

@ahmet-fennel The current upgrader package does not support multiple enclosure tags in an Appcast item. There is no supporting documentation that suggests that multiple enclosures should be supported. According to https://sparkle-project.org/documentation/publishing/ and https://sparkle-project.org/documentation/api-reference/Classes/SUAppcastItem.html there is no indication that multiple enclosure tags are supported.

To get around this, just use multiple items with different sparkle:os tags.