Commit Graph

22 Commits

Author SHA1 Message Date
John Knox
74b9ba5c40 Auto-format FlipperClient.cpp
Reviewed By: passy

Differential Revision: D17601356

fbshipit-source-id: 04701b409a838ad4dac54ae7c4f5f97cfa574dbe
2019-09-27 02:57:13 -07:00
John Knox
f72e6e0f5e Isolate background plugin initialization
Summary:
Background plugins are initialised when flipper connects.
But there's no isolation, so if any fail to initialize, then we don't carry on initializing the rest.
This fixes that by skipping failed ones only.

Reviewed By: passy

Differential Revision: D17600854

fbshipit-source-id: 2ef04cbcecda78ca448c2f4d56639ba63792e2f7
2019-09-26 07:01:40 -07:00
Alexander Blom
acf7eb1080 Initialize instance to nullptr
Summary:
In tests, the instance is never initialized and it's hard to guard against null when the
instance isn't initialized to nullptr (instead being random data).

Reviewed By: ximyu

Differential Revision: D16984717

fbshipit-source-id: 414539e1117abaad16df9f9b7d3b8dbb328e38d0
2019-08-23 08:15:06 -07:00
Rain ⁣
aa649ff48f standardize C-like MIT copyright headers throughout fbsource
Summary:
`/*` is the standard throughout open source code. For example, Firefox uses single /*: https://hg.mozilla.org/mozilla-central/file/21d22b2f541258d3d1cf96c7ba5ad73e96e616b5/gfx/ipc/CompositorWidgetVsyncObserver.cpp#l3

In addition, Rust considers `/**` to be a doc comment (similar to Javadoc) and having such a comment at the beginning of the file causes `rustc` to barf.

Note that some JavaScript tooling requires `/**`. This is OK since JavaScript files were not covered by the linter in the first place, but it would be good to have that tooling fixed too.

Reviewed By: zertosh

Differential Revision: D15640366

fbshipit-source-id: b4ed4599071516364d6109720750d6a43304c089
2019-06-06 19:40:28 -07:00
Pritesh Nandgaonkar
d720b20870 Solved the bug, where it didn't used to connect to Flipper
Summary:
The graphql plugin gets injected after the client is connected. In this case, earlier we didn't use to call `didconnect` assuming that it will be called when the plugin gets clicked by the user in the UI. But that is not true anymore as GraphQL plugin is a background plugin, And we don't call `didConnect` for the background plugins on the user click in the UI, as we assume that background plugins should have already received the call before.

This diff fixes the issue by calling didConnect on the background plugin which gets added after the `FlipperClient` is initialised.
{F152780726}

Look at the bug:

Reviewed By: danielbuechele

Differential Revision: D14369587

fbshipit-source-id: f75bf4e4463a31fa4735e90245c46632858a32b7
2019-03-07 14:41:28 -08:00
John Knox
85c041ff8d Change performAndReportError to handle exception pointers
Summary: Since plugins aren't under our control, they might throw exception pointers. We can still extract the useful info in this case.

Reviewed By: passy

Differential Revision: D14244362

fbshipit-source-id: 5f18100c08160e7514b3fd88ec47809cb37e9770
2019-02-28 05:39:52 -08:00
John Knox
40ada838d7 Add isMethodSupported handler
Summary: Allows plugin to check if something is supported by that app, for example an extension command or a new feature, before trying to use it.

Reviewed By: passy

Differential Revision: D14225957

fbshipit-source-id: 3c5a29a06b56fe5f1da772824232547447872344
2019-02-26 10:08:21 -08:00
John Knox
4a3de26a88 Add requestResponse handler for incoming calls
Summary:
Flipper exposes a call() api to plugins which lets them call their sdk component, and it returns a promise with the response.
Currently this is done by sending a fireAndForget request, noting the id of the request, and then receiving fireAndForget requests and matching up the ids to give the result back to the right plugin promise.

Instead, it will be simpler to use rsocket requestResponse, instead of fireAndForget, which is for this exact use case. This diff adds a requestResponse handler to the SDK, so that it can deal with such requests and respond accordingly, while preserving the current functionality if it receives a fireAndForget.

So this part is backwards compatible and should be safe to land in isolation.

A later diff will change the desktop app to use requestResponse, which may not be backwards compatible, so that will have to be deployed more carefully.

Reviewed By: passy

Differential Revision: D13974049

fbshipit-source-id: b371d94a86b1f186375161ed8f2242a462ce418f
2019-02-11 14:06:55 -08:00
Pritesh Nandgaonkar
87f64c4535 Send crash notification when flipper cpp exceptions are suppressed
Summary: This diff adds support to send crash notification whenever the cpp exception of Flipper is suppressed. Also updated the tests regarding the same

Reviewed By: jknoxville

Differential Revision: D13635822

fbshipit-source-id: 01e4a57c391476e5b044e64946d337cb4582a527
2019-01-17 16:47:35 -08:00
Pritesh Nandgaonkar
bf3be3e16c Wrap flipper client methods to avoid crash
Summary: Wraps flipper client methods to avoid crash. Also added a tests which makes sure that malcious plugin cannot cause a crash

Reviewed By: jknoxville

Differential Revision: D13153277

fbshipit-source-id: ac21731fa3c4eb447f189e61f61b9e83aad91e13
2018-11-26 07:56:13 -08: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
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
John Knox
a19862d7a2 Cleanup "sonar" from logs
Summary: Flipper logs already get "Flipper" prepended.

Reviewed By: passy

Differential Revision: D10028565

fbshipit-source-id: d3e84bba64044275da0145db6e804dc8eb3a44b7
2018-09-25 07:57:34 -07:00
John Knox
1a076f1300 Rename C++ fields and internal methods
Summary: From sonar* to flipper*.

Reviewed By: priteshrnandgaonkar

Differential Revision: D9944461

fbshipit-source-id: 870997e3d1d5aaef73dd445e6d94615f93fe6abc
2018-09-25 04:57:48 -07:00
John Knox
8ae77810d9 Rename SonarStep
Summary: Part of sonar to flipper rename

Reviewed By: passy

Differential Revision: D9920275

fbshipit-source-id: 02f97d1e51d58864283d26e8d3a724cac973e938
2018-09-24 06:03:51 -07:00
John Knox
c1295b1bc9 Rename SonarState* to FlipperState*
Summary: Part of sonar to flipper rename

Reviewed By: passy

Differential Revision: D9919821

fbshipit-source-id: a44a2a04d5463750f884f8bf1328e02d56593e82
2018-09-24 06:03:51 -07:00
John Knox
1d2793f701 Rename SonarWebSocket
Summary:
Part of Sonar -> Flipper rename.
It's about time this is renamed from *Websocket as well, since it doesn't use websockets anymore.

Reviewed By: passy

Differential Revision: D9919695

fbshipit-source-id: 78a63bfb7d5de19c093b7fb775d1426b4fc58f77
2018-09-24 06:03:51 -07:00
John Knox
2a822a1b99 Rename SonarResponderImpl
Summary: Part of sonar -> flipper rename

Reviewed By: passy

Differential Revision: D9918894

fbshipit-source-id: 066042b18e68a4e92308388e4cc7a29584010111
2018-09-24 06:03:51 -07:00
John Knox
5350d3ce7a Rename C++ SonarPlugin class
Summary: Part of sonar -> flipper rename

Reviewed By: passy

Differential Revision: D9917615

fbshipit-source-id: e59f43bf003d30ae6be4d95bc4a21c92ab39f732
2018-09-24 06:03:50 -07:00
John Knox
574c05c41d Rename SonarInitConfig
Summary: Part of sonar -> flipper rename

Reviewed By: priteshrnandgaonkar

Differential Revision: D9908472

fbshipit-source-id: f2e694b5abfa22a745ee4719d24d6aad8af6ee2a
2018-09-20 17:06:55 -07:00
John Knox
9889df3f3c Rename SonarConnection to FlipperConnection
Summary: Part of Sonar -> Flipper rename

Reviewed By: passy

Differential Revision: D9907353

fbshipit-source-id: 01f7bb84da1c27fd68d608151f437a18b6eaaa4e
2018-09-20 17:06:54 -07:00
John Knox
3c656de7fa Rename SonarClient to FlipperClient
Summary: Part of the Sonar -> Flipper rename

Reviewed By: passy

Differential Revision: D9871902

fbshipit-source-id: 4b64953cb1a64235d47caaf0fabfb560bb85f7a2
2018-09-20 17:06:53 -07:00