Applying production bug fixes

This commit is contained in:
Andrew Gundersen 2022-03-08 07:23:37 -06:00
commit 6b5aadc492
5 changed files with 11 additions and 40 deletions

View 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));

View 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 };

View 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

View 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;

View 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