mirror of
https://github.com/RoboSats/robosats.git
synced 2025-09-13 00:56:22 +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?) {
|
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?) {
|
private fun onWsError(path: String?) {
|
||||||
|
|||||||
@ -23,7 +23,7 @@ import arraysAreDifferent from '../../../utils/array';
|
|||||||
import getSettings from '../../../utils/settings';
|
import getSettings from '../../../utils/settings';
|
||||||
|
|
||||||
const path =
|
const path =
|
||||||
getSettings().client == 'mobile'
|
getSettings().client === 'mobile'
|
||||||
? 'file:///android_asset/static/assets/sounds'
|
? 'file:///android_asset/static/assets/sounds'
|
||||||
: '/static/assets/sounds';
|
: '/static/assets/sounds';
|
||||||
|
|
||||||
@ -98,12 +98,16 @@ const NotificationsDrawer = ({
|
|||||||
|
|
||||||
const soundType = soundByStatus[orderStatus] ?? 'ding';
|
const soundType = soundByStatus[orderStatus] ?? 'ding';
|
||||||
const sound = audio[soundType];
|
const sound = audio[soundType];
|
||||||
|
console.log(sound);
|
||||||
void sound.play();
|
void sound.play();
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadNotifciationsNostr = (): void => {
|
const loadNotifciationsNostr = (): void => {
|
||||||
const tokens = Object.keys(garage.slots);
|
const tokens = Object.keys(garage.slots);
|
||||||
if (!arraysAreDifferent(subscribedTokens, tokens)) return;
|
if (!arraysAreDifferent(subscribedTokens, tokens)) {
|
||||||
|
setLoading(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
cleanUpNotifications();
|
cleanUpNotifications();
|
||||||
setSubscribedTokens(tokens);
|
setSubscribedTokens(tokens);
|
||||||
|
|||||||
@ -21,7 +21,7 @@ import { Send } from '@mui/icons-material';
|
|||||||
|
|
||||||
const audioPath =
|
const audioPath =
|
||||||
getSettings().client == 'mobile'
|
getSettings().client == 'mobile'
|
||||||
? 'file:///android_asset//static/assets/sounds'
|
? 'file:///android_asset/static/assets/sounds'
|
||||||
: '/static/assets/sounds';
|
: '/static/assets/sounds';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@ -135,7 +135,7 @@ const EncryptedSocketChat: React.FC<Props> = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
connection.onMessage((message) => {
|
connection.onMessage((message) => {
|
||||||
setServerMessages((prev) => [...prev, message]);
|
setServerMessages((prev) => [...prev, message as ServerMessage]);
|
||||||
});
|
});
|
||||||
connection.onClose(() => {
|
connection.onClose(() => {
|
||||||
setConnected(false);
|
setConnected(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user