Commit Graph

966 Commits

Author SHA1 Message Date
Pascal Hartig
2f307b8b4f Avoid import-time side effects for application
Summary:
`INITIAL_STATE` is defined at import-time and relies on `remote.getCurrentWindow()`, which means that any import from the `flipper` module will require a display server + electron running.

Happy to take alternative suggestions to make this look a bit less intrusive.

Reviewed By: danielbuechele

Differential Revision: D10507539

fbshipit-source-id: 62b6bff0b4fd40638e54328613de4d3821b69dd6
2018-10-25 12:56:42 -07:00
John Knox
1be54ebee1 Add optional debug log switch
Summary:
This won't affect runtime, but is useful when debugging issues with flipper itself.
Setting this flag means all state changes will be output in logcat.

Reviewed By: passy

Differential Revision: D10231148

fbshipit-source-id: 7ddd490290ad973fc339b2f5f93a6f9a1fab4577
2018-10-25 04:14:37 -07:00
John Knox
57752533a6 Reconnect after desktop fails during cert exchange
Summary:
The code here is quite complicated so here's whats happening:

There's a disconnect hook, that waits and reconnects, so flipper never stops, except for the case where the desktop itself fails.

This makes some sense, but not total sense, as the client should really keep connecting, in case there's a different desktop that won't fail, or even if it was a transient failure.

Explicitly disconnecting, by setting the client to null, will trigger the disconnect hook and carry on the connect loop.

Reviewed By: passy

Differential Revision: D10231241

fbshipit-source-id: 90d823dce2221b1fb6501bd2797871dc1fb9770a
2018-10-24 10:37:16 -07:00
John Knox
d1a1c299dc Reconnect when adb server gets killed
Summary:
Flipper tracks devices on an adb connection. If the adb server gets killed, it deletes all devices, but doesn't attempt to reconnect.
This gets it to rety after 500ms.

Reviewed By: priteshrnandgaonkar

Differential Revision: D10526974

fbshipit-source-id: a2101067f2245b728f458fc5e06dc68833c5e772
2018-10-24 08:13:43 -07:00
John Knox
bd25e5e97c Re-use adb client
Summary: This class already has an adb client. Instead of creating new ones, should just use that.

Reviewed By: passy

Differential Revision: D10231152

fbshipit-source-id: c9426a12f0f6baf94026da51a79131d07e58053c
2018-10-24 04:31:03 -07:00
Pritesh Nandgaonkar
ff6b1790cb Adds Diagnostics screen in sample app
Summary: Adds Diagnostics screen in sample app

Reviewed By: danielbuechele

Differential Revision: D10509941

fbshipit-source-id: 9d0a8244dc93528cfdb06ae70d51c2a408f3e3be
2018-10-23 10:39:08 -07:00
Pritesh Nandgaonkar
12d2af38f7 Added screens in sample app for notification
Summary:
Added a basic communication flows and a button to trigger notification
{F142016937}

Reviewed By: jknoxville

Differential Revision: D10492428

fbshipit-source-id: b65fc46b3be695852f9197771a253d9e8596f328
2018-10-23 09:12:57 -07:00
Pritesh Nandgaonkar
74c1a24b86 Add example plugin
Summary: Added example plugin for iOS, similar to android

Reviewed By: jknoxville

Differential Revision: D10492429

fbshipit-source-id: d639edc7a47ab240bb172516c2f38b8e2a9f285c
2018-10-23 09:12:57 -07:00
Pascal Hartig
da37326a14 v0.10.1-SNAPSHOT
Summary: Pull Request resolved: https://github.com/facebook/flipper/pull/308

Reviewed By: priteshrnandgaonkar

Differential Revision: D10505464

Pulled By: passy

fbshipit-source-id: 7c44730b4086e983db05f666463e8ca62b57220c
2018-10-23 07:35:50 -07:00
John Knox
4eaf76ecf2 Fix isSearchActive crash in wilde
Summary:
This responder was added to android but not iOS, and was always being called during layout init.
Fixing by implementing it in iOS too.

Reviewed By: priteshrnandgaonkar

Differential Revision: D10489411

fbshipit-source-id: ef711dc5f54f52dd76db1245d07f9007fc846532
2018-10-23 05:54:25 -07:00
Pascal Hartig
66790e12e6 Bump build tools
Summary: This is actually the new minimum required version for the gradle plugin we use.

Reviewed By: jknoxville

Differential Revision: D10505346

fbshipit-source-id: ce331851b74997369325f27f050efae07e4bf00c
2018-10-23 04:44:52 -07:00
Pascal Hartig
f75a90bf78 Remove overloaded ErrorReportingRunnable class
Summary:
This masks this fact that `mConnection` must be `non-null` for
very little convenience in return. Let's keep this explicit.

Reviewed By: danielbuechele

Differential Revision: D10505205

fbshipit-source-id: d8187cc8e79d4508babe281ff88b3ba75c0baa1f
2018-10-23 04:44:52 -07:00
Pascal Hartig
bc0e5b3a11 Broaden notification message type definition
Summary:
Let's the notification render any React node.
Particularly useful when including links or wanting to
format messages.

Reviewed By: jknoxville

Differential Revision: D10488157

fbshipit-source-id: 06d3c6b4477c78e8bef78e3a3dc0e05bc67a2ef4
2018-10-22 15:47:49 -07:00
John Knox
f0262d91f0 Oneworld connectivity test
Summary:
Gets a oneworld device (just android for now), installs an app. Checks it connects and stays connected for 5s.

The app installed is in an array, we just need to add more targets for further tests.

Reviewed By: danielbuechele

Differential Revision: D10231083

fbshipit-source-id: c33fb091c1b7914a33690398a79fd700c445c06c
2018-10-22 11:38:36 -07:00
John Knox
764cdfe127 Move async work out of the Server constructor
Summary:
I feel like doing async stuff here isn't a good idea in general.
But more pressingly, it means you can't immediately call server.close() after new Server(), because the things to close haven't been created yet.

Reviewed By: danielbuechele

Differential Revision: D10488301

fbshipit-source-id: 76ebe91e0c09f353e0bdb9f2e4116757e757abb2
2018-10-22 11:38:36 -07:00
Daniel Büchele
086ab0188b rename fill attribute
Summary:
We were using `fill={true}` as an attribute to make flexbox containers fill the entire available space.

However, `fill` is an HTML attribute (see: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill) This caused warnings printed to the console.

This diff renames the attribute to `grow` with is also more in line with the Flexbox terminology.

Reviewed By: priteshrnandgaonkar

Differential Revision: D10488389

fbshipit-source-id: ed8553c6203cdf6df94d26c731164ecec4c9fbd2
2018-10-22 09:54:59 -07:00
Pascal Hartig
2a179b9d3c @Nullable for example plugin
Summary: Per title.

Reviewed By: jknoxville

Differential Revision: D10464336

fbshipit-source-id: 84b572d9fddf62b8515183aff6bb64925772c719
2018-10-22 09:02:19 -07:00
John Knox
76d40e7ddf Use node's perf_hooks
Summary:
I tried switching Flipper to use the node.js module: https://nodejs.org/api/perf_hooks.html instead of electrons window.performance. But the module couldn't be found.

So instead, I'm just replacing it in the pure node tests.

This means tests without node can work without issues.

Reviewed By: danielbuechele

Differential Revision: D10302114

fbshipit-source-id: b3b8aa5fb350a8246fcdfc2a80cc72daec2448d7
2018-10-22 09:00:38 -07:00
John Knox
87830ff106 Add transform for stubbing electron
Summary:
The idea behind this is to enable tests running in pure node, without electron, because electron requires display drivers and complicated things.

I've been lazy and only added the bare minimum electron api's for the connection test to pass.
It would be awesome to auto generate it properly.

Reviewed By: danielbuechele

Differential Revision: D10238132

fbshipit-source-id: d4a2da2baf5f8964184b532a581c3a75ee33ef06
2018-10-22 09:00:38 -07:00
Daniel Büchele
c8a7ce5cfb link to hub
Summary: Clicking on a notifications links to the Notification Hub highlighting the selected notification.

Reviewed By: jknoxville

Differential Revision: D10487822

fbshipit-source-id: ed907ec244bef970d1b30ddb719856949229d0c4
2018-10-22 06:59:52 -07:00
Daniel Büchele
7b9bd8560e update PluginContainer to new React API
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
2018-10-22 06:59:52 -07:00
Daniel Büchele
86c796a706 adding selectPlugin API to plugins
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
2018-10-22 06:59:52 -07:00
John Knox
b1c735c40d Modify recommended ios build commands (#296)
Summary:
This will make sure your local pods repo is up to date, so you won't be building against old dependencies.
Pull Request resolved: https://github.com/facebook/flipper/pull/296

Reviewed By: passy

Differential Revision: D10446899

Pulled By: jknoxville

fbshipit-source-id: 61c8832e8d5f7c54a43fc3e419347687756f4883
2018-10-22 03:40:51 -07:00
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