leanflutter / auto_updater

This plugin allows Flutter desktop apps to automatically update themselves (based on sparkle and winsparkle).
MIT License
278 stars 38 forks source link

Are you sure that this plugin works ? #19

Closed Bahrom2101 closed 2 years ago

Bahrom2101 commented 2 years ago

I have a desktop project mostly for windows users and I want to update it by itself. I am attempting to use this plugin. Please, make the documentation more accessible. I am so confused about what to do. I've created a server that holds my exe and appcast.xml file. I am feeding autoupdater from appcast's URL. But it is not working. What do I have to do ?

lijy91 commented 2 years ago

What step are you stuck at?

lijy91 commented 2 years ago

You need to package your app as an installer with inno setup / nsis.

Bahrom2101 commented 2 years ago

You need to package your app as an installer with inno setup / nsis.

My steps were:

  1. Installed open SSL
  2. Generated dsa_priv.pem and dsa_pub.pem
  3. WinSparkle script added to windows/runner/Runner.rc
  4. Added distribute_options.yaml
  5. Released windows with flutter_distributor command (version: 1.0.0+1 in pubspec.yaml)
  6. Got signature for it
  7. Put my .exe file to server and also appcast.xml file with .exe file URL and its signature.
  8. Set appcast.xml file's URL to code -> await autoUpdater.setFeedURL(Constants.feedUrl);
  9. I installed 1.0.0+1 exe file. and checked for updates. Result: my_project 1.0.0 is currently the newest version available
  10. Released windows with flutter_distributor command (version: 1.0.1+2 in pubspec.yaml)
  11. Got signature for it
  12. Put my .exe file to server and also appcast.xml file with .exe file URL and its signature.
  13. I installed 1.0.1+2 exe file. and checked for updates. Result: my_project 1.0.0 is currently the newest version available Every time I have changed my appcast.xml versions for new.
lijy91 commented 2 years ago

Did you change the version number of Runner.rc? Since flutter windows cannot automatically update the version number at present, you need to modify it yourself.

https://github.com/leanflutter/auto_updater/blob/66be5845bf37fe4c6a30d7532b32af1d6e49f590/example/windows/runner/Runner.rc#L63-L73

lijy91 commented 2 years ago

https://github.com/flutter/flutter/issues/73652

Bahrom2101 commented 2 years ago

Did you change the version number of Runner.rc? Since flutter windows cannot automatically update the version number at present, you need to modify it yourself.

https://github.com/leanflutter/auto_updater/blob/66be5845bf37fe4c6a30d7532b32af1d6e49f590/example/windows/runner/Runner.rc#L63-L73

I am doing it that way but no work. Maybe it's from appcast.xml My appcast URL is https://test.cdn.billz.ai/billz/appcast.xml Is this normal?

ollyde commented 2 years ago

@Bahrom2101 it works for both MacOS and Windows, we have it working on both. @lijy91 instead of references other tickets it might be good to update the readme.

Bahrom2101 commented 2 years ago

@Bahrom2101 it works for both MacOS and Windows, we have it working on both. @lijy91 instead of references other tickets it might be good to update the readme.

Can you provide your appcast make and read details?

ollyde commented 2 years ago

Sure, here is an example of an app cast.

@Bahrom2101 also keep in mind, for Apple you will need to Notorise your app for it to install without making users go though weird security loops.

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle">
    <channel>
        <title>MyApp</title>
        <description>Most recent updates to MyApp</description>
        <language>en</language>
        <item>
            <title>Version 1.0.2</title>
            <description>
                <h1>New update</h1>
                <p>Welcome to MyApp 1.0.2!</p>
            </description>
            <!-- Build number, what it uses to update. -->
            <sparkle:version>18</sparkle:version>
            <sparkle:shortVersionString>1.0.2</sparkle:shortVersionString>
            <pubDate>Sun, 7 Jun 2022 12:00:00 +0000</pubDate>
            <enclosure url="https://storage.googleapis.com/MyApp-dev/macos_builds/MyApp_macos_1.0.2+18.zip"
                       sparkle:edSignature="yeScRLFcBlFsZGns0gMr36yiqXCKqeIkV+CxXeak+t8CSaVuS5dQcHZ5EMERcwI8aMomhBA=="
                       sparkle:os="macos"
                       length="28781045"
                       type="application/octet-stream" />
        </item>
        <item>
            <title>Version 1.0.2</title>
             <description>
                <h1>New update</h1>
                <p>Welcome to MyApp 1.0.2!</p>
            </description>
            <!-- Build number is broken on Windows -->
            <sparkle:version>1.0.2</sparkle:version>
            <pubDate>Sun, 7 Jun 2022 12:00:00 +0000</pubDate>
            <enclosure url="https://storage.googleapis.com/MyApp-dev/windows_builds/MyApp-1.0.1+15.exe"
                       sparkle:dsaSignature="MEQCIBVHZCZR6wThDoEXN/xx0AXAiAuNgBi5B4yH/qagELEMCFiMAEzz3C64lIGRrIDDuRvqg=="
                       sparkle:os="windows"
                       length="0"
                       type="application/octet-stream" />
        </item>
    </channel>
</rss>
ollyde commented 2 years ago

@Bahrom2101 you also need to update the runner.rc manually, since flutter doesn't update it.

GolnazMirzaie commented 3 months ago

@lijy91 @ollyde this is my appcast.xml file after second update (I add some changes to the project, then release windows with flutter_distributor command, sign the app after update, and then create appcast file like below) :

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle">
    <channel>
        <title>kiosk app update</title>
<description>Most recent updates to kiosk</description>
<language>en</language>
<item>
<title>Version 1.0.2</title>
<pubDate>Wed, 6 June 2024 10:28:00 +0800</pubDate>
<enclosure url="url for exe" sparkle:dsaSignature="MD0CHQCRaSvLRZOaPRQegfbgis9qoY/pazzyAhoGskDBAhxhBTg3bVvOKFqGrUnT9d/0LKk/8b0qR5fUHsLp" sparkle:version="1.0.2+1" sparkle:os="windows" length="0" type="application/octet-stream"/>
</item>
    </channel>
</rss>

but when ever I open the app, it checks for updates and it detects that there is a newer version, it starts downloading updates but in the middle, it gives this message:

an error occured in retrieving update information, are you connected to internt? please try again later.

my Runner.rc:

#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD)
#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD
#else
#define VERSION_AS_NUMBER 1,0,2,1
#endif

#if defined(FLUTTER_VERSION)
#define VERSION_AS_STRING FLUTTER_VERSION
#else
#define VERSION_AS_STRING "1.0.2.1"
#endif

version in pubspec.yaml: 1.0.2+1

I dont know what I'm doing wrong! should I run "flutter windows build" after each update??