Summary:
- New improved UI
- Instead of sending the callstack as a string from android, now sending it as an array
- Deeplink to Logs support just for android. In iOS crash is not automatically logged in Logs plugin, atleast thats what happens in sample app
Reviewed By: jknoxville
Differential Revision: D13216477
fbshipit-source-id: d8b77549c83572d0442e431ce88a8f01f42c9565
Summary:
Plugins were loaded in `/plugins/index.js` which was loaded once at launch of the app. This moves the list of available plugins to redux. This way, plugins can be dynamically added. The redux store keeps to Maps of plugins (devicePlugins and clientPlugins) with their ID as key:
```
devicePlugins: Map<string, Class<FlipperDevicePlugin<>>>,
clientPlugins: Map<string, Class<FlipperPlugin<>>>,
```
On launch of the app, all plugins bundled with the app and the one found in `pluginsPath` are dynamically added.
This changes now allows to add new plugins at any time. All components that need to know which plugins are available (e.g. the sidebar) are connected to the redux store. This way, they will automatically update, whenever a new plugin is added.
- add `plugins` to the redux store to keep the list of available plugins
- add a plugins dispatcher, responsible for loading the plugins on launch
- connecting all React components that imported `plugins/index.js` before to the redux store to get the plugins from there.
- moved the updating of the MenuBar to the plugins dispatcher as it needs to update whenever a new plugin is added.
Reviewed By: jknoxville, passy
Differential Revision: D12449236
fbshipit-source-id: 6ef3e243e2c80443614b901ccbfde485fcb4301c
Summary: React has a built in API for computing the state from props called `getDerivedStateFromProps`. So let's use this instead of our custom implementation.
Reviewed By: jknoxville
Differential Revision: D10484213
fbshipit-source-id: 4c434c5252dabfc2f6015cb6a50719b985c60446
Summary:
Allow linking from one plugin to another. Adds a prop `selectPlugin` to the plugin that can be passed a pluginID and an optional `deepLinkPayload`.
The return value tells you if switching the plugin was successful.
```
selectPlugin: (pluginID: string, deepLinkPayload: ?string) => boolean,
```
Reviewed By: passy
Differential Revision: D10483925
fbshipit-source-id: 6f821277150b2db185b7d545c310214a11432eac
Summary: adding a `static defaultPersistedState` which plugins can use to populate their persistedState for the first render.
Reviewed By: passy
Differential Revision: D10446987
fbshipit-source-id: eb37553db7bbec31edf5b4972176e71f303639fe
Summary:
Adding a static method plugins can implement to trigger notifications:
```
static getActiveNotifications: ?(persistedState: P) => Array<Notification>;
```
When the plugin's persisted state changes, this API is called from the `notification`-dispatcher which updates the notifications store.
Reviewed By: passy
Differential Revision: D10378434
fbshipit-source-id: 778fe3ad4229b03bd5ba14ebfdafa5020c25f34f
Summary: As all device plugins are now moved to the plugins folder, this was the last thing in this folder. I am moving it out and putting it next to the core UI parts of the app.
Reviewed By: jknoxville
Differential Revision: D10337838
fbshipit-source-id: 6fa699c28e5df8a53719179fbb760f2a140bafc4
Summary:
Restore the logic for setting and computing notifications that was
partially removed with D10300838.
Reviewed By: jknoxville
Differential Revision: D10361547
fbshipit-source-id: 4d229d5f4dbeda3139463e1c348909b9c5dba66f
Summary:
Adds a new type of plugin: `FlipperBackgroundPlugin`
Background plugins are not torn down when the user switches to another plugin so they keep receiving messages in the background.
Background plugins need to use persistedState to keep their data. To handle the messages received in the background they need to implement a static method that merges a message with the current state from redux. The plugin doesn't need to call this method itself, it is called from `client.js`.
```static persistedStateReducer = (
persistedState: PersistedState,
data: Object,
): PersistedState
```
This method is used to handle messages in both foreground and background.
Reviewed By: danielbuechele
Differential Revision: D10256305
fbshipit-source-id: d86da9caa1b75178841a9a347eb427112141eaa3
Summary:
This diff sets up flipper for running plugins in background. This diff does the following
- Adds a function named `runInBackground` to the interface `FlipperPlugin` to make the plugins opt in to be run in background, default is false
- Changes the javascript side of the flipper to store the messages received by the plugins in background
- Process the stored messages when the plugin in background becomes active
- Currently I have just turned on network plugin to be in background mode.
- Remove the buffering from the network plugin, as it will run in background
- Write a batching layer to batch the messages and send to flipper.
Note: I haven't tested the wilde app yet, but the sample app works. I will remove the "[WIP]" from the title once I have tested it in wilde
Reviewed By: danielbuechele
Differential Revision: D10301403
fbshipit-source-id: 034eebf659a545d6b480a4ac1b73b0aa4b2f9797
Summary:
* move CPU and Logs plugin to plugins directory, set up package.json for them
* adjust plugins/index.js to expose device and client plugins in the same place, adding two new exports
Reviewed By: danielbuechele
Differential Revision: D10247606
fbshipit-source-id: 347bf8b3f9629987ad29d1d2ed025e0c88b9c967
Summary:
- Adds the Flipper notifications UI from the hackweek
- The notifications plugin is hidden behind a GK `flipper_notifications`
- Plugins currently can not dispatch any notifications
Reviewed By: jknoxville, passy
Differential Revision: D10300838
fbshipit-source-id: 2a3a823f09fee3370ce725b506b162e57751c382
Summary:
Method `computeNotifications` added to the base plugin class.
Plugins should implement this to define a mapping from their state+props to the notifications they are emitting.
I've plugged this into componentDidUpdate, because we don't yet have the background plugin infra. When we do, we'll want some other incoming data hook to use so it's not tied to the react component rendering.
Example usage added to network plugin in the next commit.
Reviewed By: passy
Differential Revision: D10127875
fbshipit-source-id: efd4d8cfc0d3d33852a6cf9a290549a5f90d389d
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
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
Summary: Track the time from when the plugin is selected until its `init()` function finishes.
Reviewed By: passy
Differential Revision: D9239750
fbshipit-source-id: 569f236c9d58f70548f1ba6bf31a96047dcc8245
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
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
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
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
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
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