Skip to content

Commit

Permalink
Merge pull request #310 from enisn/4.1-ignore-differenttype-comparison
Browse files Browse the repository at this point in the history
Ignoring diffretent type comparison in validators
  • Loading branch information
enisn committed Sep 17, 2022
2 parents aa4b258 + 36d047b commit fd79c35
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/InputKit.Maui/InputKit.Maui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<SingleProject>true</SingleProject>
<MauiVersion>6.0.486</MauiVersion>
<PackageId>InputKit.Maui</PackageId>
<Version>4.1.0</Version>
<Version>4.1.1</Version>
<DefineConstants Condition="$(TargetFramework.Contains('-windows'))">$(DefineConstants);UWP</DefineConstants>

<!-- NuGet Package Info -->
Expand Down
2 changes: 1 addition & 1 deletion src/InputKit.Maui/Shared/Validations/MaxValueValidation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public bool Validate(object value)
}

var converted = ComparableTypeConverter.Instance.ConvertFrom(value);
if (converted is IComparable comparable)
if (converted is IComparable comparable && converted.GetType() == comparable.GetType())
{
return comparable.CompareTo(MaxValue) <= 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/InputKit.Maui/Shared/Validations/MinValueValidation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public bool Validate(object value)

var converted = ComparableTypeConverter.Instance.ConvertFrom(value);

if (converted is IComparable comparable)
if (converted is IComparable comparable && converted.GetType() == comparable.GetType())
{
return comparable.CompareTo(MinValue) >= 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public bool Validate(object value)
}

var converted = ComparableTypeConverter.Instance.ConvertFrom(value);
if (converted is IComparable comparable)
if (converted is IComparable comparable && converted.GetType() == comparable.GetType())
{
return comparable.CompareTo(MaxValue) <= 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public bool Validate(object value)

var converted = ComparableTypeConverter.Instance.ConvertFrom(value);

if (converted is IComparable comparable)
if (converted is IComparable comparable && converted.GetType() == comparable.GetType())
{
return comparable.CompareTo(MinValue) >= 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Xamarin.Forms.InputKit/Xamarin.Forms.InputKit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<RootNamespace>Plugin.InputKit</RootNamespace>
<PackageId>Xamarin.Forms.InputKit</PackageId>
<Product>$(AssemblyName) ($(TargetFramework))</Product>
<Version>4.1.0</Version>
<Version>4.1.1</Version>
<PackOnBuild>false</PackOnBuild>
<NeutralLanguage>en-US</NeutralLanguage>
<DefineConstants>$(DefineConstants);</DefineConstants>
Expand Down

0 comments on commit fd79c35

Please sign in to comment.