forked from Shiloh/remnantchat
chore(deps): use trystero@0.15.0
This commit is contained in:
parent
ab18b795c8
commit
1cf4b50ac2
11
package-lock.json
generated
11
package-lock.json
generated
@ -46,7 +46,7 @@
|
||||
"sdp": "^3.2.0",
|
||||
"secure-file-transfer": "^0.0.7",
|
||||
"streamsaver": "^2.0.6",
|
||||
"trystero": "^0.13.1",
|
||||
"trystero": "^0.15.0",
|
||||
"typeface-public-sans": "^1.1.13",
|
||||
"typeface-roboto": "^1.1.13",
|
||||
"typescript": "^4.9.5",
|
||||
@ -25716,8 +25716,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/trystero": {
|
||||
"version": "0.13.1",
|
||||
"license": "MIT",
|
||||
"version": "0.15.0",
|
||||
"resolved": "https://registry.npmjs.org/trystero/-/trystero-0.15.0.tgz",
|
||||
"integrity": "sha512-BsHx1OlMQOvGbWb5OZ8hIZUyH9H2V6HjdvsnvOLBd2LruoFn20zwJrK5kqK9K2hl/VaW1ln0dMC3E4pQb75rbA==",
|
||||
"dependencies": {
|
||||
"firebase": "^9.6.5",
|
||||
"ipfs-core": "0.9.0",
|
||||
@ -42784,7 +42785,9 @@
|
||||
"version": "1.0.1"
|
||||
},
|
||||
"trystero": {
|
||||
"version": "0.13.1",
|
||||
"version": "0.15.0",
|
||||
"resolved": "https://registry.npmjs.org/trystero/-/trystero-0.15.0.tgz",
|
||||
"integrity": "sha512-BsHx1OlMQOvGbWb5OZ8hIZUyH9H2V6HjdvsnvOLBd2LruoFn20zwJrK5kqK9K2hl/VaW1ln0dMC3E4pQb75rbA==",
|
||||
"requires": {
|
||||
"firebase": "^9.6.5",
|
||||
"ipfs-core": "npm:dry-uninstall",
|
||||
|
@ -42,7 +42,7 @@
|
||||
"sdp": "^3.2.0",
|
||||
"secure-file-transfer": "^0.0.7",
|
||||
"streamsaver": "^2.0.6",
|
||||
"trystero": "^0.13.1",
|
||||
"trystero": "^0.15.0",
|
||||
"typeface-public-sans": "^1.1.13",
|
||||
"typeface-roboto": "^1.1.13",
|
||||
"typescript": "^4.9.5",
|
||||
|
@ -1,10 +0,0 @@
|
||||
import { useState } from 'react'
|
||||
|
||||
import { PeerRoom } from 'services/PeerRoom'
|
||||
import { PeerActions } from 'models/network'
|
||||
|
||||
export function usePeerRoomAction<T>(peerRoom: PeerRoom, action: PeerActions) {
|
||||
const [peerRoomAction] = useState(() => peerRoom.makeAction<T>(action))
|
||||
|
||||
return peerRoomAction
|
||||
}
|
@ -30,8 +30,6 @@ import { fileTransfer } from 'services/FileTransfer'
|
||||
|
||||
import { messageTranscriptSizeLimit } from 'config/messaging'
|
||||
|
||||
import { usePeerRoomAction } from './usePeerRoomAction'
|
||||
|
||||
interface UseRoomConfig {
|
||||
roomId: string
|
||||
userId: string
|
||||
@ -156,7 +154,7 @@ export function useRoom(
|
||||
)
|
||||
|
||||
const [sendTypingStatusChange, receiveTypingStatusChange] =
|
||||
usePeerRoomAction<TypingStatus>(peerRoom, PeerActions.TYPING_STATUS_CHANGE)
|
||||
peerRoom.makeAction<TypingStatus>(PeerActions.TYPING_STATUS_CHANGE)
|
||||
|
||||
const [isTyping, setIsTypingDebounced, setIsTyping] = useDebounce(
|
||||
false,
|
||||
@ -199,17 +197,17 @@ export function useRoom(
|
||||
}, [isShowingMessages, setUnreadMessages])
|
||||
|
||||
const [sendPeerMetadata, receivePeerMetadata] =
|
||||
usePeerRoomAction<UserMetadata>(peerRoom, PeerActions.PEER_METADATA)
|
||||
peerRoom.makeAction<UserMetadata>(PeerActions.PEER_METADATA)
|
||||
|
||||
const [sendMessageTranscript, receiveMessageTranscript] = usePeerRoomAction<
|
||||
const [sendMessageTranscript, receiveMessageTranscript] = peerRoom.makeAction<
|
||||
Array<ReceivedMessage | ReceivedInlineMedia>
|
||||
>(peerRoom, PeerActions.MESSAGE_TRANSCRIPT)
|
||||
>(PeerActions.MESSAGE_TRANSCRIPT)
|
||||
|
||||
const [sendPeerMessage, receivePeerMessage] =
|
||||
usePeerRoomAction<UnsentMessage>(peerRoom, PeerActions.MESSAGE)
|
||||
peerRoom.makeAction<UnsentMessage>(PeerActions.MESSAGE)
|
||||
|
||||
const [sendPeerInlineMedia, receivePeerInlineMedia] =
|
||||
usePeerRoomAction<UnsentInlineMedia>(peerRoom, PeerActions.MEDIA_MESSAGE)
|
||||
peerRoom.makeAction<UnsentInlineMedia>(PeerActions.MEDIA_MESSAGE)
|
||||
|
||||
const sendMessage = async (message: string) => {
|
||||
if (isMessageSending) return
|
||||
|
@ -5,8 +5,6 @@ import { PeerActions } from 'models/network'
|
||||
import { AudioState, Peer } from 'models/chat'
|
||||
import { PeerRoom, PeerHookType, PeerStreamType } from 'services/PeerRoom'
|
||||
|
||||
import { usePeerRoomAction } from './usePeerRoomAction'
|
||||
|
||||
interface UseRoomAudioConfig {
|
||||
peerRoom: PeerRoom
|
||||
}
|
||||
@ -34,8 +32,7 @@ export function useRoomAudio({ peerRoom }: UseRoomAudioConfig) {
|
||||
})()
|
||||
}, [audioStream])
|
||||
|
||||
const [sendAudioChange, receiveAudioChange] = usePeerRoomAction<AudioState>(
|
||||
peerRoom,
|
||||
const [sendAudioChange, receiveAudioChange] = peerRoom.makeAction<AudioState>(
|
||||
PeerActions.AUDIO_CHANGE
|
||||
)
|
||||
|
||||
|
@ -9,8 +9,6 @@ import { PeerRoom, PeerHookType } from 'services/PeerRoom'
|
||||
|
||||
import { fileTransfer } from 'services/FileTransfer/index'
|
||||
|
||||
import { usePeerRoomAction } from './usePeerRoomAction'
|
||||
|
||||
interface UseRoomFileShareConfig {
|
||||
onInlineMediaUpload: (files: File[]) => void
|
||||
peerRoom: PeerRoom
|
||||
@ -36,10 +34,7 @@ export function useRoomFileShare({
|
||||
const { peerOfferedFileMetadata, setPeerOfferedFileMetadata } = roomContext
|
||||
|
||||
const [sendFileOfferMetadata, receiveFileOfferMetadata] =
|
||||
usePeerRoomAction<FileOfferMetadata | null>(
|
||||
peerRoom,
|
||||
PeerActions.FILE_OFFER
|
||||
)
|
||||
peerRoom.makeAction<FileOfferMetadata | null>(PeerActions.FILE_OFFER)
|
||||
|
||||
receiveFileOfferMetadata((fileOfferMetadata, peerId) => {
|
||||
if (fileOfferMetadata) {
|
||||
|
@ -7,8 +7,6 @@ import { PeerActions } from 'models/network'
|
||||
import { ScreenShareState, Peer, VideoStreamType } from 'models/chat'
|
||||
import { PeerRoom, PeerHookType, PeerStreamType } from 'services/PeerRoom'
|
||||
|
||||
import { usePeerRoomAction } from './usePeerRoomAction'
|
||||
|
||||
interface UseRoomScreenShareConfig {
|
||||
peerRoom: PeerRoom
|
||||
}
|
||||
@ -28,7 +26,7 @@ export function useRoomScreenShare({ peerRoom }: UseRoomScreenShareConfig) {
|
||||
} = roomContext
|
||||
|
||||
const [sendScreenShare, receiveScreenShare] =
|
||||
usePeerRoomAction<ScreenShareState>(peerRoom, PeerActions.SCREEN_SHARE)
|
||||
peerRoom.makeAction<ScreenShareState>(PeerActions.SCREEN_SHARE)
|
||||
|
||||
receiveScreenShare((screenState, peerId) => {
|
||||
const newPeerList = peerList.map(peer => {
|
||||
|
@ -8,8 +8,6 @@ import { PeerRoom, PeerHookType, PeerStreamType } from 'services/PeerRoom'
|
||||
|
||||
import { isRecord } from 'utils'
|
||||
|
||||
import { usePeerRoomAction } from './usePeerRoomAction'
|
||||
|
||||
interface UseRoomVideoConfig {
|
||||
peerRoom: PeerRoom
|
||||
}
|
||||
@ -70,8 +68,7 @@ export function useRoomVideo({ peerRoom }: UseRoomVideoConfig) {
|
||||
})()
|
||||
}, [peerRoom, selfVideoStream, setSelfVideoStream])
|
||||
|
||||
const [sendVideoChange, receiveVideoChange] = usePeerRoomAction<VideoState>(
|
||||
peerRoom,
|
||||
const [sendVideoChange, receiveVideoChange] = peerRoom.makeAction<VideoState>(
|
||||
PeerActions.VIDEO_CHANGE
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user