Commit Graph

94 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
bb529411b5 Expose current connection status to Sandy plugins
Summary:
Introduced `isConnected` flag on device and plugin client to reflect whether a connection is still available for the plugins, or that they have been disconnected.

Potentially we could expose the (readonly) `connected` state atom for this as well, or an `onDisconnect` event for device pugins, to create a responsive UI, but there might be no need for that, in which case this suffices.

Reviewed By: nikoant

Differential Revision: D26249346

fbshipit-source-id: b8486713fdf2fcd520488ce54f771bd038fd13f8
2021-02-09 04:16:24 -08:00
Michel Weststrate
c43049d881 Preserve device state after disconnect
Summary:
This diff stack introduces support for keeping devices and clients around after they have disconnected. This is a pretty important debugging improvement, that will allow inspecting a device / app after it crashed for example.

This feature existed partially before, but only supported Android, and only support plugins with persisted state; as it replace the current device with an archived version of the same device. In practice this didn't work really well, as most plugins would not be available, and all non-persisted state would be lost.

This diff makes sure we can keep devices around after disconnecting, the next one will keep the clients around as well. And explain some code choices in more detail.

Note that `Device.isArchived` was an overloaded term before, and even more now (both representing imported and disconnected devices), will address that in a later diff.

https://github.com/facebook/flipper/issues/1460
https://github.com/facebook/flipper/issues/812
https://github.com/facebook/flipper/issues/1487

Changelog: iOS and Android devices will preserve their state after being disconnected

Reviewed By: nikoant

Differential Revision: D26224310

fbshipit-source-id: 7dfc93c2a109a51c2880ec212a00463bc8d32041
2021-02-09 04:16:24 -08:00
dependabot[bot]
e09e3c82ee Bump antd from 4.9.1 to 4.11.2 in /desktop (#1886)
Summary:
allow-large-files

Bumps [antd](https://github.com/ant-design/ant-design) from 4.9.1 to 4.11.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/ant-design/ant-design/releases">antd's releases</a>.</em></p>
<blockquote>
<h2>4.11.2</h2>
<ul>
<li>{emoji:1f41e} Fix rc-trigger BuildInPlacements TypeScript compile error. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/29029">#29029</a> <a href="https://github.com/waiwaiku"><code>waiwaiku</code></a></li>
</ul>
<hr />
<ul>
<li>{emoji:1f41e} 修复 rc-trigger BuildInPlacements TypeScript 编译错误。<a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/29029">#29029</a> <a href="https://github.com/waiwaiku"><code>waiwaiku</code></a></li>
</ul>
<h2>4.11.1</h2>
<ul>
<li>{emoji:1f484} Layout inline sub menu now has grey background. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28842">#28842</a></li>
<li>{emoji:1f195} PageHeader supports <code>breadcrumbRender</code>. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28999">#28999</a></li>
<li>{emoji:1f195} Typography <code>ellipsis</code> support <code>tooltip</code> to customize tooltip when ellipsis. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28821">#28821</a></li>
<li>Image
<ul>
<li>{emoji:1f195} Image supports <code>preview.maskClassName</code>. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28681">#28681</a></li>
<li>{emoji:1f41e} Fix preview image will move after click it. <a href="https://github-redirect.dependabot.com/react-component/image/pull/61">react-component/image#61</a> <a href="https://github.com/simonwong"><code>simonwong</code></a></li>
<li>{emoji:1f41e} Fix Image <code>placeholder</code> disappear issue. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/issues/28953">#28953</a></li>
<li>{emoji:1f41e} Fix multiple Image.PreviewGroup contain same image. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/issues/28881">#28881</a></li>
</ul>
</li>
<li>ConfigProvider
<ul>
<li>{emoji:1f195} ConfigProvider supports <code>iconPrefixCls</code>. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28924">#28924</a></li>
<li>{emoji:26a1} Optimize ConfigProvider props updating perfermance. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28792">#28792</a> <a href="https://github.com/zxc0328"><code>zxc0328</code></a></li>
</ul>
</li>
<li>{emoji:1f484} Tweak TreeSelect filter highlight color. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28984">#28984</a></li>
<li>{emoji:1f484} Fix Select item align style with custom <code>tagRender</code>. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28962">#28962</a></li>
<li>Form
<ul>
<li>{emoji:1f41e} Fix Form.Item can not clear nested <code>noStyle</code> error message. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28918">#28918</a></li>
<li>{emoji:1f41e} Form.Item with <code>preserve=false</code> will reset value to <code>initialValues</code> when removed. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28908">#28908</a></li>
</ul>
</li>
<li>{emoji:1f41e} Fix Button click effect style not working in shadow root. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28995">#28995</a> <a href="https://github.com/rinick"><code>rinick</code></a></li>
<li>{emoji:1f41e} Fix Table custom filter menu cannot close bug. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28688">#28688</a> <a href="https://github.com/alekye"><code>alekye</code></a></li>
<li>Less
<ul>
<li>{emoji:1f484} Add <code>menu-inline-submenu-bg</code> less variable and rename <code>menu-dark-submenu-bg</code> to <code>menu-dark-inline-submenu-bg</code>. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28842">#28842</a></li>
<li>{emoji:1f484} Add less variable <code>drawer-footer-padding-horizontal</code>. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28975">#28975</a> <a href="https://github.com/yuxuan"><code>yuxuan</code></a></li>
</ul>
</li>
<li>RTL
<ul>
<li>{emoji:1f484} Fix Card actions divider style in RTL. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28915">#28915</a> <a href="https://github.com/Aghosey"><code>Aghosey</code></a></li>
</ul>
</li>
<li>TypeScript
<ul>
<li>� Expose interfaces and types from default entry of antd. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28963">#28963</a></li>
<li>� Improve Input/Skeleton <code>style</code> definition. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28966">#28966</a> <a href="https://github.com/yingpengsha"><code>yingpengsha</code></a></li>
</ul>
</li>
</ul>
<hr />
<ul>
<li>{emoji:1f484} Layout 内联子表单添加背景颜色以更好的区分层级。<a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28842">#28842</a></li>
<li>{emoji:1f195} PageHeader 支持 <code>breadcrumbRender</code> 属性。<a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28999">#28999</a></li>
<li>{emoji:1f195} Typography <code>ellipsis</code> 属性添加 <code>tooltip</code> 支持以自定义收缩时的提示信息。<a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28821">#28821</a></li>
<li>Image
<ul>
<li>{emoji:1f195} Image 支持配置 <code>preview.maskClassName</code>。<a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28681">#28681</a></li>
<li>{emoji:1f41e} 修复预览图片会跟随鼠标移动的问题。<a href="https://github-redirect.dependabot.com/react-component/image/pull/61">react-component/image#61</a> <a href="https://github.com/simonwong"><code>simonwong</code></a></li>
<li>{emoji:1f41e} 修复 Image <code>placeholder</code> 不显示的问题。<a href="https://github-redirect.dependabot.com/ant-design/ant-design/issues/28953">#28953</a></li>
<li>{emoji:1f41e} 修复多个 Image.PreviewGroup 之间图片互串的问题。<a href="https://github-redirect.dependabot.com/ant-design/ant-design/issues/28881">#28881</a></li>
</ul>
</li>
<li>ConfigProvider</li>
<li>ConfigProvider
<ul>
<li>{emoji:1f195} ConfigProvider 支持 <code>iconPrefixCls</code> 修改图标样式前缀。<a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28924">#28924</a></li>
<li>{emoji:26a1} 优化 ConfigProvider 切换属性的性能。<a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28792">#28792</a> <a href="https://github.com/zxc0328"><code>zxc0328</code></a></li>
</ul>
</li>
<li>{emoji:1f484} 调整 TreeSelect 搜索高亮条目的颜色。<a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28984">#28984</a></li>
<li>{emoji:1f484} 修复 Select 自定义 <code>tagRender</code> 时不对齐的问题。<a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28962">#28962</a></li>
<li>Form
<ul>
<li>{emoji:1f41e} 修复 Form.Item 无法正确清理嵌套的 <code>noStyle</code> 错误信息问题。<a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28918">#28918</a></li>
<li>{emoji:1f41e} Form.Item 配置 <code>preserve=false</code> 时,移除该字段将自动重置对应值为 <code>initialValues</code>。<a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28908">#28908</a></li>
</ul>
</li>
</ul>

</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/ant-design/ant-design/blob/master/CHANGELOG.en-US.md">antd's changelog</a>.</em></p>
<blockquote>
<h2>4.11.2</h2>
<p><code>2021-01-26</code></p>
<ul>
<li>{emoji:1f41e} Fix rc-trigger BuildInPlacements TypeScript compile error. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/29029">#29029</a> <a href="https://github.com/waiwaiku"><code>waiwaiku</code></a></li>
</ul>
<h2>4.11.1</h2>
<p><code>2021-01-24</code></p>
<ul>
<li>{emoji:1f484} Layout inline sub menu now has grey background. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28842">#28842</a></li>
<li>{emoji:1f195} PageHeader supports <code>breadcrumbRender</code>. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28999">#28999</a></li>
<li>{emoji:1f195} Typography <code>ellipsis</code> support <code>tooltip</code> to customize tooltip when ellipsis. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28821">#28821</a></li>
<li>Image
<ul>
<li>{emoji:1f195} Image supports <code>preview.maskClassName</code>. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28681">#28681</a></li>
<li>{emoji:1f41e} Fix preview image will move after click it. <a href="https://github-redirect.dependabot.com/react-component/image/pull/61">react-component/image#61</a> <a href="https://github.com/simonwong"><code>simonwong</code></a></li>
<li>{emoji:1f41e} Fix Image <code>placeholder</code> disappear issue. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/issues/28953">#28953</a></li>
<li>{emoji:1f41e} Fix multiple Image.PreviewGroup contain same image. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/issues/28881">#28881</a></li>
</ul>
</li>
<li>ConfigProvider
<ul>
<li>{emoji:1f195} ConfigProvider supports <code>iconPrefixCls</code>. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28924">#28924</a></li>
<li>{emoji:26a1} Optimize ConfigProvider props updating perfermance. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28792">#28792</a> <a href="https://github.com/zxc0328"><code>zxc0328</code></a></li>
</ul>
</li>
<li>{emoji:1f484} Tweak TreeSelect filter highlight color. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28984">#28984</a></li>
<li>{emoji:1f484} Fix Select item align style with custom <code>tagRender</code>. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28962">#28962</a></li>
<li>Form
<ul>
<li>{emoji:1f41e} Fix Form.Item can not clear nested <code>noStyle</code> error message. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28918">#28918</a></li>
<li>{emoji:1f41e} Form.Item with <code>preserve=false</code> will reset value to <code>initialValues</code> when removed. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28908">#28908</a></li>
</ul>
</li>
<li>{emoji:1f41e} Fix Button click effect style not working in shadow root. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28995">#28995</a> <a href="https://github.com/rinick"><code>rinick</code></a></li>
<li>{emoji:1f41e} Fix Table custom filter menu cannot close bug. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28688">#28688</a> <a href="https://github.com/alekye"><code>alekye</code></a></li>
<li>Less
<ul>
<li>{emoji:1f484} Add <code>menu-inline-submenu-bg</code> less variable and rename <code>menu-dark-submenu-bg</code> to <code>menu-dark-inline-submenu-bg</code>. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28842">#28842</a></li>
<li>{emoji:1f484} Add less variable <code>drawer-footer-padding-horizontal</code>. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28975">#28975</a> <a href="https://github.com/yuxuan"><code>yuxuan</code></a></li>
</ul>
</li>
<li>RTL
<ul>
<li>{emoji:1f484} Fix Card actions divider style in RTL. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28915">#28915</a> <a href="https://github.com/Aghosey"><code>Aghosey</code></a></li>
</ul>
</li>
<li>TypeScript
<ul>
<li>� Expose interfaces and types from default entry of antd. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28963">#28963</a></li>
<li>� Improve Input/Skeleton <code>style</code> definition. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28966">#28966</a> <a href="https://github.com/yingpengsha"><code>yingpengsha</code></a></li>
</ul>
</li>
</ul>
<h2>4.11.0</h2>
<p><code>2021-01-24</code></p>
<p>It is a wrong release which same as <code>4.10.3</code>, don't use it.</p>
<h2>4.10.3</h2>
<p><code>2021-01-18</code></p>
<ul>
<li>{emoji:1f41e} Fix Button not adapting to the <code>btn-border-width</code> when loading. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28886">#28886</a> <a href="https://github.com/jjanssen"><code>jjanssen</code></a></li>
<li>Table
<ul>
<li>{emoji:1f484} Add <code>table-border-color</code> less variable. <a href="https://github-redirect.dependabot.com/ant-design/ant-design/pull/28903">#28903</a></li>
</ul>
</li>
</ul>

</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="8158f45611"><code>8158f45</code></a> chore: upgrade ant-design/tools</li>
<li><a href="83904e56ea"><code>83904e5</code></a> docs: release 4.11.2</li>
<li><a href="20c49b7bbb"><code>20c49b7</code></a> docs: fix demo-focus layout (<a href="https://github-redirect.dependabot.com/ant-design/ant-design/issues/29028">#29028</a>)</li>
<li><a href="da0f6519f0"><code>da0f651</code></a> fix: import BuildInPlacements type (<a href="https://github-redirect.dependabot.com/ant-design/ant-design/issues/29029">#29029</a>)</li>
<li><a href="47792085b0"><code>4779208</code></a> docs: Update showCheckedStrategy desc</li>
<li><a href="9dff2dd9c3"><code>9dff2dd</code></a> dos({emoji:1f6e1} ): update test badge</li>
<li><a href="52e84f92e0"><code>52e84f9</code></a> test({emoji:1f500}): use wearerequired/git-mirror-action (<a href="https://github-redirect.dependabot.com/ant-design/ant-design/issues/29012">#29012</a>)</li>
<li><a href="48842e2a49"><code>48842e2</code></a> chore: update mirror.yml</li>
<li><a href="eebdb95cbe"><code>eebdb95</code></a> test: should not ignore *.md</li>
<li><a href="d86cfba197"><code>d86cfba</code></a> docs: release 4.11.1</li>
<li>Additional commits viewable in <a href="https://github.com/ant-design/ant-design/compare/4.9.1...4.11.2">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=antd&package-manager=npm_and_yarn&previous-version=4.9.1&new-version=4.11.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/1886

Reviewed By: passy

Differential Revision: D26222325

Pulled By: nikoant

fbshipit-source-id: f769bca6be6939b607678defa1ad2ea5beba5b50
2021-02-03 03:37:19 -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
Michel Weststrate
f2ade40239 Support custom data processing during import
Summary: Per title, this allows for pre-processing data after it is deserialized and before it is stored in the plugin

Reviewed By: nikoant

Differential Revision: D26126423

fbshipit-source-id: bc08a6ab205d2a0d551515563cd85a197595ddb2
2021-02-01 11:43:30 -08:00
Michel Weststrate
34c915a739 Add support for async / custom plugin export
Summary:
Sandy plugins can now set up an `onExport` handler to enable customizing the export format of a plugin: `client.onExport(callback: (idler, onStatusMessage) => Promise<state>)`

Import will be done in next diff

Reviewed By: nikoant

Differential Revision: D26124440

fbshipit-source-id: c787c79d929aa8fb484f15a9340d7c87545793cb
2021-02-01 11:43:29 -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
Michel Weststrate
a6c1a95be7 Bump Immer to fix potential security issue
Summary:
Immer had security issues. Noobs.

Only the patches feature was affected, which at this moment isn't used by any known plugin, but just in case.

Reviewed By: passy

Differential Revision: D25993961

fbshipit-source-id: 9bfe7065c90865d912ebcfd14c1117697bf714f7
2021-01-21 04:20:21 -08:00
Anton Nikolaev
5383017299 Separate interfaces for installed, bundled and downloadable plugins
Summary:
I've re-designed interfaces describing plugins as I found that mental overhead working with them became too expensive because of slightly flawed design. However this cascaded changes in many files so you can see how extensively these interfaces used in our codebase.

Before this change we had one interface PluginDetails which described three different entities: 1) plugins installed on the disk 2) plugins bundled into Flipper 3) plugins available on Marketplace. It's hard to use this "general" PluginDetails interface because of this as you always need to think about all three use cases everywhere.

After this change we have 3 separate interfaces: InstalledPluginDetails, BundledPluginDetails and DownloadablePluginDetails and things became much type-safer now.

Reviewed By: mweststrate

Differential Revision: D25530383

fbshipit-source-id: b93593916a980c04e36dc6ffa168797645a0ff9c
2020-12-15 09:31:57 -08:00
Anton Nikolaev
ab441d8226 Tests for plugin installer with in-memory file system (#1761)
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/1761

Plugin installed logic is quite complex and heavily relies on file system. So I added integration tests which uses in-memory file system. Here I've covered complex functions added in the previous diff of this stack.

Reviewed By: mweststrate

Differential Revision: D25393473

fbshipit-source-id: a823eb7d6707152a1c3717a6da25b6beee85801d
2020-12-15 09:31:55 -08:00
Michel Weststrate
52862f6083 Introduce isPluginAvailable and selectPlugin
Summary:
Introduced API to replace the deprecated `selectPlugin` in Sandy.

The API can be used to navigate from `device plugin -> device plugin`, or` client plugin -> device / client plugin`

Introduced `isPluginAvailable` as well, so that the user interaction an be fine tuned in case the plugin is not disabled.

Reviewed By: jknoxville

Differential Revision: D25422370

fbshipit-source-id: c6c603f1c68e6291280b3d0883e474448754ded1
2020-12-09 14:36:18 -08:00
Michel Weststrate
4832d6275b Fix activatePlugin measurements not completing
Summary:
`activatePlugin` events where not recorded correctly for Sandy plugins. Although the starting measuerments is fired the `connections` reducer, the completing event fires from `PluginContainer`. Since this is done as part of a ref-update (!!), see [here](https://www.internalfb.com/intern/diffusion/FBS/browse/master/xplat/sonar/desktop/app/src/PluginContainer.tsx?commit=65a625ea9941&lines=155), and the ref to the corresponding element is not set for Sandy plugins, the event was never marked as completed.
Fixed this by making it part of the `activate` life-cycle event of Sandy plugins.

Reviewed By: passy

Differential Revision: D25421537

fbshipit-source-id: 5cbfeb91cc12e4520fa271bab24034094d7ddb39
2020-12-09 05:33:08 -08:00
Michel Weststrate
8dc321c1ee Verify that all APIs are documented in unit test
Summary: When exposing new top-level APIs from `flipper-plugin`, they should be documented. Added a unit test to enforce this and added documentation for all missing APIs.

Reviewed By: passy

Differential Revision: D25421401

fbshipit-source-id: f5cafc1881de846c8a5dd86e5d094ebd27a66f2a
2020-12-09 05:33:08 -08:00
Michel Weststrate
4aff8c1bcf Introduce useLogger hook
Summary: In the Flipper chrome there is a lot of `logger={logger}` prop drilling. Let's not do that anymore in the future by using a proper hook, which is exposed from `flipper-plugin`.

Reviewed By: passy

Differential Revision: D25421304

fbshipit-source-id: 01ec8563c67f7e2fac359c2f8216eba722bff8d9
2020-12-09 05:33:08 -08:00
Michel Weststrate
698df77553 Expose GK api on client
Summary: Make sure that GKs can be used in pure sandy plugins.

Reviewed By: jknoxville

Differential Revision: D25368358

fbshipit-source-id: c7c6aa4ecf0443cb3b5d90e22e8aca9a73a69389
2020-12-07 09:45:25 -08:00
Michel Weststrate
84c6e05b8a Wire up tracking to Sandy Chrome
Summary: Wired up tracking to all chrome sections and some import UI elements

Reviewed By: jknoxville

Differential Revision: D25219089

fbshipit-source-id: c75bed91894609dafc5fcc6423a5228211fb92d8
2020-12-03 04:15:45 -08:00
Michel Weststrate
dd6f39c2b3 Wire up Tracking to different ant.design elements
Summary:
This wires up tracking directly to the ANT component library for the following components:

1. `Button`
2. `Collapse.Panel`
3. `Tabs`

Other less commonly used elements can be connected in the future if needed.
I played a bit with different patterns, but in testing the patch-package patching give the most reliable results. Alternatives considered:

1. Expect users to explicitly wrap there components, e.g. `<Tracked><Button>Hi</Button></Tracked>`
    1. Didn't implement this because it would be very common to forget, and at the moment you want to make some analysis you'll discover there is no interesting data available. I think for tracking we want to have opt-out rather than opt-in
    2. The additional wrapping can cause some subtile layout issues due to static field inspection / forwarded refs (e.g. Ant often has an assumption that relevant children types are _directly_ nested under their parent element. For examle `<Tooltip><Tracked><Button>` does not work as expected
2. Expose our own `Button` / `Collapse` / `Tabs` that applies `Tracked` to an underlying Ant component.
    1. also suffers from 1.b.
    2. It is gonna be quite confusing for other devs that some elements would need to be imported from `flipper-plugin`, ant some from `antd`, and that this is likely to change over time. We could lint against it, but it will be still suboptimal

Reviewed By: jknoxville

Differential Revision: D25196321

fbshipit-source-id: b559356498c3191a283062a88daacb354b0f79f4
2020-12-03 04:15:45 -08:00
Michel Weststrate
b885ff3b9e Tracking interactions
Summary:
Set up basic primitives for user interaction tracking. I hope the docs and unit tests in this diff are self explanatory :)

In upcoming diffs:
* Wire up to scuba events
* Annotate all important parts of Flipper Chrome
* Investigate if we can wrap important interactions of ANT by default

Reviewed By: jknoxville

Differential Revision: D25120234

fbshipit-source-id: 9849d565d7be27e498cc2b4db33e7d6e6938ee06
2020-12-03 04:15:44 -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
2e5b52d247 batch for more efficient message processing
Summary: `unstablebatched_updates` should be used whenever a non-react originating event might affect multiple components, to make sure that React batches them optimally. Applied it to the most import events that handle incoming device events

Reviewed By: nikoant

Differential Revision: D25052937

fbshipit-source-id: b2c783fb9c43be371553db39969280f9d7c3e260
2020-11-18 08:51:15 -08:00
Michel Weststrate
375a612dff Update to Immer 8
Summary: Per title, the primary change is that Immer 8 will also freeze automatically in _production_ builds as well.

Reviewed By: nikoant

Differential Revision: D25052621

fbshipit-source-id: 1cb0b083aae82992b57c4a6e9dca0a8bebe903ec
2020-11-18 08:51:15 -08:00
Michel Weststrate
f7c40c315c Update to Emotion 11
Summary: Per title

Reviewed By: passy

Differential Revision: D24994086

fbshipit-source-id: 84d83638ec518a39ea2d80f56b8c794c8b86a9d4
2020-11-18 06:52:03 -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
d5557ef8de Documented so far undocumented top level APIs
Summary: Per title

Reviewed By: passy

Differential Revision: D24992066

fbshipit-source-id: a9aa351600d46a67b605e8555efb30d42ffc2d9b
2020-11-16 13:10:33 -08:00
Michel Weststrate
45db64f0d0 Make sure that limited top-level exports are exposed from flipper-plugin
Summary: This prefixes APIs of `flipper-plugin`, that are used by Flipper, but should not be used by plugins directly, with `_`. Also added tests to make sure we are always intentional when extending the exposed APIs

Reviewed By: passy

Differential Revision: D24991700

fbshipit-source-id: ed3700efa188fca7f5a14d5c68250598cf011e42
2020-11-16 13:10:33 -08:00
Michel Weststrate
33e527f39a Add onUnhandledMesssage handler
Summary: This diff adds the `client.onUnhandledMessage` handler, to be able to handle messages for which we don't know the names upfront. Some existing plugins that only send one kind of message can benefit from this, as can generic plugins, like the createTablePlugin

Reviewed By: passy

Differential Revision: D24949453

fbshipit-source-id: 0fed81e28aee350632c09ee3bb834f306dc8b100
2020-11-16 13:10:32 -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
Michel Weststrate
ba541e76dc Fix slowly disappearing NUX element
Summary: This issue was reported in the dogfooding group. https://fb.prod.workplace.com/groups/748354712423318/permalink/759865114605611/

Reviewed By: jknoxville

Differential Revision: D24918536

fbshipit-source-id: 7c353dfe1230fa98964216a35e9679a90f398e1d
2020-11-12 04:12:40 -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
1157976eef Expose more meta information for plugins
Summary: expose `appName`, `appId` and `device` to Sandy plugins. Will be used in next diff to migrate navigation plugin

Reviewed By: cekkaewnumchai

Differential Revision: D24857253

fbshipit-source-id: 03ac3d376d5d1950bcf3d78386a65ce167b517e3
2020-11-11 07:58:55 -08:00
Michel Weststrate
2b0e93a063 Introduce NUX element
Summary:
allow-large-files

This diff introces the `NUX` element that can be wrapped around any other element to give a first-time usage hint.

Hint dismissal is stored by taking a hash of the hint contents, and scoped per plugin.

Users can reset the 'read' status in the settings page

Example usage:

```
<NUX
  title="Use bookmarks to directly navigate to a location in the app."
  placement="right">
  <Input addonAfter={<SettingOutlined />} defaultValue="mysite" />
</NUX>
```

Reviewed By: nikoant

Differential Revision: D24622276

fbshipit-source-id: 0265634f9ab50c32214b74f033f59482cd986f23
2020-11-06 08:23:42 -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
9f3df3406d Bless "Layout" and "theme"
Summary: This blesses the `Layout` and `theme` components and exposes them from `flipper-plugin`, so that they can be used in (public) Sandy plugins. Also marked old abstractions as going to be deprecated.

Reviewed By: cekkaewnumchai

Differential Revision: D24503560

fbshipit-source-id: a8f384667b8f66e3b9f00771a123fe5c9d755eb3
2020-10-27 05:21:23 -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
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
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
generatedunixname89002005306973
ad929b23d0 Flipper Release: v0.61.0
Summary: Releasing version 0.61.0

Reviewed By: mweststrate

Differential Revision: D24132584

fbshipit-source-id: 7ae6ad5144561d356effe8eda5eaf472445365e6
2020-10-06 03:43:56 -07:00
Michel Weststrate
7b758d2697 Support supportsMethod in FlipperPlugin
Summary: `supportsMethod` wasn't implemented in the new sandy APIs so far, but is needed for D24108772

Reviewed By: cekkaewnumchai

Differential Revision: D24109496

fbshipit-source-id: 694344b423c1805baa193e4f2e1ad5f28483378b
2020-10-05 13:33:49 -07:00
generatedunixname89002005306973
8054f6446f Flipper Release: v0.60.0
Summary: Releasing version 0.60.0

Reviewed By: priteshrnandgaonkar

Differential Revision: D24017297

fbshipit-source-id: ff193e95edc7d236c204bddf83aba56a7f009469
2020-09-30 09:28:54 -07:00
generatedunixname89002005306973
c0e8cef466 Flipper Release: v0.59.0
Summary: Releasing version 0.59.0

Reviewed By: priteshrnandgaonkar

Differential Revision: D23985341

fbshipit-source-id: a477f9c05f7a62db3a59758c8c5fe06651ffa6f2
2020-09-29 08:11:39 -07:00
Michel Weststrate
ecf4cff7cf Fix most lint warnings
Summary:
I noticed that after the typescript upgrade, I got several weird positives from ESLint (like unused parameters in a type definition, which are obviously always unused, e.g. `type onClick = (e: Event) => void`). After some investigation, it turned out these warnings are generated by eslint, but that those rules should be performaned by typescript/eslint instead. For future reference to which rules this applies:

https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/README.md#extension-rules

Updated the config, and while at it, fixed all warnings in our codebase, except for `react-hooks/exhaustive-deps` warnings, since those require semantic changes.

This reduces the amount of eslint warnings from 86 to 39.

Reviewed By: passy

Differential Revision: D23905630

fbshipit-source-id: 0557708fd9ec6b17840a3c191e7d3baf225bdf23
2020-09-28 01:42:48 -07:00
Michel Weststrate
191df465b7 Updated to typescript 4
Summary:
allow-large-files

Updated to typescript 4. Note that this is no new major, the way TS numbers is that 4.0 is simply the number after 3.9 (so they refuse to use 3.10).

Primarily reason is that it allows us to use `/** deprecated */`. although there are definitely more interesting improvements

Reviewed By: passy, nikoant

Differential Revision: D23869445

fbshipit-source-id: 54e251b398b8698d9b18898ce66c3203b32aa356
2020-09-24 05:58:29 -07:00
generatedunixname89002005306973
32315c2d97 Flipper Release: v0.58.0
Summary: Releasing version 0.58.0

Reviewed By: cekkaewnumchai

Differential Revision: D23872448

fbshipit-source-id: b74483db292311719a0231f9b2fed78122e9f339
2020-09-23 12:06:38 -07:00