Commit Graph

1482 Commits

Author SHA1 Message Date
Lucas Bento
d1fb8bed4a Add React Native/Metro hotkeys (#822)
Summary:
This PR fixes https://github.com/facebook/flipper/issues/798 by adding customizable hotkeys to reload and/or open developer menu in React Native apps.

![Screenshot of the Preferences window with hotkeys](https://user-images.githubusercontent.com/6207220/75113976-b27c0280-5652-11ea-8d5d-020d2650425b.png)

#### TODO:

- [x] Add correct icon for removing content of the hotkey input (currently using `undo`) - cc passy 😄

## Changelog

Add customizable hotkeys to reload and/or open developer menu in React Native apps.
Pull Request resolved: https://github.com/facebook/flipper/pull/822

Test Plan:
- Run React Native on version `0.62.0-rc.2` (you can use this app: https://github.com/lucasbento/RNWithFlipper);
- Open the Preferences window (`⌘,`);
- Customise the React Native hotkeys to whatever you want;
- Test them out with Flipper's window active and inactive.

> **Note**: this has been tested only in macOS.

Reviewed By: jknoxville

Differential Revision: D20061833

Pulled By: passy

fbshipit-source-id: 601d29e07d7de2683d2c70c7c87f0d841aa3559e
2020-03-03 09:22:03 -08:00
Timur Valiev
2d9d0314b9 add a context menu to copy URI
Summary: It's handy to copy images URI to paste it in other tools

Reviewed By: mweststrate

Differential Revision: D20221861

fbshipit-source-id: 09074b434d5c1277bb83daa7846b885717c5ee8d
2020-03-03 08:57:05 -08:00
Pascal Hartig
4c9b1dfd1a Make SeetingsSheet test deterministic
Summary:
The platform check is a side-effect and shouldn't be in the UI component
itself.

Reviewed By: mweststrate

Differential Revision: D20159799

fbshipit-source-id: c5fa99e0b915a140f10056283671cf5b7368e9c9
2020-03-02 04:09:26 -08:00
Anton Nikolaev
58225fe113 Yarn start is hanging
Summary: Fixed hanging on "yarn start"

Reviewed By: passy, cekkaewnumchai

Differential Revision: D20158451

fbshipit-source-id: 0aa834e33ce622cc264005d0648546608f208d07
2020-02-28 04:09:11 -08:00
Pritesh Nandgaonkar
74e1376089 Fix the edge case to export and import broken export
Summary:
This diff fixes the broken export which is being made [here](https://fb.workplace.com/groups/graphqlandroid/permalink/3319822971399628/). In the import there is no client and plugin states. The fact that the validation succeeded on submit button click suggests that the app got disconnected between the click on submit button and the initiation of export, thus exporting the store with no plugin data and client.

I have added a validation after exporting the store and before the trace is uploaded.

Also in the support request details page, we assumed that client can't be null,  relaxed this assumption as the flipper should still open even the above broken export instead of crashing.

Reviewed By: mweststrate

Differential Revision: D20136295

fbshipit-source-id: f589d01f8ff0ec0b23d53ad5099e11ebbd0930cd
2020-02-28 00:04:35 -08:00
Anton Nikolaev
2bd61bca87 Typescriptify the main process code (13/N)
Summary: Converted src/utils/icons.js to typescript

Reviewed By: passy

Differential Revision: D20076060

fbshipit-source-id: fa6309033f5de7183de7f85ac8318eec36b6bb69
2020-02-27 05:45:24 -08:00
Anton Nikolaev
caf04e4e4a Typescriptify the main process code (9/N)
Summary: Converted scripts/build-release.js and scripts/build-headless.js to typescript

Reviewed By: passy

Differential Revision: D20066504

fbshipit-source-id: 25f336062361e1211b581f96979978a6bf4fe6d4
2020-02-27 05:45:23 -08:00
Moti Zilberman
1e00966a4a Correctly capitalise "React DevTools"
Summary: TSIA

Reviewed By: rickhanlonii, jknoxville

Differential Revision: D20069072

fbshipit-source-id: 56ca37c8354b2dcbe2756bfe0f48f139ea44e32d
2020-02-26 00:24:14 -08:00
Michel Weststrate
7c2fd4d5e5 Track memory usage
Summary: ^

Reviewed By: passy

Differential Revision: D20035089

fbshipit-source-id: 5df97847e442c626af8445e0909ea5e07311cc7e
2020-02-25 14:59:49 -08:00
Michel Weststrate
74004b6338 Improve unit test robustness
Summary: When running tests locally, some are quite flaky, and there is a lot of error logging noise. This diff doesn't remove all of it, but does reduce it significantly.

Reviewed By: nikoant

Differential Revision: D20034619

fbshipit-source-id: 183f74475b644f803b2f92b1b1301f4d0f6e193a
2020-02-25 14:59:48 -08:00
Pritesh Nandgaonkar
abb2dc72ee Fix the broken notification click
Summary:
This diff fixes the broken deeplink to the notifications hub when one clicks on the macos native notification. See the bug reported [here](https://fb.workplace.com/groups/220760072184928/permalink/532998544294411/)

This [post](https://fb.workplace.com/groups/220760072184928/permalink/532998544294411/) reports the bug.

Reviewed By: passy

Differential Revision: D20089749

fbshipit-source-id: 8061ae07c450fd674795af4c5be53ce77402c063
2020-02-25 08:09:59 -08:00
John Knox
b3a6bf3dba Use named args for ArchivedDevice constructor
Summary: The constructor is getting quite a few args now, so to avoid string, string mistakes I'm making sure you pass objects with named params.

Reviewed By: passy, mweststrate

Differential Revision: D20034012

fbshipit-source-id: 4e0d23eeaa9100c6c19d3e36fee62649659ad261
2020-02-24 19:43:22 -08:00
John Knox
20db85adf4 Add archived device visualizer
Summary:
Adds a visual indicator of layout nodes when using an archived device.

The "device" window isn't movable for some reason. I've tried the movable and draggable attributes but with no luck. It would obviously be good to fix that but I think its probably shippable as is, and I don't have any more ideas about how to do it.

Reviewed By: passy

Differential Revision: D19885719

fbshipit-source-id: 186ba38c85afee18ce111e30187bdccd9b919025
2020-02-21 07:19:13 -08:00
John Knox
c2dfa6ca6b Kill orphaned instruments processes (#819)
Summary:
Fix https://github.com/facebook/flipper/issues/808
Kills any orphaned Instruments processes belonging to the user.

In some cases, we've seen interactions between Instruments and the iOS
simulator that cause hung instruments and DTServiceHub processes. If
enough instances pile up, the host machine eventually becomes
unresponsive. Until the underlying issue is resolved, manually kill any
orphaned instances (where the parent process has died and PPID is 1)
before launching another instruments run.

Taking the same approach as done by flutter here.

Reviewed By: passy

Differential Revision: D20030005

Pulled By: jknoxville

fbshipit-source-id: aa80be78c80f7797e88bf29b15f90d4aad0c66e4
2020-02-21 06:53:44 -08:00
Michel Weststrate
4aec81b059 Fix issue where messages where not queued for non-selected apps
Summary: When determing whether to queue a message, the logic checked if the plugin is enabled on the currently selected app, rather than checking if it is enabled for the receiving app. This diff fixes that.

Reviewed By: passy

Differential Revision: D20000055

fbshipit-source-id: 665f0a650dcee8f7f46aa56f399a4f7d0d0aa1e0
2020-02-21 04:46:23 -08:00
Anton Nikolaev
e1e8bb841c Cannot scroll with crash report
Summary: Fixed scroll for crash reported plugin

Reviewed By: mweststrate

Differential Revision: D19975593

fbshipit-source-id: 756c017e8a6e5e5e1309be5787bc88dd2ac97bca
2020-02-21 03:51:19 -08:00
Michel Weststrate
64b06ba6f6 Fixed some issues with too many devices showing up in the sidebar
Summary:
Device management was inconsistent so far, this diff addresses the following issues

* pending a subtle timing issue, a physical android device might also show up as emulator, so effectively the device would be shown twice, but with the same content
* Metro devices now behave more like the android devices: offline devices are replaced if it comes online again
* Generalized this logic; the reducer now forces serials to be unique
* Fixed issue where a Metro device that disconnected due to a connection failure would be archived twice
* Use the metro connection url as serial, to have a slightly more future proof serial

Reviewed By: jknoxville

Differential Revision: D19996385

fbshipit-source-id: 0f6e3ddc6444542553d25cc3b592591652d688f2
2020-02-20 12:56:24 -08:00
Michel Weststrate
ea1c21c8c3 Fix key warnings
Summary: Fixed a bunch of key errors in the network plugin, when a plugin is selected

Reviewed By: passy

Differential Revision: D19980275

fbshipit-source-id: 0ae61ed3b655c03d11c848d3502f455a409dcdcf
2020-02-20 04:39:35 -08:00
Michel Weststrate
2dad8809c4 Fix performance issues [1/N]
Summary:
This issue fixes a bunch of performance issues:

* The introduction of a context menu around every _row_ in D18808544 breaks the internal contract between lists and rows that react-window has, causing empty element to appear during scrolling, and some optimizations not working. Fixed by wrapping the context menu at the right level
* Every time a new row is created for the listview, it gets fresh event handlers and column configurations. THis has been fixed by precomputing the column configuration and avoiding the need to close over the row data in the event handlers
* Added some stricter immutable typings to make sure we don't break the immutable contract somewhere
* Fix the introduction of on the fly styling generation, which isn't needed

Reviewed By: passy

Differential Revision: D19853595

fbshipit-source-id: dc82b6586889f4e8c7a437cfdc27a50dc33ba2a2
2020-02-20 04:39:35 -08:00
Michel Weststrate
a05b8d1ba2 Prevent extensive logging of failed network requests
Summary:
If the browser makes a network request, and it fails, this is _always_ logged to the console, despite any error handling being in place. (see https://stackoverflow.com/questions/43012334/silence-neterr-connection-refused)

This diffs doesn't use the browser network stack, but the node network stack instead, which doesn't suffer from the same fate.

Reviewed By: passy

Differential Revision: D19995684

fbshipit-source-id: 4ffc12b820620c5310c140c1a3af63e5d2053a50
2020-02-20 04:33:02 -08:00
Michel Weststrate
97f9b2494d Fix tooltips causing entire app to rerender
Summary:
Hovering a tooltip container would cause the full application to re-render. (Even if there isn't an actual tooltip!).

Fixed it by killing legacy context code, and using proper fragments rather than returning arrays.

Reviewed By: priteshrnandgaonkar

Differential Revision: D19969775

fbshipit-source-id: 59f6470d03b6c476305681fde7bbe3f0dca063aa
2020-02-19 22:17:24 -08:00
Michel Weststrate
07e5d7faf7 Don't subscribe to entire store. Don't cause rerender on every store change
Reviewed By: passy

Differential Revision: D19968715

fbshipit-source-id: 74e5ca9d2f68c6fa4e04771e7ad7ba1fecb207f3
2020-02-19 22:17:24 -08:00
Michel Weststrate
15cde55981 Convert Hermesdebugger to device plugin
Summary:
This diff exposes the Hermes debugger as a device plugin, for similar reasons as we did with React Devtools.

Also replaced an ugly hack with another just as ugly hack (rendering outside the React tree to preserve the state of the chrome devtools when switching to another plugin and coming back), that behaves at least correctly when resizing etc instead of doing absolute styling

Reviewed By: passy

Differential Revision: D19905082

fbshipit-source-id: 1e80c55fc9c5b1f8a9292f0ba1ef66b0b007b7fc
2020-02-17 03:41:14 -08:00
Michel Weststrate
1383260a7c Expose React Devtools as a Metro plugin
Summary:
This diff turns the DevTools plugin from a normal plugin in a device plugin. The reason for that can be seen at the end of the test plan in the first stack of this diff: Regardless on which client you open the devtools, you are always looking at the react tree of the app that happens to listen at the appropriate port, unrelated to the actively selected app. This diff moves the plugin from being a client plugin to a device plugin, a Metro device plugin to be precisely, as of the latter there is only one and they should typically correspond (which is why we can trigger reload as done in the previous diff)

Currently we have a Flipper plugin inside the iOS / Android apps with one purpose: to select different ports to listen to on different devices. But this functionality was never implemented, nor seems there to be much demand for. So these plugin don't offer any actual value. The widely used standalone version of the react devtools (https://www.npmjs.com/package/react-devtools) doesn't offer port customization either, so this limitation seems to be acceptable.

To make sure that this change is backward compatible, we make sure to show the metro device if we find metro, regardless whether it is new enough to support log forwarding and reload commands (previously we only showed the device if it has the /events endpoint).

The only case I can think of we are killing with this approach is where people are debugging a RN app, but with having metro running. I doubt that is an actual case, but probably rickhanlonii knows more about that.

Furthermore this diff makes sure that the devTools can connect to physical android devices. Also, making it to the end of this explanation means that you have done most of the reviewing for this diff. The actual code diff is shorter.

Reviewed By: passy

Differential Revision: D19878605

fbshipit-source-id: 3f33e59d4f6e4cce39102420f38afee10018999f
2020-02-17 03:41:13 -08:00
Michel Weststrate
56297d0cfc Automatically cause reload to trigger devTools
Summary:
To connect to the React Devtools, the app has to be reload (or the dev menu opened).
This diff does force a reload if the React Devtools don't connect timely

Reviewed By: passy

Differential Revision: D19878172

fbshipit-source-id: 0b3e22f70c9d24dae1fdbf0cc351d23367654ae1
2020-02-17 03:41:13 -08:00
Michel Weststrate
3849807d6b Show status of connection, so that user knows what is happening
Summary: In many cases the React DevTools fail to show up for RN. usually that is because the app didn't enter devMode yet. This diff adds the necessary logic to query the state of the DevTools and communicate back the current connection status

Reviewed By: passy

Differential Revision: D19878127

fbshipit-source-id: f5c3f5a92b23c87c87d778a468122210325eed17
2020-02-17 03:41:13 -08:00
Pritesh Nandgaonkar
14ebfb8439 Make network plugin a required plugin
Summary: Makes network plugin a required plugin for Graphql grps

Reviewed By: jonathoma

Differential Revision: D19905736

fbshipit-source-id: f72fddd5e04ce9b1670715d731dc86a8d4a19cc5
2020-02-15 08:13:48 -08:00
Pritesh Nandgaonkar
467b54a6fb Select both required and default plugins
Summary: This diff selects both required and default plugins in the plugin selection menu

Reviewed By: mweststrate

Differential Revision: D19905737

fbshipit-source-id: 86fb308f8f189350cc035d14174b34fac14a2cd1
2020-02-15 08:13:48 -08:00
John Knox
a24b043df0 Allow websocket connections from browser
Summary: Gets flipper to open up a websocket server for web browser connections.

Reviewed By: passy, priteshrnandgaonkar

Differential Revision: D19501123

fbshipit-source-id: e506f35d7ddce622128932494e8bb10802d3747b
2020-02-13 13:56:37 -08:00
Anton Nikolaev
707759f096 Install pre-bundled packages 2/N
Summary: A first simple version of pre-bundled plugin installation. Currently both pre-bundled and source-only plugins are supported. Pre-bundled plugins should have folder "dist" inside and package.json's "main" field should point to the entry point script there.

Reviewed By: passy

Differential Revision: D19834020

fbshipit-source-id: 7e0b495fb9666acbb22fc32ca2382339cd9dc72f
2020-02-12 04:57:31 -08:00
Anton Nikolaev
71928fdf08 Install pre-bundled packages 1/N
Summary: No functional changes in this diff. This is just plugin manager refactoring before implementing  new functionality for installing pre-bundled packages.

Reviewed By: passy

Differential Revision: D19832078

fbshipit-source-id: 56b7ff1c68b6beb4abb2941da607651268e5f71a
2020-02-11 12:54:06 -08:00
Michel Weststrate
463e8a7984 Show progress bar during metro rebuilds
Summary: Tiny detail, but this shows a progress bar in the reload button, just like the console.logs of metro do normally

Reviewed By: jknoxville

Differential Revision: D19813243

fbshipit-source-id: 70b360d55776fab08c81664c6cabf998402bbba6
2020-02-11 07:29:40 -08:00
Michel Weststrate
6fe69f6fc0 Make sure Metro's own messages are logged as well
Summary: This diff logs the Metro messages as well so that the logs also show it Metro dies or something

Reviewed By: jknoxville

Differential Revision: D19791112

fbshipit-source-id: 477ccdd291df90e49b016d4aeae121d4d81a3835
2020-02-11 07:29:39 -08:00
Michel Weststrate
535ed88bc3 Unwrap device plugins in sidebar in certain scenarios
Summary:
This diff removes the 'device plugins' section, and shows plugin at top level in certain scenarios:

- there are no other clients
- there is only one device plugin
- the device has been imported

This removes visual clutter

Reviewed By: nikoant

Differential Revision: D19789511

fbshipit-source-id: 6a5fce120ac811428662828ee43f7ab7f3331362
2020-02-11 07:29:39 -08:00
Michel Weststrate
3dcfe9f3ae Move Metro control buttons to titlebar
Summary:
The Metro control buttons are now in the titlebar. This has a few benefits:
- the buttons are accessible if you are inspecting other metro plugins
- the buttons are even usuable if you selected an app on the actual device. This should help with reducing the cognitive dissonance of having apps both as 'android' app and metro device
- killed the Metro plugin again :)

Reviewed By: nikoant

Differential Revision: D19789455

fbshipit-source-id: 476fd0af1d3fc7b51a33f1af6d3fc3578aeeefae
2020-02-11 07:29:39 -08:00
Michel Weststrate
182b2a629d Fixed bug where location bar remained active but empty on apps / devices that don't have nav
Summary: Fixed bug where location bar remained active but empty on apps / devices that don't have nav

Reviewed By: nikoant

Differential Revision: D19788337

fbshipit-source-id: c5f7299945783672164ed03d487a023ddaadc082
2020-02-11 07:29:38 -08:00
Michel Weststrate
dfcfca4370 Support logging in metro plugin
Summary: Show metro logs using the standard logs plugin

Reviewed By: passy

Differential Revision: D19697439

fbshipit-source-id: 032a9a6aa2d987945d2058e0ea494d74e5aa310e
2020-02-11 07:29:38 -08:00
Michel Weststrate
437ec11ca7 Introduce Metro device and plugin
Summary: Introduced Metro device and the possibility to directly connect to running Metro instances

Reviewed By: jknoxville

Differential Revision: D19445623

fbshipit-source-id: 31978d966a56007c48f795076d6651e23de0e38d
2020-02-11 07:29:38 -08:00
Jonathan Thomas
014524ec26 Introduce way to clear SearchableTable search term on mount
Summary:
In order to link to this plugin multiple times, we want to be able to clear the existing search term on entry.

This change adds a check to the `componentDidMount` section of `Searchable` to see if we want to update the existing search term from the saved state, or use the one inherited from props.

We call it from the Network tab depending on if an explicit default search term has been set, so normal navigation to and from the plugin still preserves the default behavior -- only when we enter from a `selectPlugin` call does this overwrite the existing term.

Reviewed By: mweststrate

Differential Revision: D19794860

fbshipit-source-id: 4a2b1221acc0732ffc321a16a5eee8348da019f5
2020-02-11 07:22:18 -08:00
Pritesh Nandgaonkar
c8548e8063 Always allow user to select group
Summary: This diff always allows user to select the group irrespective of the validation error. We will show the validation error at the bottom before letting them submit.

Reviewed By: passy

Differential Revision: D19816805

fbshipit-source-id: ff576a2101a5ed548c56a2f08da8d27457ebf332
2020-02-11 05:48:47 -08:00
John Knox
6712182fd1 Capture screenshot during export
Summary:
^

context: https://fb.workplace.com/groups/flippersupport/permalink/804152663398727/

Reviewed By: passy

Differential Revision: D19747718

fbshipit-source-id: 30a06446ba3d7d103332580ab5baad59bbc2481c
2020-02-10 06:05:17 -08:00
Anton Nikolaev
611870e344 Some plugin dependencies are not installed on plugin installation (#787)
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/787

https://github.com/facebook/flipper/issues/785

Reviewed By: jknoxville

Differential Revision: D19813491

fbshipit-source-id: 3ae99720fc85d5bd46e91779cc8b10c2853e581f
2020-02-10 05:49:30 -08:00
Jonathan Thomas
991b00f163 Expand deepLinkPayload format for Network tab
Summary: In order to select IDs in a different manner, I am introducing functionality to the Network plugin to allow it to accept more than just IDs that it has assigned, and add the ability to select this plugin with a default search term. I hope to use this to allow for selecting rows by request name.

Reviewed By: mweststrate

Differential Revision: D19702494

fbshipit-source-id: 58ea397fa30eb7d80e9640a4c92905de22bb27d4
2020-02-07 15:16:32 -08:00
John Knox
2acf81027e Refactor screenshot capturing
Summary: Adding a utility for capturing screenshots to the configured location without having to worry about where to store it or use buffers etc.

Reviewed By: mweststrate

Differential Revision: D19765926

fbshipit-source-id: d6b51c4ffafab7450e97a60468926d84a25a8c0f
2020-02-07 12:52:52 -08:00
John Knox
652a95b664 Fix plugin to plugin deeplinking
Summary:
Plugin to plugin deeplinking was broken because the state reducer was ignoring the parameter.

This fixes it.

Reviewed By: jonathoma

Differential Revision: D19791230

fbshipit-source-id: 158b3a6278f5e634093c4284018458883e9aa5ca
2020-02-07 09:49:09 -08:00
Pritesh Nandgaonkar
c52ca255bb Remove the gk
Summary: We have already rolled out `support_requests_v2` to 100% of FB employees. Thus removing the unneeded checks for the GK.

Reviewed By: jknoxville

Differential Revision: D19770930

fbshipit-source-id: 06fcf7b6b7c1305ab1b5b3c8df344e2877251e65
2020-02-07 03:44:51 -08:00
Pritesh Nandgaonkar
b9fafb0e61 Remove older support request form
Summary: This diff removes the older support form as we no longer use it.

Reviewed By: jknoxville

Differential Revision: D19769541

fbshipit-source-id: ca2088e721f2895f2c8a1205889b0670477cc2d2
2020-02-07 03:44:50 -08:00
Anton Nikolaev
e42e44c324 Support installation of plugins packaged as vsix
Summary: This is experimental feature to prove that vsix format can be used to publish plugins. Turns out there are almost no differences of vsix in comparison with npm packages.

Reviewed By: jknoxville

Differential Revision: D19770476

fbshipit-source-id: b3c62e7f2a4e8000113b9f1651e8657eb3e0d6fa
2020-02-06 11:14:15 -08:00
Pritesh Nandgaonkar
47b63f9543 Fix the broken video recording feature for iOS
Summary:
This diff fixes the broken video recording feature for iOS.
 There were two bugs, the `stopScreenCapture` was misspelled and one with the codec, ReactPlayer was not able to render with the default codec of hevc

Reviewed By: jknoxville

Differential Revision: D19746904

fbshipit-source-id: f951b016be5f5aec5d4e6bcea4c9c246a62b37a3
2020-02-06 11:14:14 -08:00
Anton Nikolaev
1b6ce47be2 Real restart in dev mode
Summary: To test plugin installation I need to restart Flipper often, however restart in dev mode is not "true" restart - instead it just reloads the window and doesn't load freshly installed plugins. To make my life easier I have implemented more realistic way for restart in dev mode.

Reviewed By: jknoxville

Differential Revision: D19770263

fbshipit-source-id: 8755663746dc265e0826ed79b9782e073132537f
2020-02-06 09:43:27 -08:00