]> Repos - mime-chat/commitdiff
message updates
authorAndrew Gundersen <gundersena@xavier.edu>
Sun, 23 Jan 2022 16:46:44 +0000 (10:46 -0600)
committerAndrew Gundersen <gundersena@xavier.edu>
Sun, 23 Jan 2022 16:46:44 +0000 (10:46 -0600)
src/render/components/bubble.js
src/render/components/messenger.js
src/session.js

index 1eaa48e1367b82f68bf0563b69a06b806dcf960a..87d989742d2855cce22d9592277d4811aa897fd6 100644 (file)
@@ -33,4 +33,4 @@ const Bubble =
 
 export default Bubble;
 
-// TODO: should include other styling/actions for audio bubbles
\ No newline at end of file
+// TODO: should include other styling/actions for audio bubbles
index 6a1e9a2546e57ad7acbaaa33a54f1c17a05de3d2..def7fcd2debc83c107817819c79b4412e31e179b 100644 (file)
@@ -37,9 +37,17 @@ const Messenger = {
                 {
                     messages.value.push(update);
                 }
-                else
+                else if (typeof update == Array)
                 {
-                    messages.value[messages.value.length - 1].content.push(update);
+                    messages.value.push(...update);
+                }
+                else if (update.category)
+                {
+                    search(update.message).content.push(update);
+                }
+                else if (update.context)
+                {
+                    search(update.message).context = update.context;
                 }
 
             });
@@ -52,6 +60,8 @@ const Messenger = {
             messages.value = [];
         });
 
+        const search = (id) => messages.value.find(m => m.id == id);
+
         return { person, messages, onDrop };
     },
 
index 3d6ccdfe141dbe6c4b05a411aa81e25b6ed84757..d2e4a2a5bf40091886cd8751a03d449c66f34536 100644 (file)
@@ -26,6 +26,8 @@ function handleMessageQueue()
     {
         const update = messageQueue.shift();
 
+        console.log(update);
+
         if (update)
         {
             if (update.person)
@@ -40,20 +42,30 @@ function handleMessageQueue()
             {
                 ui.messages.push(update);
             }
+            else if (typeof update == Array)
+            {
+                ui.messages.push(...update);
+            }
             else if (update.category)
             {
-                ui.messages[ui.messages.length - 1].content.push(update);
+                search(update.message).content.push(update);
             }
-            else
+            else if (update.title)
             {
                 new Notification(update).show(); return;
             }
+            else if (update.context)
+            {
+                search(update.message).context = update.context;
+            }
 
             ipcEmit("message", update);
         }
     }
 }
 
+const search = (id) => ui.messages.find(m => m.id == id);
+
 function launchSession(account)
 {
     connectToPlatform(account);