mirror of
https://github.com/liamcottle/reticulum-meshchat.git
synced 2026-04-28 00:20:48 +00:00
add button to retry sending failed messages
This commit is contained in:
parent
a396f6d841
commit
8c011dd72f
1 changed files with 33 additions and 2 deletions
|
|
@ -601,6 +601,7 @@
|
|||
<span>{{ chatItem.lxmf_message.state }}</span>
|
||||
<span v-if="chatItem.lxmf_message.state === 'outbound' && chatItem.lxmf_message.delivery_attempts >= 1">(attempt {{ chatItem.lxmf_message.delivery_attempts + 1 }})</span>
|
||||
<span v-if="chatItem.lxmf_message.state === 'sending'">{{ chatItem.lxmf_message.progress.toFixed(0) }}%</span>
|
||||
<a v-if="chatItem.lxmf_message.state === 'failed'" @click="retrySendingMessage(chatItem)" class="cursor-pointer underline text-blue-500">retry?</a>
|
||||
</div>
|
||||
|
||||
<!-- delivered icon -->
|
||||
|
|
@ -1672,6 +1673,36 @@
|
|||
// scroll to bottom
|
||||
this.scrollMessagesToBottom();
|
||||
|
||||
},
|
||||
async retrySendingMessage(chatItem) {
|
||||
|
||||
// do nothing if not connected to websocket
|
||||
if(!this.isWebsocketConnected){
|
||||
this.alert("Not connected to WebSocket!");
|
||||
return;
|
||||
}
|
||||
|
||||
// force delete existing message
|
||||
await this.deleteChatItem(chatItem, false);
|
||||
|
||||
try {
|
||||
|
||||
// send message to reticulum via websocket
|
||||
this.ws.send(JSON.stringify({
|
||||
"type": "lxmf.delivery",
|
||||
"lxmf_message": chatItem.lxmf_message,
|
||||
}));
|
||||
|
||||
} catch(e) {
|
||||
|
||||
// todo handle error
|
||||
console.error(e);
|
||||
|
||||
}
|
||||
|
||||
// scroll to bottom
|
||||
this.scrollMessagesToBottom();
|
||||
|
||||
},
|
||||
async updateConfig(config) {
|
||||
|
||||
|
|
@ -2246,11 +2277,11 @@
|
|||
this.alert("unsupported url: " + url);
|
||||
|
||||
},
|
||||
async deleteChatItem(chatItem) {
|
||||
async deleteChatItem(chatItem, shouldConfirm = true) {
|
||||
try {
|
||||
|
||||
// ask user to confirm deleting message
|
||||
if(!confirm("Are you sure you want to delete this message? This can not be undone!")){
|
||||
if(shouldConfirm && !confirm("Are you sure you want to delete this message? This can not be undone!")){
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue