fix: remove unused code from preload and config
This commit is contained in:
parent
3a89dd82df
commit
f96cd7a1bc
4 changed files with 7 additions and 22 deletions
|
|
@ -14,5 +14,4 @@ export const config = {
|
|||
BUSINESS_URL: `${BUSINESS_IP}:${BUSINESS_PORT}`,
|
||||
BUSINESS_PREFIX: '/api',
|
||||
configPath: app.getPath('userData'),
|
||||
appPath: app.getPath('appData')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,15 +16,16 @@ import { initTray } from './tray';
|
|||
|
||||
export default async function main() {
|
||||
|
||||
/* initiate controls for frontend to use when needed */
|
||||
/* initiate render process event listeners & handlers */
|
||||
initIpcMain();
|
||||
|
||||
/* initiate tray icon in default state */
|
||||
initTray();
|
||||
|
||||
/* launch browser window */
|
||||
await createWindow();
|
||||
|
||||
/* try to authenticate with token */
|
||||
await accountAuth();
|
||||
accountAuth();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
// All of the Node.js APIs are available in the preload process.
|
||||
// It has the same sandbox as a Chrome extension.
|
||||
import { ipcRenderer, Tray, nativeImage } from "electron";
|
||||
const path = require('path')
|
||||
import { ipcRenderer } from "electron";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
|
|
@ -13,20 +12,6 @@ window.ipcRenderer = ipcRenderer;
|
|||
|
||||
process.once("loaded", () => {
|
||||
|
||||
const read = path.join(__dirname, 'icon_16x16.png')
|
||||
console.log(read)
|
||||
|
||||
const imgRead = nativeImage.createFromPath(read)
|
||||
|
||||
let tray = undefined;
|
||||
|
||||
|
||||
// Automatic generation of menu
|
||||
tray = new Tray(imgRead)
|
||||
|
||||
tray.destroy()
|
||||
tray = new Tray(imgRead)
|
||||
|
||||
window.addEventListener("message", event => {
|
||||
|
||||
// do something with custom event
|
||||
|
|
|
|||
|
|
@ -60,10 +60,10 @@ function iconFactory(iconName: string): NativeImage {
|
|||
console.log('ERROR: Missing Icons: ', iconName);
|
||||
}
|
||||
// TODO: remove hard code, need icons for different states
|
||||
let iconBuffer = fs.readFileSync(path.join(__static, TRAY_ICON_DIR, 'icon.png'));
|
||||
const iconBuffer = fs.readFileSync(path.join(__static, TRAY_ICON_DIR, 'icon.png'));
|
||||
const icon = nativeImage.createFromBuffer(iconBuffer);
|
||||
return icon;
|
||||
};
|
||||
}
|
||||
|
||||
function updateTray(status: string): void {
|
||||
// read icon state
|
||||
|
|
@ -76,7 +76,7 @@ function updateTray(status: string): void {
|
|||
changeIcon(ICONS.default);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function initTray(): void {
|
||||
if (!tray) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue