Skip to content

Commit

Permalink
Merge pull request #42 from OpenSpartan/release-1.0.7
Browse files Browse the repository at this point in the history
1.0.7 Release
  • Loading branch information
dend authored Jul 11, 2024
2 parents 3aa330b + 98f8171 commit 82033d9
Show file tree
Hide file tree
Showing 44 changed files with 1,983 additions and 2,065 deletions.
23 changes: 16 additions & 7 deletions CURRENTRELEASE.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
# OpenSpartan Workshop 1.0.6 (`CRUCIBLE-06072024`)
# OpenSpartan Workshop 1.0.7 (`CYLIX-06082024`)

- Fixes an issue with matches not being populated in full search mode.
- Fixes an issue where extra events are not loaded on first (cold) boot.
- Fixes an issue where matches based on a medal are not loaded due to a malformed SQLite query.

>[!NOTE]
>This is a point release with a hotfix. Original changelog with new functionality captured in [1.0.4](https://github.com/OpenSpartan/openspartan-workshop/releases/tag/1.0.4).
- [#30] Prevent auth loops if incorrect release number is used.
- [#38] Battlepass data now correctly renders on smaller screens, allowing scrolling.
- [#39] Removes the odd cross-out line in the calendar view.
- [#41] Fixes average life positioning, ensuring that it can't cause overflow.
- Improved image fallback for The Exchange, so that missing items now render properly.
- Season calendar now includes background images for each event, operation, and battle pass season.
- Calendar colors are now easier to read.
- Fixes how ranked match percentage is calculated, now showing proper values for next level.
- Home page now can be scrolled on smaller screens.
- Inside match metadata, medals and ranked counterfactuals correctly flow when screen is resized.
- The app now correctly reacts at startup to an error with authentication token acquisition. A message is shown if that is not possible.
- General performance optimizations and maintainability cleanup.
- Fixed an issue where duplicate ranked playlist may render in the **Ranked Progression** view.
- Fixed an issue where duplicate items may render in the **Exchange** view.
- Massive speed up to the **Operations** view load times - the app no longer issues unnecessary REST API calls to get currency data.

Refer to [**getting started guide**](https://openspartan.com/docs/workshop/guides/get-started/) to start using OpenSpartan Workshop.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The benefit of using OpenSpartan Workshop is that for any more complex analysis

You can download the application from this repository, in the **Releases** section.

<a href="https://github.com/OpenSpartan/openspartan-workshop/releases/download/1.0.3/OpenSpartan.Workshop.Installer.Bundle.exe"><img alt="Download for Windows button" src="media/windows-download.gif" width="200"></a>
<a href="https://github.com/OpenSpartan/openspartan-workshop/releases/download/1.0.6/OpenSpartan.Workshop.Installer.Bundle.exe"><img alt="Download for Windows button" src="media/windows-download.gif" width="200"></a>

>[!IMPORTANT]
>Requires Windows 10 (20H1 - `10.0.19041.0`) or later, [.NET Desktop Runtime 8.0+](https://dotnet.microsoft.com/download/dotnet/8.0), and the [latest Windows App SDK](https://learn.microsoft.com/windows/apps/windows-app-sdk/downloads). Both are bundled with the installer.
Expand Down
457 changes: 238 additions & 219 deletions src/OpenSpartan.Workshop/Controls/MatchesGridControl.xaml

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions src/OpenSpartan.Workshop/Controls/SeasonCalendarControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,19 @@
x:Name="CalendarViewControl"
IsTodayHighlighted="true"
TodayForeground="Transparent"
TodayBlackoutForeground="#FFFFFF"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
CalendarItemBorderBrush="DimGray"
CalendarItemBorderThickness="1"
CalendarItemCornerRadius="0"
BlackoutStrikethroughBrush="Transparent"
BlackoutBackground="#5B6163"
BlackoutForeground="#2F2F2F"
DayItemFontSize="{StaticResource BodyTextBlockFontSize}"
BlackoutForeground="#B3A8AA"
DayItemFontSize="{StaticResource SubtitleTextBlockFontSize}"
DayItemMargin="4,0,0,0"
IsGroupLabelVisible="True"
FirstOfMonthLabelFontSize="{StaticResource BodyTextBlockFontSize}"
FirstOfMonthLabelFontSize="{StaticResource SubtitleTextBlockFontSize}"
FirstOfMonthLabelFontWeight="Bold"
HorizontalFirstOfMonthLabelAlignment="Right"
FirstOfMonthLabelMargin="0,0,4,0"
Expand All @@ -39,7 +40,7 @@
<Setter.Value>
<ControlTemplate>
<Grid x:Name="CalendarItemGrid">
<Image Opacity=".4" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="UniformToFill" Source="{Binding BackgroundImagePath, Converter={StaticResource ServicePathToLocalPathConverter}}">
<Image Opacity=".2" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="UniformToFill" Source="{Binding BackgroundImagePath, Converter={StaticResource ServicePathToLocalPathConverter}}">

</Image>

Expand Down
22 changes: 4 additions & 18 deletions src/OpenSpartan.Workshop/Converters/BoolNegativeConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,10 @@ namespace OpenSpartan.Workshop.Converters
{
public class BoolNegativeConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
if (value is bool boolValue)
{
return !boolValue;
}
public object Convert(object value, Type targetType, object parameter, string language) =>
value is bool boolValue ? !boolValue : (object)null;

return null;
}

public object ConvertBack(object value, Type targetType, object parameter, string language)
{
if (value is bool boolValue)
{
return !boolValue;
}

return false;
}
public object ConvertBack(object value, Type targetType, object parameter, string language) =>
value is bool boolValue ? !boolValue : (object)false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,9 @@ public class BoolToDisabledBrushConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
if (value is bool isActive && !isActive)
{
// Return a brush for an active state
return new SolidColorBrush((Color)Microsoft.UI.Xaml.Application.Current.Resources["TextFillColorPrimary"]);
}
else
{
// Return the system-defined disabled brush
return (SolidColorBrush)Microsoft.UI.Xaml.Application.Current.Resources["SystemControlDisabledBaseMediumLowBrush"];
}
return value is bool isActive && !isActive
? new SolidColorBrush((Color)Microsoft.UI.Xaml.Application.Current.Resources["TextFillColorPrimary"])
: (SolidColorBrush)Microsoft.UI.Xaml.Application.Current.Resources["SystemControlDisabledBaseMediumLowBrush"];
}

public object ConvertBack(object value, Type targetType, object parameter, string language)
Expand Down
17 changes: 3 additions & 14 deletions src/OpenSpartan.Workshop/Converters/BoolToVisibilityConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,10 @@ namespace OpenSpartan.Workshop.Converters
{
internal sealed class BoolToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
if ((bool)value)
{
return Visibility.Visible;
}
else
{
return Visibility.Collapsed;
}
}
public object Convert(object value, Type targetType, object parameter, string language) =>
(bool)value ? Visibility.Visible : Visibility.Collapsed;

public object ConvertBack(object value, Type targetType, object parameter, string language)
{
public object ConvertBack(object value, Type targetType, object parameter, string language) =>
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@ namespace OpenSpartan.Workshop.Converters
{
internal sealed class CommaAfterThousandsConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
return string.Format(CultureInfo.InvariantCulture, "{0:n0}", value);
}
public object Convert(object value, Type targetType, object parameter, string language) =>
string.Format(CultureInfo.InvariantCulture, "{0:n0}", value);

public object ConvertBack(object value, Type targetType, object parameter, string language)
{
public object ConvertBack(object value, Type targetType, object parameter, string language) =>
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
using Microsoft.UI.Xaml.Data;
using System;
using System.Globalization;
using System.Linq;

namespace OpenSpartan.Workshop.Converters
{
internal sealed class ComplexTimeToSimpleTimeConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
TimeSpan interval = (TimeSpan)value;
return string.Format(CultureInfo.InvariantCulture, "{0:D2}d {1:D2}hr {2:D2}min {3:D2}sec", interval.Days, interval.Hours, interval.Minutes, interval.Seconds);
}
public object Convert(object value, Type targetType, object parameter, string language) =>
value is TimeSpan interval
? string.Join(" ", new[]
{
interval.Days > 0 ? $"{interval.Days}d" : null,
interval.Hours > 0 ? $"{interval.Hours}hr" : null,
interval.Minutes > 0 ? $"{interval.Minutes}min" : null,
interval.Seconds > 0 || interval.TotalSeconds < 60 ? $"{interval.Seconds}sec" : null
}.Where(part => part != null))
: value;

public object ConvertBack(object value, Type targetType, object parameter, string language)
{
public object ConvertBack(object value, Type targetType, object parameter, string language) =>
throw new NotImplementedException();
}
}
}
11 changes: 3 additions & 8 deletions src/OpenSpartan.Workshop/Converters/CsrProgressStateConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,16 @@ internal sealed class CsrProgressStateConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
MatchTableEntity entity = value as MatchTableEntity;

if (entity != null)
if (value is MatchTableEntity entity)
{
bool inverse = parameter?.ToString() == "inverse";

return (entity.PostMatchCsr > entity.PreMatchCsr ^ inverse) ? entity.PostMatchCsr : entity.PreMatchCsr;
return (entity.PostMatchCsr > entity.PreMatchCsr) ^ inverse ? entity.PostMatchCsr : entity.PreMatchCsr;
}

return 0;
}

public object ConvertBack(object value, Type targetType, object parameter, string language)
{
public object ConvertBack(object value, Type targetType, object parameter, string language) =>
throw new NotImplementedException();
}
}
}
25 changes: 9 additions & 16 deletions src/OpenSpartan.Workshop/Converters/CsrToPathConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,17 @@ internal class CsrToPathConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
Csr csr = (Csr)value;
string tierPath = string.Empty;
// Tier is zero-indexed, but the images are starting from 1, so we need to ensure
// that we increment the tier to get the right image.
if (!string.IsNullOrEmpty(csr.Tier))
{
tierPath = Path.Combine(Core.Configuration.AppDataDirectory, "imagecache", "csr", $"{csr.Tier.ToLowerInvariant()}_{csr.SubTier + 1}.png");
}
else
{
tierPath = Path.Combine(Core.Configuration.AppDataDirectory, "imagecache", "csr", $"unranked_{csr.InitialMeasurementMatches - csr.MeasurementMatchesRemaining}.png");
}
return tierPath;
if (value is not Csr csr)
return string.Empty;

string fileName = !string.IsNullOrEmpty(csr.Tier)
? $"{csr.Tier.ToLowerInvariant()}_{csr.SubTier + 1}.png"
: $"unranked_{csr.InitialMeasurementMatches - csr.MeasurementMatchesRemaining}.png";

return Path.Combine(Core.Configuration.AppDataDirectory, "imagecache", "csr", fileName);
}

public object ConvertBack(object value, Type targetType, object parameter, string language)
{
public object ConvertBack(object value, Type targetType, object parameter, string language) =>
throw new NotImplementedException();
}
}
}
29 changes: 5 additions & 24 deletions src/OpenSpartan.Workshop/Converters/CsrToProgressConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,12 @@ namespace OpenSpartan.Workshop.Converters
{
internal class CsrToProgressConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
Csr currentCsr = (Csr)value;
if (currentCsr != null)
{
// When the Value is -1 that means the user is not ranked - there is no
// progress to report on.
if (currentCsr.Value > -1)
{
return (double)currentCsr.Value / (double)currentCsr.NextTierStart;
}
else
{
return (double)0;
}
}
else
{
return (double)0;
}
}
public object Convert(object value, Type targetType, object parameter, string language) =>
value is Csr currentCsr && currentCsr.Value > -1
? (double)(currentCsr.Value - currentCsr.TierStart) / (currentCsr.NextTierStart - currentCsr.TierStart)
: (double)0;

public object ConvertBack(object value, Type targetType, object parameter, string language)
{
public object ConvertBack(object value, Type targetType, object parameter, string language) =>
throw new NotImplementedException();
}
}
}
23 changes: 5 additions & 18 deletions src/OpenSpartan.Workshop/Converters/CsrToTextRankConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,12 @@ namespace OpenSpartan.Workshop.Converters
{
internal class CsrToTextRankConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
Csr csr = (Csr)value;
public object Convert(object value, Type targetType, object parameter, string language) =>
value is Csr csr && !string.IsNullOrEmpty(csr.Tier)
? $"{csr.Tier} {csr.SubTier + 1}"
: "Unranked";

// Tier is zero-indexed, but the images are starting from 1, so we need to ensure
// that we increment the tier to get the right image.
if (!string.IsNullOrEmpty(csr.Tier))
{
return $"{csr.Tier} {csr.SubTier + 1}";
}
else
{
return "Unranked";
}
}

public object ConvertBack(object value, Type targetType, object parameter, string language)
{
public object ConvertBack(object value, Type targetType, object parameter, string language) =>
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public object Convert(object value, Type targetType, object parameter, string la
// progress to report on.
if (currentCsr.Value > -1)
{
return $"{currentCsr.Value}/{currentCsr.NextTierStart} ({((double)currentCsr.Value/(double)currentCsr.NextTierStart)*100:0.00}%)";
return $"{currentCsr.Value}/{currentCsr.NextTierStart} ({(((double)currentCsr.Value - (double)currentCsr.TierStart) / ((double)currentCsr.NextTierStart - (double)currentCsr.TierStart)) * 100.0:0.00}%)";
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,18 @@ internal class DirectValueToPercentageStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
return $"{System.Convert.ToDouble(value, CultureInfo.InvariantCulture) / 100.0:P02}";
if (value == null)
return "0.00%";

if (double.TryParse(value.ToString(), NumberStyles.Any, CultureInfo.InvariantCulture, out double doubleValue))
{
return $"{doubleValue / 100.0:P02}";
}
else
{
// Handle cases where value cannot be converted to double
return "0.00%";
}
}

public object ConvertBack(object value, Type targetType, object parameter, string language)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,18 @@ internal sealed class DoubleToPercentageStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
return $"{System.Convert.ToDouble(value, CultureInfo.InvariantCulture):P2}";
if (value == null)
return "0.00%";

if (double.TryParse(value.ToString(), NumberStyles.Any, CultureInfo.InvariantCulture, out double doubleValue))
{
return $"{doubleValue:P2}";
}
else
{
// Handle cases where value cannot be converted to double
return "0.00%";
}
}

public object ConvertBack(object value, Type targetType, object parameter, string language)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public object Convert(object value, Type targetType, object parameter, string la
return dateTime.ToString("MMMM d, yyyy h:mm tt", CultureInfo.CurrentCulture);
}

return value;
return string.Empty; // Handle null value gracefully or return an appropriate default
}

public object ConvertBack(object value, Type targetType, object parameter, string language)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@
using Microsoft.UI.Xaml.Data;
using System;
using System.Collections;
using System.Linq;

namespace OpenSpartan.Workshop.Converters
{
internal class ListCountToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
if (value is IEnumerable enumerable)
if (value is IEnumerable enumerable && enumerable.GetEnumerator().MoveNext())
{
return enumerable.Cast<object>().Any() ? Visibility.Visible : Visibility.Collapsed;
return Visibility.Visible;
}

return Visibility.Collapsed;
Expand Down
Loading

0 comments on commit 82033d9

Please sign in to comment.