(feat): add message states
(qol): prep for mtp migration
This commit is contained in:
parent
b100967fda
commit
c484a3c303
6 changed files with 110 additions and 33 deletions
|
|
@ -69,6 +69,8 @@ export default function InputComponent({
|
|||
return;
|
||||
}
|
||||
|
||||
log(3, "chat", "purple", "Message send init, adding live message ...");
|
||||
|
||||
const reference = addLiveMessage({
|
||||
height: 0,
|
||||
not_encrypted: true,
|
||||
|
|
@ -78,7 +80,19 @@ export default function InputComponent({
|
|||
message_state: "awaiting",
|
||||
});
|
||||
|
||||
const encryptedContext = await encryptText(sharedSecret, currentValue);
|
||||
log(3, "chat", "purple", "Live message added, encrypting...");
|
||||
|
||||
const encryptedContext = await encryptText(
|
||||
sharedSecret,
|
||||
currentValue,
|
||||
).catch((err) => {
|
||||
toast("error", "Failed to encrypt message", String(err));
|
||||
reference.setFailed(true);
|
||||
});
|
||||
|
||||
if (!encryptedContext) return;
|
||||
|
||||
log(3, "chat", "purple", "Content encrypted, sending message...");
|
||||
|
||||
send("message_send", {
|
||||
height: 0,
|
||||
|
|
@ -96,6 +110,8 @@ export default function InputComponent({
|
|||
toast("error", "Failed to send message");
|
||||
});
|
||||
|
||||
log(3, "chat", "purple", "Message sent");
|
||||
|
||||
moveUserIdToTop(userId);
|
||||
|
||||
if (!preserveContent) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue