show notification when a new message is received

This commit is contained in:
liamcottle
2025-02-13 18:25:10 +13:00
parent 8ff37f955e
commit 8a2a855f31
2 changed files with 27 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ import GlobalState from "./GlobalState.js";
import {BleConnection, Constants, SerialConnection} from "@liamcottle/meshcore.js";
import Database from "./Database.js";
import Utils from "./Utils.js";
import NotificationUtils from "./NotificationUtils.js";
class Connection {
@@ -232,6 +233,7 @@ class Connection {
return;
}
// save message to database
await Database.Message.insert({
status: "received",
to: GlobalState.selfInfo.publicKey,
@@ -245,6 +247,9 @@ class Connection {
error: null,
});
// show notification
await NotificationUtils.showNotification(contact.advName, message.text);
}
}