about summary refs log tree commit diff
path: root/src/state/models/ui/preferences.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/state/models/ui/preferences.ts')
-rw-r--r--src/state/models/ui/preferences.ts48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/state/models/ui/preferences.ts b/src/state/models/ui/preferences.ts
index a42f0a837..6c9dc756e 100644
--- a/src/state/models/ui/preferences.ts
+++ b/src/state/models/ui/preferences.ts
@@ -51,6 +51,10 @@ export class PreferencesModel {
   contentLabels = new LabelPreferencesModel()
   savedFeeds: string[] = []
   pinnedFeeds: string[] = []
+  homeFeedRepliesEnabled: boolean = true
+  homeFeedRepliesThreshold: number = 2
+  homeFeedRepostsEnabled: boolean = true
+  homeFeedQuotePostsEnabled: boolean = true
 
   // used to linearize async modifications to state
   lock = new AwaitLock()
@@ -65,6 +69,10 @@ export class PreferencesModel {
       contentLabels: this.contentLabels,
       savedFeeds: this.savedFeeds,
       pinnedFeeds: this.pinnedFeeds,
+      homeFeedRepliesEnabled: this.homeFeedRepliesEnabled,
+      homeFeedRepliesThreshold: this.homeFeedRepliesThreshold,
+      homeFeedRepostsEnabled: this.homeFeedRepostsEnabled,
+      homeFeedQuotePostsEnabled: this.homeFeedQuotePostsEnabled,
     }
   }
 
@@ -102,6 +110,30 @@ export class PreferencesModel {
       ) {
         this.pinnedFeeds = v.pinnedFeeds
       }
+      if (
+        hasProp(v, 'homeFeedRepliesEnabled') &&
+        typeof v.homeFeedRepliesEnabled === 'boolean'
+      ) {
+        this.homeFeedRepliesEnabled = v.homeFeedRepliesEnabled
+      }
+      if (
+        hasProp(v, 'homeFeedRepliesThreshold') &&
+        typeof v.homeFeedRepliesThreshold === 'number'
+      ) {
+        this.homeFeedRepliesThreshold = v.homeFeedRepliesThreshold
+      }
+      if (
+        hasProp(v, 'homeFeedRepostsEnabled') &&
+        typeof v.homeFeedRepostsEnabled === 'boolean'
+      ) {
+        this.homeFeedRepostsEnabled = v.homeFeedRepostsEnabled
+      }
+      if (
+        hasProp(v, 'homeFeedQuotePostsEnabled') &&
+        typeof v.homeFeedQuotePostsEnabled === 'boolean'
+      ) {
+        this.homeFeedQuotePostsEnabled = v.homeFeedQuotePostsEnabled
+      }
     }
   }
 
@@ -380,4 +412,20 @@ export class PreferencesModel {
       this.pinnedFeeds.filter(uri => uri !== v),
     )
   }
+
+  toggleHomeFeedRepliesEnabled() {
+    this.homeFeedRepliesEnabled = !this.homeFeedRepliesEnabled
+  }
+
+  setHomeFeedRepliesThreshold(threshold: number) {
+    this.homeFeedRepliesThreshold = threshold
+  }
+
+  toggleHomeFeedRepostsEnabled() {
+    this.homeFeedRepostsEnabled = !this.homeFeedRepostsEnabled
+  }
+
+  toggleHomeFeedQuotePostsEnabled() {
+    this.homeFeedQuotePostsEnabled = !this.homeFeedQuotePostsEnabled
+  }
 }