[🐴] 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:
Samuel Newman 2024-05-24 19:59:28 +01:00 committed by GitHub
parent c0175af76a
commit dc9d80d2a8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 376 additions and 231 deletions

View 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
}