Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide events for installer #93

Open
hypervtechnics opened this issue May 6, 2020 · 6 comments
Open

Provide events for installer #93

hypervtechnics opened this issue May 6, 2020 · 6 comments

Comments

@hypervtechnics
Copy link

It would be nice to receive events like with Squirrel to react to certain - who would have guessed - events.

Events:

  • Install
  • First run
  • Update
  • Uninstall (probably not possible everywhere)

Also cool to create a small framework to handle migrations to be run when certain versions are passed during an upgrade.

@Deadpikle
Copy link
Collaborator

Rather than using events, I chose to use properties on the Configuration object since Configuration was already in place and let me keep all the logic there rather than adding more logic to SparkleUpdater.

In the latest preview of NetSparkle, you can now use Configuration.IsFirstRun to see whether this is the first time the application has run. If you reload the configuration data by calling Configuration.Reload(), this flag will be false, even in the same run of the software, so...be forewarned if you reload data manually.

You can also now use Configuration.PreviousVersionOfSoftwareRan to see what the user ran last. The same warnings about reloading configuration data apply. This property is "" on the first run of the software.

Something like this should be helpful:

if (SparkleUpdater.Configuration.IsFirstRun)
  // handle first run
else if (!string.IsNullOrWhiteSpace(SparkleUpdater.Configuration.PreviousVersionOfSoftwareRan) 
          && SparkleUpdater.Configuration.PreviousVersionOfSoftwareRan != SparkleUpdater.Configuration.InstalledVersion)
   // handle update by figuring out what needs to be updated or shown to the user or whatnot

I don't think we can properly handle Install or Uninstall events at this point since we don't control those events of the software at all.

@hypervtechnics
Copy link
Author

hypervtechnics commented May 10, 2020

What do you think about storing the previous version as Version? (Nullable), so you don't have to parse it?

For the install (which is kind of first run) and uninstall I agree.

@Deadpikle
Copy link
Collaborator

I'm sorry for forgetting to reply.

I would rather let the user parse the string themselves if they need to -- they might be storing the version in formats such as 2.0.0-beta2342 or some other incompatible-with-Version format.

@Deadpikle Deadpikle added this to the 2.0.0 milestone Jun 21, 2020
@Deadpikle Deadpikle modified the milestones: 2.0.0, 2.1+ Jan 14, 2021
@Deadpikle
Copy link
Collaborator

Calling this "done" for 2.0, but am open to further suggestions for 2.1+.

@hypervtechnics
Copy link
Author

Hi, sorry had no time yet. I am trying to build a full stack prototype for the whole software update path using Avalonia for multiple platforms (Linux and Windows for now), Will look into it.

@Deadpikle
Copy link
Collaborator

Oh, that's fine. I'm just wanting to wrap things up for a 2.0 release right now. There's no rush or pressure on you to do anything more (although contributions are always welcome). :)

@Deadpikle Deadpikle modified the milestones: 2.2+, Future Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants