Replies: 1 comment 3 replies
-
Today we allow a developer to set custom HTTP headers which will get passed to the feed, update download, and release notes. So it should theoretically be possible for you to pass the app version, have your server parse the version and generate the release notes accordingly. It does probably require some server-side logic though. CSS, or styling, doesn't feel like the right approach to me. Some developers may want to strip out all release notes the user has already seen <= current, instead of stylizing older or non-current items differently. There may also be merit in being html-agnostic. For example we'd like to support (basic) Markdown one day, and we support plain-text today. We also would like to avoid adding enhancements that encourage enabling Javascript which rules out the first proposal. By the way, I don't think I understand your example. Let's say current version in your example is |
Beta Was this translation helpful? Give feedback.
-
The problem
In the Sparkle feed of the app I'm developing, the
releaseNotesLink
HTML includes the notes of all released versions, not just the latest one. This way, if someone hasn't updated the app in a while, when they get the update prompt, they can scroll down and see all that's been changed since the version they're running.However: it's not immediately clear what's new, and what's not. All releases are displayed the same: both the releasers newer than what the user is running, and the ones that are older.
I'd love to improve on that. For instance, I could gray out the notes of the currently installed version, and all notes before that.
It's currently not possible, as far as I can tell, because the HTML document is not aware of the user's currently installed version. I'd like to add support for exposing that data in Sparkle.
Proposed solution
Sparkle could inject a CSS variable in the web view, specifying the currently installed version; something like
--sparkle-installed-app-version: "2.5.2"
.Usage example
Imagining release notes that looks like this:
Then the version variable could be consumed like this:
With this result:
(To run the example yourself, add the variable definition—which Sparkle would inject—in the script tag:
document.body.style.setProperty("--sparkle-installed-app-version", "\"2.5.2\"");
)Alternative solution
Sparkle could go a bit further, and actually set a class on an element automatically. For instance, it could look for all elements with a data property matching the current version, and add a
sparkle-current
CSS class on them.This solution would be less flexible, but require less work on the developer's part (no boilerplate JS glue to rewrite) and be more secure (no need to enable JS in the Web View.
An example of using this solution is simply reusing the code above, just without the <script> tag at all.
Notes
If this feels like a good fit for Sparkle, I'll be happy to contribute (my best go at) an implementation!
I think I prefer the second solution (less boilerplate, no need to enable JS), myself; but I wonder if the first one might be more in line with Sparkle's project goals (less prescriptive).
Both could very well be implemented, actually, letting the developer choose how to adopt.
Beta Was this translation helpful? Give feedback.
All reactions