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_URL: `${BUSINESS_IP}:${BUSINESS_PORT}`,
|
||||||
BUSINESS_PREFIX: '/api',
|
BUSINESS_PREFIX: '/api',
|
||||||
configPath: app.getPath('userData'),
|
configPath: app.getPath('userData'),
|
||||||
appPath: app.getPath('appData')
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,15 +16,16 @@ import { initTray } from './tray';
|
||||||
|
|
||||||
export default async function main() {
|
export default async function main() {
|
||||||
|
|
||||||
/* initiate controls for frontend to use when needed */
|
/* initiate render process event listeners & handlers */
|
||||||
initIpcMain();
|
initIpcMain();
|
||||||
|
|
||||||
|
/* initiate tray icon in default state */
|
||||||
initTray();
|
initTray();
|
||||||
|
|
||||||
/* launch browser window */
|
/* launch browser window */
|
||||||
await createWindow();
|
await createWindow();
|
||||||
|
|
||||||
/* try to authenticate with token */
|
/* try to authenticate with token */
|
||||||
await accountAuth();
|
accountAuth();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
// All of the Node.js APIs are available in the preload process.
|
// All of the Node.js APIs are available in the preload process.
|
||||||
// It has the same sandbox as a Chrome extension.
|
// It has the same sandbox as a Chrome extension.
|
||||||
import { ipcRenderer, Tray, nativeImage } from "electron";
|
import { ipcRenderer } from "electron";
|
||||||
const path = require('path')
|
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface Window {
|
interface Window {
|
||||||
|
|
@ -13,20 +12,6 @@ window.ipcRenderer = ipcRenderer;
|
||||||
|
|
||||||
process.once("loaded", () => {
|
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 => {
|
window.addEventListener("message", event => {
|
||||||
|
|
||||||
// do something with custom event
|
// do something with custom event
|
||||||
|
|
|
||||||
|
|
@ -60,10 +60,10 @@ function iconFactory(iconName: string): NativeImage {
|
||||||
console.log('ERROR: Missing Icons: ', iconName);
|
console.log('ERROR: Missing Icons: ', iconName);
|
||||||
}
|
}
|
||||||
// TODO: remove hard code, need icons for different states
|
// 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);
|
const icon = nativeImage.createFromBuffer(iconBuffer);
|
||||||
return icon;
|
return icon;
|
||||||
};
|
}
|
||||||
|
|
||||||
function updateTray(status: string): void {
|
function updateTray(status: string): void {
|
||||||
// read icon state
|
// read icon state
|
||||||
|
|
@ -76,7 +76,7 @@ function updateTray(status: string): void {
|
||||||
changeIcon(ICONS.default);
|
changeIcon(ICONS.default);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
export function initTray(): void {
|
export function initTray(): void {
|
||||||
if (!tray) {
|
if (!tray) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue