Skip to content

Commit

Permalink
Merge pull request #7 from OpenSpartan/release-1.0.2
Browse files Browse the repository at this point in the history
1.0.2 Release Preparation
  • Loading branch information
dend authored Mar 2, 2024
2 parents 09cfc64 + 14f3521 commit f3dfdeb
Show file tree
Hide file tree
Showing 8 changed files with 127 additions and 90 deletions.
14 changes: 6 additions & 8 deletions CURRENTRELEASE.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# OpenSpartan Workshop 1.0.1 (`MANTLE-02292024`)
# OpenSpartan Workshop 1.0.2 (`SANGHEILI-03012024`)

- Improves performance in navigation between pages.
- Fixes an issue where logs were produced even if the option is disabled.
- Medal description can be seen when a medal is selected in the **Medals** view.
- Introduces support for **expected deaths** and **expected kills** in the match overview.
- Adds the ability to browse matches where a certain medal was earned.
- Minor performance enhancements across the codebase.
- The **Battle Pass** view now remembers the tab you visited when navigating away in the same session.
- Application moves to Windows App SDK 1.5.
- Fixed the logic where some matches for which stats were not acquired were never re-acquired.
- Improves match acquisition performance.
- Fixes an issue where the match population process is not done if a playlist or playlist map/mode pair is not available.
- Fix an issue with the query where the map and playlist metadata was requested from the server even when it was available locally.

Refer to [**getting started guide**](https://openspartan.com/docs/workshop/guides/get-started/) to start using OpenSpartan Workshop.
Binary file not shown.
4 changes: 2 additions & 2 deletions src/OpenSpartan.Workshop/Core/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ internal class Configuration
internal const string HaloWaypointPlayerEndpoint = "https://www.halowaypoint.com/halo-infinite/players";

// Build-related metadata.
internal const string Version = "1.0.1";
internal const string BuildId = "MANTLE-02292024";
internal const string Version = "1.0.2";
internal const string BuildId = "SANGHEILI-03012024";
internal const string PackageName = "OpenSpartan.Workshop";

internal static readonly string[] Scopes = ["Xboxlive.signin", "Xboxlive.offline_access"];
Expand Down
90 changes: 48 additions & 42 deletions src/OpenSpartan.Workshop/Data/DataHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -419,46 +419,46 @@ internal static async Task<bool> UpdateMatchAssetRecords(MatchStats result)

using var connection = new SqliteConnection($"Data Source={DatabasePath}");
await connection.OpenAsync();

string query = "SELECT EXISTS(SELECT 1 FROM Maps WHERE AssetId = $MapAssetId AND VersionId = $MapVersionId) AS MAP_AVAILABLE, " +
"EXISTS(SELECT 1 FROM GameVariants WHERE AssetId = $GameVariantAssetId AND VersionId = $GameVariantVersionId) AS GAMEVARIANT_AVAILABLE";

using (var command = connection.CreateCommand())
if (result.MatchInfo.Playlist != null)
{
command.CommandText = "SELECT EXISTS(SELECT 1 FROM Maps WHERE AssetId=@MapAssetId AND VersionId=@MapVersionId) AS MAP_AVAILABLE, " +
"EXISTS(SELECT 1 FROM GameVariants WHERE AssetId=@GameVariantAssetId AND VersionId=@GameVariantVersionId) AS GAMEVARIANT_AVAILABLE";

if (result.MatchInfo.Playlist != null)
{
command.CommandText += ", EXISTS(SELECT 1 FROM Playlists WHERE AssetId=@PlaylistAssetId AND VersionId=@PlaylistVersionId) AS PLAYLIST_AVAILABLE";
}
query += ", EXISTS(SELECT 1 FROM Playlists WHERE AssetId = $PlaylistAssetId AND VersionId = $PlaylistVersionId) AS PLAYLIST_AVAILABLE";
}

if (result.MatchInfo.PlaylistMapModePair != null)
{
command.CommandText += ", EXISTS(SELECT 1 FROM PlaylistMapModePairs WHERE AssetId=@PlaylistMapModePairAssetId AND VersionId=@PlaylistMapModePairVersionId) AS PLAYLISTMAPMODEPAIR_AVAILABLE";
}
if (result.MatchInfo.PlaylistMapModePair != null)
{
query += ", EXISTS(SELECT 1 FROM PlaylistMapModePairs WHERE AssetId = $PlaylistMapModePairAssetId AND VersionId = $PlaylistMapModePairVersionId) AS PLAYLISTMAPMODEPAIR_AVAILABLE";
}

command.Parameters.AddWithValue("@MapAssetId", result.MatchInfo.MapVariant.AssetId);
command.Parameters.AddWithValue("@MapVersionId", result.MatchInfo.MapVariant.VersionId);
command.Parameters.AddWithValue("@GameVariantAssetId", result.MatchInfo.UgcGameVariant.AssetId);
command.Parameters.AddWithValue("@GameVariantVersionId", result.MatchInfo.UgcGameVariant.VersionId);
using (SqliteCommand command = new(query, connection))
{
command.Parameters.AddWithValue("$MapAssetId", result.MatchInfo.MapVariant.AssetId.ToString());
command.Parameters.AddWithValue("$MapVersionId", result.MatchInfo.MapVariant.VersionId.ToString());
command.Parameters.AddWithValue("$GameVariantAssetId", result.MatchInfo.UgcGameVariant.AssetId.ToString());
command.Parameters.AddWithValue("$GameVariantVersionId", result.MatchInfo.UgcGameVariant.VersionId.ToString());

if (result.MatchInfo.Playlist != null)
{
command.Parameters.AddWithValue("@PlaylistAssetId", result.MatchInfo.Playlist.AssetId);
command.Parameters.AddWithValue("@PlaylistVersionId", result.MatchInfo.Playlist.VersionId);
command.Parameters.AddWithValue("$PlaylistAssetId", result.MatchInfo.Playlist.AssetId.ToString());
command.Parameters.AddWithValue("$PlaylistVersionId", result.MatchInfo.Playlist.VersionId.ToString());
}

if (result.MatchInfo.PlaylistMapModePair != null)
{
command.Parameters.AddWithValue("@PlaylistMapModePairAssetId", result.MatchInfo.PlaylistMapModePair.AssetId);
command.Parameters.AddWithValue("@PlaylistMapModePairVersionId", result.MatchInfo.PlaylistMapModePair.VersionId);
command.Parameters.AddWithValue("$PlaylistMapModePairAssetId", result.MatchInfo.PlaylistMapModePair.AssetId.ToString());
command.Parameters.AddWithValue("$PlaylistMapModePairVersionId", result.MatchInfo.PlaylistMapModePair.VersionId.ToString());
}

using var reader = await command.ExecuteReaderAsync();
if (await reader.ReadAsync())
{
mapAvailable = reader.GetFieldValue<int>("MAP_AVAILABLE") == 1;
playlistAvailable = result.MatchInfo.Playlist != null && reader.GetFieldValue<int>("PLAYLIST_AVAILABLE") == 1;
playlistMapModePairAvailable = result.MatchInfo.PlaylistMapModePair != null && reader.GetFieldValue<int>("PLAYLISTMAPMODEPAIR_AVAILABLE") == 1;
gameVariantAvailable = reader.GetFieldValue<int>("GAMEVARIANT_AVAILABLE") == 1;
mapAvailable = await reader.GetFieldValueAsync<int>("MAP_AVAILABLE") == 1;
playlistAvailable = result.MatchInfo.Playlist != null && await reader.GetFieldValueAsync<int>("PLAYLIST_AVAILABLE") == 1;
playlistMapModePairAvailable = result.MatchInfo.PlaylistMapModePair != null && await reader.GetFieldValueAsync<int>("PLAYLISTMAPMODEPAIR_AVAILABLE") == 1;
gameVariantAvailable = await reader.GetFieldValueAsync<int>("GAMEVARIANT_AVAILABLE") == 1;
}
}

Expand All @@ -482,36 +482,42 @@ internal static async Task<bool> UpdateMatchAssetRecords(MatchStats result)

if (!playlistAvailable)
{
var playlist = await UserContextManager.SafeAPICall(async () => await UserContextManager.HaloClient.HIUGCDiscoveryGetPlaylist(result.MatchInfo.Playlist.AssetId.ToString(), result.MatchInfo.Playlist.VersionId.ToString(), UserContextManager.HaloClient.ClearanceToken));
if (playlist != null && playlist.Result != null && playlist.Response.Code == 200)
if (result.MatchInfo.Playlist != null)
{
using var insertionCommand = connection.CreateCommand();
insertionCommand.CommandText = GetQuery("Insert", "Playlists");
insertionCommand.Parameters.AddWithValue("$ResponseBody", playlist.Response.Message);
var playlist = await UserContextManager.SafeAPICall(async () => await UserContextManager.HaloClient.HIUGCDiscoveryGetPlaylist(result.MatchInfo.Playlist.AssetId.ToString(), result.MatchInfo.Playlist.VersionId.ToString(), UserContextManager.HaloClient.ClearanceToken));
if (playlist != null && playlist.Result != null && playlist.Response.Code == 200)
{
using var insertionCommand = connection.CreateCommand();
insertionCommand.CommandText = GetQuery("Insert", "Playlists");
insertionCommand.Parameters.AddWithValue("$ResponseBody", playlist.Response.Message);

var insertionResult = await insertionCommand.ExecuteNonQueryAsync();
var insertionResult = await insertionCommand.ExecuteNonQueryAsync();

if (insertionResult > 0)
{
if (SettingsViewModel.Instance.EnableLogging) Logger.Info($"Stored playlist: {result.MatchInfo.Playlist.AssetId}/{result.MatchInfo.Playlist.VersionId}");
if (insertionResult > 0)
{
if (SettingsViewModel.Instance.EnableLogging) Logger.Info($"Stored playlist: {result.MatchInfo.Playlist.AssetId}/{result.MatchInfo.Playlist.VersionId}");
}
}
}
}

if (!playlistMapModePairAvailable)
{
var playlistMmp = await UserContextManager.SafeAPICall(async () => await UserContextManager.HaloClient.HIUGCDiscoveryGetMapModePair(result.MatchInfo.PlaylistMapModePair.AssetId.ToString(), result.MatchInfo.PlaylistMapModePair.VersionId.ToString(), UserContextManager.HaloClient.ClearanceToken));
if (playlistMmp != null && playlistMmp.Result != null && playlistMmp.Response.Code == 200)
if (result.MatchInfo.PlaylistMapModePair != null)
{
using var insertionCommand = connection.CreateCommand();
insertionCommand.CommandText = GetQuery("Insert", "PlaylistMapModePairs");
insertionCommand.Parameters.AddWithValue("$ResponseBody", playlistMmp.Response.Message);
var playlistMmp = await UserContextManager.SafeAPICall(async () => await UserContextManager.HaloClient.HIUGCDiscoveryGetMapModePair(result.MatchInfo.PlaylistMapModePair.AssetId.ToString(), result.MatchInfo.PlaylistMapModePair.VersionId.ToString(), UserContextManager.HaloClient.ClearanceToken));
if (playlistMmp != null && playlistMmp.Result != null && playlistMmp.Response.Code == 200)
{
using var insertionCommand = connection.CreateCommand();
insertionCommand.CommandText = GetQuery("Insert", "PlaylistMapModePairs");
insertionCommand.Parameters.AddWithValue("$ResponseBody", playlistMmp.Response.Message);

var insertionResult = await insertionCommand.ExecuteNonQueryAsync();
var insertionResult = await insertionCommand.ExecuteNonQueryAsync();

if (insertionResult > 0)
{
if (SettingsViewModel.Instance.EnableLogging) Logger.Info($"Stored playlist + map mode pair: {result.MatchInfo.PlaylistMapModePair.AssetId}/{result.MatchInfo.PlaylistMapModePair.VersionId}");
if (insertionResult > 0)
{
if (SettingsViewModel.Instance.EnableLogging) Logger.Info($"Stored playlist + map mode pair: {result.MatchInfo.PlaylistMapModePair.AssetId}/{result.MatchInfo.PlaylistMapModePair.VersionId}");
}
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions src/OpenSpartan.Workshop/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.

using System.Diagnostics.CodeAnalysis;

[assembly: SuppressMessage("Reliability", "CA2007:Consider calling ConfigureAwait on the awaited task", Justification = "Not needed in the context of this project.")]
[assembly: SuppressMessage("Security", "CA2100:Review SQL queries for security vulnerabilities", Justification = "Only runs on the local database, that the customer has full access to.")]
6 changes: 3 additions & 3 deletions src/OpenSpartan.Workshop/OpenSpartan.Workshop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls" Version="7.1.2" />
<PackageReference Include="Den.Dev.Orion" Version="1.0.48" />
<PackageReference Include="Den.Dev.Orion" Version="1.0.49" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="8.0.2" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.59.0" />
<PackageReference Include="Microsoft.Identity.Client.Extensions.Msal" Version="4.59.0" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.4.240211001" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.2428" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240227000" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.3233" />
<PackageReference Include="NLog" Version="5.2.8" />
<PackageReference Include="SkiaSharp" Version="2.88.7" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
Expand Down
4 changes: 3 additions & 1 deletion src/OpenSpartan.Workshop/Queries/Select/DistinctMatchIds.sql
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
SELECT DISTINCT MatchId FROM MatchStats
SELECT DISTINCT MatchStats.MatchId
FROM MatchStats
JOIN PlayerMatchStats ON MatchStats.MatchId = PlayerMatchStats.MatchId;
Loading

0 comments on commit f3dfdeb

Please sign in to comment.