mirror of
https://github.com/RoboSats/robosats.git
synced 2024-12-13 19:06:26 +00:00
Fix connected chat status (#632)
This commit is contained in:
parent
f3a7701166
commit
1e5f7c0715
@ -35,6 +35,7 @@ const path =
|
||||
window.NativeRobosats === undefined
|
||||
? '/static/assets/sounds'
|
||||
: 'file:///android_asset/Web.bundle/assets/sounds';
|
||||
|
||||
const audio = {
|
||||
chat: new Audio(`${path}/chat-open.mp3`),
|
||||
takerFound: new Audio(`${path}/taker-found.mp3`),
|
||||
|
@ -16,6 +16,11 @@ import { type EncryptedChatMessage, type ServerMessage } from '..';
|
||||
import ChatBottom from '../ChatBottom';
|
||||
import { sha256 } from 'js-sha256';
|
||||
|
||||
const audioPath =
|
||||
window.NativeRobosats === undefined
|
||||
? '/static/assets/sounds'
|
||||
: 'file:///android_asset/Web.bundle/assets/sounds';
|
||||
|
||||
interface Props {
|
||||
orderId: number;
|
||||
status: number;
|
||||
@ -44,7 +49,7 @@ const EncryptedSocketChat: React.FC<Props> = ({
|
||||
const { t } = useTranslation();
|
||||
const theme = useTheme();
|
||||
|
||||
const [audio] = useState(() => new Audio(`/static/assets/sounds/chat-open.mp3`));
|
||||
const [audio] = useState(() => new Audio(`${audioPath}/chat-open.mp3`));
|
||||
const [connected, setConnected] = useState<boolean>(false);
|
||||
const [peerConnected, setPeerConnected] = useState<boolean>(false);
|
||||
const [peerPubKey, setPeerPubKey] = useState<string>();
|
||||
@ -268,7 +273,7 @@ const EncryptedSocketChat: React.FC<Props> = ({
|
||||
/>
|
||||
<Grid item>
|
||||
<ChatHeader
|
||||
connected={connected}
|
||||
connected={connected && (peerPubKey ? true : false)}
|
||||
peerConnected={peerConnected}
|
||||
turtleMode={turtleMode}
|
||||
setTurtleMode={setTurtleMode}
|
||||
|
@ -28,6 +28,11 @@ interface Props {
|
||||
setTurtleMode: (state: boolean) => void;
|
||||
}
|
||||
|
||||
const audioPath =
|
||||
window.NativeRobosats === undefined
|
||||
? '/static/assets/sounds'
|
||||
: 'file:///android_asset/Web.bundle/assets/sounds';
|
||||
|
||||
const EncryptedTurtleChat: React.FC<Props> = ({
|
||||
orderId,
|
||||
robot,
|
||||
@ -43,7 +48,7 @@ const EncryptedTurtleChat: React.FC<Props> = ({
|
||||
const { t } = useTranslation();
|
||||
const theme = useTheme();
|
||||
|
||||
const [audio] = useState(() => new Audio(`/static/assets/sounds/chat-open.mp3`));
|
||||
const [audio] = useState(() => new Audio(`${audioPath}/chat-open.mp3`));
|
||||
const [peerConnected, setPeerConnected] = useState<boolean>(false);
|
||||
const [peerPubKey, setPeerPubKey] = useState<string>();
|
||||
const [value, setValue] = useState<string>('');
|
||||
@ -255,7 +260,7 @@ const EncryptedTurtleChat: React.FC<Props> = ({
|
||||
|
||||
<Grid item>
|
||||
<ChatHeader
|
||||
connected={true}
|
||||
connected={peerPubKey ? true : false}
|
||||
peerConnected={peerConnected}
|
||||
turtleMode={turtleMode}
|
||||
setTurtleMode={setTurtleMode}
|
||||
|
Loading…
Reference in New Issue
Block a user