Commit Graph

31 Commits

Author SHA1 Message Date
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
Daniel Büchele
e70ebc4c59 check android emulator names
Summary: maliciously named Android emulators could execute arbitrary commands. This checks makes sure the emulator name only has valid characters and puts them in quotes to prevent executing other commands.

Reviewed By: jknoxville

Differential Revision: D8489024

fbshipit-source-id: d91011ceaa8abf0ac53a308089cbdd0b0db03b54
2018-06-19 04:02:20 -07:00
Daniel Büchele
7406af9c3a old version check
Summary:
Remove old version number check. `AutoUpdateVersion` is used instead for macOS, we currently do not support auto-updates on other platforms.
This also removes the leaked Intern Graph secret.

Reviewed By: emilsjolander

Differential Revision: D8488849

fbshipit-source-id: 0853e8f868137972f718847c49038304525e1e06
2018-06-18 11:07:16 -07:00
John Knox
8b2a2b12a3 Add LibreSSL support (and other openssl implementations)
Summary:
Common Name extraction by regex was failing on LibreSSL.
Now using RFC2253 to unamiguously format distinguished name subject strings.

Reviewed By: emilsjolander

Differential Revision: D8452825

fbshipit-source-id: a18d4162a7aed3b5bd8c2996ff3832877dac90db
2018-06-18 03:47:21 -07:00
Daniel Buchele
6f95ad512f fbshipit-source-id: b14273e883aba6de7b817801a1b04e54a29a6366 2018-06-15 02:23:48 -07:00
Michael Evans
5c779b9176 Remove hardcoded path to Android SDK directory
Summary: Closes https://github.com/facebook/Sonar/pull/19

Differential Revision: D8383484

Pulled By: danielbuechele

fbshipit-source-id: cabf6daed9c0919c186f88eb154d201818723ed6
2018-06-12 12:33:09 -07:00
Daniel Buchele
28be3c7cd8 fbshipit-source-id: cad5f527363fe09c2eea5b05ce1f3f2ecb86941b 2018-06-12 11:42:02 -07:00
sungjk
1fa0eb3ad2 Fix typo in reducers (#34)
Summary:
Fixed typos in reducers
Closes https://github.com/facebook/Sonar/pull/34

Differential Revision: D8379211

Pulled By: danielbuechele

fbshipit-source-id: d1dc6ff80963b931a3d8b1e4abe0f40ade3ba67f
2018-06-12 06:27:42 -07:00
Daniel Buchele
f7d487dd76 fbshipit-source-id: 2cd940396d650342920b28835f6e672febe6b55c 2018-06-12 03:39:09 -07:00
Daniel Büchele
fbbf8cf16b Initial commit 🎉
fbshipit-source-id: b6fc29740c6875d2e78953b8a7123890a67930f2
Co-authored-by: Sebastian McKenzie <sebmck@fb.com>
Co-authored-by: John Knox <jknox@fb.com>
Co-authored-by: Emil Sjölander <emilsj@fb.com>
Co-authored-by: Pritesh Nandgaonkar <prit91@fb.com>
2018-06-01 11:03:58 +01:00