This commit is contained in:
koalasat
2025-07-24 15:50:38 +02:00
parent b463c236c5
commit e951f8bb15
3 changed files with 16 additions and 5 deletions

View File

@ -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?) {

View File

@ -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);

View File

@ -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);