Commit Graph

322 Commits

Author SHA1 Message Date
Daniel Büchele
5afb148ffa Migrate to custom plugin
Summary: In this step, we want to visualize our mammals in a custom card view. For this reason, we need to replace `createTablePlugin` with a React component that extends `FlipperPlugin`.

Reviewed By: jknoxville

Differential Revision: D15183324

fbshipit-source-id: 329cdc5c6cbd7e1435538e8cdddf049d914ff221
2019-05-03 02:50:04 -07:00
Pascal Hartig
18af62ebfd Add a basic android plugin
Summary:
Moves some things around for package access reasons.
Otherwise sets up the simplest possible plugin that
just sends over all the data it shows in the UI
on connection time. Is that a good idea? You tell me.

JS part coming with the next diff.

Reviewed By: jknoxville

Differential Revision: D15182282

fbshipit-source-id: da5c1de43dfaee273b4eecc0f4512bef872a0ac6
2019-05-02 09:10:26 -07:00
Pascal Hartig
bbee7a3357 Update iOS license headers (and more)
Summary: Add the affiliates bit that the linter is checking for.

Reviewed By: jknoxville

Differential Revision: D15164826

fbshipit-source-id: 500ffe89ec0c2fd3acfbc374408d16a337cecfa4
2019-05-02 03:28:07 -07:00
Pascal Hartig
cd9445a3bd Add Fresco plugin
Summary: Per title

Reviewed By: jknoxville

Differential Revision: D15166443

fbshipit-source-id: e8098ce941d66fc2948fcf3d2e99f0813f20049e
2019-05-01 09:39:52 -07:00
Pascal Hartig
3829ac7d03 Enable Sections and Litho plugins
Summary: Per title

Reviewed By: jknoxville

Differential Revision: D15166432

fbshipit-source-id: ec2a53ef2af920e4c9f8a8742b2b8fbff01320fe
2019-05-01 09:39:52 -07:00
Pascal Hartig
3339944ff4 Tutorial app
Summary:
A very basic app with a scrolling list backed by a static data source. It also covers two bases that we hadn't before: Sections and Kotlin; the latter being the better choice for a modern Android tutorial anyway.

Missing right now: BUCK support (likely not going to come anytime soon due to the kapt limitations), the actual Flipper plugin integration (that's up next).

Reviewed By: jknoxville

Differential Revision: D15166195

fbshipit-source-id: 3cfaa1d243548279cabc4f244c13363f1bcaa36c
2019-05-01 09:39:52 -07:00
Pascal Hartig
2e65ab7133 Reorganise sample into debug/release flavours
Summary:
This makes use of the new no-op package and also structures the app
into release and debug flavours that can be built with and without
Flipper part of the APK.

This was a pretty tedious adventure. I may have missed some corner cases
and also restructured a bunch of seemingly unrelated stuff that was
necessary to respect buck module boundaries.

Reviewed By: jknoxville

Differential Revision: D15148004

fbshipit-source-id: bf81f45105f5f16d17daccb3e8050ee00d69fc35
2019-05-01 08:38:22 -07:00
Pascal Hartig
b7fff23700 Move example plugin out of core
Summary:
We should not ship this as part of our distribution.
Just meant we had to bifurcate our unit tests which
is a bit awkward, but it works now.

Reviewed By: jknoxville

Differential Revision: D15146980

fbshipit-source-id: 496b000630bbfcaa663cddacb00550e1499a1279
2019-05-01 08:38:22 -07:00
Pascal Hartig
608b9182ce Add version headers
Summary: Last big batch of adding license headers in Java code where they were missing.

Reviewed By: jknoxville

Differential Revision: D15164860

fbshipit-source-id: 4c0a61eec7b5659fdc674ebed85f2ade60dd0aa0
2019-05-01 08:14:55 -07:00
Pascal Hartig
c5e77220fc Remove dangling TODO comment
Summary: No longer relevant.

Reviewed By: jknoxville

Differential Revision: D15146917

fbshipit-source-id: 830a8193b128a8177610269b6e7f37fb8f1ee74e
2019-04-30 13:13:00 -07:00
Pascal Hartig
db5d486c6f Set up no-op package (#425)
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/425

Incomplete implementation that should allow for most uses
as a release-only package.

Next steps:
- Integrate sample app with this.
- Set up CI to build sample app in release mode with this.
- Register with JCenter.
- Automatically publish to JCenter as part of our release step.

Reviewed By: jknoxville

Differential Revision: D15146823

fbshipit-source-id: 3ad058dce7b0395721c6e6715d44d4d51b1834da
2019-04-30 13:13:00 -07:00
Pascal Hartig
356614e1c7 Small fixes for FlipperClientImpl
Summary: One unsafe assignment and an incorrect comment open.

Reviewed By: jknoxville

Differential Revision: D15146815

fbshipit-source-id: ec2186c82f60cacab91d286b4c68138a44e1ea27
2019-04-30 13:12:59 -07:00
Pascal Hartig
ef46dd7f91 Add missing @Nullable annotations
Summary: Native can return nullptr, so this should be annotated.

Reviewed By: jknoxville

Differential Revision: D15146700

fbshipit-source-id: 332e3a074d2e39cfff677f3d84e94f910563f992
2019-04-30 13:12:59 -07:00
Pascal Hartig
8ba4feba66 Add gradle license headers
Summary: Some more will follow.

Reviewed By: jknoxville

Differential Revision: D15146750

fbshipit-source-id: b78331b1fb00f357812e598165d6def62e2a89c8
2019-04-30 05:34:59 -07:00
John Knox
f00ff72211 Allow null TableRow sidebars
Summary: Makes the API a bit easier to use. Don't have to build an empty sidebar if you don't want one.

Reviewed By: passy

Differential Revision: D15064205

fbshipit-source-id: bd31c1aa97fd6d1c93717c10b268f49e44eb1299
2019-04-26 09:29:42 -07:00
Pritesh Nandgaonkar
afd729deb6 Added metrics argument to headless inorder to export metrics
Summary:
This diff makes headless flipper accept `metrics` argument. Once this is passed. The headless flipper will terminate to export the metrics of the plugins, the type of the export looks like the following.

```
export type MetricType = {[metricName: string]: number};
type MetricPluginType = {[pluginID: string]: MetricType};
export type ExportMetricType = {[clientID: string]: MetricPluginType};

```

This diff, uses the store to export the metrics. I will modify the logic to accept the data which gets exported through `exportData`

Reviewed By: passy

Differential Revision: D14933499

fbshipit-source-id: dade5b7bc59ea4beb6d16c5ef471737e8597358a
2019-04-25 07:41:34 -07:00
John Knox
6f8d6ddd85 Sample app requires API 21+
Summary:
Currently running the sample app on a pre-21 device produces a runtime error. This is because it includes OkHttp which requires 21+.

So this change just stops the sample app from being installable on pre-21 devices.

```
FATAL EXCEPTION: main
Process: com.facebook.flipper.sample, PID: 19629
java.lang.ExceptionInInitializerError
	at okhttp3.OkHttpClient.newSslSocketFactory(OkHttpClient.java:263)
	at okhttp3.OkHttpClient.<init>(OkHttpClient.java:229)
	at okhttp3.OkHttpClient$Builder.build(OkHttpClient.java:1015)
	at com.facebook.flipper.sample.FlipperSampleApplication.onCreate(FlipperSampleApplication.java:54)
	at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4344)
	at android.app.ActivityThread.access$1500(ActivityThread.java:135)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
	at android.os.Handler.dispatchMessage(Handler.java:102)
	at android.os.Looper.loop(Looper.java:136)
	at android.app.ActivityThread.main(ActivityThread.java:5017)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:515)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
	at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalStateException: Expected Android API level 21+ but was 19
	at okhttp3.internal.platform.AndroidPlatform.buildIfSupported(AndroidPlatform.java:238)
	at okhttp3.internal.platform.Platform.findPlatform(Platform.java:202)
	at okhttp3.internal.platform.Platform.<clinit>(Platform.java:79)
	... 16 more
```

Reviewed By: passy

Differential Revision: D14953859

fbshipit-source-id: 8289c19e837f1d3739e120dc5a0f53111b800ca0
2019-04-17 06:55:48 -07:00
Pascal Hartig
9389a8e919 Bump some more dependencies (#414)
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/414

Some more minor upgrades.

Reviewed By: jknoxville

Differential Revision: D14933687

fbshipit-source-id: 35bfcbb2ab3e552e430d8a2e3e30fb3568fab6c9
2019-04-15 09:57:59 -07:00
Pascal Hartig
59881f1888 Bump okhttp
Summary:
Requires some compile options as it uses newer Java features.
Post here: https://github.com/square/okhttp/issues/4597#issuecomment-461204144

Reviewed By: jknoxville

Differential Revision: D14933502

fbshipit-source-id: 265c43f2d9ae61fa9f6f42516fc6eb899af7f072
2019-04-15 06:55:21 -07:00
Pritesh Nandgaonkar
5169d318de Fix the callstack sent from error reporting runnable
Summary:
The crash logged from `ErrorReporterRunnable` wasn't detailed. For example look at the following video.
Also for some reason the `FlipperConnection` interface doesn't have an argument for crash name. Thus I changed the js side of the plugin to accept `crash.name` to be undefined.

{F155526537}

Reviewed By: passy

Differential Revision: D14852561

fbshipit-source-id: 6daf9847535b4508fa312b4f940b014911aae2e5
2019-04-15 05:51:37 -07:00
Pritesh Nandgaonkar
25f82986ea Avoid triggering notification in headless
Summary:
There was a bug where headless version used to crash when crash reporter plugin used to get messages. So the problem was that it tried to trigger the notification in headless version, which obviously won't work.

Solves this [bug](https://our.intern.facebook.com/intern/sandcastle/log/?instance_id=88210824&step_id=773963185&step_index=5&name=Get+headless+and+run+it)
Bug:

{F155634920}

Reviewed By: jknoxville, danielbuechele

Differential Revision: D14874122

fbshipit-source-id: 2614b16665a354be7a75844a372dbea7a59d7e55
2019-04-11 04:08:59 -07:00
John Knox
a27cd84d45 Add top and bottom toolbars to native plugins
Summary: I'm adding these in the table plugin for now, since it's the only native plugin, but it probably makes sense to have this ability in all native plugins.

Reviewed By: passy

Differential Revision: D14833326

fbshipit-source-id: 906190745091e02daccb9f6e84b95e0e13f2d8bd
2019-04-10 06:17:52 -07:00
John Knox
f21c9f1c61 Rename SidebarSection to UISection
Summary: These are full width blocks, and can be put anywhere, so calling them SidebarSections isn't very helpful.

Reviewed By: danielbuechele

Differential Revision: D14833465

fbshipit-source-id: 2433337f78b6bbcb951cd90b6925de1b9a304d42
2019-04-09 08:29:25 -07:00
John Knox
fb772d3f81 Move TableMetadata serialization into its class
Summary: Where it should be.

Reviewed By: danielbuechele

Differential Revision: D14833499

fbshipit-source-id: 7af951a402756ddde6d9672ca733a2c910d4ddb4
2019-04-08 11:42:33 -07:00
John Knox
e306ecda19 Fix Test
Summary: GitHub test failing because of this: https://travis-ci.org/facebook/flipper/jobs/517181150

Reviewed By: passy

Differential Revision: D14827468

fbshipit-source-id: e1d85747b39bd9fd781e8e6e8cb1827adb786482
2019-04-08 07:47:30 -07:00
John Knox
fa3dcdc5dd NativePlugins API update
Summary:
The main change is is changing from the inheritance model:
`FlipperPlugin > NativePlugin > TablePlugin > ConcretePlugin`

to a composition model where:
`NativePlugin > TablePlugin > ConcretePlugin`

And behind the scenes, there's a `FlipperPlugin` that has a `NativePlugin` reference.

Now your native plugin will call methods like (in the table case) `display.updateRows` instead of `super.updateRows()`

The reasons for this are:

* Testability: we can easily mock the display and assert output.
* Encapsulation: Previously, native plugins could call `mConnection.send(...)` and send completely unsupported messages to the desktop. Now they only have access to the display's public api, which is guaranteed to work.

I've also changed it so that on every row update, we send the latest table metadata along with it. This makes sure we can ensure that the right table schema is displayed for the current data.

QueryResponder interface also added, which will come in useful for queryable datasets.

Reviewed By: passy

Differential Revision: D14751885

fbshipit-source-id: ea0bbd25f7eaa60020f8866fe210d8bd1c22e90b
2019-04-05 10:06:14 -07:00
Dustin Bluck
825ecb8e23 SharedPreferencesPlugin -- Look for all shared pref files
Summary: Searches for all shared pref files instead of only the package name by default

Reviewed By: xiphirx

Differential Revision: D14763787

fbshipit-source-id: a3b7dfe8db078ac4f55e236b1516ed2de668f8d2
2019-04-03 18:16:05 -07:00
John Knox
ddd06971f1 NativePlugins: Implement sidebar sections in java
Summary:
Changes sidebar from just a bucket of json, to be a list of SidebarSections.
Currently implemented sections are Json, and Toolbar.

Reviewed By: passy

Differential Revision: D14620095

fbshipit-source-id: 6ba57f6f1ad954373c0bbb79570d779787e5d4db
2019-03-28 06:45:39 -07:00
John Knox
ff6988ddaf Java side of NativePlugins
Summary:
Adds abstract classes NativePlugin and TableNativePlugin.

Extend NativePlugin to implement a new NativePlugin type/template.

TableNativePlugin is an example of that. Extend TableNativePlugin to add a particular instance of a table plugin. See the stacked diff for an example of that (newsfeed inspector).

I think I'm going to change the NativePlugin implementation so it uses composition instead of inheriting from FlipperPlugin, so that the concrete subclasses don't get access to the FlipperPlugin primitive methods like onConnect etc. But I don't mind shipping this as is and changing it separately.

Reviewed By: passy

Differential Revision: D14505912

fbshipit-source-id: 0534147112aaf4c5a41d2d3e08de855767b2a010
2019-03-28 06:45:38 -07:00
Pascal Hartig
0b72c6082f Set up text filter to allow for correct emoji display
Reviewed By: jknoxville

Differential Revision: D14640808

fbshipit-source-id: 9ecdb15f32143f5615d5763b9da79c581698acc5
2019-03-28 03:12:50 -07:00
Pascal Hartig
d08a123ae4 Fix test
Summary: Add an ability to inspect errors reported through `ErrorReportingRunnable`.

Reviewed By: jknoxville

Differential Revision: D14640270

fbshipit-source-id: a5a79d647e20d5d46c85aac2a814c77abbc624b7
2019-03-27 10:12:04 -07:00
Vlad Albulescu
4d0b1d2fc3 remove unused constructor arg from MainThreadFlipperReceiver
Summary: Argument became unused in a previous diff.

Reviewed By: jknoxville

Differential Revision: D14642264

fbshipit-source-id: 99bc78a9cff8322e8bed337f201a4748039a0332
2019-03-27 09:50:54 -07:00
Vlad Albulescu
de46240272 explicitly report errors in MainThreadFlipperReceiver
Summary: Use responder rather than allowing exception to propagate.

Reviewed By: jknoxville

Differential Revision: D14538883

fbshipit-source-id: 2774a2adfcee356e1853fa3bf3c01aa113181262
2019-03-27 08:05:14 -07:00
Pascal Hartig
b2d1506f15 Fix SDK app crash
Summary:
I'm not sure why this was made an AssertionError in the first place
as this cannot be caught by a catch branch that only takes Exception-subclasses.

Given that this is expected behaviour in some cases, using an Error here
is rather dangerous.

This does not fix the underlying issue of the attached task, but fixes
the undesired crashing behaviour of the app.

Reviewed By: priteshrnandgaonkar

Differential Revision: D14598611

fbshipit-source-id: b024b35f07e16755d9a4ab2f4a1f75b10d1353fb
2019-03-27 07:49:01 -07:00
Pascal Hartig
12700b8643 Remove test copy
Summary: Umm, not sure why this is still around. Looks like an `hg mv` gone wrong.

Reviewed By: jknoxville

Differential Revision: D14639300

fbshipit-source-id: 511116808c4e8ae684fc21454853a482a2c36122
2019-03-27 07:49:01 -07:00
Alex Dickson
99b0bf516e Make FlipperUtils parameters final
Summary: This diff makes the params final.

Reviewed By: jknoxville

Differential Revision: D14641443

fbshipit-source-id: 5c003bd09144a8d8dd848c04599388ace4baef4d
2019-03-27 07:44:16 -07:00
Mihaela Ogrezeanu
2d357a2ced Show state data in flipper Sections inspector
Summary:
as title; refactored getStateData for components so we can reuse
Depends on D14386744

Reviewed By: passy

Differential Revision: D14386910

fbshipit-source-id: 088605b920fd5b489d007e5daa69f4cd53fc3072
2019-03-20 09:13:21 -07:00
Mihaela Ogrezeanu
5195bfc0e4 Show Section props in flipper
Summary:
as title.
Refactored the getPropsData from DebugComponentDescriptor and extracted it to separate class so we can use it for SectionComponentDescriptor as well.
Will follow up with adding state info

Reviewed By: passy

Differential Revision: D14386744

fbshipit-source-id: c6b9887aa9d0c8d2333e7e64fa0954e56b505e51
2019-03-20 09:13:21 -07:00
Pascal Hartig
7c185ea771 Add activity for connectivity test
Summary:
This is quite hacky, but allows us to test that a plugin connects, sends some actions and
then shuts down the app which we can use in a headless test.

Reviewed By: jknoxville

Differential Revision: D14482381

fbshipit-source-id: deafa8fa7e6d5a5ca1bb006e9d150b62295105af
2019-03-18 07:34:44 -07:00
Pascal Hartig
69dd6e4fc1 Add non-interactive mode to sample app
Summary:
This can be used in integration tests/headless to create
some data to match against.

Ideally, headless also will need some mechanism to be
told to exit, but that's a separate issue.

Reviewed By: jknoxville

Differential Revision: D14387494

fbshipit-source-id: 88d7c27e342fb0b26251e6edf12e7b922d5144c0
2019-03-14 11:16:40 -07:00
Mihaela Ogrezeanu
50a1fa64d8 Use SoftReference in ObjectTracker
Summary:
if we use WeakReferences, DebugSection nodes are released very fast and highlighting doesn't work because the node is removed from the ObjectTracker.
passy do you know who else I can add as reviewer?

Reviewed By: passy

Differential Revision: D14385872

fbshipit-source-id: ecc63190a84a7186296ed9c4c82ff6ab2aca8ad2
2019-03-13 08:29:57 -07:00
Pritesh Nandgaonkar
1c8fffa20b Enable import all the nodes for android
Summary: Enables Import and Export for all the nodes for android. Also search and Accessibility feature works

Reviewed By: danielbuechele

Differential Revision: D14406016

fbshipit-source-id: 8976db66d1ca91e98c52983a31ea584764bde0f6
2019-03-12 07:08:24 -07:00
Pasquale Anatriello
a0ddb92cd2 Remove Reference API
Summary: Reference has been deprecated for a while. This diff completely removes it in favor of using ComparableDrawable everywhere.

Reviewed By: astreet

Differential Revision: D14241428

fbshipit-source-id: a986f34fda3a05c85d3d57b1e806c5e48c3f485e
2019-03-08 11:19:49 -08:00
Mihaela Ogrezeanu
410b6a6043 Update Section hierarchy when child views change
Summary:
we only include in the inspector hierarchy the sections which are visible on screen. If as a result of a UI change the hierarchy of visible sections changes (for example when scrolling to a section that wasn't previously visible) this forces the section hierarchy to be recreated.
passy not sure if there's an easier way of making the children of a node invalidate, let me know if you have any suggestions
Depends on D14300298

Reviewed By: passy

Differential Revision: D14301404

fbshipit-source-id: 551e1910d0a80238027e32417aab8d42ed1c00b3
2019-03-06 07:51:52 -08:00
Mihaela Ogrezeanu
de43fd29c6 Enable searching for sections in flipper
Summary:
as title, enables section name matching in the flipper search bar
Depends on D14300283

Reviewed By: passy

Differential Revision: D14300298

fbshipit-source-id: 33caefccf04b833c8606a083a13f3bffea6c419d
2019-03-06 07:51:52 -08:00
Mihaela Ogrezeanu
a665a12aec DebugSectionDescriptor non-null data and attributes
Summary:
these are not nullable. returning a non-null value
Depends on D14300226

Reviewed By: passy

Differential Revision: D14300283

fbshipit-source-id: bbc37161d2e01d94998cb287377742d8c5952bd1
2019-03-06 07:51:52 -08:00
Pascal Hartig
fbe9e3a086 Prepare for Fresco stable release (#385)
Summary:
This unblocks our open source releases.

Pull Request resolved: https://github.com/facebook/flipper/pull/385

Reviewed By: danielbuechele

Differential Revision: D14299867

Pulled By: passy

fbshipit-source-id: d9ce29d0d0713cd54f6d8bed03e7a919f443f44b
2019-03-04 09:03:10 -08:00
John Knox
e594176401 Handle any exception pointers at top level
Summary: If a plugin thows an exception pointer instead of by value, we should capture it and stop the app from crashing.

Reviewed By: passy

Differential Revision: D14243644

fbshipit-source-id: a2e5dde2b36c430355552e3305634baa5913b703
2019-02-28 05:39:52 -08:00
Pascal Hartig
156a0c17c6 Load Fresco image on button press only
Summary: Only load the image when clicking on the "button"

Reviewed By: oprisnik

Differential Revision: D14165707

fbshipit-source-id: d07fb76562f8b91fc945713d779319b976e17016
2019-02-22 02:51:33 -08:00
Pascal Hartig
cbfb280783 Set up FrescoFlipperPlugin default constructor
Summary:
Not quite sure about the default as static, but then if it's for
debugging only, does it matter?

Reviewed By: oprisnik

Differential Revision: D14165668

fbshipit-source-id: edd53420a4fc8570de87f02b3e5e65cfe649f810
2019-02-22 02:51:33 -08:00