Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ServiceControl.Config/Framework/RaygunFeedBack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ async Task<bool> TryInitializeRaygunClientWithCredentials(ICredentials? credenti
readonly Guid trackingId;
readonly RaygunSettings raygunSettings = new() { ApiKey = "zdm49nndHCXZ3NVzM8Kzug==" };

const string RaygunUrl = "https://raygun.io";
const string RaygunUrl = "https://raygun.com";

sealed class Feedback(string message) : Exception(message);
}
Expand Down
51 changes: 33 additions & 18 deletions src/ServiceControl.Config/UI/Shell/ShellViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ protected override async Task OnActivate()
{
await base.OnActivate();

await CheckForUpdates();
BeginCheckForUpdates();
}

public async Task RefreshInstances()
Expand All @@ -121,27 +121,42 @@ void LoadAppVersion()
AppVersion = Constants.CurrentVersion;
}

async Task CheckForUpdates()
void BeginCheckForUpdates()
{
// Get the lates upgradble version based on the current version
// get the json version file from https://s3.us-east-1.amazonaws.com/platformupdate.particular.net/servicecontrol.txt

var availableUpgradeRelease = await VersionCheckerHelper.GetLatestRelease(AppVersion);

if (availableUpgradeRelease.Version == AppVersion)
{
UpdateAvailable = false;
}
else
updateCheckTask = Task.Run(async () =>
{
AvailableUpgradeReleaseLink = availableUpgradeRelease.Assets.FirstOrDefault().Download.ToString();
UpdateAvailableText = $"v{availableUpgradeRelease.Version} - Update Available";
UpdateAvailable = true;
}

NotifyOfPropertyChange(nameof(UpdateAvailable));
NotifyOfPropertyChange(nameof(IsCheckingForUpdate));
try
{
// Get the lates upgradeable version based on the current version
// get the json version file from https://s3.us-east-1.amazonaws.com/platformupdate.particular.net/servicecontrol.txt

var availableUpgradeRelease = await VersionCheckerHelper.GetLatestRelease(AppVersion);

if (availableUpgradeRelease.Version == AppVersion)
{
UpdateAvailable = false;
}
else
{
AvailableUpgradeReleaseLink = availableUpgradeRelease.Assets.FirstOrDefault().Download.ToString();
UpdateAvailableText = $"v{availableUpgradeRelease.Version} - Update Available";
UpdateAvailable = true;
}

NotifyOfPropertyChange(nameof(UpdateAvailable));
}
finally
{
updateCheckTask = null;
NotifyOfPropertyChange(nameof(IsCheckingForUpdate));
}
});
}

public bool IsCheckingForUpdate => updateCheckTask is not null;

Task updateCheckTask;
readonly ListInstancesViewModel listInstances;
readonly NoInstancesViewModel noInstances;
}
Expand Down
3 changes: 2 additions & 1 deletion src/ServiceControl.Config/UI/Shell/VersionCheckerHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ static async Task<List<Release>> GetVersionInformation()
}
}

static readonly HttpClient httpClient = new HttpClient(new HttpClientHandler
static readonly HttpClient httpClient = new(new HttpClientHandler
{
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
})
{
Timeout = TimeSpan.FromSeconds(30),
DefaultRequestHeaders =
{
Accept =
Expand Down
Loading