Commit Graph

643 Commits

Author SHA1 Message Date
Pritesh Nandgaonkar
c98a463464 Ignore Podfile.lock (#297)
Summary:
This PR puts Podfile.lock in gitignore
Pull Request resolved: https://github.com/facebook/flipper/pull/297

Reviewed By: passy

Differential Revision: D10447350

Pulled By: priteshrnandgaonkar

fbshipit-source-id: 8de6e92f6e53972e8dc5af3b09d18259020c89c5
2018-10-21 16:09:48 -07:00
Pascal Hartig
c5a94d871c Bump gradle tools
Summary: Otherwise latest Android Studio complains.

Reviewed By: jknoxville

Differential Revision: D10464342

fbshipit-source-id: 4351574f2bd8ca5742ed057f3441571575e0940c
2018-10-20 05:11:14 -07:00
Pascal Hartig
cb186d2af3 Fix sample app style issues
Summary:
Start adding Nullable and finals in some places to
make our sample app (and hopefully rest of the codebase) follow
some of the standards we have in place elsewhere.

Reviewed By: jknoxville

Differential Revision: D10463816

fbshipit-source-id: 7df6758919331ba8a334c94214b9e02bbab8cd2d
2018-10-20 05:11:14 -07:00
Daniel Büchele
f1c6ebfbd5 disable GK
Summary: Adding a GK to be able to disable notifications remotely.

Reviewed By: passy

Differential Revision: D10467036

fbshipit-source-id: ee555bd73cb5c58d1113e28fe88fe605480865cf
2018-10-19 10:53:13 -07:00
Daniel Büchele
1f84a6244c update persistedStateReducer API
Summary:
upadting to the new API:
```
static persistedStateReducer: ?(
  persistedState: P,
  method: string,
  data: Object,
) => $Shape<P>;
```

Reviewed By: jknoxville

Differential Revision: D10466918

fbshipit-source-id: 08ba963c6ae744d8d445e375c41f601e9bafd4da
2018-10-19 09:59:41 -07:00
John Knox
6cc7f60cde Add sample js and android plugin
Summary:
The start of an example plugin.

My intention is for this to be a place that we keep up to date with the current best practice for doing things.

For example, with the introduction on persistedStateReducer, there are two ways to receive incoming messages, but only one of them works in the background. This should act as a guideline.

For this reason, don't hold back on reviewing it. I want it to be 👌

Reviewed By: priteshrnandgaonkar

Differential Revision: D10448592

fbshipit-source-id: d5fa978c14e47a7fa3c9a29d0929d5a6109267af
2018-10-19 09:44:05 -07:00
Pascal Hartig
881d066369 Flipper Release: v0.10.0
Summary: Featuring the new notification API. 🛎🎉

Reviewed By: jknoxville

Differential Revision: D10466460

fbshipit-source-id: 11a5bf9b83844bc623acd2dd9d7504dea2b61018
2018-10-19 09:25:28 -07:00
Daniel Büchele
61d80b4bb9 network deeplink
Summary: Deep link from the QPL plugin into the network plugin

Reviewed By: passy

Differential Revision: D10462528

fbshipit-source-id: cc044863191fc4375390165f6b7b7d5c5e9c77e3
2018-10-19 08:39:51 -07:00
Daniel Büchele
1904cc3521 Docs for notifications
Summary: as per title

Reviewed By: passy

Differential Revision: D10449043

fbshipit-source-id: 70fac302f9c5ebc4d7ca9950aa8fab1c3e71006e
2018-10-19 08:35:19 -07:00
Daniel Büchele
9a43a00a80 Notifications UI
Summary:
- Adding hover buttons
- showing timestamp
- adjusting colors

Reviewed By: passy, priteshrnandgaonkar

Differential Revision: D10461877

fbshipit-source-id: 1a384428ab2ce5d22a0e619055b04c1afdcbcb63
2018-10-19 07:24:19 -07:00
Pritesh Nandgaonkar
d89e559dbd Move QPL plugin to Background Plugin
Summary: Makes QPL iOS plugin to work in background

Reviewed By: jknoxville

Differential Revision: D10446049

fbshipit-source-id: 02ad6f6f83b13e326b6fdd8aa972fa7d29c76eb9
2018-10-19 06:49:47 -07:00
Daniel Büchele
4f08fd8711 remove pluginStates on disconnect
Summary:
When a client disconnects, we want to remove all plugins states for this client, so the next time the client reconnects the plugins start with an empty state.

The main use case for this is when recompiling the app and launching it in the simulator, we don't want to show old network-requests or QPL events.

Reviewed By: passy

Differential Revision: D10447808

fbshipit-source-id: 5fb3f24ee37f564e8dc00315bff86a2bcd5f65f2
2018-10-19 05:14:17 -07:00
Daniel Büchele
a8a512fe44 network defaultPersistedState
Summary: using defaultPersistedState in network plugin to remove unnecessary null check

Reviewed By: passy

Differential Revision: D10446988

fbshipit-source-id: b0290e4b678c36c031ecd0fba88cdb9add24b46e
2018-10-19 05:14:17 -07:00
Daniel Büchele
4090c2d096 defaultPersistedState
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
2018-10-19 05:14:17 -07:00
John Knox
d48f93edea Add method field to persistedStateReducer
Summary:
When sending a message from the mobile side, you call something like:

`send(method: string, params: Object)`

But when receiving it in the reducer, you only get the params. Adding method so you can distinguish them.

Reviewed By: passy

Differential Revision: D10447890

fbshipit-source-id: f1fe925e82355866f86b322ecd3c72c604ae86af
2018-10-19 03:37:59 -07:00
Pascal Hartig
48f9b350fe Upgrade Metro to 0.48
Summary:
Just to stay up-to-date. No breaking changes affecting us:
https://github.com/facebook/metro/releases/tag/v0.48.0

Also bumping babel-generator to be in line with the others.

Reviewed By: danielbuechele

Differential Revision: D10446300

fbshipit-source-id: b373bc6b1e6e53f2f760730679d1667928002e5f
2018-10-18 14:52:48 -07:00
Daniel Büchele
6d18701d6a disable ASAR
Summary:
Metro's new version using `jest-haste-map` wants to access files inside our ASAR bundle, not using electron's require function. This fails, because it can not read from inside the ASAR bundle. For this reason we are disabeling ASAR for now.

Additionally, we are disabling reloads when a hidden file changes. This is because watchman creates a `.watchman-cookie` which shoudln't triggers a reload. But in general I think it's safe to not reload when hidden files are changed, as they are unlikely to have actual code in them.

Reviewed By: passy

Differential Revision: D10426715

fbshipit-source-id: 6ad9dcf88c62d5b65a9736eff28aadaf89c6af7a
2018-10-18 02:56:17 -07:00
Daniel Büchele
f973bdd455 add notification API to network plugin
Summary: Trigger notifications for all network requests having an error status code.

Reviewed By: passy

Differential Revision: D10401402

fbshipit-source-id: 8fa63cbc251457142abd71845fb6f1c735b247cc
2018-10-18 02:47:53 -07:00
Daniel Büchele
38268fe4c9 whitelist persisted reducers
Summary:
We only want to persist certain reducers that are whitelisted.

Currently some parts of the `connections` reducer and everything from the other reducers was persisted. This changes the behavior to only persist what is explicitly whitelisted and not the other reducers.

These pars of the store are whitelisted:
- `connections.userPreferredDevice`
- `connections.userPreferredPlugin`
- `connections.userPreferredApp`

Reviewed By: jknoxville

Differential Revision: D10401403

fbshipit-source-id: e4aa4f2b2f8f6229b02dcf46798965fa1ae74df6
2018-10-18 02:47:53 -07:00
Daniel Büchele
51f70fd78c call notifications API
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
2018-10-18 02:47:52 -07:00
Pritesh Nandgaonkar
ce996ba8af Add listener in the renderer process for deeplink
Summary:
- Set userPrefferedPlugin for external deeplink
- Listen for deeplink in renderer process and navigate accordingly

Reviewed By: passy

Differential Revision: D10339035

fbshipit-source-id: 4de6249a0672f9ce02b0dfb78a4563302c308578
2018-10-17 06:21:01 -07:00
Pritesh Nandgaonkar
4f914a655e Register flipper: scheme for deeplink
Summary: This diff adds a basic setup of deeplink, with this diff whenever the link is entered in the browser the flipper app is opened and the corresponding.

Reviewed By: passy

Differential Revision: D10149797

fbshipit-source-id: ddff3d794aec66f9e878abcf4c81e87dfadca070
2018-10-17 06:21:01 -07:00
Pritesh Nandgaonkar
603c4c5fbc Layout Plugin support for swift (#295)
Summary:
Changed the podspec file to expose only those header files in public which are necessary. The exposed public header files have no c++ in it, thus due to this layout plugin now works for swift too.

Fixes #174

![ezgif com-video-to-gif](https://user-images.githubusercontent.com/3865908/46979109-9c5a4b80-d0c8-11e8-8f86-639dfba51efe.gif)
Pull Request resolved: https://github.com/facebook/flipper/pull/295

Reviewed By: passy

Differential Revision: D10389202

Pulled By: priteshrnandgaonkar

fbshipit-source-id: 0ecc428f8008dd3aac48a675a8b97bb610f8e9eb
2018-10-16 08:37:57 -07:00
John Knox
c544199289 Fix flipper crashing app bug
Summary: Fixing bug based on stack trace from crash: P59988055

Reviewed By: passy

Differential Revision: D10161779

fbshipit-source-id: 8ad4a7b41144817dfcddb5431326e98fd176adec
2018-10-16 06:46:20 -07:00
Daniel Büchele
fede0b854e iOS device availability
Summary: Apple seems to have changed the key for device availablility. We check for both now.

Reviewed By: jknoxville

Differential Revision: D10401073

fbshipit-source-id: 284a168a701eb2d5d9b3cbcac2aa6276ee1a2211
2018-10-16 06:36:06 -07:00
Daniel Mueller
12a2c0ee70 Add option to display network response as copyable json
Summary: This is meant to reduce the friction of getting network response payloads. Simple switch allows developers to go to "formatted" body ui which shows the json in a text blob.

Reviewed By: passy

Differential Revision: D10378877

fbshipit-source-id: 87aeff5318f0c2c6d3d91d7e3b491595794e69bf
2018-10-16 03:55:43 -07:00
Pritesh Nandgaonkar
92498ec6f8 Update version name to the snapshot
Summary: As per title

Reviewed By: passy

Differential Revision: D10380459

fbshipit-source-id: 006aa76fc0254687d1d4591528f8a04884a8a4ec
2018-10-16 03:20:11 -07:00
Pascal Hartig
9f24f05167 Best effort of extending immutable declaration
Summary:
It's still very much incomplete but this now exports
some of the top-level functions I'm about to use.

I'd love to just import f71ccd5db2/type-definitions/immutable.js.flow but this doesn't actually work as a module declaration because top-level type declarations are incompatible with it at the moment ... sigh.

Reviewed By: danielbuechele

Differential Revision: D10378353

fbshipit-source-id: 3023882b8bd38cf25d9a6c97905ff71548105775
2018-10-16 03:07:38 -07:00
Pritesh Nandgaonkar
b367e38050 Flipper Release: v0.9.0
Summary: New Flipper Release: v0.9.0

Reviewed By: passy

Differential Revision: D10378915

fbshipit-source-id: 90e0c4fe7a7fb690f68afddc7781ff0c5bd35d15
2018-10-15 11:37:29 -07:00
Pritesh Nandgaonkar
9c96ab1565 Documentation for background plugin
Summary: Documentation for background plugin

Reviewed By: passy

Differential Revision: D10378898

fbshipit-source-id: 42f23b9464c41ee2f329301233c1e01d0ae05e95
2018-10-15 11:37:29 -07:00
Pritesh Nandgaonkar
14e38c087f Add runInBackground Interface method
Summary:
Add support for plugins to opt in to background for android.
This diff does the following
- Adds a method `runInBackground` in java interface of `FlipperPlugin`
- Make the network plugin opt in to run in background

Reviewed By: danielbuechele

Differential Revision: D10360033

fbshipit-source-id: b31c7550d00b760b7033c150232e3925b6272d24
2018-10-15 05:47:25 -07:00
Pascal Hartig
e58961e184 Use compileOnly dependency (#294)
Summary:
Fixes #293.
Pull Request resolved: https://github.com/facebook/flipper/pull/294

Reviewed By: danielbuechele

Differential Revision: D10367678

Pulled By: passy

fbshipit-source-id: 69ccdc470b20d5d43e1bb3c1eb4e52c2e01debb5
2018-10-15 03:11:37 -07:00
Daniel Büchele
faf521aa87 use pastry for createPaste
Summary:
Moving from `arc` to `pastry` to create Pastes.
arc paste is deprecated and throws errors sometimes. Pastry seems to be the tool of choice now and has a nicer API anyways.

Reviewed By: passy

Differential Revision: D10302075

fbshipit-source-id: a846adf3768a2adf5c7ff73dc89b18c1e9169ac0
2018-10-15 03:08:58 -07:00
Daniel Büchele
8d7774c409 don't minify plugins
Summary: The minifier removed `debugger` statements from the plugins. We don't need to minify the plugins, because we don't care about bundle size, so we can just disable minification for plugins.

Reviewed By: alangenfeld

Differential Revision: D10334694

fbshipit-source-id: 0b3e23db107f960a3dbeb6a79aa24bacca41c230
2018-10-15 03:05:16 -07:00
Daniel Büchele
e86a756e3c remove PortForwarder
Summary: Removing PortForwarderMacApp as it is not used anymore. Before it was used to allow us to debug physical iOS device. However, the support for physical iOS device was removed a while ago for security reasons. The PortForwarder was not in use anymore so it is safe to remove it.

Reviewed By: passy

Differential Revision: D10337888

fbshipit-source-id: 93f508ec524a0fc055141176c06d7e7169d83f16
2018-10-15 03:03:35 -07:00
Daniel Büchele
22e3017cdc move NotificationHub from plugins to main folder
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
2018-10-15 02:59:37 -07:00
Pascal Hartig
01020edbf2 Restore computeNotifications
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
2018-10-13 04:18:11 -07:00
John Knox
4889f5dc6a Allow plugins to require from /static/
Summary:
Disallowing plugins from requiring anything but flipper or their own package broke lots of plugins at yarn start.
The ones that broke, require from the static directory.
Allowing them for now to unblock people.

Reviewed By: passy

Differential Revision: D10358733

fbshipit-source-id: 37077c806e022a6eb7ecf9bc95a455bf6f9a34d8
2018-10-12 05:48:24 -07:00
Marc Terns
c7ad49a9eb Integrating NSUserDefaults plugin to iOS (#291)
Summary:
I have a few details left, but its almost done. This PR addresses #145

- The NSUserDefaults plugin uses the SharedPreferences Desktop Part since we can reuse all of it.
- The NSUserDefaults plugin uses swizzling in order to be notified of what specific event changed at runtime.
- Added Test harness in both Sample Swift and Sample apps for iOS in order to test the plugin.
- Updated the documentation in `docs/shared-preferences-plugin.md` and` README.md`

I am open to suggestions since the desktop sharedPreferences version doesn't support deletion of preferences. Most likely I would have to modify the UI, and for that matter, I might as well build a user defaults desktop version

I wanted to add xiphirx in this MR since he developed the shared preferences plugin for Android and Desktop. I don't see a way to remove preferences from the flipper desktop app so I was wondering if you would be OK with me adding that.
Pull Request resolved: https://github.com/facebook/flipper/pull/291

Reviewed By: passy

Differential Revision: D10334685

Pulled By: priteshrnandgaonkar

fbshipit-source-id: d798c01a46df7ddecf713924799f046b560ea922
2018-10-12 04:09:29 -07:00
Pritesh Nandgaonkar
233b7bcd3c Send deinit message even if the plugin runs in background
Summary: Put back deinit message and send deinit call even if the plugin is the background one

Reviewed By: danielbuechele

Differential Revision: D10300165

fbshipit-source-id: ef945282fe628e9196c21b5060a8e464e98bc94c
2018-10-11 15:23:22 -07:00
Pritesh Nandgaonkar
396e385651 Handle empty state for background plugin
Summary: Handles the case when persisted state is undefined which will be the case when the initially selected plugin is not the one running in background

Reviewed By: danielbuechele

Differential Revision: D10269073

fbshipit-source-id: b7a17b0daa37a486cc7f456338cb97123ad813b7
2018-10-11 15:23:22 -07:00
Pritesh Nandgaonkar
5adc0d0625 make network plugin running in background
Summary: implements `persistedStateReducer` for the network plugins to merge messages into the persistedState even when the plugin is not running.

Reviewed By: danielbuechele

Differential Revision: D10256311

fbshipit-source-id: 53011a2123342825e8404b1c2c798aeb550c596d
2018-10-11 15:23:22 -07:00
Pritesh Nandgaonkar
ac7980993c FlipperBackgroundPlugin
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
2018-10-11 15:23:21 -07:00
Pritesh Nandgaonkar
5bbfa58909 Setup sdk for background plugin
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
2018-10-11 15:23:21 -07:00
Daniel Büchele
992ad68517 error plugin import from outside
Summary:
Plugins can not require files outside their folder, to make sure they don't pull in any dependencies from Flipper which are not exported by the main app.

However, those imports simply resolve to `undefined`. This diff adds a check in the babel-transform for plugins and throws an error if something from outside the plugin is required.

Reviewed By: passy

Differential Revision: D10297980

fbshipit-source-id: 1606f3211103281f9f4aa7bb2f3ca4d085d0ea1b
2018-10-11 07:11:18 -07:00
Itai Rosenberger
de85f9d455 Make dylib plugin error message more user friendly
Summary: Make dylib plugin error message more user friendly by making the URL linkable.

Reviewed By: dshahidehpour

Differential Revision: D10304489

fbshipit-source-id: 3d5c0d8da426e1b5580d431f07b5291dad068ffc
2018-10-10 18:56:05 -07:00
Alex Langenfeld
f3d2e0983e support user defined device plugins
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
2018-10-10 18:43:21 -07:00
Alex Langenfeld
7527636a38 change device plugin support check
Summary: Invert the way device plugin <-> device support works with the long term goal of supporting user defined device plugins

Reviewed By: danielbuechele

Differential Revision: D10240765

fbshipit-source-id: 9e886518a2fbfd263c79daa4b805c088ab38ab87
2018-10-10 18:43:21 -07:00
Daniel Büchele
069f2be335 notifications] adding native notifications
Summary: Adds a notification disapatcher to the redux store which triggers native notifications.

Reviewed By: jknoxville

Differential Revision: D10301490

fbshipit-source-id: d926d9a5378359ebb98a8b5816100f41db1e13e6
2018-10-10 10:41:09 -07:00
Daniel Büchele
78252b2ef2 adding UI
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
2018-10-10 10:41:09 -07:00