Skip to content

Commit

Permalink
Fix API breakage in Xamarin.Forms 4.7-pre (#55)
Browse files Browse the repository at this point in the history
* Implemented `IPlatformServices.GetHash`
* Updated other various NuGet packages like NUnit

Co-authored-by: Jonathan Peppers <[email protected]>
  • Loading branch information
VladislavAntonyuk and jonathanpeppers authored May 15, 2020
1 parent 546013c commit 6079f72
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 13 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ Make sure to choose the appropriate version of this package for the version of X

| Xamarin.Forms | Xamarin.Forms.Mocks |
| -------------- | ------------------- |
| 4.7.0.x | 4.7.0.x |
| 4.6.0.x | 4.6.0.x |
| 3.5.x-4.5.x | 3.5.0.x |
| 3.0.0.x | 3.0.0.x |
Expand Down
2 changes: 1 addition & 1 deletion TestAssembly/TestAssembly.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="3.6.0.220655" />
<PackageReference Include="Xamarin.Forms" Version="4.7.0.773-pre1" />
</ItemGroup>

</Project>
11 changes: 7 additions & 4 deletions Xamarin.Forms.Mocks.Tests/Xamarin.Forms.Mocks.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.6.0.726" />
<PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
<PackageReference Include="Xamarin.Forms" Version="4.7.0.773-pre1" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\TestAssembly\TestAssembly.csproj" />
<ProjectReference Include="..\Xamarin.Forms.Mocks\Xamarin.Forms.Mocks.csproj" />
<ProjectReference Include="..\Xamarin.Forms.Mocks.Xaml\Xamarin.Forms.Mocks.Xaml.csproj" />
</ItemGroup>
</Project>
</Project>
4 changes: 2 additions & 2 deletions Xamarin.Forms.Mocks.Xaml/Xamarin.Forms.Mocks.Xaml.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<AssemblyName>Xamarin.Forms.Xaml.UnitTests</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.6.0.726" />
<PackageReference Include="Xamarin.Forms" Version="4.7.0.773-pre1" />
</ItemGroup>
</Project>
</Project>
4 changes: 2 additions & 2 deletions Xamarin.Forms.Mocks.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<releaseNotes>Upgraded to netstandard2.0</releaseNotes>
<tags>Xamarin, Xamarin.Forms, Mocks, Unit Testing</tags>
<dependencies>
<dependency id="Xamarin.Forms" version="4.6.0.726" />
<dependency id="Xamarin.Forms" version="4.7.0.773-pre1" />
</dependencies>
</metadata>
</package>
</package>
16 changes: 16 additions & 0 deletions Xamarin.Forms.Mocks/PlatformServices.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System;
using System.IO;
using System.Reflection;
using System.Security.Cryptography;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Xamarin.Forms.Internals;
Expand Down Expand Up @@ -50,6 +52,20 @@ public string GetMD5Hash(string input)
throw new NotImplementedException();
}

public string GetHash(string input)
{
var stringBuilder = new StringBuilder();
using (var hash = SHA256.Create())
{
var enc = Encoding.UTF8;
byte[] result = hash.ComputeHash(enc.GetBytes(input));
foreach (byte b in result)
stringBuilder.Append(b.ToString("x2"));
}

return stringBuilder.ToString();
}

public double GetNamedSize(NamedSize size, Type targetElementType, bool useOldSizes)
{
return 14;
Expand Down
4 changes: 2 additions & 2 deletions Xamarin.Forms.Mocks/Xamarin.Forms.Mocks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<AssemblyName>Xamarin.Forms.Core.UnitTests</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.6.0.726" />
<PackageReference Include="Xamarin.Forms" Version="4.7.0.773-pre1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Xamarin.Forms.Mocks.Xaml\Xamarin.Forms.Mocks.Xaml.csproj" />
</ItemGroup>
</Project>
</Project>
4 changes: 2 additions & 2 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ var dirs = new[]
Directory("./Xamarin.Forms.Mocks.Xaml/obj") + Directory(configuration),
};
string sln = "./Xamarin.Forms.Mocks.sln";
string version = "4.6.0.1";
string suffix = "";
string version = "4.7.0.1";
string suffix = "-pre";

MSBuildSettings MSBuildSettings()
{
Expand Down

0 comments on commit 6079f72

Please sign in to comment.