shorebirdtech / updater

libupdater code for Shorebird
Other
65 stars 13 forks source link

feat: Shorebird code push should provide information about releases #140

Open erickzanardo opened 3 months ago

erickzanardo commented 3 months ago

shorebird_code_push is the pillar for users to implement any custom behaviour that Shorebird does not provides out of the box.

A very common use of it is to manually manage patches, where the developer can suggest users to update to the latest patch, or even block the user from using the app if a certain patch is not installed.

But that is not the same for releases. Since we don't provide any way for developers to get release information programatically.

Developers could rely on package_info_plus to get the current version, but that would get them the current version, they cannot know if there newer releases. There are thirdparty plugins that could do that (like this one), but IMO since shorebird contains all that info, it would provide a more robust, with better developer experience solution if we provided a way for developers to have a way to access the release information programmatically as well.

bryanoltman commented 3 months ago

What release information are you proposing we provide? Requirements for this feature request might look like:

  1. [ ] Can retrieve current release version
  2. [ ] Can retrieve all release versions

Does that seem right?

erickzanardo commented 3 months ago

What release information are you proposing we provide? Requirements for this feature request might look like:

  1. [ ] Can retrieve current release version
  2. [ ] Can retrieve all release versions

Does that seem right?

Yes, that seems pretty much what we would need! In addition, I feel it would be useful if we had a method like hasNewerReleases. Ofc the user could figure that out by getting all releases and the current and then checking manually, but feels like a useful, common method that we could provide to the user.

bryanoltman commented 3 months ago

Can retrieve current release version

Easy to implement, we'll have to think about what the best home for this would be. It feels odd to have this as an Updater API, but maybe it's fine?

Can retrieve all release versions

We'll need to think about what the correct behavior is here. Things that will make this tricky:

  1. Users will have a new Shorebird release before it's available in the store. The end user is probably more interested in what's available to them rather than what Shorebird knows about.
  2. The releases endpoints all require a logged in Shorebird user, which won't be available to devices in the field. We could make a pared-down publicly-available endpoint that simply returns which release versions are available for which platforms, but going back to the point above, I'm not sure how useful this would be.
eseidel commented 3 months ago

Not directly related, but reminds me of https://github.com/shorebirdtech/shorebird/issues/1288. We've had several requests to be able to attach metadata to releases, this is about pulling existing metadata from the disk it seems.

bryanoltman commented 3 months ago

this is about pulling existing metadata from the disk it seems

As I understand it, it's a mix – both asking about the current release (data from disk) and other available releases (data from the cloud).