Commit Graph

2 Commits

Author SHA1 Message Date
Pascal Hartig
fd6cab2a7b Launcher cycle detection
Summary:
Flipper Electron delegates to the Launcher if it is found right on startup to fetch the most recent/compatible version of Flipper. The Launcher then opens the downloaded app with a `--no-launcher` option to avoid bouncing back and forth between the Electron app and the Launcher.

This depends on the argument processing working unchanged. In the past this has been somewhat difficult to guarantee as this doesn't happen in one place and dev/prod builds have handled arguments different due to Electron weirdness (requiring a `--` passed in, for instance).

If anything here goes wrong, we end up in a very nasty scenario where the launcher and the Electron app rapidly open and close, making it nearly impossible for users to escape that vicious cycle. `pkill -f Flipper` being the best option, if you can focus a terminal for long enough.

In order to avoid this from ever happening in the future, this introduces a quick check for the last startup is written with a timestamp and if this is less than 5s in the past, we will skip delegating to the Launcher altogether, keeping the current instance running.

Reviewed By: jknoxville

Differential Revision: D14598136

fbshipit-source-id: b3335ce7ec7dc3e5e014d459db31df4c8a774fc6
2019-03-25 11:36:19 -07:00
Pascal Hartig
759329bbc3 Pass URL and file arguments to launcher
Summary:
Changes where we delegate to the launcher to a later point so we can successfully intercept file open events and custom URI events.

There's more information in Phase 1 in this paragraph of the doc: https://fb.quip.com/tpqnAbxnJw1w#UNZACAnVVGs

Reviewed By: danielbuechele

Differential Revision: D14563585

fbshipit-source-id: a8757a6072386e56102f15b0668456369a44aad7
2019-03-22 12:18:10 -07:00