Commit Graph

917 Commits

Author SHA1 Message Date
Michel Weststrate
729922e8ad clean up createTablePlugin abstraction
Summary:
createTablePlugin isn't used anymore, since all FB plugins now use flipper-plugin's, version.

Verified that no public OSS plugins use the abstraction either.

This is part of a bigger stack to clean up immutable js usage / managed table duplication and export performance speed

Reviewed By: jknoxville

Differential Revision: D29265565

fbshipit-source-id: dd6671f0b3af857db1a512c6658e1ff75c49358d
2021-06-25 04:35:13 -07:00
Michel Weststrate
603cd08767 Stop printing false positive debug message
Summary: Per title. Deserves a more coherent solution.

Reviewed By: passy

Differential Revision: D29296206

fbshipit-source-id: b8547ebc1f99c24282f79f4b98a8a5fa1d1947cd
2021-06-22 05:20:44 -07:00
Michel Weststrate
640e06f130 Update tests to use the sandyLegacy wrapper by default
Summary: Changed unit test infra to wrap legacy plugins by default in Sandy, and adapted tests where needed.

Reviewed By: nikoant

Differential Revision: D29264660

fbshipit-source-id: fe7cbc8af826afac5f945103586b3cb9647e7fbd
2021-06-21 08:37:21 -07:00
Michel Weststrate
00e2c803ef Add wrapper support for getActiveNotifications
Summary: Add support for getActive notifications in Sandy wrapped legacy plugins

Reviewed By: passy

Differential Revision: D29234071

fbshipit-source-id: e05861e27426a592756645441c934b2c76154d44
2021-06-21 08:37:21 -07:00
Michel Weststrate
6fb28df855 Make Store initialization independent of module order
Summary: Changed some imports, and again the Flipper initialisation broke. Refactored the store initialization to create nowhere module local constants, which prevents generally against module loading issues, making it possible to load all code first, and then intialise things through the `init()` method, which should make Flipper initialisation a lot more robust to changes

Reviewed By: passy

Differential Revision: D29233603

fbshipit-source-id: 322cb87cba23228b1d7a88634b7b3995e27cc277
2021-06-21 08:37:20 -07:00
Michel Weststrate
806dd63f68 Add wrapper support for import / export states
Summary: Make sure custom export handlers of classic plugins wrapped in Sandy are respected

Reviewed By: passy

Differential Revision: D29233604

fbshipit-source-id: 7bab33af3422e0b59697438577906ce8580a28ad
2021-06-21 08:37:20 -07:00
Michel Weststrate
e40faaef3f Add keyboard support to Sandy plugin wrapper
Summary: Per title / see rest of the stack

Reviewed By: passy

Differential Revision: D29196711

fbshipit-source-id: 63ea52a07b61a11c1ad4013985c5b005045dcf0a
2021-06-21 08:37:20 -07:00
Michel Weststrate
c1860ec19c Introduce Sandy wrapper for legacy plugins
Summary:
This diff introduces loading classic Flipper plugins in a Sandy container. By wrapping plugins into Sandy we will be able to remove a lot of code / logic duplication related to state, queue processing, serialization etc. This will allow us to remove most or all of the complex plugin logic from the old system, only keeping onto the legacy components which have a lower maintenance burden. Until all plugins are Sandy.

This diff is not feature complete but only implements the core mechanisms for (persisted) state and communication.

Keyboard support, serialization, and rewiring tests etc will be added in next diff.

The feature is introduced behind GK flipper_use_sandy_plugin_wrapper to have kill switch.

Tests will be added later in this diff by redirection a part of the current mechanisms to wrapped plugins. (Will land the stack as a whole)

Reviewed By: passy

Differential Revision: D29165866

fbshipit-source-id: 57f84794a4a5f898bf765ce2de13cc759267fbc6
2021-06-21 08:37:20 -07:00
Michel Weststrate
07199323d1 Remove Newsfeed Story Inspector and native plugin mechanism
Summary: Changelog: The 'nativeplugins' on Android are no longer supported

Reviewed By: jknoxville

Differential Revision: D29163281

fbshipit-source-id: fb4032f240fc306608fe57479f3124d4e7a3400f
2021-06-21 05:39:26 -07:00
Michel Weststrate
068b00c156 Improved Flipper update message message
Summary: In support group telling users to merely "pull" seemed to be a bit too vague instruction.

Reviewed By: passy

Differential Revision: D29225726

fbshipit-source-id: 5c0db1b2d3afd2a398d28caf3438f2959e5d46f1
2021-06-18 04:10:37 -07:00
Anton Nikolaev
ac9ef7620a Refactor plugin lists computations
Summary: This is purely refactoring change. Before that we computed plugin lists in-place in PluginList component. Now we will be re-computing them as side effect and will keep computed lists in redux. This makes it easier to re-use plugin lists in other places outside of PluginList component, e.g. in the upcoming Marketplace UI.

Reviewed By: mweststrate

Differential Revision: D29161719

fbshipit-source-id: 5cb06d4d8a553aa856101c78b2311fbc078c6bd7
2021-06-17 07:39:43 -07:00
Michel Weststrate
e708b2b693 Fix links not always opening outside Electron
Summary:
Changelog: Fix links not always openening in the Browser

As reported in https://fb.workplace.com/groups/flippersupport/permalink/1154240895056567/, in some cases links would open inside Flipper itself, and as a result the user would be stick as he can't navigate away.

This happened only when a `Link` was being deconstructed from `Typography` by a module that was loaded before `Link.tsx`, which fixes `Typography.Link` to do that automatically. For example:

```
import {Typograph} from "antd"
const {Link} = Typography;
```

Addressed this issue by patching the antd package directly during build, rather than during application start.

Reviewed By: passy

Differential Revision: D29193899

fbshipit-source-id: b291018406e343c0f7de1d1d899924902159d8c7
2021-06-17 03:44:27 -07:00
Michel Weststrate
c83bd7900f Deprecate Native plugins
Reviewed By: fabiomassimo

Differential Revision: D29163280

fbshipit-source-id: 368e966bf86cc0de1ee0125a6b1166811ef6d2f0
2021-06-17 03:17:54 -07:00
Pascal Hartig
f2e67c8055 Disable flaky sideEffect test
Summary: See T93353978

Reviewed By: mweststrate

Differential Revision: D29160508

fbshipit-source-id: 79ac5247e7fd1b4b0a2903b1a40833e2870e299c
2021-06-16 08:26:35 -07:00
Michel Weststrate
42c4bfcb47 Better error for ports in use
Summary:
If port 8088 / 8089 are in use, devices will not be able to connect to Flipper. We have checks for this in place, however it turns out that users can miss them. Potentially this can be caused for mulltiple reasons:

1. The notification is shown fairly short (in my testing it disappeared sometimes in < 2 secs
2. The notification is shown outside of the Flipper area
3. Flipper might not have permissions to show notifs in the first place.

Changed the notification to show inside Flipper, not hide automatically, and added clearer instructions. Including mentioning the port number (since there are multiple)

Changelog: [Flipper] Provide clearer error if Flipper ports are already in use, making device connections impossible

Differential Revision: D29128014

fbshipit-source-id: 16d9b451aa84281744155bfa1042429911a7b774
2021-06-15 06:28:48 -07:00
Pascal Hartig
53e612ff6f Fix adb path interpolation on Windows
Summary:
Concatenating strings is not a great idea for paths. This isn't actually Windows-specific (I think) but maybe more common there. If you have a space as part of your ADB path, you're in for a world of pain.

This addressed a couple of issues but I'm sure there are more when you use it for more detailed use cases.

Closes https://github.com/facebook/flipper/issues/2438

Reviewed By: mweststrate

Differential Revision: D29061367

fbshipit-source-id: 001e498ac42bd8df6e6852be9b42fb5f38379c2e
2021-06-11 06:31:59 -07:00
Michel Weststrate
df7941e2bc deprecated Searchable abstraction
Summary: Since the functionality is now available as part of DataTable, the HoC doesn't seem to be needed as generic abstraction. it is used in handful places outside datatable / datalist, but those can be localized in the future or should datatable / datalist.

Reviewed By: fabiomassimo

Differential Revision: D28993836

fbshipit-source-id: 3e6da7c7b48348faa0c4f7281868196f5585a065
2021-06-10 04:45:18 -07:00
Anton Nikolaev
9a2677fc24 Cleanup global notifications UI
Summary: We don't need to show plugin-related details and button "open globalError" (which anyway doesn't work) when showing global notifications.

Reviewed By: passy

Differential Revision: D28900468

fbshipit-source-id: 54347ede4f1e4dbfb0e41be5c50374fda35c1223
2021-06-07 05:53:44 -07:00
Anton Nikolaev
90d40ac385 More actionable notification message in case of www cert exchange failed
Summary: Improved message a bit to make it clear that VPN/Lighthouse is required on both sides - computer and mobile device. Also it will now show login link in case user is not signed in yet, because login is also required for www cert exchange.

Reviewed By: passy

Differential Revision: D28899558

fbshipit-source-id: 89de776f602a9f27a2c068efd8e3f08c28ec5f57
2021-06-07 05:53:43 -07:00
Pascal Hartig
edbb41b49b Upgrade prettier
Summary: ohsopretty

Reviewed By: fabiomassimo

Differential Revision: D28930276

fbshipit-source-id: faaca8cc53c2fe42a8e010d5c1b1d79e89190858
2021-06-07 04:59:17 -07:00
Anton Nikolaev
cc4bc293c6 More actionable notification on plugin download failure
Summary: More actionable notification on plugin download failure.

Reviewed By: priteshrnandgaonkar

Differential Revision: D28856728

fbshipit-source-id: bd4a41af8812168949d83e2e0923ca7976485fa7
2021-06-03 08:36:23 -07:00
Anton Nikolaev
fa74502a8a Show disconnected status in plugin list
Summary: Connectivity indicator on plugin panel.

Reviewed By: passy

Differential Revision: D28843182

fbshipit-source-id: 49130e6b40c1bfcc4449b8a98b092d44dbda78bf
2021-06-03 06:37:29 -07:00
Anton Nikolaev
b7d7326bae Differentiate connectivity and auth related errors
Summary: Cleaning up login session and connectivity handling.

Reviewed By: passy

Differential Revision: D28795342

fbshipit-source-id: ddc659d681f730c7183f364d8924e5c680f8a418
2021-06-02 11:30:37 -07:00
Anton Nikolaev
fff489091e Paste oauth token using deeplink
Reviewed By: passy

Differential Revision: D28790868

fbshipit-source-id: 6a22809444462af15915fa4f06e76e64ebb7f590
2021-06-02 11:30:37 -07:00
Anton Nikolaev
cf14f0808f SignInSheet refactored to use hooks
Reviewed By: passy

Differential Revision: D28788914

fbshipit-source-id: 5b000bff57d0fec7b8fafa4f5efd1c3e15caa766
2021-06-02 11:30:37 -07:00
Anton Nikolaev
bb0271a1a0 Persisted logged out state
Reviewed By: passy

Differential Revision: D28788916

fbshipit-source-id: 88ca6a069d4915e71cd7c271b6bbbea37838f4f5
2021-06-02 11:30:36 -07:00
Anton Nikolaev
48b0eb8f18 Show login dialog on Flipper startup if user is not logged
Reviewed By: passy

Differential Revision: D28780529

fbshipit-source-id: 7f4c38d8461619fe5995654e23dc5739fc852ccc
2021-06-02 11:30:36 -07:00
Anton Nikolaev
c1f161045c Move sign-in sheet under fb folder
Summary: SignInSheet and "dispatcher/user" are not used in public build, so it doesn't make sense to keep them on github.

Reviewed By: passy

Differential Revision: D28789384

fbshipit-source-id: aa1ab0fc70f2211260017be42762714b753ea877
2021-06-02 11:30:36 -07:00
Anton Nikolaev
eb788aaf43 Added "Zoom in", "Zoom out" and "Actual size" commands similarly to Google Chrome
Summary: Changelog: allow zooming Flipper window content in and out either using View menu or hotkeys (Cmd+Plus) and (Cmd+Minus)

Reviewed By: passy

Differential Revision: D28748567

fbshipit-source-id: a214c708cae2c82d04eb53fc879518a0106517de
2021-05-27 08:50:27 -07:00
Michel Weststrate
d9c986fcf8 Fix test flakiness by using jest timers
Summary: Some tests were occasionally flaky, by emulating delays, time variation should no longer influence tests.

Reviewed By: passy

Differential Revision: D28572946

fbshipit-source-id: f4134a6509a0ec0be2e8f36e5623c4882b5531b8
2021-05-25 02:22:21 -07:00
Pascal Hartig
bf32eca8fc Remove console.error for login
Summary:
This is in fact correctly handled, shown in the UI and we don't
need a task if someone pastes the wrong token.

Reviewed By: priteshrnandgaonkar

Differential Revision: D28569896

fbshipit-source-id: 689bff06b4a488be7ad4c58eb4f2e91018da31cf
2021-05-20 08:55:55 -07:00
Anton Nikolaev
fe7bb7cedd Fix null reference on isError check
Summary: Fixed new error which appeared in logview after last release. See task T91245438 for details.

Reviewed By: passy

Differential Revision: D28569848

fbshipit-source-id: a4b622d4387aa41ecc4db269e05c5315669df250
2021-05-20 07:13:35 -07:00
Anton Nikolaev
25ae4a0535 Include information about selected device, app and plugin into analytics events and error reports
Summary:
This diff generalises computation of the currently selected plugin, app, device etc. and adds this information to all the analytics events and error reports.

Slicing of events by os, device, app or selected plugin can be very useful. This is especially true for errors which often affects only certain types of devices, e.g. android only or physical devices only. Having such information can help to narrow down such issues.

Reviewed By: passy

Differential Revision: D28511441

fbshipit-source-id: ed9dc57927c70ed8cc6fe093e21604eae54c2f60
2021-05-19 05:17:41 -07:00
Pascal Hartig
3b6b684f10 Demote user errors
Summary:
One is keytar, which just needed a context.

The second one is happening every time someone uses Flipper
and not being on Lighthouse, spamming our log category besides
actually being properly handled.

Reviewed By: nikoant

Differential Revision: D28479791

fbshipit-source-id: 029721df46d12b2942b590a232618ef039a2323d
2021-05-18 08:34:19 -07:00
Anton Nikolaev
853ee24c9b Add info about interactions to error reports
Summary: When reporting errors we could add info about interactions which caused errors. Ability to connect errors and interactions could be quite helpful for analysing and debugging errors and where they are coming from.

Reviewed By: passy, mweststrate

Differential Revision: D28467575

fbshipit-source-id: bef69917a4d6c786d762a2f6eb75a47fd4e46b0f
2021-05-18 08:08:30 -07:00
Anton Nikolaev
03a1add092 Fix extracting errors from console.error data
Summary: Flipper logs all errors reported by "console.error", but I found that stack traces are broken for them. It is because a bug in `extractError` function which extracts errors from the data logged to console. It fails to extract original error stack trace and instead always logs stack trace where "console.error" was called.  This diff fixes the issue, so errors are properly reported with their original stack traces. However, sometimes stack trace of console.error call can also be useful to find where the error was actually catched and logged, so we're now writing this stack trace into addition field "log_stack_trace".

Reviewed By: passy

Differential Revision: D28466569

fbshipit-source-id: 55fb8ab52c05e8196efc1e47aec95cc1fbc0e594
2021-05-18 08:08:30 -07:00
Anton Nikolaev
8bbf9c46a3 Keep promise rejections unhandled after catching them for logging
Summary: Tracked component catches rejected promises under it to log them. After catching promises become "handled". This might hide potential promise error handling mistakes, so it's better to ensure we keep promises unhandled after catching them for tracking, so they are properly catched by the unhandled promise handler after that. The easiest solution seems to just make new rejected promise and return it instead of the catched one.

Reviewed By: passy

Differential Revision: D28466570

fbshipit-source-id: 26c1e7af3d6e4f7067b95f20e646462d808bb497
2021-05-18 08:08:30 -07:00
Anton Nikolaev
a4eb2a56d6 Option for "yarn start" and "yarn build" scripts to pre-install default plugin packages instead of bundling them
Summary:
Sorry for long diff! I can try to split it if necessary, but many changes here are 1-1 replacements / renames.

**Preambule**
Currently we bundle default plugins into the Flipper main bundle. This helps us to reduce bundle size, because of plugin dependencies re-use. E.g. if multiple plugins use "lodash" when they are bundled together, only one copy of "lodash" added. When they are bundled separately, the same dependency might be added to each of them. However as we're not going to include most of plugins into Flipper distributive anymore and going to rely on Marketplace instead, this bundling doesn't provide significant size benefits anymore. In addition to that, bundling makes it impossible to differentiate whether thrown errors are originated from Flipper core or one of its plugins.

Why don't we remove plugin bundling at all? Because for "dev mode" it actually quite useful. It makes dev build start much faster and also enables using of Fast Refresh for plugin development (fast refresh won't work for plugins loaded from disk).

**Changes**
This diff introduces new option "no-bundled-plugins" for "yarn start" and "yarn build" commands. For now, by default, we will continue bundling default plugins into the Flipper main bundle, but if this option provided then we will build each default plugin separately and include their packages into the Flipper distributive as "pre-installed" to be able to load them from disk even without access to Marketplace.

For "yarn start", we're adding symlinks to plugin folders in "static/defaultPlugins" and then they are loaded by Flipper. For "yarn build" we are dereferencing these symlinks to include physical files of plugins into folder "defaultPlugins" of the produced distributive. Folder "defaultPlugins" is excluded from asar, because loading of plugins from asar archive might introduce some unexpected issues depending on their implementation.

Reviewed By: mweststrate

Differential Revision: D28431838

fbshipit-source-id: f7757e9f5ba9183ed918d70252de3ce0e823177d
2021-05-18 08:08:30 -07:00
Pascal Hartig
6e206fc054 Fix icon fetching
Reviewed By: nikoant

Differential Revision: D28505372

fbshipit-source-id: e0b001ae56cd9014bd830630ae354ad4d76c2588
2021-05-18 03:45:31 -07:00
dependabot[bot]
0de4f11e15 Bump react-markdown from 5.0.3 to 6.0.2 in /desktop (#2298)
Summary:
Bumps [react-markdown](https://github.com/remarkjs/react-markdown) from 5.0.3 to 6.0.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/remarkjs/react-markdown/releases">react-markdown's releases</a>.</em></p>
<blockquote>
<h2>6.0.0</h2>
<p>Please see <a href="https://github.com/remarkjs/react-markdown/blob/main/changelog.md#600---2021-04-15"><code>changelog.md</code></a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/remarkjs/react-markdown/blob/main/changelog.md">react-markdown's changelog</a>.</em></p>
<blockquote>
<h2>6.0.2 - 2021-05-06</h2>
<ul>
<li><a href="https://github.com/remarkjs/react-markdown/commit/cefc02d"><code>cefc02d</code></a>
Add string type for <code>className</code>s</li>
<li><a href="https://github.com/remarkjs/react-markdown/commit/6355e45"><code>6355e45</code></a>
Fix to pass <code>vfile</code> to plugins</li>
<li><a href="https://github.com/remarkjs/react-markdown/commit/5cf6e1b"><code>5cf6e1b</code></a>
Fix to add warning when non-strings are given as <code>children</code></li>
</ul>
<h2>6.0.1 - 2021-04-23</h2>
<ul>
<li><a href="https://github.com/remarkjs/react-markdown/commit/2e956be"><code>2e956be</code></a>
Fix whitespace in table elements</li>
<li><a href="https://github.com/remarkjs/react-markdown/commit/d36048a"><code>d36048a</code></a>
Add architecture section to readme</li>
</ul>
<h2>6.0.0 - 2021-04-15</h2>
<p>Welcome to version 6.
This a major release and therefore contains breaking changes.</p>
<h3>Change <code>renderers</code> to <code>components</code></h3>
<p><code>react-markdown</code> used to let you define components for <em>markdown</em> constructs
(<code>link</code>, <code>delete</code>, <code>break</code>, etc).
This proved complex as users didn’t know about those names or markdown
peculiarities (such as that there are fully formed links <em>and</em> link references).</p>
<p>See [<strong><a href="https://github-redirect.dependabot.com/remarkjs/react-markdown/issues/549">GH-549</a></strong>](<a href="https://github-redirect.dependabot.com/remarkjs/react-markdown/issues/549">remarkjs/react-markdown#549</a>) for more
on why this changed.
See <a href="https://github.com/remarkjs/react-markdown#appendix-b-components"><strong>Appendix B: Components</strong> in
<code>readme.md</code></a>
for more on components.</p>

<p>Before (<strong>broken</strong>):</p>
<pre lang="jsx"><code>&lt;Markdown
  renderers={{
    // Use a fancy hr
    thematicBreak: ({node, ...props}) =&gt; &lt;MyFancyRule {...props} /&gt;
  }}
&gt;{`***`}&lt;/Markdown&gt;
</code></pre>
<p>Now (<strong>fixed</strong>):</p>

</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="8ed18dafa8"><code>8ed18da</code></a> 6.0.2</li>
<li><a href="cefc02d749"><code>cefc02d</code></a> Add string type for <code>className</code>s</li>
<li><a href="6355e45179"><code>6355e45</code></a> Fix to pass <code>vfile</code> to plugins</li>
<li><a href="5cf6e1b18f"><code>5cf6e1b</code></a> Fix to add warning when non-strings are given as <code>children</code></li>
<li><a href="592599fda4"><code>592599f</code></a> Update dev-dependencies</li>
<li><a href="15b4757082"><code>15b4757</code></a> 6.0.1</li>
<li><a href="4f5e62aa13"><code>4f5e62a</code></a> Fix unneeded <code>ts-ignore</code></li>
<li><a href="2e956be119"><code>2e956be</code></a> Fix whitespace in table elements</li>
<li><a href="d36048a6cb"><code>d36048a</code></a> Add architecture section to readme</li>
<li><a href="a2b611babc"><code>a2b611b</code></a> Update <code>react-syntax-highlighter</code> example</li>
<li>Additional commits viewable in <a href="https://github.com/remarkjs/react-markdown/compare/5.0.3...6.0.2">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=react-markdown&package-manager=npm_and_yarn&previous-version=5.0.3&new-version=6.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/2298

Reviewed By: mweststrate

Differential Revision: D28323791

Pulled By: cekkaewnumchai

fbshipit-source-id: c5582e7cd357eb5f3c93c7c3d2df81bb2818e105
2021-05-12 15:10:48 -07:00
Michel Weststrate
96cbc81e63 Fix connection and DOM management of React DevTools
Summary:
This diff fixes several existing issues in the React DevTools:

Every time the user opened the plugin we re-instantiated the devtools, which has a few problems: 1) it looses all state (e.g. selection), and 2) this causes the tools to start a websocket listener on a new port, that was never cleaned up, or ever used, since React Native always connects to port 8097 anyway.

To preserve the state the idea of the original implementation was to move the devTools out of the current view, without disposing it. This actually didn't work in practice due to a faulty implementation, causing a full reinialization of the tools every time. Addressed this by reusing the mechanism that is used by the Hermes debugger tools as well.

By properly managing the port (e.g. closing it), there is no need to start (in vain) the devTools on a random port.

Port reversal for physical devices needs to happen only once, in principle upon connecting the device, so moved it to the device logic, which also avoids the need to hack into the global Flipper store.

Avoiding recreating the devTools makes plugin switching near instant, instead of needing to wait for a few seconds until the devTools connect.

When multiple apps are connected the behavior is now consistent: the application that refreshed last will be the one visible in the devTools. (That is still pretty suboptimal, but at least predicable and not a use case that is requested / supported in the DevTools themselves atm)

There is still ugly DOM business going on, did put that in a stand alone component for now.
Didn't extract the shared logic with Hermes plugin yet, but did verify both are still working correctly.

Changelog: [React DevTools] Several improvements that should improve the overal experience, the plugin should load much quicker and behave more predictably.

Reviewed By: bvaughn

Differential Revision: D28382587

fbshipit-source-id: 0f2787b24fa2afdf5014dbf1d79240606405199a
2021-05-12 14:21:53 -07:00
Michel Weststrate
4062950fbe Convert React DevTools to Sandy
Summary:
Converted ReactDevTools to Sandy, no real semantic changes. Will add those in next diffs.

Made some minor flow optimizations.

The port forwarding setup interacted directly with the Flipper store, so made an escape hatch for that. Will clean that up again in next diffs.

Reviewed By: passy

Differential Revision: D28380055

fbshipit-source-id: 053979fd10bf3b62089a4f1e27b0e02b4b05e2e1
2021-05-12 14:21:53 -07:00
Anton Nikolaev
e7670e4e42 Fix retrieving versions for release builds
Summary: Fixed release build version retrieval

Reviewed By: passy, cekkaewnumchai

Differential Revision: D28378502

fbshipit-source-id: 345e7fac327a072a5c84cfa92bf4af78b6829654
2021-05-12 07:49:14 -07:00
Anton Nikolaev
a8ca142c9a Load only compatible plugins on startup
Summary: We currently filtering out incompatible versions from marketplace. This diff also add filtering for incompatible installed plugins on Flipper startup to ensure we always load the latest compatible version.

Reviewed By: passy

Differential Revision: D28341891

fbshipit-source-id: 83afc14a3c07e1763e1bd146251e6d3b71a66248
2021-05-12 07:49:13 -07:00
Anton Nikolaev
252322f525 Fix a bug with duplicated device plugins in "Detected in App" list
Summary: When crash reporter plugin is not installed in Flipper, it can appear duplicated in "Detected in App" list. This diff fixes that.

Reviewed By: passy

Differential Revision: D28325072

fbshipit-source-id: 92011f1f10c6633fbd31ea886fe53f352057f4f8
2021-05-12 07:49:13 -07:00
Anton Nikolaev
00851c6b5d Fix bug with plugin re-installation after uninstallation
Summary:
Fixed a bug when plugin installation status wouldn't be saved between sessions when plugin uninstalled and then re-installed again. Before the fix, after Flipper restart, such plugin was uninstalled again because its package name was not removed from "uninstalledPlugins" state. This was because plugin id was used by mistake instead of name in few places.

To try avoiding this issue in future I've also renamed "uninstalledPlugins" to "uninstalledPluginNames" to make it more clear than package name should be used there rather than ID. As this field is persisted, I also added migration which moves data to the renamed field.

Reviewed By: passy

Differential Revision: D28314447

fbshipit-source-id: fbe3edc258b78fe7fbb0d966f93aabcdf3b66d4b
2021-05-12 07:49:13 -07:00
Anton Nikolaev
0dce247741 Fix bug with unnecessary plugin auto-update attempts
Summary: I've noticed that Flipper is trying to schedule auto-update for some plugins on every startup even though they are already updated. I found this happens because of a race condition when the auto-updater can be triggered before plugins initialised. This diff fixes that.

Reviewed By: passy

Differential Revision: D28312086

fbshipit-source-id: 66b0bd2aa9dfede1737d565b1e7e7845c940405e
2021-05-12 07:49:13 -07:00
Anton Nikolaev
28fd8da615 Install only compatible plugins
Summary: Currently, when user installs a new plugin which was not installed before that, Flipper always takes the latest available version of it. This is not correct, because the latest version might be incompatible with the currently running version of Flipper. To avoid that, instead of always using just the latest version we will be using the most recent version which is compatible with the current Flipper version.

Reviewed By: passy

Differential Revision: D28306505

fbshipit-source-id: 4258a456d6a5d92cbf48af55c0efb17ecf560b57
2021-05-12 07:49:13 -07:00
Anton Nikolaev
2b41fba704 Change Flipper version retrieving
Summary:
Changed retrieving of Flipper version. Now it will be always retrieved from package.json. Before this change we used "remote.app.getVersion()" API which instead returned electron version for dev builds, e.g. "11.2.3". This is not convenient, because we now use Flipper version to check plugin compatibility and unrelated Electron version here makes things more complicated. After this change, if version is not properly bumped then "0.0.0" will be used: 1) when running using "yarn start", 2) when local building with "yarn build --mac" without setting new version, 3) when running tests "yarn test".

In addition to that I added a new command-line argument and env var which allow overriding version number for Flipper. This is useful for testing plugin updates, because compatibility between plugins and Flipper is checked by comparing Flipper version with the min version set in the plugin metadata.

Reviewed By: passy

Differential Revision: D28287354

fbshipit-source-id: 2f9482080e3612b95a24300050d98150c6db6cb7
2021-05-12 07:49:13 -07:00
Anton Nikolaev
21ce694fd5 Retrieve multiple plugin versions from marketplace
Summary: Retrieve multiple plugin versions so we later can choose a version which is compatible with the current version of Flipper (e.g. if user is on old version of Flipper).

Reviewed By: passy

Differential Revision: D28284121

fbshipit-source-id: 3ed9cffb3e9702fc65d19b73fc8cc162b776b7c9
2021-05-12 07:49:13 -07:00