Skip to content

Commit

Permalink
v2.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarolorentedev committed Aug 5, 2024
1 parent ab3044a commit 8f23803
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 17 deletions.
1 change: 1 addition & 0 deletions forge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import MakerDMG from '@electron-forge/maker-dmg';

const config: ForgeConfig = {
packagerConfig: {
asar: true,
icon: 'src/assets/favicon',
osxSign: {
identity: `Developer ID Application: ${process.env.MAC_DEVELOPER_ID}`,
Expand Down
10 changes: 0 additions & 10 deletions src/index.html

This file was deleted.

5 changes: 4 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { initialize } from './i18n';
import { NotificationConfiguration } from './types/NotificationEnabled';

declare const MAIN_WINDOW_VITE_DEV_SERVER_URL: string;
declare const MAIN_WINDOW_VITE_NAME: string;

if (store.get('autoupdate')) {
updateElectronApp();
Expand Down Expand Up @@ -45,7 +46,9 @@ app.on('ready', () => {
observerManager.refershObservers();
appManager.setTray(tray);

appManager.setWindow(new AppWindow(MAIN_WINDOW_VITE_DEV_SERVER_URL, join(__dirname, 'preload.js')));
appManager.setWindow(
new AppWindow(MAIN_WINDOW_VITE_DEV_SERVER_URL, MAIN_WINDOW_VITE_NAME, join(__dirname, 'preload.js'))
);
ipcMain.on('electron-refresh-observers', () => {
observerManager.refershObservers();
});
Expand Down
3 changes: 2 additions & 1 deletion src/main/AppWindow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ describe('AppWindows', () => {
it('generates correct instance', () => {
const expectedUrl = faker.internet.url();
const expectedPreload = faker.system.directoryPath();
const window = new AppWindow(expectedUrl, expectedPreload);
const name = faker.string.alphanumeric();
const window = new AppWindow(expectedUrl, name, expectedPreload);
expect(browserWindowMock).toBeCalledWith({
title: 'Barklarm - Configuration',
icon: expectedImage,
Expand Down
12 changes: 8 additions & 4 deletions src/main/AppWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ export class AppWindow {
public readonly window: BrowserWindow;
private readonly IconPath: string = join(__dirname, '..', 'assets', 'icon.png');

constructor(url: string, preload: string) {
this.window = this.createWindow(url, preload);
constructor(url: string, windowName: string, preload: string) {
this.window = this.createWindow(url, windowName, preload);
}

createWindow(url: string, preload: string): BrowserWindow {
createWindow(url: string, windowName: string, preload: string): BrowserWindow {
const window = new BrowserWindow({
title: `Barklarm - ${translate('Configuration')}`,
icon: nativeImage.createFromPath(this.IconPath),
Expand All @@ -27,7 +27,11 @@ export class AppWindow {
},
});
window.setMenu(null);
window.loadURL(url);
if (url) {
window.loadURL(url);
} else {
window.loadFile(join(__dirname, `../renderer/${windowName}/index.html`));
}
if (!app.isPackaged) window.webContents.openDevTools();
const hide = _hide(window);
window.on('minimize', hide);
Expand Down
2 changes: 1 addition & 1 deletion vite.renderer.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default defineConfig((env) => {
return {
root,
mode,
base: './src',
base: './',
build: {
outDir: `.vite/renderer/${name}`,
},
Expand Down

0 comments on commit 8f23803

Please sign in to comment.