diff options
Diffstat (limited to 'src/state/models/me.ts')
-rw-r--r-- | src/state/models/me.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/state/models/me.ts b/src/state/models/me.ts index ba2dc6f32..68c89ac9b 100644 --- a/src/state/models/me.ts +++ b/src/state/models/me.ts @@ -8,6 +8,7 @@ import {PostsFeedModel} from './feeds/posts' import {NotificationsFeedModel} from './feeds/notifications' import {MyFollowsCache} from './cache/my-follows' import {isObj, hasProp} from 'lib/type-guards' +import {SavedFeedsModel} from './feeds/algo/saved' const PROFILE_UPDATE_INTERVAL = 10 * 60 * 1e3 // 10min const NOTIFS_UPDATE_INTERVAL = 30 * 1e3 // 30sec @@ -21,6 +22,7 @@ export class MeModel { followsCount: number | undefined followersCount: number | undefined mainFeed: PostsFeedModel + savedFeeds: SavedFeedsModel notifications: NotificationsFeedModel follows: MyFollowsCache invites: ComAtprotoServerDefs.InviteCode[] = [] @@ -43,12 +45,14 @@ export class MeModel { }) this.notifications = new NotificationsFeedModel(this.rootStore) this.follows = new MyFollowsCache(this.rootStore) + this.savedFeeds = new SavedFeedsModel(this.rootStore) } clear() { this.mainFeed.clear() this.notifications.clear() this.follows.clear() + this.savedFeeds.clear() this.did = '' this.handle = '' this.displayName = '' @@ -65,6 +69,7 @@ export class MeModel { displayName: this.displayName, description: this.description, avatar: this.avatar, + savedFeeds: this.savedFeeds.serialize(), } } @@ -86,6 +91,9 @@ export class MeModel { if (hasProp(v, 'avatar') && typeof v.avatar === 'string') { avatar = v.avatar } + if (hasProp(v, 'savedFeeds') && isObj(v.savedFeeds)) { + this.savedFeeds.hydrate(v.savedFeeds) + } if (did && handle) { this.did = did this.handle = handle @@ -110,6 +118,7 @@ export class MeModel { /* dont await */ this.notifications.setup().catch(e => { this.rootStore.log.error('Failed to setup notifications model', e) }) + /* dont await */ this.savedFeeds.refresh() this.rootStore.emitSessionLoaded() await this.fetchInviteCodes() await this.fetchAppPasswords() |