[🐴] Swap in new package, update usages (#3992)

* Swap in new package, update usages

* Remove uneccessary patch

* Override type in safe place
This commit is contained in:
Eric Bailey
2024-05-14 09:22:09 -05:00
committed by GitHub
parent 107760d551
commit 9173be686c
22 changed files with 79 additions and 173 deletions
+1 -7
View File
@@ -1,6 +1,5 @@
import React, {useContext, useState, useSyncExternalStore} from 'react'
import {AppState} from 'react-native'
import {BskyAgent} from '@atproto-labs/api'
import {useFocusEffect, useIsFocused} from '@react-navigation/native'
import {Convo} from '#/state/messages/convo/agent'
@@ -8,7 +7,6 @@ import {ConvoParams, ConvoState} from '#/state/messages/convo/types'
import {useMessagesEventBus} from '#/state/messages/events'
import {useMarkAsReadMutation} from '#/state/queries/messages/conversation'
import {useAgent} from '#/state/session'
import {useDmServiceUrlStorage} from '#/screens/Messages/Temp/useDmServiceUrlStorage'
const ChatContext = React.createContext<ConvoState | null>(null)
@@ -25,18 +23,14 @@ export function ConvoProvider({
convoId,
}: Pick<ConvoParams, 'convoId'> & {children: React.ReactNode}) {
const isScreenFocused = useIsFocused()
const {serviceUrl} = useDmServiceUrlStorage()
const {getAgent} = useAgent()
const events = useMessagesEventBus()
const [convo] = useState(
() =>
new Convo({
convoId,
agent: new BskyAgent({
service: serviceUrl,
}),
agent: getAgent(),
events,
__tempFromUserDid: getAgent().session?.did!,
}),
)
const service = useSyncExternalStore(convo.subscribe, convo.getSnapshot)