More prefs cleanup (#1882)

* Update useHomeTabs

* Use queryClient to fetch

* Replace useHomeTabs and useDesktopRightNavItems

* Fix type error

* Some cleanup
This commit is contained in:
Eric Bailey 2023-11-13 12:21:53 -06:00 committed by GitHub
parent 37a2204483
commit c3edde8ac6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 177 additions and 176 deletions

View file

@ -61,7 +61,7 @@ export class FeedSourceModel {
}
get isPinned() {
return this.rootStore.preferences.isPinnedFeed(this.uri)
return false
}
get isLiked() {

View file

@ -4,7 +4,6 @@ import {
BskyFeedViewPreference,
BskyThreadViewPreference,
} from '@atproto/api'
import AwaitLock from 'await-lock'
import {isObj, hasProp} from 'lib/type-guards'
import {RootStoreModel} from '../root-store'
import {ModerationOpts} from '@atproto/api'
@ -33,30 +32,17 @@ export class LabelPreferencesModel {
}
export class PreferencesModel {
adultContentEnabled = false
contentLabels = new LabelPreferencesModel()
savedFeeds: string[] = []
pinnedFeeds: string[] = []
birthDate: Date | undefined = undefined
homeFeed: FeedViewPreference = {
hideReplies: false,
hideRepliesByUnfollowed: false,
hideRepliesByLikeCount: 0,
hideReposts: false,
hideQuotePosts: false,
lab_mergeFeedEnabled: false, // experimental
}
thread: ThreadViewPreference = {
sort: 'oldest',
prioritizeFollowedUsers: true,
lab_treeViewEnabled: false, // experimental
}
// used to linearize async modifications to state
lock = new AwaitLock()
constructor(public rootStore: RootStoreModel) {
makeAutoObservable(this, {lock: false}, {autoBind: true})
makeAutoObservable(this, {}, {autoBind: true})
}
serialize() {
@ -106,7 +92,7 @@ export class PreferencesModel {
get moderationOpts(): ModerationOpts {
return {
userDid: this.rootStore.session.currentSession?.did || '',
adultContentEnabled: this.adultContentEnabled,
adultContentEnabled: false,
labels: {
// TEMP translate old settings until this UI can be migrated -prf
porn: tempfixLabelPref(this.contentLabels.nsfw),