Skip to content

Commit

Permalink
Remove usage of extensions library for BlazorStorage as more reliable…
Browse files Browse the repository at this point in the history
… way to access browsers's local storage.

Bump version to 1.0.4
  • Loading branch information
Andrii Snihyr committed Dec 26, 2019
1 parent 64637e0 commit 8491c9b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Blazor.Extensions.Storage" Version="1.0.0" />
<PackageReference Include="BlazorStorage" Version="1.0.0" />
<PackageReference Include="Nerdbank.GitVersioning" Version="3.0.28">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
6 changes: 3 additions & 3 deletions src/BlazorState.Redux.Storage/LocalStorageProvider.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
using System.Text.Json;
using System.Threading.Tasks;
using Blazor.Extensions.Storage;
using BlazorState.Redux.Interfaces;
using BlazorStorage.Interfaces;
using Newtonsoft.Json;

namespace BlazorState.Redux.Storage
{
public class LocalStorageProvider : IStateStorage
{
private readonly string _key;
private readonly LocalStorage _storage;
private readonly ILocalStorage _storage;

public LocalStorageProvider(string key, LocalStorage storage)
public LocalStorageProvider(string key, ILocalStorage storage)
{
_key = key;
_storage = storage;
Expand Down
7 changes: 4 additions & 3 deletions src/BlazorState.Redux.Storage/ReduxStoreConfigExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using System.Linq;
using Blazor.Extensions.Storage;
using BlazorState.Redux.Configuration;
using BlazorState.Redux.Interfaces;
using BlazorStorage.Extensions;
using BlazorStorage.Interfaces;
using Microsoft.Extensions.DependencyInjection;

namespace BlazorState.Redux.Storage
Expand All @@ -17,8 +18,8 @@ public static void UseLocalStorage<TState>(this ReduxStoreConfig<TState> config,
config.Services.Remove(storageRegistration);
}

config.Services.AddSingleton<LocalStorage>();
config.Services.AddSingleton<IStateStorage>(s => new LocalStorageProvider(key, s.GetService<LocalStorage>()));
config.Services.AddStorage();
config.Services.AddSingleton<IStateStorage>(s => new LocalStorageProvider(key, s.GetService<ILocalStorage>()));
}
}
}
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.0.3",
"version": "1.0.4",
"publicReleaseRefSpec": [
"^refs/heads/master$",
"^refs/heads/v\\d+(?:\\.\\d+)?$"
Expand Down

0 comments on commit 8491c9b

Please sign in to comment.