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