Commit Graph

467 Commits

Author SHA1 Message Date
Juan Tejada
4a93224151 Differentiate Flipper in logging from standalone app
Summary:
This commit makes it so when we load DevTools from within Flipper we log it as a Flipper load and not a regular standalone app load.

Note that the logging only applies internally.

Reviewed By: bvaughn

Differential Revision: D32884616

fbshipit-source-id: 90d0962bac9c1abdde36a70fd361251d7e607b57
2021-12-06 12:41:51 -08:00
Juan Tejada
f9547e024e Allow switching between internal and OSS DevTools (#3139)
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/3139

This commit adds new UI in the top level toolbar to allow internal FB users to switch between the internal build of devtools and the OSS one.

## Scenarios

**Internal (when `client.isFB`)**

- DevTools version will default to the internal version, and will render a `Select` component with option to switch to the OSS version.
- If a global install of DevTools is present, the selection menu will also offer the option to switch to the global DevTools version.

**External (when `!client.isFB`)**
Will preserve previous behavior:

- Uses the OSS version by default, and doesn't provide option to switch to internal version.
- If a global installation is present, will render a `Switch` component that allows switching between OSS and global installation.

### Implementation

This commit refactors some parts of the DevTools plugin to provide a bit more clarity in the loading sequence by renaming and modifying some of the messaging, and fixing lint warnings.

A change introduced here is that when switching or loading devtools, when we attempt to reload the device via Metro, don't immediately show a "Retry" button, since at that point nothing has gone wrong, and the Retry button will only occur if the Metro reload doesn't occur after a few seconds.

In a future commit, this [PR in Devtools](https://github.com/facebook/react/pull/22848) will allow us to clear any loading messages once DevTools has successfully connected.

Reviewed By: lunaruan, mweststrate

Differential Revision: D32773200

fbshipit-source-id: aa15ffecba7b2b2ea74e109e9f16334d47bf5868
2021-12-06 12:41:51 -08:00
Juan Tejada
618670d00a Update Flipper DevTools plugin to use internal build
Summary:
This commit update the React DevTools Flipper plugin to use the internal build of `react-devtools-core/standalone`.

The internal build of `react-devtools-core/standalone` is generated by the new sync script: `js1 upgrade react-devtools-core`, which places the build under  `xplat/sonar/desktop/plugins/public/reactdevtools/fb`.

As a follow up, we can add a dropdown to allow users to select which version of React DevTools they'd like to use.

Reviewed By: mweststrate

Differential Revision: D31904288

fbshipit-source-id: ce0880284bd7f9ccaa6258a7c2956f20771e81a9
2021-12-06 12:41:51 -08:00
Pascal Hartig
77d7ec2efb Guard against screenshot capture failure
Summary:
Bit off an odd one but according to the crash report in T107008330,
the screenshot can sometimes be not a real buffer. This may not actually
fix things but should give us some more insights into what's up.

Changelog: Better handling of screenshot taking in navigation

Reviewed By: mweststrate

Differential Revision: D32797863

fbshipit-source-id: 6d16ccb82fb8258591f9bc5f79c00811b18b9c51
2021-12-03 03:30:23 -08:00
Andrey Goncharov
5610f8f058 Remove 'path' from plugins
Summary:
1. Add `path` replacement
1. Remove Node's path for all plugins but MobileBuildsPluginContainer (it is probably going to be moved to the server)

Reviewed By: mweststrate

Differential Revision: D32766327

fbshipit-source-id: e636f273842506e752b97cf1b28ce7ac51ce9a12
2021-12-02 04:14:51 -08:00
Flipper Bot
902242b3b6 Flipper Release: v0.123.0
Summary: Releasing version 0.123.0

Reviewed By: lblasa

Differential Revision: D32753694

fbshipit-source-id: 70aa24c8711e99c7555346bc44106897ca6753db
2021-12-01 10:22:24 -08:00
Anton Nikolaev
ceba421997 Prepend mdx files which used as includes with underscore to avoid creating and indexing pages from them
Summary:
By default docusaurus generates pages and routes for every mdx file it finds under the root dir. So even for the mdx files which are only used as includes and don't even have headers, page is still created, then index and often looks very weird, e.g. title is the same as file name etc. See e.g. this one: https://www.internalfb.com/intern/staticdocs/flipper/docs/fb/portal-troubleshooting/

I went through Flipper docs and renamed all mdx files which are only used as includes to prepend them with underscore. Everything which name is starting with underscore, or which is inside a folder which name is starting with underscore is considered private by docusaurus and skipped.

Reviewed By: passy

Differential Revision: D32722547

fbshipit-source-id: 0524d4dd56960714fbdd2b01ad8383cd16de4948
2021-11-30 13:26:17 -08:00
Pascal Hartig
41dd757616 More defensively handle initial expand
Reviewed By: jknoxville

Differential Revision: D32674423

fbshipit-source-id: 0d8216ebb9da9530c53c7209dcd18eb677c73fc3
2021-11-26 03:52:58 -08:00
Flipper Bot
c308f7c9bc Flipper Release: v0.122.0
Summary: Releasing version 0.122.0

Reviewed By: passy

Differential Revision: D32674367

fbshipit-source-id: 5c7e6c30c13b910244d5ccd85f9d58b9ba23ab7f
2021-11-26 03:38:59 -08:00
Flipper Bot
5338c26c59 Flipper Release: v0.121.1
Summary: Releasing version 0.121.1

Reviewed By: passy

Differential Revision: D32645612

fbshipit-source-id: 881af2b42348660257cc1a1596e048c9f80ee2fb
2021-11-24 08:04:15 -08:00
Flipper Bot
1c160fb6ac Flipper Release: v0.121.0
Summary: Releasing version 0.121.0

Reviewed By: passy

Differential Revision: D32641519

fbshipit-source-id: 4d137765188cba52597d73ea6c3634ee9ba8ab4b
2021-11-24 04:12:36 -08:00
Andrey Goncharov
a279b9bc43 Remove fs.readFile from some plugins
Summary:
1. Remove fs.readFile from some plugins
2. Add "importFile" to FlipperLib and RenderHost

See D32492149 for context

Followups:

1. Decapitate Stella's sendToPhone
2. Decapitate crash reporter
3. Figure out how to approach navigation
4. Figure out how to approach FileSelector

Reviewed By: mweststrate

Differential Revision: D32496775

fbshipit-source-id: e150aa56a2c2c1eb12a4c03c801f76cd76485a9d
2021-11-18 09:15:30 -08:00
Andrey Goncharov
2c7bc0a952 Remove fs.write from plugins
Summary:
1. Remove "fs.writeFile" from plugins
2. Remove "showSaveDialog" from "FlipperLib"
3. Add "exportFile" to "FlipperLib" and "RenderHost"

As we are going to use Flipper in a browser as well, instead of providing low-level abstraction like "showSaveDialog", we should provide more high-level ones like "exportFile". In browsers it does not make too much sense to expose "showSaveDialog" as there is not way to use the returned file path to write to it.
In the end, "exportFile" is going to trigger a file download for browsers and show the save dialog and write to the returned file path for Electron.

Reviewed By: mweststrate

Differential Revision: D32492149

fbshipit-source-id: 0673119bdb7670a5872f5982c7d82dfc44eb7906
2021-11-18 09:15:30 -08:00
Flipper Bot
71a19cef8b Flipper Release: v0.120.0
Summary: Releasing version 0.120.0

Reviewed By: jknoxville

Differential Revision: D32489726

fbshipit-source-id: 2843f8ddee7ec728dc320e3a4ae432ec392bc304
2021-11-18 06:58:54 -08:00
Michel Weststrate
7e50c0466a Move app/src (mostly) to flipper-ui-core/src
Summary:
This diff moves all UI code from app/src to app/flipper-ui-core. That is now slightly too much (e.g. node deps are not removed yet), but from here it should be easier to move things out again, as I don't want this diff to be open for too long to avoid too much merge conflicts.

* But at least flipper-ui-core is Electron free :)
* Killed all cross module imports as well, as they where now even more in the way
* Some unit test needed some changes, most not too big (but emotion hashes got renumbered in the snapshots, feel free to ignore that)
* Found some files that were actually meaningless (tsconfig in plugins, WatchTools files, that start generating compile errors, removed those

Follow up work:
* make flipper-ui-core configurable, and wire up flipper-server-core in Electron instead of here
* remove node deps (aigoncharov)
* figure out correct place to load GKs, plugins, make intern requests etc., and move to the correct module
* clean up deps

Reviewed By: aigoncharov

Differential Revision: D32427722

fbshipit-source-id: 14fe92e1ceb15b9dcf7bece367c8ab92df927a70
2021-11-16 05:29:21 -08:00
Andrey Goncharov
ed5c2bd39f Add plugin actions menu
Summary: See D32311662 for details

Reviewed By: mweststrate

Differential Revision: D32329804

fbshipit-source-id: 26670353fdf8580643afcb8bc3493384146f5574
2021-11-12 07:13:56 -08:00
Flipper Bot
af581a20a0 Flipper Release: v0.119.0
Summary: Releasing version 0.119.0

Reviewed By: nikoant

Differential Revision: D32309847

fbshipit-source-id: a4c4728c935111fa593ea629b564f2d8d02b9135
2021-11-11 02:44:32 -08:00
Michel Weststrate
8764da7c0b Add error handling to Layout.setHighlighted
Summary: Fixed error generated by monitoring, by adding a proper .catch

Reviewed By: lblasa

Differential Revision: D32278523

fbshipit-source-id: dd14f81d708893a1505ef902e0dc03fee433487b
2021-11-09 05:48:36 -08:00
Michel Weststrate
2fcd815098 Flipper Release: v0.118.1
Summary: Releasing version 0.118.1

Reviewed By: passy

Differential Revision: D32204867

fbshipit-source-id: ac9bc8d106375e834ea18f502b6badb52d726233
2021-11-05 10:59:55 -07:00
Michel Weststrate
2eaccff720 Remove Electron devtools closing
Summary: Follow up on D31992230 (2e7015388c) to replace `require('electron')` with `global.electronRequire('electron')`. However, during testing noticed that the Hermes debugger works just fine even with Electron DevTools open, so removed the logic altogether.

Reviewed By: aigoncharov

Differential Revision: D32167673

fbshipit-source-id: c6c6c07f07ac8c44e0f6959d56bf4c16725c186e
2021-11-05 05:14:03 -07:00
Flipper Bot
4c4ef9b68f Flipper Release: v0.118.0
Summary: Releasing version 0.118.0

Reviewed By: mweststrate

Differential Revision: D32167843

fbshipit-source-id: 1731e360ee1427ffabb9f0933470b1288bbe51a4
2021-11-04 04:29:00 -07:00
Michel Weststrate
2e7015388c Remove remaining Electron imports from product code: paths & env
Summary:
This diff removes most remaining Electron imports, by storing env and path constants on the RenderHost. As nice side effect those paths are all cached now as well.

To make sure RenderHost is initialised before Flipper itself, forced loading Flipper through a require. Otherwise the setup is super sensitive to circular import statements, since a lot of module initialisation code depends on those paths / env vars.

Reviewed By: nikoant

Differential Revision: D31992230

fbshipit-source-id: 91beb430902272aaf4b051b35cdf12d2fc993347
2021-11-03 07:01:21 -07:00
Juan Tejada
763a29d799 Update React Devtools v4.21.0
Summary:
Update `react-devtools-core` and `react-devtools` dependencies for RN, VSCode, Flippe, etc.

`js1 upgrade react-devtools -v 4.21.0`

# Changelog:

[General][Changed] - Upgraded react-devtools-core dependency to 4.21.0

Reviewed By: bvaughn

Differential Revision: D32065685

fbshipit-source-id: 30d0cca2bec6e9abe384da2afefab1d241e0523f
2021-11-01 10:46:02 -07:00
Anton Kastritskiy
4a4cc21d89 Refine DataSource id to use actual key type instead of a wide string type
Summary: Current implementation uses type `string` as a key for indexing items stored in datasource. However, users can provide any key as an index which means that the type of index item can be anything, not only string. This diff introduces a more refined types for the key. It adds another requirement to provide a key property to a generic which is used to infer the index type.

Reviewed By: mweststrate, aigoncharov

Differential Revision: D31895751

fbshipit-source-id: 19ba907bd6f35df87e3fa442db5fc5cec6af174d
2021-10-28 10:44:01 -07:00
Michel Weststrate
64e791e253 Remove usage of Electron context menus
Summary: Removed the usage of electron's native context menus, and replaces it with Antd based context menu's.

Reviewed By: passy

Differential Revision: D31990756

fbshipit-source-id: 0312cbac5fd20a1a30603ce1058c03f4291b23b1
2021-10-28 07:41:00 -07:00
Flipper Bot
360ecb4b24 Flipper Release: v0.117.0
Summary: Releasing version 0.117.0

Reviewed By: aigoncharov

Differential Revision: D31955241

fbshipit-source-id: 0a4c848c96bc63ebd1f4d642965693a1e3502f6c
2021-10-27 09:44:32 -07:00
Michel Weststrate
9763af4c96 Decouple open/save dialogs, reload, shouldUseDarkColors from Electron
Summary: Per title. Less imports from Electron.

Reviewed By: timur-valiev, aigoncharov

Differential Revision: D31923504

fbshipit-source-id: dc7557cf7c88c0c8168ba22f7dca7b3e2d339a09
2021-10-26 12:07:22 -07:00
Juan Tejada
2423423183 Update React DevTools v4.20.2
Summary:
Update `react-devtools-core` and `react-devtools` dependencies for RN, VSCode, Flipper, etc.

`js1 upgrade react-devtools -v 4.20.2`

# Changelog:

[General][Changed] - Upgraded react-devtools-core dependency to 4.20.2

Reviewed By: lunaruan

Differential Revision: D31809278

fbshipit-source-id: 0360fe173cfc7ce09595e6db4e8e41c6f64becd7
2021-10-25 14:00:42 -07:00
Flipper Bot
3a233129b3 Flipper Release: v0.116.0
Summary: Releasing version 0.116.0

Reviewed By: cekkaewnumchai

Differential Revision: D31789901

fbshipit-source-id: f714fa7195f5e07be72d8039074e8b745b657e72
2021-10-20 03:54:57 -07:00
Juan Tejada
0e91f8562a Update React DevTools v4.20.1
Summary:
Update `react-devtools-core` and `react-devtools` dependencies for RN, VSCode, Flipper, etc.

`js1 upgrade react-devtools -v 4.20.1`

# Changelog:

[General][Changed] - Upgraded react-devtools-core dependency to 4.20.1

Reviewed By: lunaruan

Differential Revision: D31762360

fbshipit-source-id: 9269a49afb263c78916852f51ebbd48ceaf531b0
2021-10-19 10:00:41 -07:00
Anton Kastritskiy
6facf5ed0f Fix eslint warning for communist-spelling/communist-spelling rule
Summary: Fixes eslint warnings

Reviewed By: passy

Differential Revision: D31760180

fbshipit-source-id: 635e842d626c58a2a8d2ea2543bf171237e93dc4
2021-10-19 09:40:49 -07:00
Zack Brody
9d34c90b9a Fix Date Label In Crashes Plugin
Summary: The date type for crash reports was updated in D29327501 (aff02b2ca1) from `Date` to `number`. Unset values were previously `null` but became `NaN` in this change. `NaN` is nonnull so the backup value of `Date.now()` was not getting triggered properly and leading to "Invalid Date" to show up in the UI.

Reviewed By: passy

Differential Revision: D31702757

fbshipit-source-id: da93b1f79eb633b2f49dcffbe680d56d47a23ea0
2021-10-18 12:21:52 -07:00
Juan Tejada
b4647eaa13 Update React DevTools v4.20.0
Summary:
Update `react-devtools-core` and `react-devtools` dependencies for RN, VSCode, Flipper, etc.

`js1 upgrade react-devtools -v 4.20.0`

# Changelog:

[General][Changed] - Upgraded react-devtools-core dependency to 4.20.0

Reviewed By: bvaughn

Differential Revision: D31694359

fbshipit-source-id: d05d75e9473878828617c5cd0db8d6008b6abd4d
2021-10-15 12:56:43 -07:00
Flipper Bot
bee907fab4 Flipper Release: v0.115.0
Summary: Releasing version 0.115.0

Reviewed By: passy

Differential Revision: D31612162

fbshipit-source-id: 34f54f6cd7e6f67086081db982cafcc8cccea89c
2021-10-13 11:57:59 -07:00
Michel Weststrate
91d96774f6 Move files to flipper-common
Summary: Moved Logger, sleep, timeout and server contract types to flipper-common packages.

Reviewed By: passy

Differential Revision: D31475790

fbshipit-source-id: 42d2147698875f9e919ad5250f9953f3bff3ec2d
2021-10-12 16:00:52 -07:00
Flipper Bot
e7b3ea9344 Flipper Release: v0.114.1
Summary: Releasing version 0.114.1

Reviewed By: passy

Differential Revision: D31501455

fbshipit-source-id: bfc85cf82b140364badff4a73069285f66b89b9f
2021-10-08 04:39:30 -07:00
Michel Weststrate
89b193b438 Clean up Sheet abstraction
Summary: This stack gets rid of Flippers old sheet abstraction that relies on native (Electron) overlays, and implements it using Ant dialogs instead. Also removes a lot of code by making dialog API imperative, rather than reducer organised, like done in the deeplink handling.

Reviewed By: passy

Differential Revision: D30192001

fbshipit-source-id: 9bca3274bd039207e58f8f9394027515e391671d
2021-10-06 09:10:19 -07:00
Juan Tejada
eab4804792 Update React DevTools from 4.13.0 -> 4.19.1
Summary:
Update `react-devtools-core` and `react-devtools` dependencies for RN, VSCode, Sonar, etc.

`js1 upgrade react-devtools -v 4.19.1`

# Changelog:

[General][Changed] - Upgraded react-devtools-core dependency to 4.19.1

Reviewed By: bvaughn

Differential Revision: D31345135

fbshipit-source-id: dae06a18699df19a6e8422460effd48f715e395b
2021-10-06 08:36:00 -07:00
Flipper Bot
49d41f15e3 Flipper Release: v0.114.0
Summary: Releasing version 0.114.0

Reviewed By: passy

Differential Revision: D31430620

fbshipit-source-id: fce3d83479199d27352c3b05d92fa6c5f0a69051
2021-10-06 08:09:30 -07:00
Flipper Bot
672cfad7d6 Flipper Release: v0.113.0
Summary: Releasing version 0.113.0

Reviewed By: jknoxville

Differential Revision: D31264525

fbshipit-source-id: 400ff8a08dd0671d780e5663b0538fe7e970b237
2021-10-01 09:12:06 -07:00
Pascal Hartig
4aa7439fbf Fix Flipper lints #10
Summary:
Grey -> gray. "Cancelled" seems quite common in APIs though, so I disabled that.
A few promise cleanups

Reviewed By: aigoncharov

Differential Revision: D31323610

fbshipit-source-id: c8863d995936f451c24eb408fe5c26677187f089
2021-10-01 08:08:35 -07:00
Michel Weststrate
b8236f1b3a Don't leave rejection unhandled if node fetching fails
Summary: Fix potentially unhandled promise rejection in Layout inspector. Not really reproducible, and probably originating from old Flipper versions (no trace is available either), since we have a lot of connection check in place. Just in case still handled the exception, for example if something goes wrong on client side

Reviewed By: passy

Differential Revision: D31267465

fbshipit-source-id: d1b384db7bb010af8d2aa12ae29110f343fb14af
2021-09-30 01:40:22 -07:00
Flipper Bot
597cb6b1da Flipper Release: v0.112.0
Summary: Releasing version 0.112.0

Reviewed By: nikoant

Differential Revision: D31140851

fbshipit-source-id: 18106a3f0c0383f8f32a7abf30866d9a72c912a4
2021-09-23 04:21:42 -07:00
Flipper Bot
2fc156c15a Flipper Release: v0.111.0
Summary: Releasing version 0.111.0

Reviewed By: nikoant

Differential Revision: D31107620

fbshipit-source-id: 3651b4e38c4311d895af411a15925eb99bef1382
2021-09-22 09:28:02 -07:00
Michel Weststrate
3882357579 Factor out realDevice [7/n]
Summary: `device.realDevice` was the escape hatch used in Sandy plugins to give access to device specific features like taking screenshots, clearing logs or accessing `adb`. Since in decapitated Flipper that won't be possible anymore (since plugins run in the client but device implementations on the server), all escape hatches have been bridged in this stack, and we can get of the `realDevice` interaction, by explicitly exposing those cases, which makes it type safe as well.

Reviewed By: passy

Differential Revision: D31079509

fbshipit-source-id: c9ec2e044d0dec0ccb1de287cf424907b198f818
2021-09-22 09:03:33 -07:00
Michel Weststrate
8cf182cc26 Restore adb executeShell [5/n]
Summary: Expose executeShell explicitly through the device interface

Reviewed By: jameslawson

Differential Revision: D31055959

fbshipit-source-id: b14395d0783ede265c6ae39c397ea93a85a78336
2021-09-22 09:03:32 -07:00
Michel Weststrate
4463e7ede2 Restore metro functionality [4/n]
Summary: Restored Metro functionality; progress reports, metro logs, RN/Hermes debugging, reload / dev menu button

Reviewed By: passy

Differential Revision: D31055958

fbshipit-source-id: c243035c343c14718a9afe275c8f5f36a1aa3a94
2021-09-22 09:03:32 -07:00
Michel Weststrate
2d838efd4d Separate device in server and client version [2/n]
Summary:
This stack takes care of handling care of moving all device interactions over the (possible) async channel FlipperServer. The FlipperServer interface (see previous diff) allows listening to specific server events using `on`, and emit commands to be executed by the server by using `exec` (e.g. `exec('take-screenshot', serial) => Promise<buffer>`).

FlipperServerImpl implements this interface on the server side.

The device implementations are split as follows

```
server / backend process:

ServerDevice
- iOSDevice
- AndroidDevice
- MetroDevice
- DummyDevice
- Mac/Windows Device

frontend / ui:

BaseDevice: a normal connected, device, implements device apis as they already existed
- ArchivedDevice (note that this doesn't have a server counterpart)
- TestDevice (for unit tests, with stubbed backend communication)

```

All features of devices are for simplicity unified (since the deviations are small), where specific device types might not implement certain features like taking screenshots or running shell commands.

To avoid making this diff unnecessarily big, some open Todo's will be addressed later in this stack, and it shouldn't be landed alone.

Reviewed By: timur-valiev

Differential Revision: D30909346

fbshipit-source-id: cce0bee94fdd5db59bebe3577a6084219a038719
2021-09-22 09:03:32 -07:00
Flipper Bot
5e10baa43f Flipper Release: v0.110.0
Summary: Releasing version 0.110.0

Reviewed By: mweststrate

Differential Revision: D31020264

fbshipit-source-id: e161705979fda9f95ddd212d5f35ede4bb8f49c3
2021-09-17 09:23:20 -07:00
Mathias Fleig Mortensen
094c320c5c Ignore react-vis types missing
Reviewed By: defHLT

Differential Revision: D30993257

fbshipit-source-id: 32d7f6af837f47407e10e3c3bd744071d6b374e6
2021-09-17 04:23:27 -07:00