@@ -16,14 +16,10 @@ import { ElectronCapacitorApp, setupContentSecurityPolicy, setupReloadWatcher }
|
||||
// Graceful handling of unhandled errors.
|
||||
unhandled();
|
||||
|
||||
// Define our menu templates (these are optional)
|
||||
// Define our menu template (this is optional)
|
||||
const trayMenuTemplate: (MenuItemConstructorOptions | MenuItem)[] = [
|
||||
new MenuItem({ label: 'Quit App', role: 'quit' })
|
||||
];
|
||||
const appMenuBarMenuTemplate: (MenuItemConstructorOptions | MenuItem)[] = [
|
||||
{ role: process.platform === 'darwin' ? 'appMenu' : 'fileMenu' },
|
||||
{ role: 'viewMenu' }
|
||||
];
|
||||
|
||||
// Get Config options from capacitor.config
|
||||
const capacitorFileConfig: CapacitorElectronConfig = getCapacitorElectronConfig();
|
||||
@@ -33,7 +29,6 @@ const capacitorFileConfig: CapacitorElectronConfig = getCapacitorElectronConfig(
|
||||
const myCapacitorApp = new ElectronCapacitorApp(
|
||||
capacitorFileConfig,
|
||||
trayMenuTemplate,
|
||||
appMenuBarMenuTemplate
|
||||
);
|
||||
|
||||
// If deeplinking is enabled then we will set it up here.
|
||||
|
||||
@@ -52,10 +52,6 @@ export class ElectronCapacitorApp {
|
||||
private TrayMenuTemplate: (MenuItem | MenuItemConstructorOptions)[] = [
|
||||
new MenuItem({ label: 'Quit App', role: 'quit' }),
|
||||
];
|
||||
private AppMenuBarMenuTemplate: (MenuItem | MenuItemConstructorOptions)[] = [
|
||||
{ role: process.platform === 'darwin' ? 'appMenu' : 'fileMenu' },
|
||||
{ role: 'viewMenu' },
|
||||
];
|
||||
private mainWindowState;
|
||||
private loadWebApp;
|
||||
private customScheme: string;
|
||||
@@ -63,7 +59,6 @@ export class ElectronCapacitorApp {
|
||||
constructor(
|
||||
capacitorFileConfig: CapacitorElectronConfig,
|
||||
trayMenuTemplate?: (MenuItemConstructorOptions | MenuItem)[],
|
||||
appMenuBarMenuTemplate?: (MenuItemConstructorOptions | MenuItem)[]
|
||||
) {
|
||||
this.CapacitorFileConfig = capacitorFileConfig;
|
||||
|
||||
@@ -73,10 +68,6 @@ export class ElectronCapacitorApp {
|
||||
this.TrayMenuTemplate = trayMenuTemplate;
|
||||
}
|
||||
|
||||
if (appMenuBarMenuTemplate) {
|
||||
this.AppMenuBarMenuTemplate = appMenuBarMenuTemplate;
|
||||
}
|
||||
|
||||
// Setup our web app loader, this lets us load apps like react, vue, and angular without changing their build chains.
|
||||
this.loadWebApp = electronServe({
|
||||
directory: join(app.getAppPath(), 'app'),
|
||||
@@ -164,8 +155,8 @@ export class ElectronCapacitorApp {
|
||||
this.TrayIcon.setContextMenu(Menu.buildFromTemplate(this.TrayMenuTemplate));
|
||||
}
|
||||
|
||||
// Setup the main manu bar at the top of our window.
|
||||
Menu.setApplicationMenu(Menu.buildFromTemplate(this.AppMenuBarMenuTemplate));
|
||||
// Disable Menu Bar at the top.
|
||||
Menu.setApplicationMenu(null);
|
||||
|
||||
// If the splashscreen is enabled, show it first while the main window loads then switch it out for the main window, or just load the main window from the start.
|
||||
if (this.CapacitorFileConfig.electron?.splashScreenEnabled) {
|
||||
|
||||
Reference in New Issue
Block a user