]> Repos - mime-chat/commitdiff
Applying production bug fixes
authorAndrew Gundersen <gundersena@xavier.edu>
Tue, 8 Mar 2022 13:23:37 +0000 (07:23 -0600)
committerAndrew Gundersen <gundersena@xavier.edu>
Tue, 8 Mar 2022 13:23:37 +0000 (07:23 -0600)
src/account.js
src/render/components/app.js
src/render/preload.js
src/tray.js
src/window.js

index df404d3dc5437d59e5162238944255f8bb257911..e339db25ee81d256678f1b0e41b7b1b77a14a5f6 100644 (file)
@@ -33,17 +33,6 @@ function initAccount()
 
     const account = store.get("account");
     if (account) launchSession(account);
-
-    for (let i = 0; i < 10; i++)
-    {
-        setTimeout(() => {
-            console.log("Testing Main to Render IPC");
-            ipcEmit("test");
-        }, 1000 * i)
-    }
-
-    ipcMain.on("test", () => console.log("Received from Render!"));
-
 }
 
 backgroundMitt.on("logout", (reason) => logout(null, reason));
index b92cb53dad5ae2a0e17057c3781b5c4c14c7d2f4..1793563f6a49f4fe2d8693320b24dcec01e8ba6c 100644 (file)
@@ -32,22 +32,11 @@ const App =
         <Splash v-else />`
 }
 
-for (let i = 0; i < 30; i++)
-{
-    setTimeout(() => {
-        console.log("Testing Render to Main IPC.");
-        window.mainApi.send("test");
-    }, i * 1000);
-}
-
 window.mainApi.on("account", (value, reason) => {
-    console.log(value, reason);
     if (reason) alert(reason);
     account.value = value;
 });
 
-window.mainApi.on("test", () => console.log("Received from Main!"));
-
 export default App;
 export { account };
 
index 8dd441bbcf98c5b19578cdf8cedb0631a2939ce8..adef673c27c060dda3cf1f01b018d5ca63d19f77 100644 (file)
@@ -7,8 +7,7 @@ const validFromMainChannels = [
     "account", 
     "message",
     "record",
-    "ws",
-    "test"
+    "ws"
 ];
 
 const validToMain = [
@@ -17,12 +16,9 @@ const validToMain = [
     "logout",
     "encode",
     "auth",
-    "nav",
-    "test"
+    "nav"
 ]
 
-console.log("Running Preload!");
-
 ipcRenderer.setMaxListeners(250);
 
 // Expose protected methods that allow the renderer process to use
index d6991d41aebc1220490f3994cb69a9ffb3aca94e..0f8c69f7c85788b48cbd7671bcf1c888325c894c 100644 (file)
@@ -5,7 +5,7 @@ const { Tray } = require("electron");
 const { backgroundMitt } = require("./utils/emitter");
 
 let tray;
-const TRAY_PATH = "./src/assets/tray/";
+const TRAY_PATH = path.join(__dirname, "assets/tray");
 
 /* Current state of recording, playback, and ws connection */
 const state = {
@@ -19,25 +19,24 @@ const state = {
  * @param {"recording" | "playback" | "disconnect"} attribute
  * @param {boolean} newState
  */
-function updateTray(attribute, newState) {
-
+function updateTray(attribute, newState) 
+{
     state[attribute] = newState;
 
     // convert boolean to number
     const bi = (b) => b ? 1 : 0;
 
     // Make sure we have the icon we're looking for.
-    tray.setImage(
-        TRAY_PATH +
+    tray.setImage(path.join(
+        TRAY_PATH
         `${bi(state.recording)}${bi(state.playback)}${bi(state.disconnect)}` + 
         ".png"
-    );
-
+    ));
 }
 
-function initTray() 
+function initTray()
 {
-    tray = new Tray(TRAY_PATH + "000" + ".png");
+    tray = new Tray(path.join(TRAY_PATH, "000.png"));
 }
 
 exports.initTray = initTray;
index 3f67a00cd73a992260947b55a2e1e0dacd9c2622..767420e7be95c9323aa479cf5fdc0442295e8d85 100644 (file)
@@ -30,8 +30,6 @@ function createWin()
 {
     if (win) return;
 
-    console.log(__dirname);
-
     let pos = store.get("window-position");
     if (!pos) pos = { width: 350, height: 750, x: null, y: null }
 
@@ -45,7 +43,7 @@ function createWin()
         minWidth:        350,
         minHeight:       500,
         backgroundColor: "#EBEBEB",
-        webPreferences:  { preload: path.join(__dirname, "/render/preload.js") }
+        webPreferences:  { preload: path.join(__dirname, "render/preload.js") }
     })
 
     // TODO: find a simpler way to notify platform of user events