From ff4f9ae752cdd85248fcdab19d6880610f5ade15 Mon Sep 17 00:00:00 2001 From: Giammaria Biffi <102854627+beef-e@users.noreply.github.com> Date: Sun, 5 May 2024 16:27:40 +0200 Subject: [PATCH] Fix: sending mechanism updated, same message bug fixed --- src/lib/WritingBar.svelte | 36 ++++++++++++++++++++++-------------- src/utils/utils.ts | 24 +++++++++++------------- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/src/lib/WritingBar.svelte b/src/lib/WritingBar.svelte index e04f398..241fc2d 100644 --- a/src/lib/WritingBar.svelte +++ b/src/lib/WritingBar.svelte @@ -1,21 +1,29 @@ - -
- - + + +
\ No newline at end of file + input { + padding-left: 1.5%; + } + diff --git a/src/utils/utils.ts b/src/utils/utils.ts index ea1a01e..965021a 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -177,19 +177,6 @@ MyID.subscribe((value) => { ID = value; }); -message.subscribe((value) => { - testo = value; - - if (testo.length > 0 && conn != null && messageIsMineValue != 2 && validate(testo)) { - try { - messageIsMine.set(1); - conn.send(testo); - } catch (error) { - console.log('Errore: ' + error); - } - } -}); - messageIsMine.subscribe((value) => { messageIsMineValue = value; }); @@ -204,3 +191,14 @@ export function validate(text: string) { return true; } } + +export function actualSend(message: string) { + if (message.length > 0 && conn != null && messageIsMineValue != 2 && validate(message)) { + try { + messageIsMine.set(1); + conn.send(message); + } catch (error) { + console.log('Errore: ' + error); + } + } +}