Summary: moved `app/src/server` to `flipper-server-core/src` and fixed any fallout from that (aka integration points I missed on the preparing diffs).
Reviewed By: passy
Differential Revision: D31541378
fbshipit-source-id: 8a7e0169ebefa515781f6e5e0f7b926415d4b7e9
Summary: Moved Logger, sleep, timeout and server contract types to flipper-common packages.
Reviewed By: passy
Differential Revision: D31475790
fbshipit-source-id: 42d2147698875f9e919ad5250f9953f3bff3ec2d
Summary: Refactor clients storage: array -> map. A lot of logic looks up clients by their id, which is currently done with an array.find operation, which is pretty inefficient. This diff changes it to a map, that is pretty important, as in the next diff the decoupled client message handing will need to find the client again for every message that arrives.
Reviewed By: timur-valiev
Differential Revision: D31303536
fbshipit-source-id: ca3f540a3de7665930d2354436d37cb0fbfd5546
Summary:
Changelog: Improved plugin / device / app selection handing.
During some refactorings I discovered that the `connetions.selectedApp` field contained sometimes an application id, and sometimes just the name. This caused inconsistent behavior especially in unit tests.
I've cleaned that up, and renamed it to `selectedAppId` where applicable, to make the distinction more clear.
And, in contrast, userPreferredApp now always has a name, not an id.
During refactoring our existing selection update logic was quite in the way, which was overcomplicated still, since during the sandy chrome migration, the reducers needed to be able to handle both the old UI, and the new application selection UI. That logic has been simplified now, and a lot of tests were added.
As a further simplification the preferredApp/Device/Plugin are now only read and used when updating selection, but not when running selectors.
Reviewed By: timur-valiev
Differential Revision: D31305180
fbshipit-source-id: 2dbd9f9c33950227cc63aa29cc4a98bdd0db8e7a
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
Summary:
This is the first of many diffs that extracts the connection, device, client detection out of the flipper core, to create a reusable flipper-server library that can be used in e.g. flipper-dump.
To keep diffs a little smaller, the current connection logic is first moved to the `server/` directory, and decoupled manually from the rest of the core, before moving it over to a separate package.
This first diffs moves the `comms/`, `devices/` and certificate utilities to the `server` directory.
Further untangling will follow in next diffs
Reviewed By: timur-valiev
Differential Revision: D30246551
fbshipit-source-id: c84259bfb1239119b3267a51b015e30c3c080866
Summary: As we now allow selection of disabled plugins we need to track plugin usage a bit smarter. We'll add a new field "pluginEnabled" to the logged messages to indicate whether selected plugin is enabled or not.
Reviewed By: cekkaewnumchai
Differential Revision: D29455248
fbshipit-source-id: 32c79e0961653edc8f4cc89adecc2662b37cbd7b
Summary:
This diff generalises computation of the currently selected plugin, app, device etc. and adds this information to all the analytics events and error reports.
Slicing of events by os, device, app or selected plugin can be very useful. This is especially true for errors which often affects only certain types of devices, e.g. android only or physical devices only. Having such information can help to narrow down such issues.
Reviewed By: passy
Differential Revision: D28511441
fbshipit-source-id: ed9dc57927c70ed8cc6fe093e21604eae54c2f60
Summary: We received questions several times from plugin authors on how to find usage for particular app/platform and I wanted to add that data on plugin usage dashboard, but right now it's impossible. We're only collecting plugin ID as a part of plugin usage analytics. That means it's impossible to filter some plugin usage (e.g. "Network") by particular platform or mobile app. This diff improves plugin usage analytics to collect enhanced data.
Reviewed By: passy
Differential Revision: D27935801
fbshipit-source-id: c2fc7d8cf84f9a28823ae56a1dda7158e0b12f1f
Summary:
Renamed actions "star" and "unstar" everywhere to "enable", "disable" and "switch". The logic behind original "star" action changed significantly, so this rename just makes everything much clearer.
Please note that as a part of rename persisted state fields "userStarredPlugins" and "userStarredDevicePlugins" were renamed. I've added a "redux-persist" migration for seamless transition.
Reviewed By: passy
Differential Revision: D26606459
fbshipit-source-id: 83ad475f9b0231194701c40a2cdbda36f02c3d10
Summary: When trying to refactor some components, did once again run into circular imports that cause the flipper startup sequence to fail. Added linting rules to make sure this is much less likely to happen in the future, and fixed all resulting errors
Reviewed By: nikoant
Differential Revision: D24390583
fbshipit-source-id: 9b20cf6a4d3555dc68f0069c2950dd7162b17e67
Summary: Really nothing interesting to see here , just moved pluginStats out of messageQueue, as it started there and kept growing
Reviewed By: nikoant
Differential Revision: D22257318
fbshipit-source-id: 26be7efb4629fcef1b14de96a2b60f17f7d76785
Summary:
I was trying to plot some graphs based on our background plugin stats, grouped per plugin, but discovered that we can't exploded or group on json object keys, so separated the data into separate `plugin-stats-plugin` events, as is done with the `time-spent` event.
Also fixed:
* grouping stats per plugin, rather than per plugin method, which was to fine-grained
* added `bytesReceived` field to the cumulative event `plugin-stats`
Reviewed By: jknoxville
Differential Revision: D21046016
fbshipit-source-id: 1043612064921cf6427d5b3bbee10b76776df39e
Summary:
Measure how many byte we receive per plugin, and add this to the plugin stats that are collected
Will add a graph to the flipper dashboard, and probably a small visualization in a next diff as well.
Reviewed By: priteshrnandgaonkar
Differential Revision: D20917583
fbshipit-source-id: bb341531ecf8492080af82c56e73c0ec608f7b36
Summary:
This adds another field to the exit data to record whether we had a clean exit where the app was closed as it should.
Note that doing a reload inside Flipper will be recorded as an unclean exit.
Reviewed By: passy
Differential Revision: D20915481
fbshipit-source-id: 240192d7a69bf620bfaa316e3e5cb0f45d6a34cc
Summary:
Quick notes:
- This looks worse than it is. It adds mandatory parentheses to single argument lambdas. Lots of outrage on Twitter about it, personally I'm {emoji:1f937_200d_2642} about it.
- Space before function, e.g. `a = function ()` is now enforced. I like this because both were fine before.
- I added `eslint-config-prettier` to the config because otherwise a ton of rules conflict with eslint itself.
Close https://github.com/facebook/flipper/pull/915
Reviewed By: jknoxville
Differential Revision: D20594929
fbshipit-source-id: ca1c65376b90e009550dd6d1f4e0831d32cbff03
Summary:
1) moved "sonar/desktop/src" to "sonar/desktop/app/src", so "app" is now a separate package containing the core Flipper app code
2) Configured yarn workspaces with the root in "sonar/desktop": app, static, pkg, doctor, headless-tests. Plugins are not included for now, I plan to do this later.
Reviewed By: jknoxville
Differential Revision: D20535782
fbshipit-source-id: 600b2301960f37c7d72166e0d04eba462bec9fc1