nullable compatibility FeeTargetTimeConverter
MODIFY
WalletWasabi.Fluent/Converters/FeeTargetTimeConverter.cs
WalletWasabi.Fluent/Converters/FeeTargetTimeConverter.cs
@@ -14,45 +14,50 @@ public class FeeTargetTimeConverter : IValueConverter
{
return "fastest";
}
- else if (feeTarget is >= Constants.TwentyMinutesConfirmationTarget and <= 6) // minutes
+
+ if (feeTarget is >= Constants.TwentyMinutesConfirmationTarget and <= 6) // minutes
{
return $"{feeTarget}0{minutesLabel}";
}
- else if (feeTarget is >= 7 and <= Constants.OneDayConfirmationTarget) // hours
+
+ if (feeTarget is >= 7 and <= Constants.OneDayConfirmationTarget) // hours
{
var hours = feeTarget / 6; // 6 blocks per hour
return $"{hours}{IfPlural(hours, hourLabel, hoursLabel)}";
}
- else if (feeTarget is >= (Constants.OneDayConfirmationTarget + 1) and < Constants.SevenDaysConfirmationTarget) // days
+
+ if (feeTarget is >= (Constants.OneDayConfirmationTarget + 1) and < Constants.SevenDaysConfirmationTarget) // days
{
var days = feeTarget / Constants.OneDayConfirmationTarget;
return $"{days}{IfPlural(days, dayLabel, daysLabel)}";
}
- else if (feeTarget == Constants.SevenDaysConfirmationTarget)
+
+ if (feeTarget == Constants.SevenDaysConfirmationTarget)
{
return "one week";
}
- else
- {
+
return "invalid";
}
- }
- 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 FeeTargetTimeConverter.Convert(feeTarget, " minutes", " hour", " hours", " day", " days");
+ return Convert(feeTarget, " minutes", " hour", " hours", " day", " days");
}
- else
+
+ if (value is { })
{
throw new TypeArgumentException(value, typeof(SmartCoinStatus), nameof(value));
}
+
+ return null;
}
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
- throw new NotSupportedException();
+ return null;
}
private static string IfPlural(int val, string singular, string plural)

nullable compatibility FeeTargetTimeConverter