Summary:
This change makes WebSockets the default for Flipper on iOS.
Having said that, we are introducing some logic to deal with clients connecting to older Flipper Desktop versions.
The mobile client will first attempt to connect via WebSocket with the Desktop. This connection can either be secure or insecure. If that fails, it will attempt to connect via RSocket.
Connection failure logic:
The mobile client will attempt to connect up-to 3 times via a WebSocket. If it fails to connect, then the socket provider is switched to RSocket.
As before, the mobile client will attempt to connect up-to 3 times via a RSocket. If it fails to connect, then the socket provider is switched back to WebSocket.
Process repeats until a successful connection is established.
Some logs that can be seen from iOS:
2021-09-15 14:31:51.193503+0100 Sample[92026:92107440] [] nw_protocol_get_quic_image_block_invoke dlopen libquic failed
2021-09-15 14:31:51.878257+0100 Sample[92026:92107440] [connection] nw_socket_handle_socket_event [C1.1:1] Socket SO_ERROR [61: Connection refused]
2021-09-15 14:31:52.553729+0100 Sample[92026:92107440] [connection] nw_socket_handle_socket_event [C1.2:1] Socket SO_ERROR [61: Connection refused]
2021-09-15 14:31:52.899511+0100 Sample[92026:92107442] [connection] nw_connection_get_connected_socket [C1] Client called nw_connection_get_connected_socket on unconnected nw_connection
2021-09-15 14:31:52.899664+0100 Sample[92026:92107442] TCP Conn 0x600001d384d0 Failed : error 0:61 [61]
2021-09-15 14:31:57.120120+0100 Sample[92026:92107439] [connection] nw_socket_handle_socket_event [C2.1:1] Socket SO_ERROR [61: Connection refused]
2021-09-15 14:31:57.141785+0100 Sample[92026:92107439] [connection] nw_socket_handle_socket_event [C2.2:1] Socket SO_ERROR [61: Connection refused]
2021-09-15 14:31:57.151604+0100 Sample[92026:92107483] [connection] nw_connection_get_connected_socket [C2] Client called nw_connection_get_connected_socket on unconnected nw_connection
2021-09-15 14:31:57.154312+0100 Sample[92026:92107483] TCP Conn 0x600001d7c0b0 Failed : error 0:61 [61]
2021-09-15 14:31:59.206079+0100 Sample[92026:92107483] [connection] nw_socket_handle_socket_event [C3.1:1] Socket SO_ERROR [61: Connection refused]
2021-09-15 14:31:59.236824+0100 Sample[92026:92107483] [connection] nw_socket_handle_socket_event [C3.2:1] Socket SO_ERROR [61: Connection refused]
2021-09-15 14:31:59.251927+0100 Sample[92026:92107439] [connection] nw_connection_get_connected_socket [C3] Client called nw_connection_get_connected_socket on unconnected nw_connection
2021-09-15 14:31:59.255963+0100 Sample[92026:92107439] TCP Conn 0x600001d1c210 Failed : error 0:61 [61]
2021-09-15 14:32:01.291303+0100 Sample[92026:92107439] [connection] nw_socket_handle_socket_event [C4.1:1] Socket SO_ERROR [61: Connection refused]
2021-09-15 14:32:01.312406+0100 Sample[92026:92107439] [connection] nw_socket_handle_socket_event [C4.2:1] Socket SO_ERROR [61: Connection refused]
2021-09-15 14:32:01.323099+0100 Sample[92026:92107483] [connection] nw_connection_get_connected_socket [C4] Client called nw_connection_get_connected_socket on unconnected nw_connection
2021-09-15 14:32:01.326028+0100 Sample[92026:92107483] TCP Conn 0x600001d7c0b0 Failed : error 0:61 [61]
flipper: Failed to connect with the current socket provider
flipper: Use legacy socket provider
flipper: FlipperClient::onConnected
Reviewed By: passy
Differential Revision: D30900471
fbshipit-source-id: 7c242ad71306803b050d0174fc22696bb74fdba5
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: Adding a Flipper plugin that is isolated to design systems engineering / FDS. This is essentially our dumping grounds of useful utilities for FDS. The first thing I've added is the ability to dump / view the ui tracker hierarchy, which will be useful for development / debugging.
Differential Revision: D31076277
fbshipit-source-id: 5aff639368945796dc3ebab603dadb8d43d7b699
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
Summary: Restored support for device icons which was disabled in previous diff
Reviewed By: passy
Differential Revision: D31054802
fbshipit-source-id: 107a53f06159211534cb9a2316340af7a7ca530a
Summary:
This stack takes care of handling care of moving all device interactions over the (possible) async channel FlipperServer. The FlipperServer interface (see previous diff) allows listening to specific server events using `on`, and emit commands to be executed by the server by using `exec` (e.g. `exec('take-screenshot', serial) => Promise<buffer>`).
FlipperServerImpl implements this interface on the server side.
The device implementations are split as follows
```
server / backend process:
ServerDevice
- iOSDevice
- AndroidDevice
- MetroDevice
- DummyDevice
- Mac/Windows Device
frontend / ui:
BaseDevice: a normal connected, device, implements device apis as they already existed
- ArchivedDevice (note that this doesn't have a server counterpart)
- TestDevice (for unit tests, with stubbed backend communication)
```
All features of devices are for simplicity unified (since the deviations are small), where specific device types might not implement certain features like taking screenshots or running shell commands.
To avoid making this diff unnecessarily big, some open Todo's will be addressed later in this stack, and it shouldn't be landed alone.
Reviewed By: timur-valiev
Differential Revision: D30909346
fbshipit-source-id: cce0bee94fdd5db59bebe3577a6084219a038719
Summary: This is the first diff in a stack of many where server and UI logic is further decoupled to be only communication through an event listener / emitting commands, where all data going over these media is json serializable. In this diff we extract the common interfaces that are to be used by both server and UI layer.
Reviewed By: passy
Differential Revision: D30899609
fbshipit-source-id: dc3c783707d47671f1d0f5dbf99cde17a8f69062
Summary: Take screenshot button state is not reset after screenshot taken. So Flipper can only take 1 screenshot per session.
Reviewed By: mweststrate
Differential Revision: D31018526
fbshipit-source-id: dc7b00f26c77ec94a8a15047f5ae835acdb710c7
Summary:
This change fixes a bug with the handled flag during the certificate exchange process.
Explanation:
handled was passed by reference as &handled
Once the function goes out of scope then the reference, well, it just becomes invalid (undefined behaviour)
In some cases, it appears as 'handled' because the reference is invalid and it happens to be 'true'.
Changelog: Fixed an issue where clients would randomly not connect to Flipper. Please update FlipperKit to 0.110.0 to apply the fix: https://fbflipper.com/docs/getting-started/react-native#using-the-latest-flipper-sdk
Reviewed By: mweststrate
Differential Revision: D31017592
fbshipit-source-id: c087a769fa23de1acfd3c198b4db4d6ccdb2be90
Summary:
As reported here: https://github.com/facebook/flipper/issues/2873, ADB would be initialised, even when disabled explicitly, resulting in an error if ADB could not be found.
Changelog: Fix: made sure that the "Android disabled" setting is respected.
Reviewed By: lblasa
Differential Revision: D31019099
fbshipit-source-id: 9d57945f2c21655426da42eb976dd46d8605d007
Summary: If a device disconnects and reconnects while keeping the plugin open, a new pluginInstance is available, but the React component would not be remounted since both the old and new pluginInstance have the same identifier (device/client/plugin). This change makes sure that if a different pluginInstance arrives, the rendering will be reinitialised as well.
Reviewed By: lblasa
Differential Revision: D31018845
fbshipit-source-id: ac09e7ac519c7aebfb4f8dc0cc7c6cda6fbbf633
Summary: Some code simplification. The validation functions are not async, so don't need promises. By combining the internal and non internal files, a lot of utilities can be kept local instead of exposing them
Reviewed By: lblasa
Differential Revision: D31018355
fbshipit-source-id: be568a70fc84971dbce82a8478495edf7dafb4a5
Summary:
When connecting both to an iOS emulator and physical device, the emulator devices would continuesly be replaced, and Flipper would print the warning
`Tried to replace still connected device XXX with a new instance`
Fixed the logical mistake that causes it. Not sure if this caused any actual bugs, but at least it was incorrect.
Reviewed By: lblasa
Differential Revision: D31015451
fbshipit-source-id: 32dd29043e9dc48357fdbf68cde930d3be11419a
Summary: I accidentally wrote a cert at the wrong location, but noticed that there was never raised an exception. Added error handing to surface the error. Seems the underlying RSocket implementation silently eats errors that escape from handlers....
Reviewed By: lblasa
Differential Revision: D31015168
fbshipit-source-id: 38480921c3cf33f3a5d91eb2ed4e3a912fdf74a7
Summary: If multiple apps connect simultanously, they could overwrite or cancel each other timeoutHandles, leading to potential incorrect messages.
Reviewed By: lblasa
Differential Revision: D31015171
fbshipit-source-id: 1d498a90c8a7a1847d2a961fc944d2f74e734cc2
Summary: While investigating Flipper to unblock D30990411. I found this untyped `device` field. This field is exactly the `Device` type in 'adbkit', so I did a small refactor to type it.
Reviewed By: timur-valiev
Differential Revision: D30996427
fbshipit-source-id: 9972a865c2dee009088635e57ef512969f404ddf
Summary:
My emulators stopped showing up, but I noticed they were still listed in adb devices as 'offline'. Seems to be a weird ADB issue, changing the developer settings on the emulator fixed that for me, so linked to the SO answer where I found the solution.
Changelog: Added warning about offline emulators in ADB
Reviewed By: nikoant
Differential Revision: D30957786
fbshipit-source-id: 5468a983b5364c0fe868610978c09382f6b43d91
Summary: Noticed in a support post that uninitialised devices could end up multiple times in the connecting list.
Reviewed By: timur-valiev
Differential Revision: D30957447
fbshipit-source-id: 11a2e3a9c52083245e66ebfb1899c00aeae6eb7e
Summary:
Noticed there are uncaught exception if adb cannot be found, that don't make it to the UI, but just cause no devices to be detected.
While testing, found that the unsafeClient fallback we use doesn't find the devices either. So it is unclear to me if it is helping in any case, and figured we'd better provide early signal to the user to set up adb correctly, rather than jumping through hoops and trying to work without it.
Changelog: Handle the absence of ADB better
Reviewed By: timur-valiev
Differential Revision: D30957220
fbshipit-source-id: 4d9a89bffefa96d3861d3f26224b4c74c19abd37
Summary:
The changes below add the notion of alternative ports to Flipper.
These alternative ports are meant to and will be used to connect via WebSocket instead of RSocket. The name does not suggest that as to make as generic as possible so that they can be reused for different purposes in the future.
Reviewed By: passy
Differential Revision: D30898874
fbshipit-source-id: 5eed8c61b41b502c859192aaac59c284b7b36228
Summary: There are some issues with label positioning, but overall works.
Reviewed By: defHLT
Differential Revision: D29588329
fbshipit-source-id: 5c2e8f6f139d997559111fa2ad124ae1d695b36a
Summary: Bump several deps of flipper-js-client-sdk at once, to close multiple dependabot PRs
Reviewed By: passy
Differential Revision: D30931608
fbshipit-source-id: 4c95a98e4fce805c8c92c605b3fd7eb71e7daaa7
Summary:
Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.43 to 1.0.44.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/dtolnay/anyhow/releases">anyhow's releases</a>.</em></p>
<blockquote>
<h2>1.0.44</h2>
<ul>
<li>Mark error constructors cold to help LLVM optimize code paths not leading to error (<a href="https://github-redirect.dependabot.com/dtolnay/anyhow/issues/166">https://github.com/facebook/flipper/issues/166</a>, thanks <a href="https://github.com/stepancheg"><code>@stepancheg</code></a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="6c97c59375"><code>6c97c59</code></a> Release 1.0.44</li>
<li><a href="447eff84b0"><code>447eff8</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/dtolnay/anyhow/issues/166">https://github.com/facebook/flipper/issues/166</a> from stepancheg/cold</li>
<li><a href="fa9bcc0457"><code>fa9bcc0</code></a> Mark error constructors cold</li>
<li><a href="b3c5e25860"><code>b3c5e25</code></a> Mirror PR 162 from readme to rustdoc</li>
<li><a href="bec8204d5f"><code>bec8204</code></a> Reword PR 162</li>
<li><a href="4d3adef908"><code>4d3adef</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/dtolnay/anyhow/issues/162">https://github.com/facebook/flipper/issues/162</a> from ArekPiekarz/readme-backtrace</li>
<li><a href="b45d6490c4"><code>b45d649</code></a> Ignore unhelpful Clippy lint in build script</li>
<li><a href="58b873a3cd"><code>58b873a</code></a> Add to README using backtraces on stable channel</li>
<li>See full diff in <a href="https://github.com/dtolnay/anyhow/compare/1.0.43...1.0.44">compare view</a></li>
</ul>
</details>
<br />
[](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `dependabot rebase` will rebase this PR
- `dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `dependabot merge` will merge this PR after your CI passes on it
- `dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `dependabot cancel merge` will cancel a previously requested merge and block automerging
- `dependabot reopen` will reopen this PR if it is closed
- `dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
Pull Request resolved: https://github.com/facebook/flipper/pull/2847
Reviewed By: timur-valiev
Differential Revision: D30900762
Pulled By: mweststrate
fbshipit-source-id: e951554c0562fd53918843e58b8c1c3f13239bde
Summary:
Follow up on D29436059 (014e571f74), another place where the old format was leaked.
Fixes https://github.com/facebook/flipper/issues/2842 + some mentions on WP
Changelog: Fixed JavaScript exception on main thread occurring after loading Flipper
Reviewed By: nikoant
Differential Revision: D30928768
fbshipit-source-id: 083731e18230825738466b34368c2b5f730e386c
Summary: Sandy is idiomatic now, cleaned up old docs to avoid confusion as in https://github.com/facebook/flipper/issues/2611.
Reviewed By: passy
Differential Revision: D30908794
fbshipit-source-id: c4076f1d24b193f71923d19eeed631763bb9dacb
Summary:
Removed the Flipper QPL integration, see:
https://fb.workplace.com/groups/flippersupport/permalink/1200183003795689/
It complicates our build setup significantly, without actually being used anywhere for the past year. Apparently it doesn't solve a gap compared to the scuba logging we have already in place.
Reviewed By: passy
Differential Revision: D30911573
fbshipit-source-id: 836e2aba0c92c0eed9fed0dfb12bd8bdcb8c7d71