Commit Graph

217 Commits

Author SHA1 Message Date
Michel Weststrate
1bb1cae167 Don't send messages to disconnected clients. Make exportPersistedState compatible with disconnected devices.
Summary:
This diff addresses two problems:

1. Since clients plugins can be active beyond having a connection, we have to make it possible for plugin authors to check if they are connected before they make a call.
2. if there is a custom `exportPersistedState`, plugins should be able to skip making calls if the device has disconnected.

Introducing this change makes it possible to interact with a reasonable level with disconnected clients, and makes it possible to create Flipper traces for disconnected clients.

Note that both items were already problems before supporting offline clients; as there can be a noticeable delay between disconnecting and Flipper detecting that (i've seen up to 30 secs). What happend previously in those cases is that the export would simply hang, as would other user interactions, as loosing the connection in the middle of a process would cause the promise chains to be neither rejected or resolved, which is pretty iffy.

Before this diff, trying to export a disconnected device would hang forever like:

{F369600601}

Reviewed By: nikoant

Differential Revision: D26250895

fbshipit-source-id: 177624a116883c3cba14390cd0fe164e243bb97c
2021-02-09 04:16:26 -08:00
Michel Weststrate
ff7997b3fa Make sure disconnected devices / apps can be imported and exported
Summary:
It should be possible to exported disconnected devices, so that flipper traces / support form reports can be created from them. This diff introduces this functionality. Support for plugins with custom export logic is introduced in a later diff.

Issues fixed in this diff:
- don't try to take a screenshot for a disconnected device (this would hang forever)
- device plugins were always exported, regardless whether the user did select them or not
- sandy plugins were never part of exported disconnected clients
- increased the amount of data exported for device logs to ~10 MB. This makes more sense now as the logs will no longer be included in all cases
- fixed issue where are plugins would appear to be enabled after the client disconnected (this bug is the result of some unfortunate naming of `isArchived` vs `isConnected` semantics. Will clean up those names in a later diff.

Changelog: It is now possible to create a Flipper trace for disconnected devices and apps

Reviewed By: nikoant

Differential Revision: D26250894

fbshipit-source-id: 4dd0ec0cb152b1a8f649c31913e80efc25bcc5dd
2021-02-09 04:16:25 -08:00
Michel Weststrate
7361ecc080 Disable CPU plugin on archived devices
Summary:
Changelog: CPU plugin will no longer show up for archived devices

CPU plugin did show up on imported devices, but would always result in exceptions as no `adb` connection is available for them.

Reviewed By: jknoxville

Differential Revision: D26249575

fbshipit-source-id: c4fa7b3fec895f9c4ab9e31dce2f61fb23e9195b
2021-02-09 04:16:24 -08:00
Michel Weststrate
40abef860f Fix key warning
Summary: Crash reporter generated React errors because the different lines in a stack trace are not per definition unique

Reviewed By: jknoxville

Differential Revision: D26201941

fbshipit-source-id: 084e0157b1fa3b8216d35f62f0dc17b0d6414b8e
2021-02-03 06:59:59 -08:00
Michel Weststrate
594fa4d2bc serialize Sandy plugins with serialization utils to support Date/Set/Map
Summary:
Unlike non-sandy plugins, non-sandy plugins weren't serialized using our serialization utility yet. This diff addresses that, meaning that users don't have to bother about how to serialize maps, sets and dates.

Unlike the old fashioned plugins, the `makeObjectSerialize` utility is used, rather than `serialize`. This normalizes the objects, but doesn't serialize them, which is done at the end of the export data process anyway for the whole tree. This avoids creating a double JSON serialization which is fully of ugly escape characters.

This makes the onImport / onExport definition of the logs plugin nicer.

Also improved the docs.

Reviewed By: nikoant

Differential Revision: D26146421

fbshipit-source-id: 6abfb6ee2e3312e2a13a11832ff103dc62fd844c
2021-02-01 11:43:31 -08:00
Michel Weststrate
7cc55daf34 Stop storing device logs on the device object and in the plugin
Summary:
Logs were stored hardcoded on the Device object first, this diff makes it normal plugin state.

This makes sure that we can use the same abstractions as in all plugins that store large data sets, and that we can leverage the upcoming DataSource abstraction.

Reviewed By: nikoant

Differential Revision: D26127243

fbshipit-source-id: 7c386a615fa7989f35ba0df5b7c1d218d37b57a2
2021-02-01 11:43:30 -08:00
bizzguy
5320015776 Fix mock export file format (#1872)
Summary:
Provide a more robust technique for exporting the mocks to a file.

The current technique for exporting mocks to a file seems to fail under some scenarios.  The correct format is an array of objects:

```
[
  {
    "requestUrl": "https://api.github.com/repos/facebook/yoga",
    "requestMethod": "GET",
```
However, the following format is sometimes exported instead:

```
{
  "10": {
    "requestUrl": "https://demo9512366.mockable.io/SonarPost",
```

Using `Object.values` provides a more robust technique that has been successful during subsequent testing.

## Changelog

Network Plugin - new technique for exporting mocks

Pull Request resolved: https://github.com/facebook/flipper/pull/1872

Test Plan:
Create mocks in the network plugin
Export mocks
Manually examine file for correct format
Import mocks and verify that the file has been imported correctly

Reviewed By: nikoant

Differential Revision: D26172954

Pulled By: mweststrate

fbshipit-source-id: bdfa3ba7dfe656f30ef17df001fc83dd8ea18ece
2021-02-01 10:23:45 -08:00
dependabot[bot]
a9ad3d2f1b Bump @testing-library/react from 11.1.0 to 11.2.3 in /desktop (#1868)
Summary:
Bumps [testing-library/react](https://github.com/testing-library/react-testing-library) from 11.1.0 to 11.2.3.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/testing-library/react-testing-library/releases"><code>testing-library/react's releases</code></a>.</em></p>
<blockquote>
<h2>v11.2.3</h2>
<h2><a href="https://github.com/testing-library/react-testing-library/compare/v11.2.2...v11.2.3">11.2.3</a> (2021-01-07)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>Return type of unmount is <code>void</code> (<a href="https://github-redirect.dependabot.com/testing-library/react-testing-library/issues/857">https://github.com/facebook/flipper/issues/857</a>) (<a href="1389f09474">1389f09</a>)</li>
</ul>
<h2>v11.2.2</h2>
<h2><a href="https://github.com/testing-library/react-testing-library/compare/v11.2.1...v11.2.2">11.2.2</a> (2020-11-20)</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong>dependencies:</strong> bump dom testing library (<a href="https://github-redirect.dependabot.com/testing-library/react-testing-library/issues/836">https://github.com/facebook/flipper/issues/836</a>) (<a href="7fcb0f2e93">7fcb0f2</a>)</li>
</ul>
<h2>v11.2.1</h2>
<h2><a href="https://github.com/testing-library/react-testing-library/compare/v11.2.0...v11.2.1">11.2.1</a> (2020-11-19)</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong>types:</strong> Allow all HTML and SVG elements in render. (<a href="https://github-redirect.dependabot.com/testing-library/react-testing-library/issues/833">https://github.com/facebook/flipper/issues/833</a>) (<a href="1dc33b23be">1dc33b2</a>)</li>
</ul>
<h2>v11.2.0</h2>
<h1><a href="https://github.com/testing-library/react-testing-library/compare/v11.1.2...v11.2.0">11.2.0</a> (2020-11-18)</h1>
<h3>Features</h3>
<ul>
<li>bump dom testing library (<a href="https://github-redirect.dependabot.com/testing-library/react-testing-library/issues/831">https://github.com/facebook/flipper/issues/831</a>) (<a href="456424ff33">456424f</a>)</li>
</ul>
<h2>v11.1.2</h2>
<h2><a href="https://github.com/testing-library/react-testing-library/compare/v11.1.1...v11.1.2">11.1.2</a> (2020-11-11)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>import pretty-format from testing-library/dom (<a href="https://github-redirect.dependabot.com/testing-library/react-testing-library/issues/821">https://github.com/facebook/flipper/issues/821</a>) (<a href="2712dc2da4">2712dc2</a>)</li>
</ul>
<h2>v11.1.1</h2>
<h2><a href="https://github.com/testing-library/react-testing-library/compare/v11.1.0...v11.1.1">11.1.1</a> (2020-11-03)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>upgrade dependencies, typescript, testing-library/dom etc (<a href="https://github-redirect.dependabot.com/testing-library/react-testing-library/issues/816">https://github.com/facebook/flipper/issues/816</a>) (<a href="e07e6416f2">e07e641</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="deafd51bc2"><code>deafd51</code></a> docs: add sanchit121 as a contributor (<a href="https://github-redirect.dependabot.com/testing-library/react-testing-library/issues/858">https://github.com/facebook/flipper/issues/858</a>)</li>
<li><a href="1389f09474"><code>1389f09</code></a> fix: Return type of unmount is <code>void</code> (<a href="https://github-redirect.dependabot.com/testing-library/react-testing-library/issues/857">https://github.com/facebook/flipper/issues/857</a>)</li>
<li><a href="64a8b9c2f3"><code>64a8b9c</code></a> chore: update all deps (<a href="https://github-redirect.dependabot.com/testing-library/react-testing-library/issues/842">https://github.com/facebook/flipper/issues/842</a>)</li>
<li><a href="03bea9fd76"><code>03bea9f</code></a> chore: Add 'Cancel Previous Runs' step (<a href="https://github-redirect.dependabot.com/testing-library/react-testing-library/issues/840">https://github.com/facebook/flipper/issues/840</a>)</li>
<li><a href="7fcb0f2e93"><code>7fcb0f2</code></a> fix(dependencies): bump dom testing library (<a href="https://github-redirect.dependabot.com/testing-library/react-testing-library/issues/836">https://github.com/facebook/flipper/issues/836</a>)</li>
<li><a href="276673ff00"><code>276673f</code></a> chore(types): add test for rendering SVG elements (<a href="https://github-redirect.dependabot.com/testing-library/react-testing-library/issues/834">https://github.com/facebook/flipper/issues/834</a>)</li>
<li><a href="1dc33b23be"><code>1dc33b2</code></a> fix(types): Allow all HTML and SVG elements in render. (<a href="https://github-redirect.dependabot.com/testing-library/react-testing-library/issues/833">https://github.com/facebook/flipper/issues/833</a>)</li>
<li><a href="456424ff33"><code>456424f</code></a> feat: bump dom testing library (<a href="https://github-redirect.dependabot.com/testing-library/react-testing-library/issues/831">https://github.com/facebook/flipper/issues/831</a>)</li>
<li><a href="236ea4962d"><code>236ea49</code></a> chore: remove one temporary fix with a better permenant one</li>
<li><a href="96b9aebe96"><code>96b9aeb</code></a> chore: Update validate.yml (<a href="https://github-redirect.dependabot.com/testing-library/react-testing-library/issues/827">https://github.com/facebook/flipper/issues/827</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/testing-library/react-testing-library/compare/v11.1.0...v11.2.3">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@testing-library/react&package-manager=npm_and_yarn&previous-version=11.1.0&new-version=11.2.3)](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/1868

Reviewed By: mweststrate

Differential Revision: D26149524

Pulled By: passy

fbshipit-source-id: 6cc8159ffdf8e13b7851042e7c25ff058f5c88cb
2021-02-01 09:02:11 -08:00
bizzguy
6a9d06a4ce Misc UI fixes (#1873)
Summary:
Continue with cleanup of Network plugin mock screens.  This mostly consists of replacing FlexColumn, FlexRow and FlexBox with equivalent Sandy components.

Here is the new screen:

- replace text buttons with Button
- add NUX info to "Copy Highlighted Calls" button
- add message when no calls have been highlighted
- in routes list remove padding on line items

![image](https://user-images.githubusercontent.com/337874/106415468-d58f6480-6414-11eb-93a8-498fd81b54d9.png)

Here is the prior screen:

![image](https://user-images.githubusercontent.com/337874/106415499-e8099e00-6414-11eb-8e0e-48875a945621.png)

## Changelog

Network Plugin - Additional cleanup of UI on mock screen

Pull Request resolved: https://github.com/facebook/flipper/pull/1873

Test Plan:
Create and modify mocks
Verify that the functionality has not been affected by UI changes

Reviewed By: passy

Differential Revision: D26172915

Pulled By: mweststrate

fbshipit-source-id: f0af143d8509b53585076737832657fb095e75a6
2021-02-01 03:58:34 -08:00
bizzguy
8c3abf7450 Network Plugin - Minor UI fixes (#1864)
Summary:
Made UI fixes to Network Plugin (mostly to Route screens) to continue migration to the new design framework.  This consisted mostly of replacing FlexColumn and FlexRow with Layout.Container and Layout.Horizontal.

Also, contains some cosmetic changes to "Mock Network Response" page.

Here is the screenshot with UI changes:

![image](https://user-images.githubusercontent.com/337874/105937062-6d0e4500-601a-11eb-97ce-d9c4ae0c184f.png)

This was the old screen for comparison:

![image](https://user-images.githubusercontent.com/337874/105937028-5667ee00-601a-11eb-84a9-a2bd4bb78846.png)

## Changelog

Network Plugin - UI changes to continue migration to Sandy design framework

Pull Request resolved: https://github.com/facebook/flipper/pull/1864

Test Plan: Manual testing to ensure that all data still displayed with new UI changes (especially the Data and Headers info in the "Route Info" section)

Reviewed By: passy

Differential Revision: D26125656

Pulled By: mweststrate

fbshipit-source-id: a25104274ed25788e5c0738ac0a9609f2cead751
2021-01-29 09:02:54 -08:00
Anton Nikolaev
d7cfcb5d8e Extend device plugin metadata to include supported devices
Summary: Plugin metadata format extended to include type of each plugin (client / device) and list of supported devices (android/ios/..., emulator/physical, etc). This will allow to detect plugins supported by device even if they are not installed and only available on Marketplace.

Reviewed By: mweststrate

Differential Revision: D26073531

fbshipit-source-id: e331f1be1af1046cd4220a286a1d52378c26cc53
2021-01-27 17:31:41 -08:00
bizzguy
6df117ba04 Network Plugin - New functions to import, export and clear Routes (#1855)
Summary:
In the network plugin, add features to import and export routes as described in issue https://github.com/facebook/flipper/issues/1651

Primary use case is that external testers (such as QA teams) would be able to create test data, convert it to mocks and save the mocks to make bug fixes easier for devs.

Here is a screenshot showing location of buttons to perform import/export (and clearing) of mock routes:

![image](https://user-images.githubusercontent.com/337874/105658269-cb58ed80-5e8b-11eb-8118-f13efc96bf6d.png)

Here is another screenshot showing export dialog:

![image](https://user-images.githubusercontent.com/337874/105657733-afa11780-5e8a-11eb-9725-120617e1dd71.png)

Changelog: [Network] Mock routes can now be imported and exported. Thanks bizzguy!

Pull Request resolved: https://github.com/facebook/flipper/pull/1855

Test Plan:
Performed manual testing

- create new mocks
- export mocks
- clear mocks
- import mocks
- verify that mocks still work by making GET/POST requests in sample app

Performed various permutations of above manual tests, including restarting Flipper at various points to ensure that test plan still worked.  Also performed visual inspection of exported files to verify correctness.

Would be very interested in learning how to create automated tests for this functionality.

Reviewed By: passy

Differential Revision: D26072928

Pulled By: mweststrate

fbshipit-source-id: 51bd5e19e78d830b94add850d5dc9b9e45fa6fad
2021-01-26 05:34:36 -08:00
dependabot[bot]
0b4d5fedc1 Bump recharts from 1.7.1 to 2.0.3 in /desktop (#1846)
Summary:
Bumps [recharts](https://github.com/recharts/recharts) from 1.7.1 to 2.0.3.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/recharts/recharts/blob/master/CHANGELOG.md">recharts's changelog</a>.</em></p>
<blockquote>
<h2>2.0.3 (Jan 13, 2021)</h2>
<h3>refactor</h3>
<ul>
<li>use <code>getDerivedStateFromProps</code> to replace <code>UNSAFE_componentWillReceiveProps</code>, support react@17, <a href="https://github-redirect.dependabot.com/recharts/recharts/issues/2385">#2385</a></li>
</ul>
<h2>2.0.2 (Jan 12, 2021)</h2>
<h3>fix</h3>
<ul>
<li>fix lint error</li>
</ul>
<h2>2.0.1 (Jan 12, 2021)</h2>
<h3>fix</h3>
<ul>
<li>Fix typo, createLabeldScales -&gt; createLabeledScales</li>
<li>Prefer Number.isFinite if available</li>
<li>fix types error</li>
<li>fix(package.json): disable side effects explicitly</li>
</ul>
<h3>feat</h3>
<ul>
<li>Add aria-hidden to measurementSpan</li>
</ul>
<h2>2.0.0 (Dec 29, 2020)</h2>
<h3>fix</h3>
<ul>
<li>fix minAngle for 0 in PieChart, fix #<a href="https://github-redirect.dependabot.com/recharts/recharts/issues/2237">#2237</a></li>
<li>fix type error of <!-- raw HTML omitted -->, fix <a href="https://github-redirect.dependabot.com/recharts/recharts/issues/2335">#2335</a></li>
<li>fix type error of cursor in <!-- raw HTML omitted -->, fix <a href="https://github-redirect.dependabot.com/recharts/recharts/issues/2178">#2178</a></li>
<li>fix Props of XAxis, fix <a href="https://github-redirect.dependabot.com/recharts/recharts/issues/2128">#2128</a></li>
<li>export Props of components, fix <a href="https://github-redirect.dependabot.com/recharts/recharts/issues/2319">#2319</a>, <a href="https://github-redirect.dependabot.com/recharts/recharts/issues/2156">#2156</a>, <a href="https://github-redirect.dependabot.com/recharts/recharts/issues/2203">#2203</a></li>
<li>Fix typo, getRectangePath -&gt; getRectanglePath in Rectangle</li>
<li>allow Duplicated Category for bar charts not using correct entries for custom tool tips</li>
<li>fixing typescript array coalesce</li>
<li>fix types error of sankey, fix <a href="https://github-redirect.dependabot.com/recharts/recharts/issues/2280">#2280</a></li>
<li>Fixed SVG path for pie charts when corner radius is set to a value other than zero (<a href="https://github-redirect.dependabot.com/recharts/recharts/issues/2331">#2331</a>)</li>
</ul>
<h3>feat</h3>
<ul>
<li>add props <code>reversed</code> to <code>&lt;Funnel /&gt;</code></li>
<li>add <code>breakAll</code> props to <code>&lt;Text /&gt;</code> to allow break all for chinese</li>
<li>fix width of labelList in Funnel; fix <a href="https://github-redirect.dependabot.com/recharts/recharts/issues/2056">#2056</a>, <a href="https://github-redirect.dependabot.com/recharts/recharts/issues/1866">#1866</a></li>
<li>support range RadarChart and add props <code>connectNulls</code> to <!-- raw HTML omitted -->, fix <a href="https://github-redirect.dependabot.com/recharts/recharts/issues/1890">#1890</a></li>
<li>add ability to pass in custom legend icon.</li>
</ul>

</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="a7f39d196c"><code>a7f39d1</code></a> Version 2.0.3</li>
<li><a href="702163b27a"><code>702163b</code></a> fix: update test case</li>
<li><a href="2b635f43ef"><code>2b635f4</code></a> fix: fix type error of &lt;Text /&gt;</li>
<li><a href="29b793b33e"><code>29b793b</code></a> refactor: use <code>getDerivedStateFromProps</code> to replace `UNSAFE_componentWillRece...</li>
<li><a href="69da3a2e24"><code>69da3a2</code></a> Version 2.0.2</li>
<li><a href="aeea67edf1"><code>aeea67e</code></a> fix: fix lint error</li>
<li><a href="e9e71b0849"><code>e9e71b0</code></a> Version 2.0.1</li>
<li><a href="f4d0153225"><code>f4d0153</code></a> refactor: rewirte demo by ts, fix type error, fix <a href="https://github-redirect.dependabot.com/recharts/recharts/issues/2372">#2372</a></li>
<li><a href="c35db1ef71"><code>c35db1e</code></a> refactor: use .tsx to write demo files</li>
<li><a href="98294c97b4"><code>98294c9</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/recharts/recharts/issues/2362">#2362</a> from juajang/chore</li>
<li>Additional commits viewable in <a href="https://github.com/recharts/recharts/compare/v1.7.1...v2.0.3">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=recharts&package-manager=npm_and_yarn&previous-version=1.7.1&new-version=2.0.3)](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/1846

Reviewed By: mweststrate

Differential Revision: D25945597

Pulled By: priteshrnandgaonkar

fbshipit-source-id: d4061cfd9f5a4638443ade74fa67b4340da10cce
2021-01-21 04:37:51 -08:00
bizzguy
1559c1ef2c Network Plugin - Update UI for routes (#1831)
Summary:
The current UI for managing mock network request definitions (routes) has some issues
- too small for the amount of information it displays
- no formatting for JSON response bodies
- uses the older design system (not ant)
- no separation between commands for creating routes and the list of routes

The following screen images show these problems.

![image](https://user-images.githubusercontent.com/337874/104691438-deb9cb00-56cb-11eb-92df-9e2d122f65c2.png)

![image](https://user-images.githubusercontent.com/337874/104691471-eda07d80-56cb-11eb-8f82-444d591ff966.png)

## Changelog

Enhance UI for Mocks dialog in Network Plugin

Pull Request resolved: https://github.com/facebook/flipper/pull/1831

Test Plan:
Ran multiple manual tests using the Android sample app.  Here is a screen image (at 1280 x 720) for the enhanced UI.

![image](https://user-images.githubusercontent.com/337874/104691649-37896380-56cc-11eb-849f-4e470bb7fbc4.png)

Reviewed By: mweststrate

Differential Revision: D25922798

Pulled By: priteshrnandgaonkar

fbshipit-source-id: d27ba30a7eb51105a8d381097ecaafd82624cad5
2021-01-20 15:45:38 -08:00
bizzguy
f806ee41d7 Network plugin - fix issue with responses with empty body (#1776)
Summary:
The Network Plugin does not properly handle network requests that return an empty body (because of the body actually being empty or because the network call returns something like a 404 status).

Also, the creation of mocks using the "Copy Highlighted" command when the original response returns an empty body is not handled properly.

## Fix

The Android plugin now returns a response when the body length is 0.

The client plugin creates a body containing an empty string instead of null when the body is empty.

## Changelog

Fix problem in Network Plugin when original call or mock has an empty body in the response.

Pull Request resolved: https://github.com/facebook/flipper/pull/1776

Test Plan:
The following screen output for the Network Plugin shows that the call is now being handled correctly.  The fields for "status", "size" and "duration" are now populated.

Also, the mock calls are properly defined and shown in yellow.

![image](https://user-images.githubusercontent.com/337874/102738969-5edd5280-4311-11eb-9b46-33a57a50e334.png)

Reviewed By: mweststrate

Differential Revision: D25804212

Pulled By: passy

fbshipit-source-id: b31cc87619c604b4df76e05bca5c86554a1cabff
2021-01-07 04:15:18 -08:00
dependabot[bot]
dbf194b952 Bump react-devtools-core from 4.9.0 to 4.10.1 in /desktop (#1795)
Summary:
Bumps [react-devtools-core](https://github.com/facebook/react/tree/HEAD/packages/react-devtools-core) from 4.9.0 to 4.10.1.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a href="https://github.com/facebook/react/commits/HEAD/packages/react-devtools-core">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=react-devtools-core&package-manager=npm_and_yarn&previous-version=4.9.0&new-version=4.10.1)](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/1795

Reviewed By: mweststrate

Differential Revision: D25802076

Pulled By: passy

fbshipit-source-id: 142dabcc0a7e688309cc4fc5ced8abde6914879e
2021-01-06 05:02:31 -08:00
dependabot[bot]
be6fd42e11 Bump pako from 1.0.11 to 2.0.2 in /desktop (#1786)
Summary:
Bumps [pako](https://github.com/nodeca/pako) from 1.0.11 to 2.0.2.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/nodeca/pako/blob/master/CHANGELOG.md">pako's changelog</a>.</em></p>
<blockquote>
<h2>[2.0.2] - 2020-11-19</h2>
<h3>Fixed</h3>
<ul>
<li>Fix esm build named exports.</li>
</ul>
<h2>[2.0.1] - 2020-11-17</h2>
<h3>Changed</h3>
<ul>
<li>Changed esm build <code>.js</code> =&gt; <code>.mjs</code> to fix node.js <code>import</code>.</li>
<li>Added <code>module</code> entry in package.json for some bundlers.</li>
</ul>
<h2>[2.0.0] - 2020-11-17</h2>
<h3>Changed</h3>
<ul>
<li>Removed binary strings and <code>Array</code> support.</li>
<li>Removed fallbacks for TypedArray methods (<code>.set()</code>, <code>.subarray()</code>).</li>
<li>Rewritten top-level wrappers.</li>
<li>Removed support of <code>Inflate</code> &amp; <code>Deflate</code> instance create without <code>new</code>.</li>
<li><code>Inflate.push()</code> no longer needs second param (end is auto-detected).</li>
<li>Increased default inflate chunk size to 64K.</li>
<li>Moved exported constants to <code>.constants</code>.</li>
<li>Switched to es6. Legacy es5 builds available in <code>/dist</code>.</li>
<li>Added esm build.</li>
<li>Structure of <code>/dist</code> folder changed.</li>
<li>Upgraded build tools to modern ones.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="45cce9f4d6"><code>45cce9f</code></a> 2.0.2 released</li>
<li><a href="b3861d9a66"><code>b3861d9</code></a> dist rebuild</li>
<li><a href="d0382badcc"><code>d0382ba</code></a> Fix esm build named exports</li>
<li><a href="8d5f9c70f8"><code>8d5f9c7</code></a> 2.0.1 released</li>
<li><a href="70ee7697ac"><code>70ee769</code></a> dist rebuild</li>
<li><a href="bd90fca738"><code>bd90fca</code></a> Add <code>module</code> entry for some bundlers</li>
<li><a href="84d6931fe8"><code>84d6931</code></a> Rename module build .js =&gt; .mjs to fix node import (<a href="https://github-redirect.dependabot.com/nodeca/pako/issues/200">https://github.com/facebook/flipper/issues/200</a>)</li>
<li><a href="52df0c510f"><code>52df0c5</code></a> 2.0.0 released</li>
<li><a href="a8faeffc94"><code>a8faeff</code></a> dist rebuild</li>
<li><a href="b4d9a94488"><code>b4d9a94</code></a> Added esm build, <a href="https://github-redirect.dependabot.com/nodeca/pako/issues/97">https://github.com/facebook/flipper/issues/97</a></li>
<li>Additional commits viewable in <a href="https://github.com/nodeca/pako/compare/1.0.11...2.0.2">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pako&package-manager=npm_and_yarn&previous-version=1.0.11&new-version=2.0.2)](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/1786

Reviewed By: passy

Differential Revision: D25664507

Pulled By: cekkaewnumchai

fbshipit-source-id: bd33a7a11ef38b54675cde31d1243742476263d9
2020-12-22 04:03:03 -08:00
Michel Weststrate
41a1af33cb Kill metrics reducer
Reviewed By: nikoant

Differential Revision: D24332440

fbshipit-source-id: 0a48b25f98d93b181b622e8477a74c7ef0094816
2020-12-15 01:44:27 -08:00
Michel Weststrate
092a286bc8 Update several deps at once
Summary: Fixes #1771, #1770, #1769, #1768, #1767, #1766

Reviewed By: nikoant

Differential Revision: D25533717

fbshipit-source-id: 86b90e1ec93f0255edcf1cf3cf5fb2311f0ca23f
2020-12-14 09:14:23 -08:00
Pascal Hartig
e33afdb938 Fix typos in comments
Summary: Per title.

Reviewed By: mweststrate

Differential Revision: D25394444

fbshipit-source-id: b741a147e25df5d4e91094c71136179871123743
2020-12-08 08:32:58 -08:00
Michel Weststrate
b1140ae3f9 Remove error when no app bookmarks are found
Summary: App match patterns are not available for all apps, there is no reason to treat this as an error, currently errors are printed for apps like "Flipper".

Reviewed By: nikoant

Differential Revision: D25369648

fbshipit-source-id: a63aadbf14745310501565b00081602e44852398
2020-12-07 09:14:34 -08:00
Anton Nikolaev
dbc888613b Do not bump every package version for every release
Summary:
This diff sets all package version to "0.0.0" except of the root package and changes the bump script to only bump version in the root package. This should reduce possibility of conflicts on release diffs. Anyway we always use the same version for all of our packages, so we can only set it to the root.

Before npm publishing we will set all package versions to the same number as in the root package (we actually already do that) so there will be no differences except we won't need to bump version in  more than 100 packages each release.

Reviewed By: mweststrate

Differential Revision: D25162373

fbshipit-source-id: 02fe401bee72845339c67925c130027bdaee559d
2020-12-02 02:38:47 -08:00
generatedunixname89002005306973
3a733a10df Flipper Release: v0.67.0
Summary: Releasing version 0.67.0

Reviewed By: passy

Differential Revision: D25217536

fbshipit-source-id: 489cba736a847ea9f864b594646014a6d7279161
2020-11-30 10:13:36 -08:00
Michel Weststrate
8025c49768 Upgrade to TypeScript 4.1
Summary:
allow-large-files

Upgrade to TypeScript 4.1

Reviewed By: nikoant

Differential Revision: D25122073

fbshipit-source-id: 7d2bc6f97595c825c9527b0c6ecab07698d5f981
2020-11-26 04:22:05 -08:00
Michel Weststrate
d71297a1ea Expose styled and produce
Summary: To control bundle size and the amount of different versions used, we want plugins to use emotion's styled and immer's produce from flipper-plugin, rather than bringing their own

Reviewed By: passy

Differential Revision: D25087286

fbshipit-source-id: d2cc8b2cb1a17c520d05d99048cd94338984a913
2020-11-19 08:59:52 -08:00
Michel Weststrate
25158416ce Freeze incoming data
Summary:
This diff will enabling freezing (making immutable) of all data we receive from the device. This prevents dev mistakes causing components not to update or logic being hard to reason about. Also this makes Immer's `produce` faster in the typical case

Since this is potentially a risky change, that might break existing plugin logic, it has been put behind a GK https://www.internalfb.com/intern/gatekeeper/projects/flipper_frozen_data/

I did some quick exploratory testing on all plugins available for Facebook iOS / Android, and the only plugin that caused trouble was Fresco, which is fixed in this diff as well.

Reviewed By: nikoant

Differential Revision: D25055056

fbshipit-source-id: 8525511f4a8a0221740a6e1371ce7f2b757a203e
2020-11-18 08:51:15 -08:00
generatedunixname89002005306973
ad8e8fbb24 Flipper Release: v0.66.0
Summary: Releasing version 0.66.0

Reviewed By: nikoant

Differential Revision: D25052024

fbshipit-source-id: 5ef39431905ca3bc2c4870bff2f8ae917ed1e81e
2020-11-18 03:13:31 -08:00
Michel Weststrate
c6e51fe73c Moved sections plugin into fb/
Summary: See https://github.com/facebook/flipper/issues/1680, the sections plugin was exposed publicly, even though we don't have a publicly available client plugin

Reviewed By: passy

Differential Revision: D24993552

fbshipit-source-id: 788ecc29ec64048b3077dea89e492ddbf1ea7d84
2020-11-17 02:42:13 -08:00
Michel Weststrate
da6d6593a5 Update seammamals plugin to Sandy
Reviewed By: nikoant

Differential Revision: D24951251

fbshipit-source-id: 5510c2777d232fe4290f6b248b736c80306fb44e
2020-11-16 13:10:32 -08:00
Chaiwat Ekkaewnumchai
d00cb84ad9 Sync Flipper Library Version
Summary: The plugin seems to miss the train to version 0.65. This diff gives it a ride to the current version

Reviewed By: nikoant

Differential Revision: D24950948

fbshipit-source-id: 3132a3baf0a41d8ec0de5cf8c55c0561126b038f
2020-11-13 07:24:47 -08:00
Michel Weststrate
273b895e30 Support auto completion on discovered bookmarks and filling out params
Summary:
This diff adds support for finding appPatterns (not sure how the feature is called) in the device, and auto completing on it.

Also improved the styling of bookmark sections.

This diff also adds support of showing a dialog in which params an be filled out if needed.

The behavior around optional arguments seems buggy, as in, no dialog will show up, but since I didn't want to change the logic around this unilaterally, left it as-is for now.

Updated the dialog to Ant so that the renderReactRoot utility could be used safely

Reviewed By: cekkaewnumchai

Differential Revision: D24889855

fbshipit-source-id: 6af264abec2e9e5b921ef7da6deb1d0021615e9e
2020-11-12 04:17:29 -08:00
Michel Weststrate
661bea1d5b Convert Navigation plugin to Sandy
Summary:
Converted the Navigation plugin to Sandy, and updated Locations bookmark accordingly.
This is a prerequisite step of supporting the bookmarkswidgetin the new AppInspect tab.

Updated LocationsButton accordingly, and overal simplified implementation a bit; locationsbutton now reuses the logic of the NavigationPlugin, rather than reimplemting it. This reduces code duplication and also makes sure the state between plugin and location button stays in sync.

Made sure that search providers are derived and cached rather than stored, again simplifying logic

That being said, the navigation plugin is buggy, but all these things failed before this diff as well:
* No events happening when using iOS, despite the plugin being enabled. But these seems to be a long time know issue, looks like it was never implemented
* Not sure if the parameterized bookmarks is working correctly
* screenshots not always happening at the right time (but fixed a race condition where the wrong bookmark might get updated)
* Locations button doesn't show up if the navigation plugin is supported but not enabled (will try to fix in next diff)

Would be great if bnelo12 could do some exploratory testing to verify what ought to be working, but currently isn't.

Reviewed By: cekkaewnumchai

Differential Revision: D24860757

fbshipit-source-id: e4b56072de8c42af2ada0f5bb022cb9f8c04bb47
2020-11-12 04:17:29 -08:00
generatedunixname89002005306973
f04c7a1768 Flipper Release: v0.65.0
Summary: Releasing version 0.65.0

Reviewed By: nikoant

Differential Revision: D24884910

fbshipit-source-id: 6aa59c57c9d372046d71048513db322c03c72b57
2020-11-11 08:17:41 -08:00
Michel Weststrate
9b4e7e873c Make client -> device connection synchronous
Summary:
devices not always being readily available is causes a lot of complication in the api,
figured to resolve devices first before construction clients,
since clients not attached to a device are shown uncategorized anyway, making them practically un-interactable.
For more background info, see following chat.

{F344388883}

This diff will make it possible to only expose a synchronous api in Sandy

n.b. didn't update Navigation plugin, as that is done in a next diff

Reviewed By: jknoxville

Differential Revision: D24858332

fbshipit-source-id: 8339f831fbbc9c219add56a199364fde67adafc7
2020-11-11 07:58:55 -08:00
John Knox
fd8065eb7a Sort headers when displaying them
Summary: It's easier to scan the same header value of multiple requests when it's in roughly the same place for each one.

Reviewed By: mweststrate

Differential Revision: D24885172

fbshipit-source-id: 7be02903d2f9f79c8ba618e57c74169392f6244b
2020-11-11 03:48:41 -08:00
Michel Weststrate
670be012b2 Kill Flow support
Summary:
* Removed Flow compilation step
* Removed all `flow` annotations
* Removed all FlowFixMe's
* Removed flow typings for Flipper
* Left flow transpilation (stripping) in babel, in case there is any external user using Flow in his plugin
* Left `eslint-plugin-flowtype` dependencies, as `eslint-config-fbjs` requires it

Reviewed By: passy

Differential Revision: D24755545

fbshipit-source-id: 9c0a7910657fd1cba88294e041bf2bfdf7b565bf
2020-11-09 08:24:28 -08:00
Michel Weststrate
c9b08695d5 Make sure out-of-contents rendering is supported in Sandy
Summary: For RN Debugger an ugly hack is used that roars its head now again; to make sure that the embedded debugger state isn't lost when switching to a different plugin, the chrome devtools are rendered _outside_ the domNode where they should normally appeared, and made invisible rather than removed when becoming invisible. Since at this moment this is the only place where we apply the trick, figured for now to condone it, rather than making a neater abstraction out of it (or kiling it all together)

Reviewed By: passy

Differential Revision: D24786771

fbshipit-source-id: 726617899bc620fc8b9db677d9413b31d5ad7653
2020-11-09 07:23:29 -08:00
Michel Weststrate
e92145d2fd Removed ex-employees as PoC
Summary:
When creating the plugin overview (https://docs.google.com/spreadsheets/d/181jKpsUHO3q8I1G-bMcu-O7Hr3f4GCDVXKMVY2beOuQ/edit?usp=sharing) found some plugins with inactive points of contact

Per title, having no PoC entry makes it more clear there is none, rather than having an ex-employee in there that can't be reached

Reviewed By: nikoant

Differential Revision: D24783043

fbshipit-source-id: a852f87f42350476558bc9fc67cb3ad427268a2f
2020-11-06 06:25:14 -08:00
Chaiwat Ekkaewnumchai
88f3faffb1 Enable Plugin
Summary: Encountered while debugging. Seems that the id was incorrect. This diff changes the id back to `"Example"`

Reviewed By: nikoant

Differential Revision: D24782578

fbshipit-source-id: ad1c6d6fe4962179ad609728c8641adc2063e929
2020-11-06 05:24:13 -08:00
generatedunixname89002005306973
a3bcf6b043 Flipper Release: v0.64.0
Summary: Releasing version 0.64.0

Reviewed By: priteshrnandgaonkar

Differential Revision: D24590607

fbshipit-source-id: 04671a31028a33cf020acd8b83c219608fe38319
2020-10-28 06:06:33 -07:00
Pascal Hartig
f36c3656b5 Upgrade to React 17
Summary:
Doing some oncall upgrades.

Changelog: Upgrade internal React version to v17

Reviewed By: mweststrate

Differential Revision: D24506315

fbshipit-source-id: 911e4f657684b4d98ec3ef91bc8a81c43130da5b
2020-10-27 05:56:34 -07:00
Michel Weststrate
5731e3a155 Scrolling improvements
Summary:
Split container had a convenient property `scrollable`, that automatically applies a Scroll container to the main content.

But I noticed it leads to bad design choices because it is so convenient. So sometimes scrolling would be unnecessarily in two directions because of this.

Or, since the scroll container wraps around the whole content, toolbars would scroll out of view. By forcing scrolling to be put explicitly in the component tree, we encourage plugin developers to think about where they actually want to have that scroll, and in which direction.

Also added options to use the Container padding properties on ScrollContainer, which is great since we can keep the scrollbars outside the padding, and apply it to the content only, to prevent an accidental mistake where people would put a scroll container in a padded container, that would put the scrollbar inside the padding.

Reviewed By: cekkaewnumchai

Differential Revision: D24502546

fbshipit-source-id: 524004a1c5f33a185f9b959251b72875dd623cb3
2020-10-23 06:46:15 -07:00
Chaiwat Ekkaewnumchai
402ea2fc14 Convert to Shared Preference Plugin to Sandy
Summary:
per title

In addition, this diff adds `startUnactivated` option to allow setting up `onSend` mock implementation.

Reviewed By: mweststrate

Differential Revision: D24477989

fbshipit-source-id: f913574ebacdd436e8511baa43744249a014e90b
2020-10-23 06:22:02 -07:00
Michel Weststrate
966d748ace Some fixes in rendering legacy plugins
Summary:
Some exploratory testing on all iOS and Android plugins, to see how they behave inside Sandy, and fixed some layout glitches (some were also present without Sandy)

General fixes:
* Introduced some niceties like searchbox resizing properly, and toolbars wrapping automatically in Sandy, rather than buttons becoming invisible
* Containers don't grow anymore by default, but take size of contents
* ScrollContainer child is now a Layout.Vertical. Layout.Vertical should be used as default container everywhere (e.g. Tabs, Panels) in the future
* Fixed layout issue if a split container had only 1 visible child
* DetailsSidebar now scrolls vertically by default
* Details sidebar would sometimes render content in-place rather than in the reserved area
* AppSelector dropdown and Plugin list will now properly ellipse (...) if there is not enough space

Plugin fixes:
* Long database / table names in Database plugin would break layout

Also fixes https://github.com/facebook/flipper/issues/1611

Reviewed By: passy

Differential Revision: D24454188

fbshipit-source-id: c60c867270900a1d4f28587d47067c6ec1072ede
2020-10-22 09:41:11 -07:00
generatedunixname89002005306973
0f23f409ab Flipper Release: v0.63.0
Summary: Releasing version 0.63.0

Reviewed By: nikoant

Differential Revision: D24423408

fbshipit-source-id: 0bc12c49d8bf77d8dbf9688adb07dc176b210548
2020-10-20 11:13:12 -07:00
Michel Weststrate
a2fac737f6 Render sidebar
Summary:
Restore sidebar functionality for Sandy plugins

Also needed to fix some circular dependency issues as fallout.

Reviewed By: cekkaewnumchai

Differential Revision: D24362215

fbshipit-source-id: 0a09ac35ba981322ae0793edc3aa79ffddf2ce73
2020-10-20 03:24:47 -07:00
Michel Weststrate
99757622a5 Tiny Regex improvements
Summary: Recreation of D22118786, which was so old rebasing died on some lacking meta data. Lands https://github.com/facebook/flipper/pull/1256

Reviewed By: passy

Differential Revision: D24331424

fbshipit-source-id: 65fc5d8bf0242d4266e269716a319d71ce2e2826
2020-10-15 09:23:35 -07:00
Michel Weststrate
6b7b1fab5c Fix content encoding issues
Summary:
Changelog: [Network] Non-binary request are not properly utf-8 decoded on both iOS and Android, both when gzipped and when not gzipped

This diff fixes a long standing / ping-pong issue regarding network decoding differences between
* iOS vs Android
* binary vs utf-8
* gzipped vs uncompressed

The changes aren't too big, but the underlying investigating is :)

The primary contribution to this diff is:

First, adding test cases for know problematic cases. This is done by grabbing the messages that are send from the flipper client to flipper using the flipper messages plugin. This is the base64 data that is stored in the `.txt` files. Beyond that, for all tests public endpoints are used, so that we can both get a hold of the raw original files, and how we expect them to be displayed in flipper.

For testing a simple RN app was build, with a button that fires a bunch requests. The first 3 are captured in unit tests, the last one is not idempotent, but a case reported in #1466, so just left it there as manual verification.

```
const fetchData = async () => {
  await fetch(
    'https://raw.githubusercontent.com/SangKa/MobX-Docs-CN/master/docs/donating.md',
    {
      headers: {
        'Accept-Encoding': 'identity', // signals that we don't want gzip
      },
    },
  );
  await fetch('https://reactnative.dev/img/tiny_logo.png?x=' + Math.random());
  await fetch(
    'https://raw.githubusercontent.com/SangKa/MobX-Docs-CN/master/docs/donating.md',
  );
  await fetch(
    'https://ex.ke.com/sdk/recommend/html/100001314?hdicCityId=110000&paramMap[source]=&id=100001314&mediumId=100000037&elementId=&resblockId=1111027381003&templateConfig=%5Bobject%20Object%5D&fbExpoId=346620976471638017&fbQueryId=&required400=true&unique=1111027381003&parentSceneId=',
  );
};
```

The second contribution of this diff is that it doesn't use weird URLencoder hacks to convert base64 to utf8, but rather a proper library. The problem with our original solution, using `atob` is that it converts to ASCII, not to utf-8, which is the source of the original bugs. See for more background on this: https://www.npmjs.com/package/js-base64#decode-vs-atob-and-encode-vs-btoa-

Solves:
https://github.com/facebook/flipper/issues/1466
https://github.com/facebook/flipper/pull/1541
https://github.com/facebook/flipper/issues/1458

Supersedes D23837750

Future work: we don't inspect the `content-type=xxx;charset` header yet, which we should do for less common encodings, to make sure that they get displayed correctly as well

Future work: in feature like copy data and curl, we always call decode body, without check if we are actually dealing with non-binary data. Probably it is better to keep binary data in base64, rather than decoding it, as that will assume the data is an utf-8 string, which might fail.

An assumption in these changes is that binary data is never gzipped, which is generally correct; gzip is not applied by webserver to things like images, as it would increase, not decrease their size, and waste a lot of computation power.

Reviewed By: cekkaewnumchai

Differential Revision: D23403095

fbshipit-source-id: 5099cc4a7503f0f63bd10585dc6590ba893f3dde
2020-10-14 06:23:27 -07:00
Anna Murawska
fdde2761ef Migrate Network plugin to Sandy (#1583)
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/1583

Migrate Network plugin to Sandy

Reviewed By: mweststrate

Differential Revision: D24108772

fbshipit-source-id: e889b9f6b00398cd5f98cf15660b42b1d5496cea
2020-10-14 01:48:55 -07:00
generatedunixname89002005306973
ca271dd7c3 Flipper Release: v0.62.0
Summary: Releasing version 0.62.0

Reviewed By: nikoant

Differential Revision: D24248944

fbshipit-source-id: 05742031294f6a77c78c0bdccbdffe7d82427f05
2020-10-12 06:03:03 -07:00