Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Es/chore settings about and config #717

Draft
wants to merge 47 commits into
base: master
Choose a base branch
from

Conversation

ErikSin
Copy link
Contributor

@ErikSin ErikSin commented Jan 24, 2023

Added Settings menu, and ability to change config.

window.location.reload()
// userConfig.importSettings(result.filePaths[0], err => {
// if (err) return onerror(err)
// ipc.send('reload-config', async err => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to call this IPC call. this IPC call originally was being sent from the main process to mapeo-core, which is a background process.

Now we are sending this from a renderer process. Do you know the best way to do this? @gmaclennan

Should i send an IPC call to the main thread, and then that IPC sends and ipc call to mapeo-core?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ErikSin we set up a MessageChannel to communicate between renderer processes. There is currently a message channel established between the mapeo-core background process and the frontend. The message handlers are exported from mapeo-core/index.js, and the coordination between the message channel and the handlers is in src/background/index.js. The initial connection of the MessageChannels needs to be coordinated via the main process, which is done here: https://github.com/digidem/mapeo-desktop/blob/master/src/background/index.js. Finally on the front-end renderer process the channel is connected in https://github.com/digidem/mapeo-desktop/blob/master/src/renderer/index-preload.js.

If you want to do IPC with mapeo-core, it is a question of adding extra handler methods to mapeo-core/index.js and calling them from within https://github.com/digidem/mapeo-desktop/blob/master/src/renderer/new-api.js, which has access to the message channel.

If you want to do IPC to a different background renderer process (e.g. not mapeo-core), then you will need to set up a new channel, and attach it to window in the renderer. I can help with more details if that is what you need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants