[🐴] update convo list from message bus (#4189)
* update convo list from message bus * don't increase unread count if you're the sender * add refetch interval back * Fix deleted message state copy * only enable if `hasSession` * Fix logged out handling * increase refetch interval to 60s * request 10s interval when message screen active * use useAppState hook for convo resume/background * Combine forces * fix useFocusEffect logic --------- Co-authored-by: Eric Bailey <git@esb.lol>
This commit is contained in:
parent
c0175af76a
commit
dc9d80d2a8
8 changed files with 376 additions and 231 deletions
15
src/lib/hooks/useAppState.ts
Normal file
15
src/lib/hooks/useAppState.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import {useEffect, useState} from 'react'
|
||||
import {AppState} from 'react-native'
|
||||
|
||||
export function useAppState() {
|
||||
const [state, setState] = useState(AppState.currentState)
|
||||
|
||||
useEffect(() => {
|
||||
const sub = AppState.addEventListener('change', nextAppState => {
|
||||
setState(nextAppState)
|
||||
})
|
||||
return () => sub.remove()
|
||||
}, [])
|
||||
|
||||
return state
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue