about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Classes/LocalStorageWrapper.cs
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-05-14 15:07:47 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-05-14 15:07:47 +0200
commit60d713b82fcc6b17858dd4975601ee67177a9313 (patch)
tree548893df40087a6a1cc7f0bc9bbfd993f0428a56 /MatrixRoomUtils.Web/Classes/LocalStorageWrapper.cs
parentAdd state cache (diff)
downloadMatrixUtils-60d713b82fcc6b17858dd4975601ee67177a9313.tar.xz
Local changes
Diffstat (limited to 'MatrixRoomUtils.Web/Classes/LocalStorageWrapper.cs')
-rw-r--r--MatrixRoomUtils.Web/Classes/LocalStorageWrapper.cs16
1 files changed, 16 insertions, 0 deletions
diff --git a/MatrixRoomUtils.Web/Classes/LocalStorageWrapper.cs b/MatrixRoomUtils.Web/Classes/LocalStorageWrapper.cs
index 287d1e5..a439ea1 100644
--- a/MatrixRoomUtils.Web/Classes/LocalStorageWrapper.cs
+++ b/MatrixRoomUtils.Web/Classes/LocalStorageWrapper.cs
@@ -6,6 +6,8 @@ namespace MatrixRoomUtils.Web.Classes;
 
 public partial class LocalStorageWrapper
 {
+    public static Settings Settings { get; set; } = new();
+    
     //some basic logic
     public static async Task ReloadLocalStorage(ILocalStorageService localStorage)
     {
@@ -14,6 +16,7 @@ public partial class LocalStorageWrapper
     }
     public static async Task LoadFromLocalStorage(ILocalStorageService localStorage)
     {
+        Settings = await localStorage.GetItemAsync<Settings>("rory.matrixroomutils.settings") ?? new();
         // RuntimeCache.AccessToken = await localStorage.GetItemAsync<string>("rory.matrixroomutils.token");
         RuntimeCache.LastUsedToken = await localStorage.GetItemAsync<string>("rory.matrixroomutils.last_used_token");
         // RuntimeCache.CurrentHomeserver = await localStorage.GetItemAsync<string>("rory.matrixroomutils.current_homeserver");
@@ -34,6 +37,7 @@ public partial class LocalStorageWrapper
 
     public static async Task SaveToLocalStorage(ILocalStorageService localStorage)
     {
+        await localStorage.SetItemAsync("rory.matrixroomutils.settings", Settings);
         // if(RuntimeCache.AccessToken != null) await localStorage.SetItemAsStringAsync("rory.matrixroomutils.token", RuntimeCache.AccessToken);
         // if(RuntimeCache.CurrentHomeserver != null) await localStorage.SetItemAsync("rory.matrixroomutils.current_homeserver", RuntimeCache.CurrentHomeserver);
         if(RuntimeCache.LoginSessions != null) await localStorage.SetItemAsync("rory.matrixroomutils.user_cache", RuntimeCache.LoginSessions);
@@ -43,4 +47,16 @@ public partial class LocalStorageWrapper
                 .ToDictionary(x => x.Key, x => x.Value));
         await localStorage.SetItemAsync("rory.matrixroomutils.generic_cache", RuntimeCache.GenericResponseCache);
     }
+}
+
+
+public class Settings
+{
+    public DeveloperSettings DeveloperSettings { get; set; } = new();
+}
+
+
+public class DeveloperSettings
+{
+    public bool EnableLogViewers { get; set; } = false;
 }
\ No newline at end of file