Skip to content

Commit f3e68d7

Browse files
committed
Modified ShowUpdateSnackbar in UpdaterService.vb to show a different colour for pre-release updates
1 parent cffc232 commit f3e68d7

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

CompactGUI.Core/Compactor.vb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ Public Class Compactor : Implements IDisposable
146146
Public Sub Dispose() Implements IDisposable.Dispose
147147
_cancellationTokenSource.Dispose()
148148
_pauseSemaphore.Dispose()
149-
If not _EFInfoPtr.Equals(IntPtr.Zero) Then
149+
If Not _EFInfoPtr.Equals(IntPtr.Zero) Then
150150
Marshal.FreeHGlobal(_EFInfoPtr)
151151
_EFInfoPtr = IntPtr.Zero
152152
End If

CompactGUI/Models/SemVersion.vb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
End Function
5454

5555
Public Function IsPreRelease() As Boolean
56-
If PreRelease = "" Then Return True
57-
Return False
56+
If PreRelease = "" OrElse PreRelease = Nothing OrElse PreRelease = "r" Then Return False
57+
Return True
5858
End Function
5959

6060
Public Function Friendly() As String

CompactGUI/Services/UpdaterService.vb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,22 @@ Public Class UpdaterService : Implements IUpdaterService
1919
Dim jVer = JsonSerializer.Deserialize(Of Dictionary(Of String, SemVersion))(ret)
2020
Dim newVersion As SemVersion = If(includePrerelease, jVer("Latest"), jVer("LatestNonPreRelease"))
2121
If newVersion > Application.AppVersion Then
22-
23-
ShowUpdateSnackbar(newVersion)
24-
22+
ShowUpdateSnackbar(newVersion, newVersion.IsPreRelease)
2523
End If
2624
Catch ex As Exception
2725
Debug.WriteLine(ex.Message)
2826
End Try
29-
3027
End Function
3128

32-
Public Sub ShowUpdateSnackbar(newVersion As SemVersion)
29+
Public Sub ShowUpdateSnackbar(newVersion As SemVersion, Optional isPreRelease As Boolean = False)
3330

3431
Dim snackbarSV = Application.GetService(Of CustomSnackBarService)()
3532

3633
Dim textBlock = New TextBlock
3734
textBlock.Text = "Click to download"
3835

3936
' Show the custom snackbar
40-
snackbarSV.ShowCustom(textBlock, $"Update Version {newVersion.Friendly} Available", ControlAppearance.Success, timeout:=TimeSpan.FromSeconds(10))
37+
snackbarSV.ShowCustom(textBlock, $"Update Available ▸ Version {newVersion.Friendly}", If(isPreRelease, ControlAppearance.Info, ControlAppearance.Success), timeout:=TimeSpan.FromSeconds(10))
4138

4239
Dim handler As MouseButtonEventHandler = Nothing
4340
Dim closedHandler As TypedEventHandler(Of Snackbar, RoutedEventArgs) = Nothing

0 commit comments

Comments
 (0)