Commit Graph

59 Commits

Author SHA1 Message Date
Daniel Büchele
75dfbf51f8 electron flow type definitions
Summary: Adding a flowtype library definition for electron 3 and fixing related type errors

Reviewed By: passy

Differential Revision: D9124758

fbshipit-source-id: e09cb5b05ba952e7f95f68f9043edc586f81ae83
2018-08-02 03:57:52 -07:00
Sara Valderrama
30a19901ee Cleanup js in layout inspector, add check for ios
Summary: Clean up javascript. Add a check to remove ax mode toggle if using ios. Add safety check for extraInfo where it hasn't been added yet.

Reviewed By: danielbuechele

Differential Revision: D9070574

fbshipit-source-id: 49ac781c01ea47239d6c24089976497371973726
2018-08-01 13:41:43 -07:00
Daniel Büchele
06e70a1555 Screen capture unique file names and location
Summary: Screen captures now have unique names, so they don't get overwritten. By default they are saved to the desktop, but the path can be overwritten by setting `screenCapturePath` in `~/.sonar/config.js`

Reviewed By: jknoxville

Differential Revision: D9120822

fbshipit-source-id: ab6880eac475da3839f08c6e644c16bdc8693647
2018-08-01 11:29:05 -07:00
Benjamin Pankow
a4638033b7 Improve styling of Hprof Analysis for Memory Tools plugin
Summary:
Improves the look of analyzed Hprof data for the Memory Tools plugin. Adds an expandable/collapsable tree using ElementsInspector and groups large objects/leaked objects.
https://pxl.cl/fxNs

Reviewed By: danielbuechele

Differential Revision: D8721141

fbshipit-source-id: f78fe32bd2ca1f11ce39b9e696f48a56dc5c9bff
2018-07-31 14:56:28 -07:00
Daniel Büchele
37425e7ae8 persist state over reload
Summary: The selected device, app and plugin are not persisted over a reload using `redux-persist`.

Reviewed By: jknoxville

Differential Revision: D8836481

fbshipit-source-id: 3ace1a950a200255d5daf77791d706ede0ff2138
2018-07-31 07:58:33 -07:00
Daniel Büchele
1f977f4844 Store use selected plugin after reconnect
Summary:
Deselect plugin when app disconnects, but store the information that the users had the app selected. When the app conencts again, restore the user's selection.
This also stores the device seleced by the user and reselects the device if it connects.

Reviewed By: xiphirx

Differential Revision: D8833948

fbshipit-source-id: ad3ef54681550ae674bdd4e695d677aea5c14588
2018-07-31 07:58:33 -07:00
Hilal Alsibai
a8138984f9 Fix undefined references
Summary: If the app youre inspecting doesnt have extra ax info then the layout inspector has a bad time

Reviewed By: sjkirby

Differential Revision: D9038286

fbshipit-source-id: e3c1736cba13b870cf7ff648377c822fba4446d0
2018-07-31 04:14:49 -07:00
Sara Valderrama
33e6538477 Highlight the current talkback-focused element in the accessibility tree
Summary: Highlights the element corresponding to the view talkback is focused on in green in the ax tree (and updates live as talkback moves).

Reviewed By: blavalla

Differential Revision: D9021542

fbshipit-source-id: c3bf6f5625aacb0cd054032b33a50541b88b2eaf
2018-07-31 04:14:49 -07:00
Aurelien Fredouelle
5714ce08c9 Added export for the DataDescription component
Reviewed By: jknoxville

Differential Revision: D8896383

fbshipit-source-id: f4873c251046be5983ef1e7377a9a269a087261a
2018-07-26 04:34:46 -07:00
John Knox
b68d802fae Sort plugins alphabetically
Summary: Show plugins in alphabetical order in the main sidebar, so you can more easily find the one you're insterested in.

Reviewed By: passy

Differential Revision: D8995900

fbshipit-source-id: 2ce4a4f4ac7491378e09da8b6ada3f60102a36cb
2018-07-26 03:32:58 -07:00
Benjamin Pankow
e223595941 Add 'depressed' param to Button
Summary: Adds an optional 'depressed' param to Button. If set to true, displays the Button as if it was depressed. Used to add a set of togglable buttons in which all or none can be selected.

Reviewed By: jknoxville

Differential Revision: D8903854

fbshipit-source-id: ff39bed91514e420b49cb75fe57e490fa641b810
2018-07-25 10:33:36 -07:00
Sara Valderrama
41f4478a74 Basic mutual highlighting for Litho components
Summary: Shows basic relationship between the AX and nonAX tree litho nodes. When a litho component is selected from the nonAX tree, it's corresponding hostView or lithoView (root of the component tree) is highlighted in the AX tree giving priority to the hostView if it exists. If a hostView is selected in the AX tree, it's corresponding component is selected in the non-AX tree. If a lithoView is selected from the AX tree, it's corresponding lithoView is highlighted in the non-AX tree. This means that each hostView has a one-to-one highlighting between the two trees but lithoViews will have many nodes in the main tree that map to one node in the AX tree (which is accurate to litho components rendering but we may need to change in the future if it is not clear).

Reviewed By: jknoxville

Differential Revision: D8972205

fbshipit-source-id: d136f5b594d0ac1b66a82b35dc7b085186829fc4
2018-07-25 10:19:37 -07:00
Sara Valderrama
c57e6e4396 Expand trees together - including fragments, not including litho components
Summary: When expanding one tree, the other tree also expands. This expanding jumps over fragments (which are not in the accessibility tree) so that the trees can stay in sync even when there are extra wrappers in the main tree. Need to figure out functionality for litho components (these simply don't expand together right now since the relationship between the trees at these nodes are less obvious).

Differential Revision: D8943229

fbshipit-source-id: 289c3511a6495508b45a62da13ae4c50209e6118
2018-07-25 10:19:37 -07:00
Pascal Hartig
a876f90b68 Fix lint error
Summary: Per title. CI is unhappy.

Reviewed By: jknoxville

Differential Revision: D8991974

fbshipit-source-id: db7b9161b814fbbae0849d3ee3d551a7a8588985
2018-07-25 09:19:38 -07:00
Pascal Hartig
6a7a580db3 Import "Fix some typos (it's vs its)" (#175)
Summary:
Original author: noahsark769

Closes https://github.com/facebook/Sonar/pull/175

Reviewed By: jknoxville

Differential Revision: D8989724

fbshipit-source-id: 8e1c09196b0c6c0d0fb0446a2a4a595d09f21652
2018-07-25 07:18:54 -07:00
Pritesh Nandgaonkar
02cd3ba560 Add warning if plugin is ignored due to gatekeeper
Summary: Adds warning if plugin is ignored due to user not being the part of gatekeeper. As it will help us to better support our users

Reviewed By: passy

Differential Revision: D8952074

fbshipit-source-id: a5b995c778989deb08972081b19313303f8bfabb
2018-07-24 07:48:37 -07:00
Barney Huang
fcfa0409e4 fix null device reference
Summary:
Force device type from BaseDevice to AndroidDevice, because we need to access adb inside AndroidDevice.
In long term, we should use DeviceShell from BaseDevice, but that need much more changes.

Differential Revision: D8876082

fbshipit-source-id: 0772a0ac361c5e3eca9c7a590281ffa786501e15
2018-07-20 03:32:54 -07:00
John Knox
e83c8d31a2 Display warning to user when a physical iOS device is connected
Summary: At the moment sonar doesn't work with physical iOS devices. Until we add that feature, to avoid confusion, tell the user that it won't work.

Reviewed By: passy

Differential Revision: D8859223

fbshipit-source-id: 318777406877e0f769c6d0dc5bbe745ca0565f55
2018-07-16 11:03:53 -07:00
Aaron Brady
d34aba9e21 Allow filesystem to decide path validity for cert dest folder (sonarCA.cert failing to write on windows)
Summary:
On windows when I used a more complicated path for the sonar directory (e.g. for writing sonarCA.cert to), it failed this regex but succeeded the node fs.writeFile call.

Unless I'm missing something else this regex does, we should just let the authority of the fs module decide if it can write something.

Reviewed By: jknoxville

Differential Revision: D8822094

fbshipit-source-id: 294c9a7b70080fefcfffdddd239d321ff7faa4e1
2018-07-16 08:33:37 -07:00
John Knox
e844e4bd34 Detect expired server certificates
Summary:
We have a check for whenever the server cert is expiring within 1 day, however this turns out it doesn't count certificates that have already expired.
So adding a check for those that have already expired, and regenerating them if so.

We can safely handle parse failures by assuming the cert has expired.

Reviewed By: passy

Differential Revision: D8858740

fbshipit-source-id: 6e06f9b267bcaec497b7eedd3d6c1974c788aea2
2018-07-16 07:19:34 -07:00
Sara Valderrama
1c5ecce667 NodeInfo tree working (besides litho nodes)
Summary: The second tree has access to all AX NodeInfo properties (they are not in the sidebar yet). Infrastructure set up to customize displayed information bassed on what is most useful. Descriptors for views updated to include AX functionality and non-view descriptors AX functions defaulted to null/empty. Non-view nodes (like Fragments, Window, Appication) no longer included in AX tree. Corresponding nodes will be highlighted (although not expanded) on click in either tree.

Differential Revision: D8795800

fbshipit-source-id: cf2333f69bfecca3ff84aae62681c684dfa14bf3
2018-07-12 09:33:21 -07:00
Sara Valderrama
9e673a07a8 Small updates to Layout Extension code (committing to keep separate from larger changes)
Summary: Changed AXVisible checking, added AX specific hover

Reviewed By: danielbuechele

Differential Revision: D8795383

fbshipit-source-id: bb10b9e860629cfd385d97e79587c76460b516bc
2018-07-12 09:33:21 -07:00
Aaron Brady
a223edafaa Get Sonar Running on Windows
Summary: Small tweaks so that Sonar can be started easily on windows.

Reviewed By: danielbuechele

Differential Revision: D8769592

fbshipit-source-id: 084dd50e5600a7e2e9c5544e3e79a18614933fdc
2018-07-11 08:18:25 -07:00
Daniel Büchele
9f95698492 disable auto publish
Summary: electro-builder automatically publishes when it detects builds on TravisCI. This disables this behaviour, as we want to manually publish releases.

Reviewed By: jknoxville

Differential Revision: D8783066

fbshipit-source-id: d8723c87b879b3ef7ee02585997a13cb55095e65
2018-07-11 08:03:57 -07:00
Barney Huang
c048e03d03 fix null variable in state
Summary:
Fix "Cannot read property 'monitoring' of null" in CPU plugin.

{F132280986}

Reviewed By: danielbuechele

Differential Revision: D8800114

fbshipit-source-id: c363eda71e4d580fdd12ff1dc3981feaaafeae93
2018-07-11 07:11:35 -07:00
Daniel Büchele
c50b2864ce fix lint errors
Summary: builds were breakign due to linting erros

Reviewed By: jknoxville

Differential Revision: D8781557

fbshipit-source-id: fccd349d0088a7b7ab8359dfd4edee20230c2393
2018-07-10 08:11:44 -07:00
Daniel Büchele
c948e50c10 remove setup method in plugins
Summary:
Plugins had their custom setup method which needed to be called externally. That is what consturctors are for. This removes the setup method and moves ths logic to the constructor.
The setup method was called to late which caused the graphQL plugin to crash. With the logic now being in the constructor, it is ensured that it is called at the initialization.

Reviewed By: jknoxville

Differential Revision: D8769807

fbshipit-source-id: 7b4ab4815bbe397c80998adcb89ca361df6970d3
2018-07-10 07:17:08 -07:00
Arvind Menon
c8c2cfa16f Ignore header case to determine if content is gzipped (#143)
Summary:
This PR updates the Network plugin's response parser to ignore the case of the `Content-Encoding` header in the response. This was preventing responses that are gzipped from being uncompressed. I tested this with gzipped responses through the OkHttp interceptor on Android. This could potentially address #79 as I was experiencing that issue before this change.

![sonar](https://user-images.githubusercontent.com/1328587/42414919-284b80bc-8238-11e8-8cf9-d9e9b9bea133.jpg)
Pull Request resolved: https://github.com/facebook/Sonar/pull/143

Differential Revision: D8780509

Pulled By: danielbuechele

fbshipit-source-id: 1a2d86226a8a0204ff43eb5f9394a56c04fd2d8d
2018-07-10 06:17:28 -07:00
Daniel Büchele
c239fcac01 persist network plugin state
Summary:
This saved the state of the network plugin even when switching between plugins using persistedState.
A bug in the Android implementation didn't clear the events that were already sent to the desktop.

Reviewed By: jknoxville

Differential Revision: D8752098

fbshipit-source-id: 152ec5da83958ad8124686f780d39983cbce563f
2018-07-10 02:33:51 -07:00
Daniel Büchele
f5dcaf02a4 persisted plugins state
Summary:
Two pros are passed into every plugin to persist state:
- `this.props.persistedState` which is the object of the persisted state
- `this.props.setPersistedState` which can be used to modify the persisted state

The state itself is stored in redux and therefore persisted when switching plugins.

The lifecycle hooks used a HOC are now implemented by the `ref`-function, which makes the code a little cleaner.

Reviewed By: jknoxville

Differential Revision: D8752097

fbshipit-source-id: d4f081f149cd840a29f1132bde91d72d3fba67ed
2018-07-10 02:33:51 -07:00
Daniel Büchele
7ed154c510 selected device
Summary: The redux store keeps a list of devices. For the active device, it stored the index in that list. This diff now stores a reference to the active device instead of the index in that array. This changes makes it easier to get the reference to the active device in a component.

Reviewed By: jknoxville

Differential Revision: D8767514

fbshipit-source-id: c740cf98d6039223ce8d5a47bcd277989fe70bc3
2018-07-09 07:19:23 -07:00
Daniel Büchele
a24655e7bd only show apps from selected OS
Summary:
The sidebar always showed all apps, because we don't know on which device an app is running. This filters the sidebar to only show Android apps, when an Android device is selected and only show iOS apps when an iOS device is selected.
Still, we can't filter when where are more simulators with the same OS.

Reviewed By: jknoxville

Differential Revision: D8766007

fbshipit-source-id: dcf0db41b2c2c5dcaa2d1700343b1dd45d3d53b0
2018-07-09 05:32:38 -07:00
Sam Goldman
51741a2741 Update Sonar from 0.69.0 to 0.70.0
Summary:
All the new errors were missing annotation errors. I fixed as many as I could
by adding annotations. For the rest I added a $FlowFixMe suppression type.

Reviewed By: nmote

Differential Revision: D8756267

fbshipit-source-id: a69b6e21525b9b12e582ff18dcb1eeea584abb2a
2018-07-06 16:04:19 -07:00
Daniel Büchele
809136fc29 fix plugin state initialization
Summary: Many plugins initialized their state in the init function. Due to changes in how plugins are rendered, the init-function might be called after the initial render and therefore the state being undefined at the first render. This moves the state initialization into a instance variable to ensure they are created before the first render.

Reviewed By: jknoxville

Differential Revision: D8746242

fbshipit-source-id: 04af039da2dc00c14a2d8ac42b72559ce789ef57
2018-07-06 03:17:54 -07:00
Sara Valderrama
d8cf48d750 Two-tree view up and running, separately interactive/editable
Summary: Added duplicate view tree (will be replaced with accessibility node tree eventually). Can toggle ax mode on and off and interact with each tree individually to view/change properties.

Reviewed By: danielbuechele

Differential Revision: D8717557

fbshipit-source-id: 1109ccafd49b6958ee7a70c2e8851ed8351516ae
2018-07-05 16:19:29 -07:00
Sara Valderrama
917376db6d basic layout edits
Summary: Include toggle button, trees/sidebar not separately interactive

Reviewed By: danielbuechele

Differential Revision: D8680613

fbshipit-source-id: 3bc52b66881abc56ea5cc0955f8237509d039fc4
2018-07-05 16:19:28 -07:00
Edoardo Tognoni
53753801b0 Open source the Sandbox plugin
Summary: This diff is mainly moving diffs around to open source the Sandbox plugin. I created the MD file writing some docs. The rest is just making our own FB implementation work

Reviewed By: danielbuechele

Differential Revision: D8731839

fbshipit-source-id: 27ac67223c6de9d1be406ab8c06b71b82d5407bc
2018-07-05 09:19:37 -07:00
Daniel Büchele
03a8e696a9 Screenshot in titlebar
Summary: Now, that we always have one device selected, we can put the buttons for screenshot and screen capture to Sonar's titlebar. This diff also adds support for iOS devices.

Reviewed By: jknoxville

Differential Revision: D8732632

fbshipit-source-id: 56271fbba7b4a2c10c2742c5c457dbb4c3c16777
2018-07-05 07:32:31 -07:00
John Knox
de353a7ed0 Add RecurringError class for errors that should only be logged once per session
Summary:
Some errors such as UI errors should be logged whenever they occur, but some, such as those that occur when a device keeps trying to connect but can't, should not be.
This adds the class and replaces the top recurring errors with it.

Reviewed By: danielbuechele

Differential Revision: D8639448

fbshipit-source-id: f001aa1e90eae6d26a8dbfcd3175b51fc486eae9
2018-07-05 07:17:41 -07:00
Daniel Büchele
0ddeb076bb Update notifications
Summary: Instead of showing a modal alert, we are now showing a notification, when an update is available. Clicking the notification will restart Sonar and install the plugin. Otherwise, the update will be installed on the next start of Sonar.

Reviewed By: jknoxville, priteshrnandgaonkar

Differential Revision: D8732743

fbshipit-source-id: b9e73a0d5b0866ab79b1e17274c501eac2ef41cc
2018-07-05 04:47:20 -07:00
Daniel Buchele
5163f8b9a3 fbshipit-source-id: c71048dfea2a03cf83650b55aa9d1e463251920c 2018-07-04 07:19:44 -07:00
Hilal Alsibai
44f561a683 Add ability to dynamically extend the layout inspector sidebar
Summary: This adds the ability to extend the layout inspector's sidebar via SidebarExtensions

Reviewed By: sjkirby

Differential Revision: D8677332

fbshipit-source-id: 1880d5d2185306290a278e8a48e965ad94b98cc0
2018-07-03 16:33:42 -07:00
Hilal Alsibai
55930db6a6 Open source desktop shared preferences plugin
Summary: The Android plugin has already been open sourced. This seemed to have fallen through the cracks.

Reviewed By: danielbuechele

Differential Revision: D8661536

fbshipit-source-id: eefbf224230f055db7ab5b5a0e04c192d3309132
2018-07-02 11:05:14 -07:00
John Knox
266af3e274 Display message when "Operation Not Permitted" bug is seen
Summary:
On certain samsung devices, the 'run-as' command, inside adb shell doesn't work.
We don't yet have a workaround for this, otherwise potentially upgrading to android 8.
Distinguish these errors (log them so we'll see how often it happens), and tell the user why it's not working.

Reviewed By: danielbuechele

Differential Revision: D8638728

fbshipit-source-id: f4764120cc27187330a3f236636292a5e63e8ec9
2018-06-26 13:02:17 -07:00
Daniel Büchele
5edb8bd770 clean up dynamic plugin loading
Summary:
There are 3 sources where plugins can be loaded from:
* `src/plugins`
* `src/fb/plugins`
* any path specified in `~/.sonar/config.json`

Plugins found in the first two directories are bundled with the app when building.

Reviewed By: jknoxville

Differential Revision: D8636061

fbshipit-source-id: 2064090d43d11695ffd99df195e5b594559fe087
2018-06-26 07:17:39 -07:00
John Knox
361a4cca76 Fix Logger issue in OSS build (#102)
Summary:
We've replaced the global console.* methods with those in the Logger.
The OSS Logger uses a different implementation to the internal fb one, and it still calls back to console.*, causing a stack overflow.
Fix it by removing the console calls from Logger.js.
Logging to the original console methods is done by the Proxy in App.js.

Fixes #101
Closes https://github.com/facebook/Sonar/pull/102

Reviewed By: priteshrnandgaonkar

Differential Revision: D8617042

Pulled By: jknoxville

fbshipit-source-id: 055bf0e1a2fba8ad5312c88fa97a44389eb52390
2018-06-25 14:05:03 -07:00
Daniel Büchele
cbab597236 show only one device in sidbar
Summary:
Refactors the plugin architecture of Sonar:
- Before plugin rendering had it's own implementation of the react lifecycle. This means the `render`-function was not called by react, but rather by the application it self. In this diff, the render method is now called from react, which enables better debugging and allows react to do optimizations.
- Business logic for querying emulators is moved away from the view components into its own dispatcher
- All plugin handling is moved from `App.js` to `PluginContainer`.
- The sidebar only shows one selected device. This allows us to add the screenshot feature as part of the Sonar main app and not a plugin.
- This also fixes the inconsistency between the devices button and the sidebar

Reviewed By: jknoxville

Differential Revision: D8186933

fbshipit-source-id: 46404443025bcf18d6eeba0679e098d5440822d5
2018-06-25 10:04:00 -07:00
Daniel Büchele
0c2f4d7cff split Client/Server
Summary: The `Client` and `Server` code was in one file, which was messy. This splits it into two separate files.

Reviewed By: emilsjolander

Differential Revision: D8186932

fbshipit-source-id: faa79d7dccd867d69ccd1bccd43a2cf85314b1b3
2018-06-25 10:04:00 -07:00
Daniel Buchele
6fda334a00 fbshipit-source-id: 5d9ecf33fca19e4a6b8c979b879ec9dd82af1ef9 2018-06-25 04:33:04 -07:00
John Knox
54fa6aa8f2 Replace usages of ErrorReporter with Logger
Summary:
At the moment, in sonar we have an error reporter and a Logger.
ErrorReporter can be encapsulated into Logger, so users don't have to decide between logging and reporting errors.

Reviewed By: danielbuechele

Differential Revision: D8531902

fbshipit-source-id: 3986f51ea163ac939f3baffd4db3ab968f2a0762
2018-06-20 06:18:26 -07:00