diff options
Diffstat (limited to 'src/state/models/ui')
-rw-r--r-- | src/state/models/ui/preferences.ts | 48 | ||||
-rw-r--r-- | src/state/models/ui/shell.ts | 5 |
2 files changed, 53 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 + } } diff --git a/src/state/models/ui/shell.ts b/src/state/models/ui/shell.ts index 3853f2395..c7e72e695 100644 --- a/src/state/models/ui/shell.ts +++ b/src/state/models/ui/shell.ts @@ -111,6 +111,10 @@ export interface ContentLanguagesSettingsModal { name: 'content-languages-settings' } +export interface PreferencesHomeFeed { + name: 'preferences-home-feed' +} + export type Modal = // Account | AddAppPasswordModal @@ -121,6 +125,7 @@ export type Modal = // Curation | ContentFilteringSettingsModal | ContentLanguagesSettingsModal + | PreferencesHomeFeed // Moderation | ReportAccountModal |