mirror of
https://github.com/RoboSats/robosats.git
synced 2025-08-06 17:40:10 +00:00
Fix chat
This commit is contained in:
@ -319,7 +319,14 @@ class WebAppInterface(private val context: Context, private val webView: WebView
|
||||
}
|
||||
|
||||
private fun onWsMessage(path: String?, message: String?) {
|
||||
safeEvaluateJavascript("javascript:window.AndroidRobosats.onWSMessage('$path', '$message')")
|
||||
val escapedMessage = message
|
||||
?.replace("\\", "\\\\") // Escape backslashes first
|
||||
?.replace("'", "\\'") // Escape single quotes
|
||||
?.replace("\"", "\\\"") // Escape double quotes
|
||||
?.replace("\n", "\\n") // Escape newlines
|
||||
?.replace("\r", "\\r") // Escape carriage returns
|
||||
?.replace("\t", "\\t") // Escape tabs
|
||||
safeEvaluateJavascript("javascript:window.AndroidRobosats.onWSMessage('$path', '$escapedMessage')")
|
||||
}
|
||||
|
||||
private fun onWsError(path: String?) {
|
||||
|
@ -23,7 +23,7 @@ import arraysAreDifferent from '../../../utils/array';
|
||||
import getSettings from '../../../utils/settings';
|
||||
|
||||
const path =
|
||||
getSettings().client == 'mobile'
|
||||
getSettings().client === 'mobile'
|
||||
? 'file:///android_asset/static/assets/sounds'
|
||||
: '/static/assets/sounds';
|
||||
|
||||
@ -98,12 +98,16 @@ const NotificationsDrawer = ({
|
||||
|
||||
const soundType = soundByStatus[orderStatus] ?? 'ding';
|
||||
const sound = audio[soundType];
|
||||
console.log(sound);
|
||||
void sound.play();
|
||||
};
|
||||
|
||||
const loadNotifciationsNostr = (): void => {
|
||||
const tokens = Object.keys(garage.slots);
|
||||
if (!arraysAreDifferent(subscribedTokens, tokens)) return;
|
||||
if (!arraysAreDifferent(subscribedTokens, tokens)) {
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
cleanUpNotifications();
|
||||
setSubscribedTokens(tokens);
|
||||
|
@ -21,7 +21,7 @@ import { Send } from '@mui/icons-material';
|
||||
|
||||
const audioPath =
|
||||
getSettings().client == 'mobile'
|
||||
? 'file:///android_asset//static/assets/sounds'
|
||||
? 'file:///android_asset/static/assets/sounds'
|
||||
: '/static/assets/sounds';
|
||||
|
||||
interface Props {
|
||||
@ -135,7 +135,7 @@ const EncryptedSocketChat: React.FC<Props> = ({
|
||||
);
|
||||
|
||||
connection.onMessage((message) => {
|
||||
setServerMessages((prev) => [...prev, message]);
|
||||
setServerMessages((prev) => [...prev, message as ServerMessage]);
|
||||
});
|
||||
connection.onClose(() => {
|
||||
setConnected(false);
|
||||
|
Reference in New Issue
Block a user