Commit Graph

178 Commits

Author SHA1 Message Date
Pascal Hartig
c0d1510d58 Move android build files to xplat
Summary:
This should work with our existing shipit config. Moves the build
files to xplat and sets up a standard gradle directory structure
that we will continue to move more files into.

Reviewed By: jknoxville

Differential Revision: D8859483

fbshipit-source-id: 5df5882a3bcaee36280af68aeaa740290288e0d3
2018-07-17 03:34:54 -07:00
Sara Valderrama
5ceb3e4ffe Include non-drawable litho components in AX tree + small sidebar edit
Summary:
Fixed issue with DebugComponentDescriptors being left out of accessibility tree so the AX tree now includes all Litho view nodes (not Litho accessibility nodes yet). Litho drawables have no accessibility properties so these are not included. Also changed default for getAXChildAt to do whatever the original view tree does for that node and added a getAXChildCount function to better customize the accessibility tree.

Segmented the ax sidebar into properties directly form the view and properties derived from the AccessibilityNodeInfo.

Differential Revision: D8861129

fbshipit-source-id: 987683ef45188aa9cb587cc0e5ffba8fbf40136d
2018-07-16 17:04:15 -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
Chris Jenkins
3d0cd38f7a Grammar fix
Summary:
Noticed issues in https://fbsonar.com/docs/stetho.html - not sure if this will push there if accepted, but suggesting the changes in any case.

Created from Diffusion's 'Open in Editor' feature.

Reviewed By: jknoxville

Differential Revision: D8852241

fbshipit-source-id: 4a3e564e22ccb1edc43aa4cc335d3a8aeb916f3b
2018-07-16 10:26:10 -07:00
Pascal Hartig
cd6a5f9ff8 Reorganize native dep download and extraction (#154)
Summary:
This moves the native setup to a separate gradle file and unpacks everything outside the build folder. That way we don't throw everything away on every incremental build.

This is an intermediate step to get to a more declarative setup like Fresco has it and get rid of the individual hacks we have for every download.
Pull Request resolved: https://github.com/facebook/Sonar/pull/154

Reviewed By: jknoxville

Differential Revision: D8833812

Pulled By: passy

fbshipit-source-id: 2424c9d6e22e6092c04af344e06939b4a6aba041
2018-07-16 10:26:10 -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
Pritesh Nandgaonkar
73c830fc1b Use tag in podspecs (#152)
Summary:
This diff uses `tag` instead of master branch and also updates the version number to the desktop sdk.
Pull Request resolved: https://github.com/facebook/Sonar/pull/152

Reviewed By: danielbuechele

Differential Revision: D8820016

Pulled By: priteshrnandgaonkar

fbshipit-source-id: ff2e554be55254b77c4e130b35b7299abbafa77d
2018-07-12 10:18:17 -07:00
John Knox
9a7017298c Add required permissions to android setup guide
Reviewed By: danielbuechele

Differential Revision: D8821115

fbshipit-source-id: 36949fc9ba5bdbd79d4e3e8349ef7daeebdaa074
2018-07-12 10:03:42 -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
Pascal Hartig
fcd1b1e773 Clean up dependencies (#153)
Summary:
Remove unused dependencies and centralise the remaining ones in the
global project config.
Pull Request resolved: https://github.com/facebook/Sonar/pull/153

Reviewed By: priteshrnandgaonkar

Differential Revision: D8820462

Pulled By: passy

fbshipit-source-id: 1c845898930eb62942379fddec6da39dbdc426d0
2018-07-12 09:05:55 -07:00
Pascal Hartig
c871496f8c Update build deps (#151)
Summary:
Update some build dependencies (gradle, android plugin) and make some
minor cleanups in the gradle files along the way.
Pull Request resolved: https://github.com/facebook/Sonar/pull/151

Reviewed By: priteshrnandgaonkar

Differential Revision: D8818841

Pulled By: passy

fbshipit-source-id: 78b6592dbf967553aadead57a60023a0b5ae79b6
2018-07-12 06:47:41 -07:00
Pascal Hartig
81e1b89b40 v0.6.11 (#150)
Summary:
Depends on #149.

Version bump for Android to bring it in line with the top-level version.
Pull Request resolved: https://github.com/facebook/Sonar/pull/150

Reviewed By: priteshrnandgaonkar

Differential Revision: D8804324

Pulled By: passy

fbshipit-source-id: 6c796f34cf064f117b6195b3c88d9b5c100f8dbb
2018-07-11 09:37:14 -07:00
Pascal Hartig
c7de8b8d37 Link against OpenSSL statically (#149)
Summary:
Compile against a static version of OpenSSL for better compatibility
with apps that already use OpenSSL in some fashion.
Pull Request resolved: https://github.com/facebook/Sonar/pull/149

Reviewed By: priteshrnandgaonkar

Differential Revision: D8804169

Pulled By: passy

fbshipit-source-id: 4de66a77806a3b3f01b2cf5f253916f2cf6f48e8
2018-07-11 08:42:02 -07:00
Daniel Büchele
2fa9cfe4e7 Fix patch version number in public build script
Summary: Accidentally the version number passed to the build script was not only the patch number but the full semver-number. The build script is expecting a single number and there for ignored the version number that was passed. This caused the build to always have patch version 0.

Reviewed By: priteshrnandgaonkar

Differential Revision: D8804473

fbshipit-source-id: a116cac69066141fe8c8ed62020d16a1a7c40079
2018-07-11 08:42:02 -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
Arvind Menon
dad05de943 Added docs for OkHttp integration (#144)
Summary:
This PR includes documentation for using the `SonarOkhttpInterceptor` for applications using the `OkHttp` network stack. The docs were modelled on the [Stetho docs](http://facebook.github.io/stetho/#enable-network-inspection)

Fixes #22.
Pull Request resolved: https://github.com/facebook/Sonar/pull/144

Differential Revision: D8780506

Pulled By: danielbuechele

fbshipit-source-id: fb2ddd4356b421c3baf0a80a410dd579ebc1bd8d
2018-07-10 03:32:16 -07:00
Daniel Büchele
dfddcc483e electron-update
Summary: Update to electron 2.0.4

Reviewed By: priteshrnandgaonkar

Differential Revision: D8767709

fbshipit-source-id: e7ddb626c59e2797ef68bb61e0938dcfc05e1980
2018-07-10 02:33:52 -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
John Knox
d0ecb46d64 Skip initialisation if not running in own thread
Summary:
One design goal of sonar is to never cause the host app to crash or hang.
For this reason, we do all heavy work in a background thread.
If we detect that it's not running in it's own thread, just return so we don't hold up the caller.

Reviewed By: danielbuechele

Differential Revision: D8767288

fbshipit-source-id: e146cc2cfe5c3e62d12f527ff79f24c74873d4ff
2018-07-09 07:49:09 -07:00
John Knox
85e6bf6d51 Stop using delayedUnsafe
Summary:
Having another attempt at removing this. It's unsafe because it in some cases executes the .then() task in the timekeeper thread, rather than the executor the original future is using.
When that default executor is an InlineExecutor, for example, you can get stack overflow.

I tried to remove this use before, but having the same thread used for both the sonar client itself and rsocket, meant that they entered a deadlock trying to connect.
Now that I've separated those jobs into separate threads, they can execute independently.

Reviewed By: danielbuechele

Differential Revision: D8748356

fbshipit-source-id: a1029ece2c7006ad7642cbf8aa59e692c76b19b2
2018-07-09 07:49:08 -07:00
John Knox
26d58557ee Android: Use separate thread for network connection
Summary:
We currently give sonar one event base from java / obj-c code to use for scheduling tasks.
This causes a problem, because we schedule reconnect tasks on the event base, and then these tasks interact with rsocket which schedules it's own tasks.
The problem is that we're passing rsocket the same event base. So the reconnect code executes and blocks waiting for rsocket to connect.
But rsocket can never connect because it never executes because that thread is blocked, so we get deadlock.

Fixing it by giving both processes their own event base / thread.

Reviewed By: danielbuechele

Differential Revision: D8748354

fbshipit-source-id: aa00766059f66fadfecb1970492bbb7107bbbfe4
2018-07-09 07:49:08 -07:00
John Knox
09c9aad32d iOS: Use separate thread for network connection
Summary:
We currently give sonar one event base from java / obj-c code to use for scheduling tasks.
This causes a problem, because we schedule reconnect tasks on the event base, and then these tasks interact with rsocket which schedules it's own tasks.
The problem is that we're passing rsocket the same event base. So the reconnect code executes and blocks waiting for rsocket to connect.
But rsocket can never connect because it never executes because that thread is blocked, so we get deadlock.

Fixing it by giving both processes their own event base / thread.

Reviewed By: danielbuechele

Differential Revision: D8748355

fbshipit-source-id: b0ad2172087f0103180677438f427c831db7f42c
2018-07-09 07:49:08 -07:00
John Knox
cebc409da6 Change SonarInitConfig to take two EventBases
Summary:
We currently give sonar one event base from java / obj-c code to use for scheduling tasks.
This causes a problem, because we schedule reconnect tasks on the event base, and then these tasks interact with rsocket which schedules it's own tasks.
The problem is that we're passing rsocket the same event base. So the reconnect code executes and blocks waiting for rsocket to connect.
But rsocket can never connect because it never executes because that thread is blocked, so we get deadlock.

This is the first step which just changes the interface to pass two event bases.
The consumers will be changed to pass in different threads next.

Reviewed By: danielbuechele

Differential Revision: D8748350

fbshipit-source-id: 481d6f23644f28fd0f1c786252605287019c999c
2018-07-09 07:49:07 -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
Pascal Hartig
540776f172 Add Travis link to readme (#141)
Summary:
![](https://media1.giphy.com/media/vntyBKuV7FwZO/giphy.gif)
Pull Request resolved: https://github.com/facebook/Sonar/pull/141

Reviewed By: jknoxville

Differential Revision: D8766655

Pulled By: passy

fbshipit-source-id: 04026f06d248880e5373806769613e9226aa712f
2018-07-09 07:19:22 -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
Hilal Alsibai
56cfe6600d Add Shared Preferences plugin docs
Summary: Moar docz

Reviewed By: danielbuechele

Differential Revision: D8752565

fbshipit-source-id: d7e4392e00dc06b0ffbebce491d5244b4b31a34d
2018-07-09 02:48:37 -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
Conor O'Donnell
d45bc14cce Keep strong reference to OnSharedPreferenceChangeListener (#131)
Summary:
A strong reference to the listener should be kept when calling `registerOnSharedPreferenceChangeListener`, otherwise the listener can get garbage-collected and stop working.

Mentioned in the Android SDK docs [here](https://developer.android.com/reference/android/content/SharedPreferences.html#registerOnSharedPreferenceChangeListener(android.content.SharedPreferences.OnSharedPreferenceChangeListener)):

> Caution: The preference manager does not currently store a strong reference to the listener. You must store a strong reference to the listener, or it will be susceptible to garbage collection. We recommend you keep a reference to the listener in the instance data of an object that will exist as long as you need the listener.
Closes https://github.com/facebook/Sonar/pull/131

Differential Revision: D8751484

Pulled By: xiphirx

fbshipit-source-id: e46715d637c89491770c266fc22c27db41beb042
2018-07-06 13:03:44 -07:00
Hilal Alsibai
3af57b1ad9 Fix minor typo in alt text for network plugin image
Summary: Typo

Reviewed By: danielbuechele

Differential Revision: D8751861

fbshipit-source-id: 26e89222a6e745dac4f114d62ad1fa6faebbecd6
2018-07-06 12:49:55 -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
Pritesh Nandgaonkar
3833f061e2 Android travis
Summary: Closes https://github.com/facebook/Sonar/pull/136

Reviewed By: danielbuechele

Differential Revision: D8735101

Pulled By: priteshrnandgaonkar

fbshipit-source-id: 648756cf67f07abb6e0c80b677fa01bf5c5085b7
2018-07-05 10:18:18 -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
Hilal Alsibai
2a46f93eab Fix install for Windows (#138)
Summary:
This lets `yarn` work properly on Windows. Tested in a Cygwin environment. I also added a note about yarn compatibility to the readme.
Closes https://github.com/facebook/Sonar/pull/138

Reviewed By: danielbuechele

Differential Revision: D8734197

Pulled By: xiphirx

fbshipit-source-id: 19be8bb0653a2b0381224b065df0cac579d72c3b
2018-07-05 03:32:30 -07:00
Pritesh Nandgaonkar
49c533ed35 Travis badge (#135)
Summary:
Adds travis badge
Closes https://github.com/facebook/Sonar/pull/135

Reviewed By: danielbuechele

Differential Revision: D8732766

Pulled By: priteshrnandgaonkar

fbshipit-source-id: 51ba49b0382f9bef88f297d061e30c862b751cd1
2018-07-04 11:33:36 -07:00
Pascal Hartig
020a771125 Clean up Folly CMakeLists (#127)
Summary:
Remove left over from local testing.
Closes https://github.com/facebook/Sonar/pull/127

Reviewed By: danielbuechele

Differential Revision: D8723789

Pulled By: passy

fbshipit-source-id: f08203a441c35860dd5257a0ec147d1bf9c3da60
2018-07-04 11:33:36 -07:00
Pascal Hartig
c4696303fc v0.0.10 (#129)
Summary:
New release including x86_64 binaries.

Depends on #128.
Closes #111.
Closes https://github.com/facebook/Sonar/pull/129

Reviewed By: danielbuechele

Differential Revision: D8723869

Pulled By: priteshrnandgaonkar

fbshipit-source-id: f52ce3eaf28e3f18f7099d17647c1650d3fa7c58
2018-07-04 10:17:52 -07:00