Summary:
afcoplan found a bug in the deeplink opening flow: If a device is open but not the app that supports a supported plugin, the dialogue won't disappear once the app is connected.
That is because apps are initialised with an empty plugin list and we're doing a reference equality check to get notified of changes which won't get triggered when the deep `plugin` property is changed.
Instead, we additionally wait for the `plugin-change` event that's emitted by the client to refresh.
Differential Revision: D31861521
fbshipit-source-id: 88fc456553e218f9c8ea68435ff84bdae0d1b586
Summary: When running debug builds, and not specifying a `device=...` qualifier as part of the deeplink, you'd get stuck on the "waiting for plugin to be launched" dialogue as Flipper would accept the local MacOS (or Windows, ...) connection as a valid client which can be quite confusing.
Reviewed By: mweststrate
Differential Revision: D31857737
fbshipit-source-id: ff568544f660c51e17b40c2aaadf058588746ef9
Summary:
Open to feedback that this is making it harder to follow the code.
I was trying to make sense of some odd opening behaviour and it helped
in that case but we can also just keep this diff around to re-apply if needed.
Reviewed By: mweststrate
Differential Revision: D31857738
fbshipit-source-id: 4ebc8685e65e1cc854586518d4f790b3ad102633
Summary: Delegate sending events over IPC from the render process to the main process over the RenderHost interface. This basically removes all our direct usages of `ipcRenderer`.
Reviewed By: timur-valiev, aigoncharov
Differential Revision: D31828580
fbshipit-source-id: 9c1333ae55620d36c2af70aa7abc5403c2f4907c
Summary:
Delegate receiving events from the Electron host process to the RenderHost interface.
Typed them as well while at it.
Reviewed By: timur-valiev
Differential Revision: D31828130
fbshipit-source-id: 920055de6f48512b91a433b229dbacd611c6f139
Summary: Started abstraction some Electron specific APIs away, like process id, select directory dialogs etc.
Reviewed By: timur-valiev, aigoncharov
Differential Revision: D31827016
fbshipit-source-id: e835ac9095e63d7ea79dd0eaf7f2918ac8d09994
Summary: We used to support invoking `flipper://` to launch Flipper. This broke with the recent changes to our deeplink handling.
Reviewed By: mweststrate
Differential Revision: D31826699
fbshipit-source-id: 09d0d16de4779bb550da884d268ca9fd60f1a9e2
Summary:
Standardize WS implementation for JS environments.
Why do we need a separate server implementation for browsers?
Browser targets cannot authenticate via the default certificate exchange flow. For browser targets we verify the origin instead.
Moreover, for already forgotten reasons the initial implementation of the WS server for browsers used a different kind of message structure and added extra `connect`/`disconnect` messages. After examination, it seems the `connect`/`disconnect` flow is redundant.
Major changes:
1. Updated class hierarchy for WS server implementations.
2. Updated browser WS server to support the modern and the legacy protocols.
3. Now a websocket connection with the device is closed on error. The idea is it is highly unlikely to handle any subsequent messages properly once we observe an error. It is better to bail and reconnect. What do you think?
Reviewed By: mweststrate
Differential Revision: D31532172
fbshipit-source-id: f86aa63a40efe4d5263353cc124fac8c63b80e45
Summary: Reverted a change in D30192002 (9e5575cf69) that unintendendly caused some plugin containers to grow too big.
Reviewed By: nikoant
Differential Revision: D31609023
fbshipit-source-id: 56daa5efe6d9071a856536a59b473f17796201eb
Summary: moved `app/src/server` to `flipper-server-core/src` and fixed any fallout from that (aka integration points I missed on the preparing diffs).
Reviewed By: passy
Differential Revision: D31541378
fbshipit-source-id: 8a7e0169ebefa515781f6e5e0f7b926415d4b7e9
Summary:
what else can I say
move_complexity
Reviewed By: passy
Differential Revision: D31483414
fbshipit-source-id: 1692c792121a3aae0843eb238040cae0445cdf54
Summary: Moved Logger, sleep, timeout and server contract types to flipper-common packages.
Reviewed By: passy
Differential Revision: D31475790
fbshipit-source-id: 42d2147698875f9e919ad5250f9953f3bff3ec2d
Summary: Further decoupling of `server/` from the rest of the code base. Also fixed a problem with promise chaining causing promises to create unhandled rejection errors.
Reviewed By: passy
Differential Revision: D31474919
fbshipit-source-id: 027cccbe9b57d856c94d63c093d39b6cb3e53312
Summary: In a diff down the stack I introduced sending of info/warn/error logs to Scuba. Here I'm just changing level of all connectivity-related logging to "info" as they often required for investigations.
Reviewed By: mweststrate
Differential Revision: D31532770
fbshipit-source-id: 956d6712918291579b3beb12cb91ab69ce1e3859
Summary: Just a small fix to ensure all plugins are shown in the list even if no device / app is connected to Flipper. We show them under "Unavailable plugins" with explanation why they not available. This allows user to check plugin documentation even without connecting anything to Flipper.
Reviewed By: passy
Differential Revision: D31532732
fbshipit-source-id: 4e481b3d6923bb073a1478b2bd283db25a374c72
Summary: As we now send warn logs to server - it better to reduce their count. This diff folds all the warnings for plugins using the legacy API into one warning.
Reviewed By: passy
Differential Revision: D31532559
fbshipit-source-id: 0621a170e11e9d9645964dd8ecf2f9e753273225
Summary:
This is not actionable on our end because this will get
triggered for anyone setting a wrong ANDROID_HOME path.
Reviewed By: mweststrate
Differential Revision: D31502390
fbshipit-source-id: 529f1ba940cf6e38363933f706d167196116231a
Summary:
This diff introduces the packages necessary for Flipper decapitated.
* flipper-common: utilities & types shared between client, server, flipper-plugin
* flipper-server-core: all device & client management goes in here. Basically flipper's backend
* flipper-ui-core: all UI goes in here, as far as it doesn't depend on Electron
* desktop: the Electron app, will load server-core and ui-core, and glue them together, providing implementations for some electron specific stuff like dialgos
* flipper-server: A node process hosting flipper-server-core, that can be connected to over websockets. And probably can serve a browser version of the UI as well.
* flipper-ui-browser: thin wrapper around flipper-ui-core, providing some browser specific behavior / stubs.
* flipper-dump: (might remove later), but want to hack a quick and dirt flipper dump in here, as alternative way to test flipper-server-core.
This diff just creates the packages, but doesn't move any code, so it can be summarized as:
restoftheowl
Reviewed By: nikoant
Differential Revision: D30218646
fbshipit-source-id: 735598a1261a98e584f52504b5eba01ec0afa162
Summary:
This diff cleans up order remaining dialogs, the ones involved in exporting to file or url. Includes some legacy component cleanup boyscouting, but not too much.
This removes a lot of code where state of the wizard was stored globally, and makes it locally instead.
Other code that was removed involves interaction with the old UI, which allowed import / export to be running in the background as well. (which is no longer needed since we optimised the process)
Reviewed By: timur-valiev
Differential Revision: D30192000
fbshipit-source-id: 13be883c5bf217a3d58b610b78516359e9bd0ebc
Summary:
This diff moves the dialogs
* Settings
* Plugin Manager
* Doctor
* Sign in
* Changelog
To use the imperative dialog APIs, rather then organising them through reducers which adds a lot of indirection which isn't really needed but hard to follow.
Reviewed By: passy
Differential Revision: D30192002
fbshipit-source-id: ba38b2e700da3e442653786448fcbf85074981ad
Summary: This stack gets rid of Flippers old sheet abstraction that relies on native (Electron) overlays, and implements it using Ant dialogs instead. Also removes a lot of code by making dialog API imperative, rather than reducer organised, like done in the deeplink handling.
Reviewed By: passy
Differential Revision: D30192001
fbshipit-source-id: 9bca3274bd039207e58f8f9394027515e391671d
Summary: This diff separates the concept of a Client as now on the UI, from the concept of a Client as known on the server, and makes all interactions with client and vice versa async.
Reviewed By: timur-valiev
Differential Revision: D31235682
fbshipit-source-id: 99089e9b390b4c5359f97f6f2b15bf4b182b6cb9
Summary: Sets up some logging for the various drop-out points when going through the deeplink flow.
Reviewed By: lblasa
Differential Revision: D31345623
fbshipit-source-id: a06ca97c1e687e39ea97a1f47fd8bb614149056f
Summary: Refactor clients storage: array -> map. A lot of logic looks up clients by their id, which is currently done with an array.find operation, which is pretty inefficient. This diff changes it to a map, that is pretty important, as in the next diff the decoupled client message handing will need to find the client again for every message that arrives.
Reviewed By: timur-valiev
Differential Revision: D31303536
fbshipit-source-id: ca3f540a3de7665930d2354436d37cb0fbfd5546
Summary:
Changelog: Improved plugin / device / app selection handing.
During some refactorings I discovered that the `connetions.selectedApp` field contained sometimes an application id, and sometimes just the name. This caused inconsistent behavior especially in unit tests.
I've cleaned that up, and renamed it to `selectedAppId` where applicable, to make the distinction more clear.
And, in contrast, userPreferredApp now always has a name, not an id.
During refactoring our existing selection update logic was quite in the way, which was overcomplicated still, since during the sandy chrome migration, the reducers needed to be able to handle both the old UI, and the new application selection UI. That logic has been simplified now, and a lot of tests were added.
As a further simplification the preferredApp/Device/Plugin are now only read and used when updating selection, but not when running selectors.
Reviewed By: timur-valiev
Differential Revision: D31305180
fbshipit-source-id: 2dbd9f9c33950227cc63aa29cc4a98bdd0db8e7a
Summary:
Set up some basic logging for deep link usage at the entry point and error cases.
More granular logging coming up next.
Reviewed By: nikoant
Differential Revision: D31337822
fbshipit-source-id: 171eae68fb3d9a11aa155087baf6f8309bbd7295
Summary: Some drive-by changes as I'm working on other stuff.
Reviewed By: mweststrate
Differential Revision: D31337500
fbshipit-source-id: 8f348af06b7c4b159703d7adf160a7380ba57b22
Summary:
Splitting this up into the wiring and the actual usage.
This just ensures we have a logger in place for handling
deeplinks.
Reviewed By: mweststrate
Differential Revision: D31337457
fbshipit-source-id: b088a7396e38554a87502ba7d5669dbef1b398d7
Summary:
Grey -> gray. "Cancelled" seems quite common in APIs though, so I disabled that.
A few promise cleanups
Reviewed By: aigoncharov
Differential Revision: D31323610
fbshipit-source-id: c8863d995936f451c24eb408fe5c26677187f089
Summary:
Promisify leads to weird types and sometimes unexpected runtime behaviour. Replacing it with the dep we use everywhere.
It's just really annoying that `stdout` is here explicitly `| null` which isn't the case in the default types.
Reviewed By: timur-valiev
Differential Revision: D31278303
fbshipit-source-id: eadbc49b287704e71a5ecba0d9a311eac91dc6f8
Summary:
Simplifies the logic by only using idb when available to query *both* simulators and physical devices.
Changelog: Prefer idb for device listing when available.
Reviewed By: mweststrate
Differential Revision: D31271539
fbshipit-source-id: ac5b73ca5b00b7707bf87cd4d3a6af6e0c0ae214
Summary:
Added fetching logs for flipper and autofilling them too with the create paste link in the description of the support form.
Changed the on click load form function to async to handle this as createPaste returns a promise and not the URL directly.
Reviewed By: mweststrate
Differential Revision: D31268006
fbshipit-source-id: 2a9ee08948198781adadd2b3b9c447f179db7d5c
Summary: Added autofill for title and description. Description are the list of steps users have taken to troubleshoot.
Reviewed By: mweststrate
Differential Revision: D31263065
fbshipit-source-id: 932e6cb42438cd2da0d7e8686f0f7e0fa69ee586
Summary:
Client up `client.device` (which had no code references anymore) / `client.deviceSync`. Cleaned up feature code for old SDKs (pre 2, which is 3 years old).
This makes decapitating Client a little simpler in the rest of the stack.
Reviewed By: passy
Differential Revision: D31235436
fbshipit-source-id: 919679c1830e2b9368d0787d7b363c090305edb8
Summary: Removed an old GK that has been 100% for all employees for months.
Reviewed By: passy
Differential Revision: D31233413
fbshipit-source-id: ce7d871c5c4f46e9264fdc1c2e4042f0362464f1
Summary: Failed to fetch promise rejections should not be reported
Reviewed By: passy
Differential Revision: D31266851
fbshipit-source-id: ce3c15db5504c01d66b44e032c2b7fb752ec2ec3
Summary:
Added noDeviceErrorMsg as a JSX.Element that will display 'No device found' if there are no devices detected. It is an empty JSX.Element otherwise and nothing is displayed as shown in the video.
I am using a JS variable as a JSX element in this diff. This simplifies the if else checks needed inside return, and reused the same styling we have.
Reviewed By: mweststrate
Differential Revision: D31193647
fbshipit-source-id: dea96232785c9e2987be1513fa3462452c996e66
Summary:
The "instruments" utility was deprecated in Xcode 12 and removed now from Xcode 13, causing all the iOS 15 / Xcode 13 builds to fail to work with Flipper.
See deprecation notice here: https://developer.apple.com/documentation/xcode-release-notes/xcode-12-release-notes
> The instruments command is now deprecated in favor of its replacement: xctrace. Use xctrace to record, import, and export data from Instruments .trace files. (36641078)
The corresponding bug was reported here:
https://github.com/facebook/flipper/issues/2896
That call should be replaced with `xcrun xctrace` run and that is what we are doing here.
IMPORTANT: There was a workaround on killing the stale `instruments` proceses and that utility function is removed as part of this PR, as `instruments` were slow and inefficient, marked for deprecation more than a year ago. `xctrace` should not have that kind of issue and it doesn't make sense to keep this workaround now.
## Changelog
The "instruments" call replaced with `xcrun xctrace` use, to align with deprecation introduced in Xcode 12 and offer Xcode 13 compatibility.
Pull Request resolved: https://github.com/facebook/flipper/pull/2903
Test Plan:
In order to test this we should run the Flipper desktop app and make sure it connects to the Simulator started out of Xcode 13
It fails to do so in `master` version right now, see https://github.com/facebook/flipper/issues/2896
Reviewed By: mweststrate
Differential Revision: D31150276
Pulled By: passy
fbshipit-source-id: 0b45ae23c15a8481a91b1effe814176b04adbf3e
Summary: Add unit tests to test errors thrown from plugins during initialisation, as follow up for D31127969 (a72e46c792). From the 4 tests cases added (first load plugin then device, device then plugin, first load plugin then client, first client then plugin), the first case was indeed failing before the mentioned diff and not registering the device.
Reviewed By: passy
Differential Revision: D31142583
fbshipit-source-id: 8e44c667316192231d1bb5e4d76c5bf1207ba835
Summary:
Unit test would fail on trying to emit server commands when creating a ArchivedDevice. But archived devices can silently ignore log start commands, which fixes the failing test as well.
Example failing run: https://github.com/facebook/flipper/runs/3685776120
I'm not sure why the test wasn't _always_ failing
Reviewed By: lblasa
Differential Revision: D31142584
fbshipit-source-id: 57106ecdace9f72444eaf68ee9fa024c84556a1c
Summary: Some cleanup in device destruction code. This diff wraps up the stack that decouples device management from the UI. Next steps are client management, and system management (file access / command execution)
Reviewed By: passy
Differential Revision: D31084036
fbshipit-source-id: 93efee7dba2193589d3c08c51128ce03de5eff7f
Summary: If a device plugin throw an error in it's initialization, it would prevent the device itself from being registered. This fixes that. As shown in the comments of for example: https://fb.workplace.com/groups/flippersupport/permalink/1218627761951213/
Reviewed By: ananyaarun
Differential Revision: D31127969
fbshipit-source-id: 9824d23b275f1f9e866f841035961e4707ff8e04
Summary: `device.realDevice` was the escape hatch used in Sandy plugins to give access to device specific features like taking screenshots, clearing logs or accessing `adb`. Since in decapitated Flipper that won't be possible anymore (since plugins run in the client but device implementations on the server), all escape hatches have been bridged in this stack, and we can get of the `realDevice` interaction, by explicitly exposing those cases, which makes it type safe as well.
Reviewed By: passy
Differential Revision: D31079509
fbshipit-source-id: c9ec2e044d0dec0ccb1de287cf424907b198f818