-
Notifications
You must be signed in to change notification settings - Fork 119
multi: show upgrade banner if newer version is available on GitHub #3286
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Philemon Ukane <[email protected]>
continue | ||
} | ||
|
||
w.latestVersion = strings.Trim(response.TagName, "v") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible this isnt just v1.x.x https://api.github.com/repos/decred/dcrd/releases/latest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible yes but we’ll have to work with how dcrdex name releases, not sure why that should change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Errm, prior to v0.6.x it was name differently "DCRDEX v0.x.x" but going forward I think we should stick to one way of doing things, using the vx.x.x as tag name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
568af47 introduced gt check that should resolve your concerns @JoeGruffins.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should proly use a regex here to future-proof this.
Review comment: #3286 (comment)
Signed-off-by: Philemon Ukane <[email protected]>
Great feature, though wouldn't it make more sense to direct people to the website? |
It would if the website and github were tightly in sync. Often there is a lag in updating the website. |
This is true...but I'm just sayin' the /average user/ isn't exactly used to downloading things from Github where you have 16 different files to select from. Is updating the website when there is a new release a difficult task? |
I thought about all of the above, and now that it's also mentioned..I'll just redirect them to the website.
I suppose there should be a release checklist, right? @buck54321 |
Signed-off-by: Philemon Ukane <[email protected]>
c92423f
to
e449ae8
Compare
The banner is too aggro. Just use a notification. |
IMO an upgrade is a highly recommended action that is not part of the actual function of the app...it could easily be ignored if sent via notes. |
client/core/core.go
Outdated
// GitHub API for the latest release. If a new release is found, it notifies the | ||
// user with a TopicNewReleaseAvailable note. | ||
func (c *Core) checkForNewRelease(ctx context.Context) { | ||
ticker := time.NewTicker(3 * time.Minute) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I didn't notice there were two for loops selecting of a case. One minute or so is fine here I guess. Would be good to try once without waiting as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we try once, and it always fails, the user may theoretically never get the note, (i.e if they never run the app for 24hrs)
client/core/core.go
Outdated
currentVersion := strings.Split(c.cfg.Version, "-")[0] | ||
if latestVersion > currentVersion && !strings.Contains(latestVersion, currentVersion) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
latestVersion > currentVersion isn't good for string comparison. consider that "v1.0.2" > "1.0.3" will return true. I assume there's a way to do better by splitting on decimals https://stackoverflow.com/questions/8955657/regex-pattern-to-extract-version-number-from-string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think tests are passing because of the !strings.Contains part
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, use this
Line 48 in 2b78ab8
func ParseSemVer(s string) (major, minor, patch uint32, preRel, build string, err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, use this
Line 48 in 2b78ab8
func ParseSemVer(s string) (major, minor, patch uint32, preRel, build string, err error) {
This would work for c.cfg.Version
, but we'd proly need the regex suggestion for latestVersion
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could reuse the userAppVersion function in #3289, might move the helper function to dex/version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not seeing the notification in the ui for some reason. I see it in logs though.
Check the Recent Activity in the Notification dropdown, poke level is < success level so it won't show up in the Notification section. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The github check looks good. I think for the UI, instead of having it in the notifications, there should be a bar on the top of the screen just sitting there all the time telling the user to update to a new version.
That was my first iteration but @buck54321 suggested we prefer notes. See: #3286 (comment) |
You guys win. Do the banner. Sorry for the back and forth. |
568af47
to
e449ae8
Compare
Lol I missed that completely. |
@@ -12,6 +12,15 @@ | |||
<link href="/css/style.css?v={{commitHash}}" rel="stylesheet"> | |||
</head> | |||
<body class="dark{{if .UseDEXBranding}} dex-branding{{end}}"> | |||
{{if and (ne .Version .LatestVersion) .LatestVersion}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exactly is this comparison. Sorry.
if and is used for two comparisons, then those are, .Version != .LatestVersion and .LatestVersion existing at all?
I still think you should parse the version and probably do this somewhere else. It should compare the versions properly. Will this make our testing builds always hit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes to your first question.
Nope, doesn’t make testing builds always hit…but we can take this check away from the html template and use a single bool variable.
|
||
for { | ||
select { | ||
case <-ticker.C: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may still be missing something, but this could fire once without waiting, as soon as the app is started, then go into the loop if that fails.
https://github.com/user-attachments/assets/7a077e62-6a2b-4744-99d2-d3e9beb6532a
https://github.com/user-attachments/assets/ecdaa6fc-99e0-436f-91ad-a11756af3eb7
The banner stays until the user upgrades.
PS: The wording was changed to direct users to the bison wallet; this is just a visual representation of the banner.
Closes #3191