mirror of
https://github.com/aljazceru/meshcore-web.git
synced 2025-12-18 16:44:21 +01:00
implement basic send message
This commit is contained in:
@@ -23,6 +23,7 @@ import Page from "./Page.vue";
|
|||||||
import GlobalState from "../../js/GlobalState.js";
|
import GlobalState from "../../js/GlobalState.js";
|
||||||
import ConnectButtons from "../connect/ConnectButtons.vue";
|
import ConnectButtons from "../connect/ConnectButtons.vue";
|
||||||
import ContactsList from "../contacts/ContactsList.vue";
|
import ContactsList from "../contacts/ContactsList.vue";
|
||||||
|
import Connection from "../../js/Connection.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'MainPage',
|
name: 'MainPage',
|
||||||
@@ -33,8 +34,17 @@ export default {
|
|||||||
Header,
|
Header,
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onContactClick(contact) {
|
async onContactClick(contact) {
|
||||||
// todo
|
|
||||||
|
// ask user for message
|
||||||
|
const message = prompt("Enter message to send");
|
||||||
|
if(!message){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// send message
|
||||||
|
await Connection.sendMessage(contact.publicKey, message);
|
||||||
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|||||||
@@ -73,6 +73,11 @@ class Connection {
|
|||||||
await GlobalState.connection.sendCommandRemoveContact(publicKey);
|
await GlobalState.connection.sendCommandRemoveContact(publicKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static async sendMessage(publicKey, message) {
|
||||||
|
await GlobalState.connection.sendTextMessage(publicKey, message);
|
||||||
|
// todo handle acks
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Connection;
|
export default Connection;
|
||||||
|
|||||||
Reference in New Issue
Block a user