aboutsummaryrefslogtreecommitdiffstats
path: root/packages/main/src/stores/MainStore.ts
Commit message (Collapse)AuthorAge
* chore: use node16 moduleResolution where possibleLibravatar Kristóf Marussy2022-05-26
| | | | | | | We can't do this in the renderer package, because we need to import MUI files that are not exported (MUI v6 is not ESM yet). Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* build: integration testing supportLibravatar Kristóf Marussy2022-05-16
| | | | | | Run integration tests in an electron environment for the main process. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* refactor: reduce service switcher tearingLibravatar Kristóf Marussy2022-05-16
| | | | | | | | | | | | | | | | | | | | | | | | | | We render the location bar and notification banners separately for each service and keep track of the BrowserView size separately for each service to reduce the tearing that appears when people switch services. The tearing cannot be eliminated completely, because it comes from the separation between the main and renderer processes. But we can at least try and reduce the IPC round-tripping and layout calculations required to accurately position the services. This approach has an overhead compared to the single BrowserViewPlaceholder approach, because the renderer process has to layout the location bar and notification for all services, not only the selected one. The number of IPC messages during windows resize is also increased. To compensate, we increase the throttle interval for resize IPC messages and let electron itself resize the BrowserView between IPC updates. (We must still keep pumping IPC messages during window resize, because, e.g., changes in notification banner size due to re-layouting will still affect the required BrowserView size). If further reduction of IPC traffic is needed, we could implement batching for resize IPC messages and more intelligent throttling via a token bucker mechanism. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* feat(renderer): Renderer translationsLibravatar Kristóf Marussy2022-05-16
| | | | | | | | | Add react-i18n to make us able to use i18next translations in the renderer process just like we do in the main process. Translations are hot-reloaded automatically. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* feat(main): Translation hot reloading during developmentLibravatar Kristóf Marussy2022-05-16
| | | | Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* feat(main): Add localization supportLibravatar Kristóf Marussy2022-05-16
| | | | | | | | | | | | | | | | Add i18next with a custom backend to the main process to load localization from file. Missing localizations are written to a missing localizations file in debug mode, but silently fall back in production mode. We will also need to add a custom backend for the renderer process that communicates with the main process. (i18next-fs-electron-backend is not applicable here, because we need localizations both in the main and renderer processes.) Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* feat: Add custom menubarLibravatar Kristóf Marussy2022-05-16
| | | | | | | | | | | The menu is populated reactive from the store with no caching. This doesn't seem to cause any performance problems so far. Currently the menu is electron-specific. In the future, we'll need a more runtime-independent way to build the menu. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* feat: Open in external browserLibravatar Kristóf Marussy2022-05-16
| | | | Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* feat: Handle service load failuresLibravatar Kristóf Marussy2022-03-06
| | | | | | | | | | | | | | Adds a "failed" state for services where the BrowserView and WebContents should be left around to keep history and allow people to navigate back. Access to the browser history otherwise doesn't seem possible (see https://github.com/electron/electron/issues/26727 and https://github.com/electron/electron/issues/7186), so destroying BrowserView and managing our own history is not possible. Also keep https://github.com/electron/electron/issues/24113 in mind. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* fix(service-preload): Browser view canvas backgroundLibravatar Kristóf Marussy2022-03-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | Due to `BrowserView.setBackgroundColor` not working under linux, we have to inject styles to make sure our `BrowserView` is opaque. We try to cover more edge cases to avoid the interference of the injected style and the web site's own styles according to the CSS specification: https://www.w3.org/TR/css-backgrounds-3/#body-background In particular, we avoid overwriting the styles for the `html` element if `body` already has an opaque background so that the background of `body` can extend to the whole canvas. This might still interfere with the web site if it updates the background color on the fly (dark mode), but a reload should solve most of such issues. Hopefully, after https://github.com/electron/electron/issues/32898 is resolved, we can get rid of the hack entirely. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* feat: Location bar actionsLibravatar Kristóf Marussy2022-03-06
| | | | | | | | | | The buttons and the text field in the location bar shall now affect the BrowserView of the loaded service. Some error handling is still needed, e.g., when loading a web page fails due to a DNS error. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* feat: Basic location barLibravatar Kristóf Marussy2022-02-24
| | | | | | Still needs adding event handlers to actually navigate the browser. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* feat: Load and switch servicesLibravatar Kristóf Marussy2022-02-14
| | | | Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* refactor: Coding conventionsLibravatar Kristóf Marussy2022-02-08
| | | | | | | | | Make sure that files have a default import with the same name as the file whenever possible to reduce surprise. Also shuffles around some file names for better legibility. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* refactor: Move runtime state into shared modelsLibravatar Kristóf Marussy2022-02-08
| | | | | | | | | | | Now the runtime state lives inside the model (instead of being associated to the static settings via a map), which simplifies state management. Static settings are now located inside the runtime models, so we must create tests to make sure that the settings are being persisted correctly. The contents of the config file are now generated as a view of store (instead of a snapshot), which adds flexibility. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* feat: Add selected service field to SharedStoreLibravatar Kristóf Marussy2022-02-08
| | | | | | Lets the main process see which service is currently selected. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* build: Add prettierLibravatar Kristóf Marussy2022-01-09
| | | | | | | eslint will also enforce prettier rules, so there is no need to call prettier separately in CI. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* build: Eslint fixes for multi-module projectLibravatar Kristóf Marussy2022-01-09
| | | | Signed-off-by: Kristóf Marussy <kristof@marussy.com>
* New configurations based on review comments (WIP)Libravatar Vijay A2022-01-09
| | | | Signed-off-by: Vijay A <vraravam@users.noreply.github.com>
* Incorporate 'eslint' (fixes #3)Libravatar Vijay A2022-01-09
| | | | Signed-off-by: Vijay A <vraravam@users.noreply.github.com>
* chore: Add import extensions preparing for ts 4.6 nodenextLibravatar Kristóf Marussy2021-12-31
|
* refactor: Make all stores optionalLibravatar Kristóf Marussy2021-12-26
| | | | | | This reduces boilerplate and helps with config file robustness: if a field is missing from the config file, it will be replaced with its default value.
* refactor: Clarify main process architectureLibravatar Kristóf Marussy2021-12-26
| | | | | | | | * stores: reactive data structures to hold application state * controllers: subscribe to store changes and call store actions in response to external events from services * services: integrate with the nodejs and electron environment (should be mocked for unit testing)
* refactor: Config persistence architectureLibravatar Kristóf Marussy2021-12-26
The architecture in the main process is split into 3 main parts: * services: interfaces for services are injected into the stores through the MainEnv interface (for testability) * services/impl: electron-specific implementations of services * stores: the actions of the stores can invoke (asynchronous) services