Commit Graph

149 Commits

Author SHA1 Message Date
Michel Weststrate
9d6abd62c6 Always use Sandy wrapper
Summary:
Since the Sandy wrapper is now rolled out to 100%, removing the GK. Further code cleanup in next diffs.

Changelog: Flipper that don't use the new Sandy plugin format yet (see https://fbflipper.com/docs/extending/sandy-migration) will now always be loaded inside a legacy container

Reviewed By: timur-valiev

Differential Revision: D29394736

fbshipit-source-id: f7a7c321c6b6a82470d47e4352d86135c3849b82
2021-06-30 10:42:32 -07:00
Anton Nikolaev
4ad7a70ee3 Differentiate enabled and disabled selected plugins in analytics
Summary: As we now allow selection of disabled plugins we need to track plugin usage a bit smarter. We'll add a new field "pluginEnabled" to the logged messages to indicate whether selected plugin is enabled or not.

Reviewed By: cekkaewnumchai

Differential Revision: D29455248

fbshipit-source-id: 32c79e0961653edc8f4cc89adecc2662b37cbd7b
2021-06-29 13:02:05 -07:00
Anton Nikolaev
ff5d8ba29f Use selectors to compute plugin lists according to the selected device and app
Summary: Use selectors to re-compute and cache plugin lists according to the selected device and app.

Reviewed By: mweststrate

Differential Revision: D29247845

fbshipit-source-id: 4bc669d5d441d605c4090086c4ce59b6d9684a4c
2021-06-29 13:02:05 -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
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
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
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
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
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
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
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
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
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
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
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
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
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
dependabot[bot]
674f71a426 Bump prettier from 2.2.1 to 2.3.0 in /desktop (#2300)
Summary:
Bumps [prettier](https://github.com/prettier/prettier) from 2.2.1 to 2.3.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/prettier/prettier/releases">prettier's releases</a>.</em></p>
<blockquote>
<h2>2.3.0</h2>
<p><a href="https://github.com/prettier/prettier/compare/2.2.1...2.3.0">diff</a></p>
<p>{emoji:1f517} <a href="https://prettier.io/blog/2021/05/09/2.3.0.html">Release Notes</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/prettier/prettier/blob/main/CHANGELOG.md">prettier's changelog</a>.</em></p>
<blockquote>
<h1>2.3.0</h1>
<p><a href="https://github.com/prettier/prettier/compare/2.2.1...2.3.0">diff</a></p>
<p>{emoji:1f517} <a href="https://prettier.io/blog/2021/05/09/2.3.0.html">Release Notes</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="2afc3b9ae6"><code>2afc3b9</code></a> Release 2.3.0</li>
<li><a href="7cfa9aa89b"><code>7cfa9aa</code></a> Fix pre-commit hook setup command (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/10710">#10710</a>)</li>
<li><a href="c8c02b4753"><code>c8c02b4</code></a> Build(deps-dev): Bump concurrently from 6.0.2 to 6.1.0 in /website (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/10834">#10834</a>)</li>
<li><a href="6506e0f50e"><code>6506e0f</code></a> Build(deps-dev): Bump webpack-cli from 4.6.0 to 4.7.0 in /website (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/10836">#10836</a>)</li>
<li><a href="69fae9c291"><code>69fae9c</code></a> Build(deps): Bump flow-parser from 0.150.0 to 0.150.1 (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/10839">#10839</a>)</li>
<li><a href="164a6e2351"><code>164a6e2</code></a> Switch CLI to async (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/10804">#10804</a>)</li>
<li><a href="d3e7e2f634"><code>d3e7e2f</code></a> Build(deps): Bump codecov/codecov-action from v1.4.1 to v1.5.0 (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/10833">#10833</a>)</li>
<li><a href="9e09845da0"><code>9e09845</code></a> Build(deps): Bump <code>@​angular/compiler</code> from 11.2.12 to 11.2.13 (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/10838">#10838</a>)</li>
<li><a href="1bfab3d045"><code>1bfab3d</code></a> Build(deps-dev): Bump eslint from 7.25.0 to 7.26.0 (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/10840">#10840</a>)</li>
<li><a href="387fce4ed8"><code>387fce4</code></a> Minor formatting tweaks (<a href="https://github-redirect.dependabot.com/prettier/prettier/issues/10807">#10807</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/prettier/prettier/compare/2.2.1...2.3.0">compare view</a></li>
</ul>
</details>
<br />

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

Reviewed By: passy

Differential Revision: D28323849

Pulled By: cekkaewnumchai

fbshipit-source-id: 1842877ccc9a9587af7f0d9ff9432c2075c8ee22
2021-05-11 05:51:56 -07:00
Michel Weststrate
c0633652e8 Fix notification handling
Summary:
Changelog: Fixed application crash notifications not opening the crash log

Crashlog notifications were quite blatantly broken:
1. Because I force all GK's to true locally during testing, and the feature gate is negative, I never had any crash reports in the first place. The GK was empty so removed it.
2. The notifications overview would always cause a NPE when the notification came from a device plugin (it assumed a client to be present). This made the button do nothing and the device name not show up near the notification
3. The OS level notifications would link to the notification screen, which was a static screen in the classic UI and would always render to an empty page in Sandy. Removed that screen from the code base. Instead the click the notification will now trigger the notification action.

Reviewed By: passy

Differential Revision: D28119719

fbshipit-source-id: 5b28dd854260fd479d09e3ee6206301cc669ab40
2021-05-04 13:50:31 -07:00
Pascal Hartig
2b6e585fd2 Improve plugin loading error message
Summary:
I was a dummy and ran into this. Tried to make it easier
for the next person to figure out what this means.

Reviewed By: mweststrate

Differential Revision: D28026376

fbshipit-source-id: ad3455938ef30b448b475cb990f86351e76628bf
2021-04-27 04:39:20 -07:00
Anton Nikolaev
e1f6f770cd Collect information about connected device and app as a part of plugin usage analytics
Summary: We received questions several times from plugin authors on how to find usage for particular app/platform and I wanted to add that data on plugin usage dashboard, but right now it's impossible. We're only collecting plugin ID as a part of plugin usage analytics. That means it's impossible to filter some plugin usage (e.g. "Network") by particular platform or mobile app. This diff improves plugin usage analytics to collect enhanced data.

Reviewed By: passy

Differential Revision: D27935801

fbshipit-source-id: c2fc7d8cf84f9a28823ae56a1dda7158e0b12f1f
2021-04-22 16:47:43 -07:00
Pascal Hartig
9e7a455910 Mute port forwarding errors
Summary: Mentioned in the comment, these aren't actionable errors.

Reviewed By: jknoxville

Differential Revision: D27910465

fbshipit-source-id: 6f5e9d9d25edbb02648f3118c074e9f1986e3a86
2021-04-22 07:45:33 -07:00
Anton Nikolaev
eabf0fc340 Fix native window objects leak after refreshes
Summary:
It looks like electron creates new native window object after each window refresh, but we hold previous objects because of listeners attached to them. In dev mode, Electron signalises about that in console log each time when window is focused / blured after refresh:
```
Attempting to call a function in a renderer window that has been closed or released.
Function provided here: init-fast-refresh.bundle?platform=web&dev=true&minify=false:800356:19
```

Reviewed By: passy

Differential Revision: D27619305

fbshipit-source-id: 51d1590903a37dba721fb7a711fdebb9f0034b98
2021-04-07 05:52:27 -07:00
Mykyta Sikriier
c9b6f6c7d9 ANDROID_SDK_ROOT support (#2106)
Summary:
According to Google, ANDROID_HOME is deprecated.
This means, that having only ANDROID_SDK_ROOT as environment variable leading to Android SDK is enough.
Flipper supports only ANDROID_HOME, so I would like to add ANDROID_SDK_ROOT support.
However, there is a set of rules of ANDROID_HOME and ANDROID_SDK_ROOT priority.
Everything is mentioned on a this page: https://developer.android.com/studio/command-line/variables

## Changelog
Added ANDROID_SDK_ROOT environment variable support

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

Test Plan: Probably I would need a help with this

Reviewed By: mweststrate

Differential Revision: D27505024

Pulled By: passy

fbshipit-source-id: 8bdc66a9652c673fd44944d87af1efc9e93d0f1b
2021-04-07 03:19:34 -07:00
Michel Weststrate
7a45941973 Fixed null pointer handling in login / QPL flow
Summary: Found an NPE during testing a prod build that I encountered a few times before, which occurs when the user isn't logged in. Maked types stricter and this probably fixes an old bug where login status icon could be out of sync as well.

Reviewed By: nikoant

Differential Revision: D27589740

fbshipit-source-id: 419aaca77a997e01e8d9b0067e604a8dad019551
2021-04-06 04:37:12 -07:00
Mathis Gardon
f25d189aa5 Support custom metro ports (#2050)
Summary:
Based on issue https://github.com/facebook/flipper/issues/1509 I needed a custom port for the metro server to pass to flipper.

## Changelog

introduce `METRO_SERVER_PORT` env variable to be able to customize default 8081 port on startup.

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

Test Plan:
Tested with a locally built linux desktop app, this seems to work OK pour hermes debugging & RN logging.

React DevTools don't seem to find the running app, maybe there's a mapping to handle there too ?

Reviewed By: jknoxville

Differential Revision: D27339006

Pulled By: passy

fbshipit-source-id: b1700c4fe73f14bf4617e23583b2954012e0a5aa
2021-03-31 03:30:14 -07:00
Michel Weststrate
d5fbe9a5b9 Support physical device logging
Summary:
Changelog: Logs plugin now supports physical iOS devices

As reported in https://github.com/facebook/flipper/issues/262 and linked papercut.

This diff adds support for iOS device logs through idb. Since idb doesn't respect `--json` flag at the moment, we perform the parsing in Flipper itself.

Reviewed By: passy

Differential Revision: D27346262

fbshipit-source-id: 3b314716f48bb9a7fe709370303396a51893359c
2021-03-29 07:00:47 -07:00
Michel Weststrate
740fbe57fd Fix release build issue
Summary:
D24358369 (8a31e984b3) introduced a dependency outside the `sonar/` dir, which probably should not have happened. D27324576 finally broke this, by adding a dep to QPL core, which will never be installed in our CI.

This diff unbreaks that rewriting the require to a locally provided version of crc32, however this is a stop gap, and it would be great if someone would look into a sustainable solution :)

Reviewed By: passy

Differential Revision: D27327272

fbshipit-source-id: 70cdf21c7ecf081ef804d6338ec11e498e3cb7cf
2021-03-25 08:42:08 -07:00
Michel Weststrate
6a30899803 Kill onRegisterDevice
Summary: `onRegisterDevice` device abstraction was only used by the CrashReporterPlugin, and since with Sandy plugin lifecycles every plugin can do 'on-load' logic, we don't need it anymore.

Reviewed By: priteshrnandgaonkar

Differential Revision: D27046711

fbshipit-source-id: 16c567c60ed29a50017d525a2b707ee696a99e62
2021-03-16 15:03:48 -07:00
Michel Weststrate
2ca52f81d2 Introduce pluginKey
Summary: Exposed the `pluginKey` to sandy plugins (which we will use later for storing table preferences per plugin). And a little moving code around because circular deps problem roared its ugly head again.

Reviewed By: nikoant

Differential Revision: D27009721

fbshipit-source-id: 7ad29e72ff8028c9daae270c4749b657bd8ff049
2021-03-16 15:03:47 -07:00
Pritesh Nandgaonkar
a2d559c8c0 Detect Physical iOS device without Xcode
Summary:
This diff adds the support of detecting physical device in Flipper even if the xcode is not installed and there is no cli tool installed.

See the demo.

Reviewed By: timur-valiev

Differential Revision: D26816588

fbshipit-source-id: 5f052998fcbe5c51385222d16df0e1855177b552
2021-03-05 11:36:20 -08:00
Michel Weststrate
163799cf89 Fix exception that happens on focus change
Summary:
Fixing the previous resulted in a next exception, where blur / focus might be triggered directly as side effect of some running logic. I think this happens when entering a debugger statement causing the window to loose focus in favor of the devtools.

Wrapped the logic in setImmediate to make sure that it runs on its own stack, since this will prevent any potential future issues with programmatically focussing / blurring as well.

Reviewed By: jknoxville

Differential Revision: D26814270

fbshipit-source-id: 5ca430653a219d3c98d8bf925277de67d8a9eb20
2021-03-04 06:01:48 -08:00
Michel Weststrate
67e87c2fa5 Fix gray screen crash that might happen when gathering usage stats
Reviewed By: jknoxville

Differential Revision: D26814271

fbshipit-source-id: bd857a42ae6b2528e42c96d0865ae2c532ea345f
2021-03-04 06:01:48 -08:00
Pascal Hartig
390f27a137 Start bridge abstraction
Summary: This is just an early start of centralising some ad-hoc logic we've got all over the place right now. Memoised do-we-have-idb calls with concatenated shell invocations. This gives us the opportunity to do a bit of testing, too.

Reviewed By: mweststrate

Differential Revision: D26694863

fbshipit-source-id: cd2b9883f90397802bbaae6030f7cb3881c565c2
2021-03-02 09:53:19 -08:00
Pascal Hartig
43242557aa Remove listDevices
Summary: Appears to be unused.

Reviewed By: mweststrate

Differential Revision: D26753922

fbshipit-source-id: 7a21b8242e4c8d2428a286bc6ef63adafe74a78c
2021-03-02 09:53:18 -08:00
Michel Weststrate
224ec4d5d6 Fix device cleanup
Summary:
Fixes https://github.com/facebook/flipper/issues/1989

We had some self healing side effect that would destroy devices when registering a new device with the same serial, if they weren't yet. Redux isn't too happy about that, causing the attached crash.

Instead introduced a utility to destroy devices, and log an error if the device life cycle isn't respected by the device implementations, rather than crashing we will now just waste some memory.

Changelog: Fix a crash when disconnecting metro devices

Reviewed By: passy

Differential Revision: D26749214

fbshipit-source-id: 4c185ac521d44c1337fac8a9145440123b8b784c
2021-03-02 03:58:55 -08:00
Michel Weststrate
357d2991d5 automatically select reconnected clients
Summary:
Changelog: Flipper will no automatically select any newly connected client

This reverts D26250896 (2df117923c) to V5, which is to aggressively select new clients. The current behavior was too conservative and caused Flipper to jump to a different client, without returning, after reconnecting a disconnected device.

As reported in https://fb.workplace.com/groups/flippersupport/permalink/1084676302013027/

Reviewed By: fabiomassimo

Differential Revision: D26691046

fbshipit-source-id: b16af2052f58dc1d4254eb1e6ebbb5848c53ed7e
2021-02-26 07:27:54 -08:00
Anton Nikolaev
fa3ff83595 Rename star/unstar actions to enable/disable/switch
Summary:
Renamed actions "star" and "unstar" everywhere to "enable", "disable" and "switch". The logic behind original "star" action changed significantly, so this rename just makes everything much clearer.

Please note that as a part of rename persisted state fields "userStarredPlugins" and "userStarredDevicePlugins" were renamed. I've added a "redux-persist" migration for seamless transition.

Reviewed By: passy

Differential Revision: D26606459

fbshipit-source-id: 83ad475f9b0231194701c40a2cdbda36f02c3d10
2021-02-24 05:30:57 -08:00
Anton Nikolaev
e9bab76614 Auto-enable plugins for new users
Summary:
This is a very simple implementation of "profiles". It allows defining sets of plugins and associate them with GKs. Plugins from sets are automatically installed and enabled when a mobile app connected to Flipper for the first time (e.g. user has not already debugged same app before). Set is only enabled if user is passing the associated GK.
Sets are simply hardcoded for now.

Reviewed By: timur-valiev

Differential Revision: D26605371

fbshipit-source-id: 9bf0600d44381e047361d960558aa004960550c1
2021-02-24 05:30:57 -08:00
Pascal Hartig
c010e22612 Reduce errors from androidDevice
Summary:
None of these are fatal. In fact, they're quite common for people
who've got Android enabled but no tools installed. So they're warnings
at best.

I'd like to find a way to guide people to the settings in this case
or use Doctor to disable Android support instead of retrying this
endlessly.

Reviewed By: mweststrate

Differential Revision: D26547577

fbshipit-source-id: 81e658fe3d95b2d12e76e4b635575f3e5a6fc53b
2021-02-22 03:37:35 -08:00
Anton Nikolaev
c0010bea4c Fix to avoid loading of disabled device plugins
Summary: There is a bug right now that even for disabled plugins we're loading them. In particular, this led to the Flipper freezes caused by Logs plugin even if it is disabled.

Reviewed By: passy

Differential Revision: D26503012

fbshipit-source-id: 2068626f4637ced44c457ee1b7ba7fffdcf5aa47
2021-02-18 04:00:21 -08:00
Pritesh Nandgaonkar
6d2206769c Fix the regex to allow xcode from non standard location (#1939)
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/1939

This diff fixes T84865014. We used to assume in our xcode cli check that xcode will be run from standard /Applications folder. But as mentioned in the above tasks, its not always true.

Reviewed By: passy

Differential Revision: D26484287

fbshipit-source-id: 32d343dece53576f99cbbb6d193138e803505935
2021-02-17 09:45:19 -08:00
Anton Nikolaev
4390ff44ce Device plugin management (7/n): Show warnings for the device plugins defined in the legacy format
Summary: Show warnings for the device plugins defined in the legacy format and suggest to migrate them

Reviewed By: mweststrate

Differential Revision: D26459321

fbshipit-source-id: 4e45cd58a63a4ff9903ecaf12e6f9ba4a43e71e1
2021-02-16 10:50:20 -08:00
Anton Nikolaev
4541cdc23b Device plugin management (2/n): enable/disable, install/uninstall
Summary:
*Stack summary*: this stack adds ability to manage device plugins in the same way as client plugins: install, update, uninstall, enable (star) and disable (unstar) them.

*Diff summary*: implemented all plugin management actions for device plugins.

Changelog: it is now possible to enable/disable and install/uninstall device plugins

Reviewed By: mweststrate

Differential Revision: D26337377

fbshipit-source-id: 7d1ed61a8dc5f3339e5e548c613b67bca0c27f4f
2021-02-16 10:50:18 -08:00
Anton Nikolaev
899fcd0783 Device plugin management (1/n): use static metadata for checking plugin compatibility with devices
Summary:
*Stack summary*: this stack adds ability to manage device plugins in the same way as client plugins: install, update, uninstall, enable (star) and disable (unstar) them.

*Diff summary*: changed the way how plugin compatibility with devices is checked from dynamic call to "supportsDevice" to static checks of "supportedDevices" metadata property which make it possible to check compatibility without even downloading plugin from Marketplace.

Changelog: plugin compatibility with devices is now checked according to metadata in property "supportedDevices" in package.json

Reviewed By: mweststrate

Differential Revision: D26315848

fbshipit-source-id: 6e4b052c4ea0507ee185fc17999b6211cdb11093
2021-02-16 10:50:18 -08:00
Anton Nikolaev
19f2fccc79 Command processing (5/n): Star plugin
Summary:
*Stack summary*: this stack refactors plugin management actions to perform them in a dispatcher rather than in the root reducer (store.tsx) as all of these actions has side effects. To do that, we store requested plugin management actions (install/update/uninstall, star/unstar) in a queue which is then handled by pluginManager dispatcher. This dispatcher then dispatches all required state updates.

*Diff summary*: refactored "star plugin" operation to perform it in pluginManager dispatcher.

Reviewed By: mweststrate

Differential Revision: D26305576

fbshipit-source-id: 90516af4e9ba8504720ddfa587f691f53e71b702
2021-02-16 10:50:18 -08:00