Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Setup Desktop before opening notes on macOS (#2369)
Desktop registers with the OS as being able to open Cozy Note documents. Thus, when a user opens a local `.cozy-note` file Desktop opens the associated note in the default browser. On Linux and Windows we receive one of two events depending on the state of the application when the file is opened: - `second-instance` when Desktop was already running - `ready` when Desktop was not running In both cases the file path is found in the execution arguments. On macOS however, the file path will be made available via a dedicated `open-file` event in both situations. When the application is not running though, we'll also receive a `ready` event **after** the `open-file` event. This is where we encountered a deadlock situation: - when receiving the `ready` event, we setup the application and start the synchronization unless asked not to (e.g. when opening a note while Desktop was not already running) - when receiving the `open-file` event, we request not to start the synchronization if the application was not already running but need to wait for the setup to complete to open the note The setup process was only run if the synchronization should be started or a note file path was passed as argument which only occurs on Linux and Windows. Therefore, the app was stuck, ever waiting for the setup process to complete. We now make sure the setup process is run as long as we have a valid config.
- Loading branch information