using Blazored.LocalStorage; using LibMatrix.Interfaces.Services; namespace MatrixUtils.Web.Classes; public class LocalStorageProviderService : IStorageProvider { private readonly ILocalStorageService _localStorageService; public LocalStorageProviderService(ILocalStorageService localStorageService) { _localStorageService = localStorageService; } Task IStorageProvider.SaveAllChildrenAsync(string key, T value) { throw new NotImplementedException(); } Task IStorageProvider.LoadAllChildrenAsync(string key) where T : default => throw new NotImplementedException(); async Task IStorageProvider.SaveObjectAsync(string key, T value) => await _localStorageService.SetItemAsync(key, value); async Task IStorageProvider.LoadObjectAsync(string key) where T : default => await _localStorageService.GetItemAsync(key); async Task IStorageProvider.ObjectExistsAsync(string key) => await _localStorageService.ContainKeyAsync(key); async Task> IStorageProvider.GetAllKeysAsync() => (await _localStorageService.KeysAsync()).ToList(); async Task IStorageProvider.DeleteObjectAsync(string key) => await _localStorageService.RemoveItemAsync(key); }