Commit Graph

140 Commits

Author SHA1 Message Date
Daniel Büchele
9caddc2b8b Button icon variant
Summary: Allow setting the icon variant for icons on buttons

Reviewed By: jknoxville

Differential Revision: D10101603

fbshipit-source-id: 344afda2296479ffb8449a7ad8172b35f0dc95e4
2018-09-28 08:57:37 -07:00
Daniel Büchele
a455520ecb adding jest test setup
Summary:
Adds a test runner for jest test and adds three simple test cases:
- render the app
- start a server
- client connecting to the app

Test can be run using `yarn test`.

To make the test runner work, some changes needed to be made:
- remove the export of `init()` from `'flipper'`, because it was a cyclic dependency
- updating Button.js to the new ref-API

Reviewed By: jknoxville

Differential Revision: D10027078

fbshipit-source-id: 49107b0dd4dec666b92ecd841422fe7e6b3a7756
2018-09-28 06:42:08 -07:00
Daniel Büchele
ab4f4ed02b table filter and icons enhancements
Summary:
- Allows alignment of table columns
- fixes display of lager numbers in log counts
- fixes the alignment of `FilterRow`

Reviewed By: priteshrnandgaonkar

Differential Revision: D9850598

fbshipit-source-id: 106f4dc6a422f58e090f97857bd7be02e7c2c1d2
2018-09-21 10:52:02 -07:00
Daniel Büchele
9ef8d32053 flow fixes
Summary: Fixes a flow issue in the type definition of a filter. The color can be optional.

Reviewed By: passy

Differential Revision: D9850602

fbshipit-source-id: 1d74d0462baef58ad1a93e23152583679f51c177
2018-09-21 10:52:01 -07:00
Daniel Büchele
26dd94f072 selecting rows from outside
Summary: Allows to set the selected rows of a table using the `highlightedRows` property.

Reviewed By: passy

Differential Revision: D9850597

fbshipit-source-id: 62239192113f43ac257d7328b21b386b584a7cfb
2018-09-21 10:52:00 -07:00
Daniel Büchele
71458b97b3 fixing plugin imports
Summary:
Plugins need to be self-contained. The can not require any dependency from Flipper's main app. This was a soft requirement before, but with the new version of metro, we now make this a hard requirement.

This speeds up plugin compile times, because only the files in the plugin's folder are watched and not all of Flipper's files. Moreover, this ensures "plugins" are real plugins and can be added and removed and are not mixed with the apps core.

Reviewed By: passy

Differential Revision: D9940735

fbshipit-source-id: 47e120429fc3c4c985731478ffa35c3359ff78f9
2018-09-20 04:27:48 -07:00
Daniel Büchele
0d33f7afd6 revert CA file name to sonar
Summary: as per title

Reviewed By: jknoxville

Differential Revision: D9927180

fbshipit-source-id: d4e0a6e3da4babeda4a04c1081878b962a091c3f
2018-09-18 17:27:21 -07:00
Daniel Büchele
3e4c24d6fe certificateProvider
Summary: rename certificate provider

Reviewed By: passy

Differential Revision: D9871288

fbshipit-source-id: 001a61416af23d89e63374cccc3df256b55eb6d2
2018-09-18 07:01:17 -07:00
Daniel Büchele
e9490ca3b4 comments and variable names
Summary:
renaming across the app:
- comments
- variable names
- constants

Reviewed By: passy

Differential Revision: D9861792

fbshipit-source-id: 72dea05d1427b1dc0f54a7865cc0ecffd69bdb27
2018-09-18 07:01:17 -07:00
Daniel Büchele
df0a0da744 DetailSidebar
Summary:
- rename `SonarSidebar` to `DetailSidebar`
- rename portal id from `#sonarSidebar` to `#detailSidebar`

Reviewed By: passy

Differential Revision: D9851703

fbshipit-source-id: 2d904d17b0c6255a2ec3a79f0ada9bf621693c2e
2018-09-18 07:01:16 -07:00
Daniel Büchele
e360654b28 TitleBar
Summary: rename `SonarTitleBar` to `TitleBar`

Reviewed By: passy

Differential Revision: D9851709

fbshipit-source-id: f4b420a70d251a0ca7a5b22b66748a238c5f410a
2018-09-18 07:01:16 -07:00
Daniel Büchele
3bea3c88e6 flipper-plugin-*
Summary: rename plugin packages from `sonar-plugin-*` to `flipper-plugin-*`.

Reviewed By: passy

Differential Revision: D9851211

fbshipit-source-id: bdac568ede0a4a9308138a6c3d60728bb6195a72
2018-09-18 07:01:16 -07:00
Daniel Büchele
66e77075be Rename package to 'flipper'
Summary:
- rename package `'sonar'` > `'flipper'`
- rename package `'sonar-static'` > `'flipper-static'`
- rename package export from `window.Sonar` to `window.Flipper`

Reviewed By: passy

Differential Revision: D9851181

fbshipit-source-id: 34d4447c3b287496b3d20ddb54471ce777ec74e1
2018-09-18 07:01:16 -07:00
Daniel Büchele
2e2924c979 SonarPlugin > FlipperPlugin
Summary:
Renaming:
- `SonarPlugin` > `FlipperPlugin`
- `SonarBasePlugin` > `FlipperBasePlugin`
- `SonarDevicePlugin` > `FlipperDevicePlugin`

Reviewed By: passy

Differential Revision: D9851075

fbshipit-source-id: d59df6952a42eb493c86c38895216c9985f1e14b
2018-09-18 07:01:16 -07:00
Pascal Hartig
175ba7f331 Remove import-sideffect call to init()
Summary:
Back out "Back out "[flipper] Export init function""
Original commit changeset: 93b916d472b7

The import side effect seems to cause some issues with shadowing,
so let's pull this all the way to the top and call this from HTML
as Sonar.init().

Reviewed By: danielbuechele

Differential Revision: D9849869

fbshipit-source-id: b62772ecddc59eab00251ebf19816f470d76ba82
2018-09-17 08:59:34 -07:00
Pascal Hartig
c93ab83bd9 Back out "[flipper] Export init function"
Summary:
This seems to break initialization. I'm not quite sure why, but
inside the exported function, nothing else from the file appears
to be visible.

Original commit changeset: 55b2a61186e6

Reviewed By: danielbuechele

Differential Revision: D9849812

fbshipit-source-id: d88973721da82040e1f29669acade6c883619ce8
2018-09-17 06:14:32 -07:00
Pascal Hartig
fc653d8057 Export init function
Summary: This way we can mock it during tests.

Reviewed By: jknoxville

Differential Revision: D9788349

fbshipit-source-id: 55b2a61186e6294a8098db7add50fd8bbac7a680
2018-09-13 08:58:03 -07:00
Pascal Hartig
20748876a9 Prepare React imports for Jest
Summary:
Not sure if it's Metro or something else providing these globally,
but it makes Jest unhappy if they're missing.

Reviewed By: danielbuechele

Differential Revision: D9788350

fbshipit-source-id: 5fabad7af146bcb705471d2c7e66d79265c81c82
2018-09-12 07:59:46 -07:00
Sara Valderrama
73759e71db add litho accessibility rendering to Flipper accessibility mode [1/2]
Summary:
Litho renders differently based on whether applicable accessibility services are enabled. In Flipper's accessibility mode this will be forced (with the option to turn it off) so that you don't have to be running an accessibility service to actually see what someone running an accessibility service would.

Here's an example video of what the re-rendering does (this also happens on toggle of accessibility mode, this is just the settings option to force it):

{F137856647}

Reviewed By: jknoxville

Differential Revision: D9667222

fbshipit-source-id: 292353d89f07734f1e525f795b1d7daf4130e203
2018-09-07 14:58:00 -07:00
Pascal Hartig
07650d0627 Remove unused fixmes
Summary: Looks like some flow-disables were no longer necessary.

Reviewed By: jknoxville

Differential Revision: D9700398

fbshipit-source-id: 5514c16294624c1bed1d3818f9e271b07e320803
2018-09-07 06:12:18 -07:00
John Knox
9cfb461a9a Collect server logs in bug reports
Summary: Not collecting all debug logs because there are so many, but server ones are few and usually important for context on what's connected at the time.

Reviewed By: danielbuechele

Differential Revision: D9654402

fbshipit-source-id: 5ad090838be3e06c25bd93e4d85726822bd7fc4e
2018-09-06 06:57:46 -07:00
Sara Valderrama
d26779cd16 Update Tooltip implementation for Flipper
Summary:
Basic tooltips available. Use is:

  <Tooltip
     title="This is what will show up inside the tooltip"
     options={{ // can include any or none of these (if not included default will be used)
        position, // 'above', 'below', 'toRight', or 'toLeft'
        showTail, // whether or not tooltip should have tail
        delay, // how long to wait on hover before showing tooltip
        // supported css properties
        backgroundColor,
        color,
        maxWidth,
        width,
        borderRadius,
        padding,
        lineHeight,
     }}>
     <ElementTooltipWillShowUpFor/>
  </Tooltip>

Reviewed By: danielbuechele

Differential Revision: D9596287

fbshipit-source-id: 233b1ad01b96264bbc1f62f3798e3d69d1ab4bae
2018-09-04 10:44:12 -07:00
Daniel Büchele
afdc846a8b log listener
Summary:
The logs plugin opened a new log connection every time it was activated and never closed the connection.

This is now changed. Once a device is connected, a log connection is opened. The logs plugin subscribes and unsubscribes to this connection. This allows the logs plugin it even access the logs from when it was not activated and ensures to only open on connection to read the logs. Logs are persisted when switching away from the plugin.

Also removes the spinner from the logs plugin, as it loads much faster now.

Reviewed By: jknoxville

Differential Revision: D9613054

fbshipit-source-id: e37ea56c563450e7fc4e3c85a015292be1f2dbfc
2018-08-31 10:13:06 -07:00
Daniel Büchele
a30e0b53e9 faster iOS device connection
Summary:
First connection attempt to iOS device was only made after 3000ms. This caused all iOS devices only show up after this delay.
Now, the devices are queried immediately.

Reviewed By: passy

Differential Revision: D9613057

fbshipit-source-id: a14e3f02576ec5e159f4002bf68efe53236dcc50
2018-08-31 10:13:06 -07:00
Daniel Büchele
ace800ad55 fix log counter
Summary: Log counter had a bug that only allowed the number to go up to 2. To increment the number of the last row is read and increased. However, this failed and always fall back to 1.

Reviewed By: passy

Differential Revision: D9613056

fbshipit-source-id: dc73990eb26c7a6ecbc70b0fe50687607b8bf0ad
2018-08-31 10:13:06 -07:00
Daniel Büchele
64ff6eb9cf iOS logs
Summary:
- Cleans up iOS log listener code
- Retries to create a connection to the log stream if it failed
- logs errors with the log parser

Reviewed By: jknoxville

Differential Revision: D9613055

fbshipit-source-id: 33a24e474be62fc2a906f022a68547594f2e66c1
2018-08-31 10:13:05 -07:00
John Knox
0f08b04571 Filter displayed plugins by selected device
Summary: Now that android devices know their own serial, we can filter plugins by the selected device.

Reviewed By: passy

Differential Revision: D9481461

fbshipit-source-id: 4a53eea1e61caa09c3d63ca0076fbc1b6dceb99f
2018-08-31 08:12:57 -07:00
John Knox
edff177c3f Give serial to the device during cert exchange so it can provide it whenever it connects
Summary:
Android devices don't always know their own serial.
But we do a certificate exchange using adb from the desktop, so we can provide it in the response.

After this the client will provide it every time it connects, so we can do things like filter plugins by device id.

For apps that have already done cert exchange, they'll continue to use 'unknown' as their id until they do it again with an up to date version of sonar.
We can think about forcefully stopping that, but I haven't done it.

Reviewed By: danielbuechele

Differential Revision: D9481460

fbshipit-source-id: f8932699711ebbec4260fabe32f87e6cdff920f2
2018-08-31 08:12:56 -07:00
Daniel Büchele
d14def44f1 fix table arrow navigation
Summary: Check for `highlightableRows` was wrong.

Reviewed By: passy

Differential Revision: D9602101

fbshipit-source-id: dbab5efb0c2d71c1a2a018bf035f39d2539f5595
2018-08-31 03:12:22 -07:00
Daniel Büchele
73e5824e35 ManagedTable debouncing
Summary:
Removes the fix introduced in D9570518 and upgrading to `react-window@1.1.2` which fixes the problem in the library.

Also finetuning debounce times.

Reviewed By: passy

Differential Revision: D9582591

fbshipit-source-id: 92b008d29f96ce0f11f5cfb5d9e92175ae536ee2
2018-08-30 11:30:36 -07:00
Daniel Büchele
63c8bd4368 fix for missing rows in ManagedTable
Summary:
When starting with an empty table and adding rows, the scrollOffset of the table might end up with a negative value, which causes rows not to be rendered.

See https://github.com/bvaughn/react-window/issues/49 for more details.

This only calls `scrollToItem` when the table is actually scrollable to prevent a negative scrollOffset.

Reviewed By: passy

Differential Revision: D9570518

fbshipit-source-id: 5b08990a353a6d41d0f1bc5c1481d5a5e471bd94
2018-08-30 08:13:07 -07:00
Daniel Büchele
2c905646ec fixing table default props
Summary:
Table was missing support for some properties, that were supported previously, which caused some regressions. Support for the following properties was added:
- `multiHighlight: boolean = false`
- `autoHeight: boolean = false`
- `highlightableRows: boolean = true`
- `onRowHighlighted: Function`

Reviewed By: jknoxville

Differential Revision: D9549384

fbshipit-source-id: 1db2e7e8c6ad483d3d9d3a5814c76c564e9ba7f4
2018-08-29 04:27:25 -07:00
Daniel Büchele
f7606c8d59 rename ~/.sonar to ~/.flipper
Summary: renames config folder from sonar to flipper

Reviewed By: jknoxville

Differential Revision: D9541803

fbshipit-source-id: ef378c46fcbb14e76e99fb0743a99f24c536a434
2018-08-29 02:43:00 -07:00
Daniel Büchele
2596e7d42a recalculate row heights on change
Summary: When table rows are chaning, we need to recaluculate all row heights. This was already done when filtering/searching, but there are other occurrences where we need to recalculate the heights (like clearing the table).

Reviewed By: passy

Differential Revision: D9540881

fbshipit-source-id: ef6e94c0330294d8196f946799a436aa5e9ce5c5
2018-08-28 10:29:26 -07:00
John Knox
db1b175d44 Use library to create temporary files
Summary: Makes the code a bit cleaner and maintainable.

Reviewed By: passy

Differential Revision: D9496316

fbshipit-source-id: a59a41b12a57bb2eedc25b154c6f9b0cdc77dd8a
2018-08-28 04:26:54 -07:00
Sara Valderrama
364883f661 Live update sidebar with click and focus accessibility events
Summary: Lets AX inspector live update the sidebar when a view is clicked (state may change) or accessibility focus changes (previously only updated the sidebar live if it became the focused element).

Differential Revision: D9489376

fbshipit-source-id: 8959f722370ce1d3a622b24c7b049b03f0d662e6
2018-08-24 09:42:02 -07:00
Daniel Büchele
61258d4b64 log correct version
Summary:
Instead of reading version number for logging from `package.json` it is now fetched via electron. We usually don't update our version number in package.json and therefore all logs showed the same version number. the version number from `app.getVersion()` is set during the build process and reflects the actual version number that is used.
Removes unused `<Version />` component.

Reviewed By: jknoxville

Differential Revision: D9495745

fbshipit-source-id: 6999ea23a1e4f90d6591b3695e01a803a5f3ff85
2018-08-24 03:57:16 -07:00
Daniel Büchele
2c071e226f fixing warnings related to emotion
Summary: Fixes some warnings that were caused by the switch to react-emotion.

Reviewed By: jknoxville

Differential Revision: D9483185

fbshipit-source-id: 8e49469772efd37f18342252653648618e644d55
2018-08-23 12:57:18 -07:00
Daniel Büchele
726966fdc0 convert to emotion
Summary:
My benchmarks have shown react-emotion to be faster than the current implementation of `styled`. For this reason, I am converting all styling to [emotion](https://emotion.sh).

Benchmark results:
{F136839093}

The syntax is very similar between the two libraries. The main difference is that emotion only allows a single function for the whole style attribute, whereas the old implementation had functions for every style-attirbute.

Before:
```
{
  color: props => props.color,
  fontSize: props => props.size,
}
```

After:
```
props => ({
  color: props.color,
  fontSize: props.size,
})
```

Reviewed By: jknoxville

Differential Revision: D9479893

fbshipit-source-id: 2c39e4618f7e52ceacb67bbec8ae26114025723f
2018-08-23 09:42:18 -07:00
Tim Isganitis
f560f770b6 Fix iOS screen recording
Summary: It looks like the iOS simulator screen recording tool expects a SIGINT instead of a SIGKILL (the default of node's ChildProcess.kill()) to indicate it should stop recording, save the video file and die cleanly.

Reviewed By: danielbuechele

Differential Revision: D9480678

fbshipit-source-id: 5f17bd288c7622ffa3c337cef311e5e4e462218a
2018-08-23 09:12:53 -07:00
Daniel Büchele
624d06f2c2 remove old virtualized
Summary: Switches elements from custom virtualization to react-window, so the custom implementation is not needed anymore and therefore can be removed.

Reviewed By: jknoxville

Differential Revision: D9447723

fbshipit-source-id: 7abcc077f87fe634a0e9517908db03398848bce7
2018-08-23 04:57:29 -07:00
Daniel Büchele
7bdb21e055 adding table debouncing
Summary:
When changing the props of a table often, this might results in a lot of unnecessary rerenders. This could be mostly seen in the analytics plugin, which is sending a lot of messages in a short time.

The update of the table component is now debounced to only re-render every 150ms. This also affects searching and filtering and makes typing in the search input smoother.

Reviewed By: passy

Differential Revision: D9447722

fbshipit-source-id: 00e092e4e047e9c40e5a1ec2789644858acc18dd
2018-08-23 04:57:28 -07:00
Daniel Büchele
1891e2c869 moving tables to react-window
Summary:
Tables were using a custom virtualization, which wasn't as performant as other solutions out there. In this diff, the table component is reworked for performance.
- removes `Table` component, because it was never used standalone, `ManagedTable` is what all plugins used
- uses `react-window` for `ManagedTable`
- reworks table highlighting and arrow-navigation to work with the new virtualization
- moves actual filtering out of `ManagedTable` into `Searchable` component for a better separation of concerns.

Reviewed By: jknoxville

Differential Revision: D9447721

fbshipit-source-id: 15eb2eb55eed9f49a0cb1ccfb2d748b3672fa898
2018-08-23 04:57:28 -07:00
Pascal Hartig
33f34650df Fix plugin resolution on Linux
Summary:
Linux appears to spawn a completely separate browser process whereas MacOS either
forks or uses a thread. Either way, Linux no longer has access to the parent
process's environment variables we use to look up plugins. Using
the remote module fixes that.

In the medium term, we should convert the `plugin` module to not rely on import effects
and instead use the IPC mechanism, making the plugin resolution asynchronous:

https://electronjs.org/docs/api/web-contents#contentssendchannel-arg1-arg2-

That would also allow us to do the plugin resolution while starting up the browser window,
lowering the startup time.

Reviewed By: danielbuechele

Differential Revision: D9423628

fbshipit-source-id: 76351f267864147c4494aadaf4e16ea636952118
2018-08-23 03:13:07 -07:00
Sara Valderrama
7852a3886b Accessibility Inspector open-sourcing move and documentation
Summary: Replaces AXElementsInpector with normal inspector implementation, removes gating from external builds. Adds documentation to https://fbflipper.com/docs/layout-plugin.html.

Reviewed By: passy

Differential Revision: D9438713

fbshipit-source-id: 18616c6cbab339bf474d116cac128e1d4a5fc2be
2018-08-22 14:57:44 -07:00
Sara Valderrama
7acf0ff9af Remove sidebar extensions from accessibility inspector
Summary: Sidebar extensions are automatically added to main inspector sidebar but kept from accessibility side menu.

Reviewed By: xiphirx

Differential Revision: D9438644

fbshipit-source-id: 47a9cc630117e15be3368d78f2396f02796c998d
2018-08-22 09:58:23 -07:00
Hilal Alsibai
1aee2cdaa3 Pass the Layout plugin's logger to the sidebar and sidebar extensions
Summary: Lets the sidebar + sidebar extensions log custom events

Reviewed By: danielbuechele

Differential Revision: D9411001

fbshipit-source-id: 37704e805eda56347cd95c155f81ad31b34bd508
2018-08-21 02:58:33 -07:00
Sara Valderrama
c428de3948 Tooltips added on hover for AX sidebar
Summary: Adds on hover descriptions for some of the more esoteric properties in the accessibility sidebar panel such as accessibility-focused and all the talkback derived properties. Also change talkback-focusable and talkback-ignored to both be talkback-focusable.

Differential Revision: D9381676

fbshipit-source-id: 55ce854da24241a7c89b0c122c4c3ebd77438dbb
2018-08-20 09:41:46 -07:00
Hilal Alsibai
82c2f0c68c Minor typo
Summary: Minor typo

Reviewed By: passy

Differential Revision: D9393881

fbshipit-source-id: 252ed38f1532947a7a15b2149bd5da42d6e0e31d
2018-08-20 02:56:44 -07:00
Hilal Alsibai
dd3cb40010 Fix shared preference plugin display
Summary:
There seems to be an issue showing a ManagedTable within a Panel. The component was properly
receiving new changes etc, it just wasn't displaying due to a 0 height (I guess).

This diff fixes that + updates the layout so its not cramped.

Reviewed By: passy

Differential Revision: D9393882

fbshipit-source-id: a35f2a298106c4b2a48883822ef997e8499f1eec
2018-08-20 02:28:12 -07:00