make converters fully compliant with docs
MODIFY
WalletWasabi.Fluent/Converters/EnumConverters.cs
WalletWasabi.Fluent/Converters/EnumConverters.cs
using System.Globalization;
+using Avalonia;
using Avalonia.Data.Converters;
using WalletWasabi.Extensions;
using WalletWasabi.Wallets.PasswordFinder;
@@ -8,19 +9,19 @@ namespace WalletWasabi.Fluent.Converters;
public static class EnumConverters
{
public static readonly IValueConverter ToFriendlyName =
- new FuncValueConverter<Enum, string>(x => x?.FriendlyName() ?? "");
+ new FuncValueConverter<Enum, object>(x => x?.FriendlyName() ?? AvaloniaProperty.UnsetValue);
public static readonly IValueConverter ToUpperCase =
- new FuncValueConverter<Enum, string>(x => x?.ToString().ToUpper(CultureInfo.InvariantCulture) ?? "");
+ new FuncValueConverter<Enum, object>(x => x?.ToString().ToUpper(CultureInfo.InvariantCulture) ?? AvaloniaProperty.UnsetValue);
public static readonly IValueConverter ToCharset =
- new FuncValueConverter<Enum, string>(x =>
+ new FuncValueConverter<Enum, object>(x =>
{
if (x is Charset c && PasswordFinderHelper.Charsets.ContainsKey(c))
{
return PasswordFinderHelper.Charsets[c];
}
- return "";
+ return AvaloniaProperty.UnsetValue;
});
}

MODIFY
WalletWasabi.Fluent/Converters/FeeTargetTimeConverter.cs
WalletWasabi.Fluent/Converters/FeeTargetTimeConverter.cs
@@ -2,14 +2,12 @@ using Avalonia.Data.Converters;
using System.Globalization;
using Avalonia;
using WalletWasabi.Helpers;
-using WalletWasabi.Fluent.Models;
-using WalletWasabi.Exceptions;
namespace WalletWasabi.Fluent.Converters;
public class FeeTargetTimeConverter : IValueConverter
{
- public static string Convert(int feeTarget, string minutesLabel, string hourLabel, string hoursLabel, string dayLabel, string daysLabel)
+ public static string? Convert(int feeTarget, string minutesLabel, string hourLabel, string hoursLabel, string dayLabel, string daysLabel)
{
if (feeTarget == Constants.FastestConfirmationTarget)
{
@@ -38,14 +36,14 @@ public class FeeTargetTimeConverter : IValueConverter
return "one week";
}
- return "invalid";
+ return null;
}
- public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
+ public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is int feeTarget)
{
- return Convert(feeTarget, " minutes", " hour", " hours", " day", " days");
+ return Convert(feeTarget, " minutes", " hour", " hours", " day", " days") ?? AvaloniaProperty.UnsetValue;
}
return AvaloniaProperty.UnsetValue;

MODIFY
WalletWasabi.Fluent/Converters/NavBarIconConverter.cs
WalletWasabi.Fluent/Converters/NavBarIconConverter.cs
@@ -25,7 +25,7 @@ public class NavBarIconConverter : IValueConverter
return AvaloniaProperty.UnsetValue;
}
- object? IValueConverter.ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ object IValueConverter.ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}

MODIFY
WalletWasabi.Fluent/Converters/StatusBarStateVisibilityConverter.cs
WalletWasabi.Fluent/Converters/StatusBarStateVisibilityConverter.cs
@@ -13,7 +13,7 @@ public class StatusBarStateVisibilityConverter : IValueConverter
{
}
- object? IValueConverter.Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
+ object IValueConverter.Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is StatusBarState state && parameter is StatusBarState paramState)
{
@@ -23,7 +23,7 @@ public class StatusBarStateVisibilityConverter : IValueConverter
return AvaloniaProperty.UnsetValue;
}
- object? IValueConverter.ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
+ object IValueConverter.ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotImplementedException();
}

make converters fully compliant with docs