Skip to content

Commit

Permalink
Merge pull request #5 from davidnajar/netstandard2
Browse files Browse the repository at this point in the history
Changed Fluxor.Persist to netstandard2.0
  • Loading branch information
Tailslide authored Feb 16, 2022
2 parents 64bf29a + d0992f8 commit d3187e4
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 61 deletions.
8 changes: 4 additions & 4 deletions Fluxor.Persist.Sample.Shared/Storage/InMemoryStateStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ public class InMemoryStateStorage : IObjectStateStorage

public void ClearStore() => _store.Clear();

public ValueTask<object> GetStateAsync(string statename)
public Task<object> GetStateAsync(string statename)
{
if (_store.ContainsKey(statename))
return ValueTask.FromResult(_store[statename]);
return Task.FromResult(_store[statename]);
return default;
}

public ValueTask StoreStateAsync(string statename, object state)
public Task StoreStateAsync(string statename, object state)
{
if (_store.ContainsKey(statename))
_store.TryRemove(statename, out _);
_store.TryAdd(statename, state);
return ValueTask.CompletedTask;
return Task.CompletedTask;
}
}
}
4 changes: 2 additions & 2 deletions Fluxor.Persist.Sample.Shared/Storage/LocalStateStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ public LocalStateStorage(ILocalStorageService localStorage)
LocalStorage = localStorage;
}

public async ValueTask<string> GetStateJsonAsync(string statename)
public async Task<string> GetStateJsonAsync(string statename)
{
return await LocalStorage.GetItemAsStringAsync(statename);
}

public async ValueTask StoreStateJsonAsync(string statename, string json)
public async Task StoreStateJsonAsync(string statename, string json)
{
await LocalStorage.SetItemAsStringAsync(statename, json);
}
Expand Down
8 changes: 8 additions & 0 deletions Fluxor.Persist/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace System.Runtime.CompilerServices
{
public class IsExternalInit { }
}
3 changes: 0 additions & 3 deletions Fluxor.Persist/Component1.razor

This file was deleted.

6 changes: 0 additions & 6 deletions Fluxor.Persist/Component1.razor.css

This file was deleted.

39 changes: 0 additions & 39 deletions Fluxor.Persist/ExampleJsInterop.cs

This file was deleted.

7 changes: 5 additions & 2 deletions Fluxor.Persist/Fluxor.Persist.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<Description>Persists fluxor packages</Description>
<Version>2.0.0</Version>
<Authors>Greg Pringle</Authors>
Expand All @@ -13,7 +13,9 @@
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<PropertyGroup>
<LangVersion>9.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<Compile Remove="ExampleJsInterop.cs" />
</ItemGroup>
Expand All @@ -38,6 +40,7 @@
<ItemGroup>
<PackageReference Include="Fluxor" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
<PackageReference Include="System.Text.Json" Version="6.0.2" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Fluxor.Persist/Middleware/PersistMiddlewareOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private class ListComparer : IEqualityComparer<KeyValuePair<string, bool>>
{
public bool Equals(KeyValuePair<string, bool> x, KeyValuePair<string, bool> y) => x.Key.Equals(y.Key);

public int GetHashCode([DisallowNull] KeyValuePair<string, bool> obj) => obj.Key.GetHashCode();
public int GetHashCode( KeyValuePair<string, bool> obj) => !obj.Equals(default(KeyValuePair<string, bool>)) ? obj.Key.GetHashCode():int.MinValue;
}
}
}
4 changes: 2 additions & 2 deletions Fluxor.Persist/Storage/IObjectStateStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Fluxor.Persist.Storage
{
public interface IObjectStateStorage
{
public ValueTask<object> GetStateAsync(string statename);
public ValueTask StoreStateAsync(string statename, object state);
public Task<object> GetStateAsync(string statename);
public Task StoreStateAsync(string statename, object state);
}
}
4 changes: 2 additions & 2 deletions Fluxor.Persist/Storage/IStringStateStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Fluxor.Persist.Storage
{
public interface IStringStateStorage
{
public ValueTask<string> GetStateJsonAsync(string statename);
public ValueTask StoreStateJsonAsync(string statename, string json);
public Task<string> GetStateJsonAsync(string statename);
public Task StoreStateJsonAsync(string statename, string json);
}
}

0 comments on commit d3187e4

Please sign in to comment.