Merge branch 'main' of github.com:bluesky-social/social-app into main
commit
29bfed78f7
|
@ -6,6 +6,7 @@ import {
|
||||||
import {RootStoreModel} from './root-store'
|
import {RootStoreModel} from './root-store'
|
||||||
import {PostsFeedModel} from './feeds/posts'
|
import {PostsFeedModel} from './feeds/posts'
|
||||||
import {NotificationsFeedModel} from './feeds/notifications'
|
import {NotificationsFeedModel} from './feeds/notifications'
|
||||||
|
import {MyFeedsUIModel} from './ui/my-feeds'
|
||||||
import {MyFollowsCache} from './cache/my-follows'
|
import {MyFollowsCache} from './cache/my-follows'
|
||||||
import {isObj, hasProp} from 'lib/type-guards'
|
import {isObj, hasProp} from 'lib/type-guards'
|
||||||
|
|
||||||
|
@ -22,6 +23,7 @@ export class MeModel {
|
||||||
followersCount: number | undefined
|
followersCount: number | undefined
|
||||||
mainFeed: PostsFeedModel
|
mainFeed: PostsFeedModel
|
||||||
notifications: NotificationsFeedModel
|
notifications: NotificationsFeedModel
|
||||||
|
myFeeds: MyFeedsUIModel
|
||||||
follows: MyFollowsCache
|
follows: MyFollowsCache
|
||||||
invites: ComAtprotoServerDefs.InviteCode[] = []
|
invites: ComAtprotoServerDefs.InviteCode[] = []
|
||||||
appPasswords: ComAtprotoServerListAppPasswords.AppPassword[] = []
|
appPasswords: ComAtprotoServerListAppPasswords.AppPassword[] = []
|
||||||
|
@ -42,12 +44,14 @@ export class MeModel {
|
||||||
algorithm: 'reverse-chronological',
|
algorithm: 'reverse-chronological',
|
||||||
})
|
})
|
||||||
this.notifications = new NotificationsFeedModel(this.rootStore)
|
this.notifications = new NotificationsFeedModel(this.rootStore)
|
||||||
|
this.myFeeds = new MyFeedsUIModel(this.rootStore)
|
||||||
this.follows = new MyFollowsCache(this.rootStore)
|
this.follows = new MyFollowsCache(this.rootStore)
|
||||||
}
|
}
|
||||||
|
|
||||||
clear() {
|
clear() {
|
||||||
this.mainFeed.clear()
|
this.mainFeed.clear()
|
||||||
this.notifications.clear()
|
this.notifications.clear()
|
||||||
|
this.myFeeds.clear()
|
||||||
this.follows.clear()
|
this.follows.clear()
|
||||||
this.rootStore.profiles.cache.clear()
|
this.rootStore.profiles.cache.clear()
|
||||||
this.rootStore.posts.cache.clear()
|
this.rootStore.posts.cache.clear()
|
||||||
|
@ -111,6 +115,11 @@ export class MeModel {
|
||||||
/* dont await */ this.notifications.setup().catch(e => {
|
/* dont await */ this.notifications.setup().catch(e => {
|
||||||
this.rootStore.log.error('Failed to setup notifications model', e)
|
this.rootStore.log.error('Failed to setup notifications model', e)
|
||||||
})
|
})
|
||||||
|
/* dont await */ this.notifications.setup().catch(e => {
|
||||||
|
this.rootStore.log.error('Failed to setup notifications model', e)
|
||||||
|
})
|
||||||
|
this.myFeeds.clear()
|
||||||
|
/* dont await */ this.myFeeds.saved.refresh()
|
||||||
this.rootStore.emitSessionLoaded()
|
this.rootStore.emitSessionLoaded()
|
||||||
await this.fetchInviteCodes()
|
await this.fetchInviteCodes()
|
||||||
await this.fetchAppPasswords()
|
await this.fetchAppPasswords()
|
||||||
|
|
|
@ -77,6 +77,11 @@ export class MyFeedsUIModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clear() {
|
||||||
|
this.saved.clear()
|
||||||
|
this.discovery.clear()
|
||||||
|
}
|
||||||
|
|
||||||
registerListeners() {
|
registerListeners() {
|
||||||
const dispose1 = reaction(
|
const dispose1 = reaction(
|
||||||
() => this.rootStore.preferences.savedFeeds,
|
() => this.rootStore.preferences.savedFeeds,
|
||||||
|
@ -107,7 +112,7 @@ export class MyFeedsUIModel {
|
||||||
_reactKey: '__saved_feeds_header__',
|
_reactKey: '__saved_feeds_header__',
|
||||||
type: 'saved-feeds-header',
|
type: 'saved-feeds-header',
|
||||||
})
|
})
|
||||||
if (this.saved.isLoading) {
|
if (this.saved.isLoading && !this.saved.hasContent) {
|
||||||
items.push({
|
items.push({
|
||||||
_reactKey: '__saved_feeds_loading__',
|
_reactKey: '__saved_feeds_loading__',
|
||||||
type: 'saved-feeds-loading',
|
type: 'saved-feeds-loading',
|
||||||
|
|
|
@ -52,6 +52,10 @@ export class SavedFeedsModel {
|
||||||
// public api
|
// public api
|
||||||
// =
|
// =
|
||||||
|
|
||||||
|
clear() {
|
||||||
|
this.all = []
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh the preferences then reload all feed infos
|
* Refresh the preferences then reload all feed infos
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -22,7 +22,7 @@ import {
|
||||||
import {ErrorMessage} from 'view/com/util/error/ErrorMessage'
|
import {ErrorMessage} from 'view/com/util/error/ErrorMessage'
|
||||||
import debounce from 'lodash.debounce'
|
import debounce from 'lodash.debounce'
|
||||||
import {Text} from 'view/com/util/text/Text'
|
import {Text} from 'view/com/util/text/Text'
|
||||||
import {MyFeedsUIModel, MyFeedsItem} from 'state/models/ui/my-feeds'
|
import {MyFeedsItem} from 'state/models/ui/my-feeds'
|
||||||
import {FeedSourceModel} from 'state/models/content/feed-source'
|
import {FeedSourceModel} from 'state/models/content/feed-source'
|
||||||
import {FlatList} from 'view/com/util/Views'
|
import {FlatList} from 'view/com/util/Views'
|
||||||
import {useFocusEffect} from '@react-navigation/native'
|
import {useFocusEffect} from '@react-navigation/native'
|
||||||
|
@ -34,7 +34,7 @@ export const FeedsScreen = withAuthRequired(
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const store = useStores()
|
const store = useStores()
|
||||||
const {isMobile, isTabletOrDesktop} = useWebMediaQueries()
|
const {isMobile, isTabletOrDesktop} = useWebMediaQueries()
|
||||||
const myFeeds = React.useMemo(() => new MyFeedsUIModel(store), [store])
|
const myFeeds = store.me.myFeeds
|
||||||
const [query, setQuery] = React.useState<string>('')
|
const [query, setQuery] = React.useState<string>('')
|
||||||
const debouncedSearchFeeds = React.useMemo(
|
const debouncedSearchFeeds = React.useMemo(
|
||||||
() => debounce(q => myFeeds.discovery.search(q), 500), // debounce for 500ms
|
() => debounce(q => myFeeds.discovery.search(q), 500), // debounce for 500ms
|
||||||
|
|
Loading…
Reference in New Issue