Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
{
role: 'help',
submenu: createHelpMenu(),
},
];
const template = is.macos ? macosTemplate : otherTemplate;
if (isDevelopment) {
template.push(createDebugMenu());
}
Menu.setApplicationMenu(Menu.buildFromTemplate(template.filter(Boolean)));
};
ipc.on('app-container-state-updated', (event, state) => {
createAppMenu({
// TODO: Get the logged in state from the container
isLoggedIn: state.activeView !== 'Login' && state.activeView !== 'AppSettings',
activeView: state.activeView,
});
});
module.exports = createAppMenu;
if (options.activeView) {
ipc.callMain('set-active-view-on-dom-ready', options.activeView);
}
location.reload();
}
async stopMarketmaker() {
await this.api.stop();
await ipc.callMain('stop-marketmaker');
}
}
const appContainer = new AppContainer();
ipc.on('log-out', () => {
appContainer.logOut();
});
ipc.on('set-active-view', (event, view) => {
// This is needed for now as we don't have a good way to flow state up to the main process
// TODO: In the future we should fix this, but not important now
if (view === 'Settings' && !appContainer.isLoggedIn) {
view = 'AppSettings';
}
appContainer.setActiveView(view);
});
ipc.on('set-next-view', () => {
appContainer.setNextView();
});
ipc.on('set-active-view', (event, view) => {
// This is needed for now as we don't have a good way to flow state up to the main process
// TODO: In the future we should fix this, but not important now
if (view === 'Settings' && !appContainer.isLoggedIn) {
view = 'AppSettings';
}
appContainer.setActiveView(view);
});
ipc.on('set-next-view', () => {
appContainer.setNextView();
});
ipc.on('set-previous-view', () => {
appContainer.setPreviousView();
});
if (isDevelopment) {
window._config = electron.remote.require('./config');
}
let prevState = appContainer.state;
appContainer.subscribe(() => {
// TODO: This can be removed when the update issue is fixed in Electron:
// https://github.com/electron/electron/issues/12636
if (appContainer.state.activeView === prevState.activeView) {
return;
}
prevState = appContainer.state;
ipc.on('log-out', () => {
appContainer.logOut();
});
ipc.on('set-active-view', (event, view) => {
// This is needed for now as we don't have a good way to flow state up to the main process
// TODO: In the future we should fix this, but not important now
if (view === 'Settings' && !appContainer.isLoggedIn) {
view = 'AppSettings';
}
appContainer.setActiveView(view);
});
ipc.on('set-next-view', () => {
appContainer.setNextView();
});
ipc.on('set-previous-view', () => {
appContainer.setPreviousView();
});
if (isDevelopment) {
window._config = electron.remote.require('./config');
}
let prevState = appContainer.state;
appContainer.subscribe(() => {
// TODO: This can be removed when the update issue is fixed in Electron:
// https://github.com/electron/electron/issues/12636
if (appContainer.state.activeView === prevState.activeView) {
location.reload();
}
async stopMarketmaker() {
await this.api.stop();
await ipc.callMain('stop-marketmaker');
}
}
const appContainer = new AppContainer();
ipc.on('log-out', () => {
appContainer.logOut();
});
ipc.on('set-active-view', (event, view) => {
// This is needed for now as we don't have a good way to flow state up to the main process
// TODO: In the future we should fix this, but not important now
if (view === 'Settings' && !appContainer.isLoggedIn) {
view = 'AppSettings';
}
appContainer.setActiveView(view);
});
ipc.on('set-next-view', () => {
appContainer.setNextView();
});
ipc.on('set-previous-view', () => {
appContainer.setPreviousView();
});
profileManager.find(id).set(prefName, prefValue)
})
ipc.answerRenderer('set-pref', ({prefName, prefValue}) => {
profileManager.set(prefName, prefValue)
})
ipc.answerRenderer('set-active-profile', activeProfileId => {
profileManager.activeProfileId = activeProfileId
})
ipc.on('activeProfileId', event => {
event.returnValue = profileManager.activeProfile().id
})
ipc.on('profiles', event => {
event.returnValue = profileManager.all()
})
ipc.answerRenderer('open-hamburger-menu', args => Menu.getApplicationMenu().popup(args))
}
profiles: profileManager.all()}
})
ipc.answerRenderer('set-profile-pref', ({id, prefName, prefValue}) => {
profileManager.find(id).set(prefName, prefValue)
})
ipc.answerRenderer('set-pref', ({prefName, prefValue}) => {
profileManager.set(prefName, prefValue)
})
ipc.answerRenderer('set-active-profile', activeProfileId => {
profileManager.activeProfileId = activeProfileId
})
ipc.on('activeProfileId', event => {
event.returnValue = profileManager.activeProfile().id
})
ipc.on('profiles', event => {
event.returnValue = profileManager.all()
})
ipc.answerRenderer('open-hamburger-menu', args => Menu.getApplicationMenu().popup(args))
}