Commit Graph

655 Commits

Author SHA1 Message Date
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
Daniel Büchele
f7cb4667c4 fix icon size
Summary: Icon size passed to a button was ignored.

Reviewed By: passy

Differential Revision: D10301573

fbshipit-source-id: 00117a35622bbd490b74359f52ecc07929390205
2018-10-10 10:41:08 -07:00
Pascal Hartig
a379b18f64 Make immutable dependency available
Summary:
Set up hand-crafted flow type for it and add it to the offline-mirror.
Using the v4 pre-release as v3 apparently has even more effed up Flow support.

Reviewed By: danielbuechele

Differential Revision: D10258117

fbshipit-source-id: 9f6fcea152308696f34645cc99ba41b496dc5385
2018-10-10 05:43:12 -07:00
Yevgeniy Miretskiy
963a59176f Classes with virtual methods ought to have virtual destructor
Summary: Classes with virtual methods (include pure virtual) should have virtual destructor.

Reviewed By: jknoxville, scottrice

Differential Revision: D10241087

fbshipit-source-id: c7d0d27e28da91648cda7bffb4f1a8772833332c
2018-10-09 09:55:47 -07:00
Pascal Hartig
8da621f8e9 Exit with error code on yarn-install failure (#292)
Summary:
If installation fails, we should exit with an error code and not just a
message. This should help narrow down the CI failures, too.
Pull Request resolved: https://github.com/facebook/flipper/pull/292

Reviewed By: danielbuechele

Differential Revision: D10255759

Pulled By: passy

fbshipit-source-id: a6b033deadf11069e6c5665870a811ae2d0ec5ef
2018-10-09 08:41:10 -07:00
John Knox
49e7f2dc8b Add notifications for failed network requests
Summary: Also acts as a model for using the computeNotifications api.

Reviewed By: passy

Differential Revision: D10240659

fbshipit-source-id: 610512de7484e10c9c0ed8e661913c2fe10869da
2018-10-09 08:27:06 -07:00
John Knox
6df906ed5f Add computeNotifications method to FlipperBasePlugin
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
2018-10-09 08:27:06 -07:00
John Knox
1a5b127d58 Run adb reverse for emulators too
Summary:
Yesterday I made a change that switches from hardcoded IP address 10.0.2.2, to localhost for emulators on Android 5+.
This didn't work with flipper because it relies on port forwarding, and port forwarding was only done for physical devices, not emulators.

This corrects that, by port forwarding whenever possible. This will enable using localhost, which simplifies remote adb connection support.

Reviewed By: danielbuechele

Differential Revision: D10255554

fbshipit-source-id: 77a05eddf530e0e9495568f2a0901f390464345a
2018-10-09 06:25:59 -07:00
Pascal Hartig
76ad9e90cc Re-enable yarn test
Summary: Now that we have a node test in place, let's run this.

Reviewed By: danielbuechele

Differential Revision: D10217534

fbshipit-source-id: cf3debaf15b80d75234b67e4a78f6343c0fce50a
2018-10-09 03:56:13 -07:00
Pascal Hartig
2c67546ad1 Add test for pluginStates
Summary:
It's not super useful, to be honest, but it's to have one
open source `.node.js` test in place so `yarn test` doesn't
error out.

Reviewed By: danielbuechele

Differential Revision: D10217530

fbshipit-source-id: c0e17e48782174b856ef6d5fe94c5c042564e4f5
2018-10-09 03:56:13 -07:00
John Knox
b95a487748 Back out "[flipper] Fix remote adb connections"
Summary:
Original commit changeset: e53aa6ad10ac

This original change relies on adb reverse being run on emulators, which isn't happening. I didn't pick it up during tests because a previous build of flipper had done it.

Reverting the change. Will fix adb reverse and then re apply it later.

Reviewed By: priteshrnandgaonkar

Differential Revision: D10241728

fbshipit-source-id: 521c18c5a0eb45f3af0fe510defd9116b9bb0626
2018-10-08 14:56:18 -07:00
John Knox
287542c49a Fix remote adb connections
Summary: On emulators and devices that support adb reverse, using localhost will always work, whereas "10.0.2.2" won't work for networked adb connections.

Reviewed By: passy

Differential Revision: D10231163

fbshipit-source-id: e53aa6ad10ac4964431694c48e7148add69487fb
2018-10-08 04:56:35 -07:00
Hilal Alsibai
52e43e6ab8 Run google-java-format over Android code
Summary: Prettier code

Reviewed By: sjkirby

Differential Revision: D10182489

fbshipit-source-id: 6a1ba4d586f49edad00f839ccd1b94857ccfccaa
2018-10-06 11:41:35 -07:00
Hilal Alsibai
34c55262ce Reformat sample android app with google-java-format
Summary: Prettier code

Reviewed By: sjkirby

Differential Revision: D10181909

fbshipit-source-id: 05e4c2417dc04e65a95b69beb3694f240c9d954a
2018-10-06 11:41:35 -07:00
Hilal Alsibai
c7e0a26876 Update sample android app to use multiple shared preference files
Summary: Demonstrates the ability to have multiple shared preference files appear in Flipper

Reviewed By: sjkirby

Differential Revision: D10181910

fbshipit-source-id: 02acc02c722315da74dfb69542ca3ab1f26fa2e5
2018-10-06 11:41:35 -07:00
Hilal Alsibai
b40810080c Add support for multiple shared preference files
Summary: Adds the ability to view multiple shared preference files in Flipper

Reviewed By: danielbuechele

Differential Revision: D10181908

fbshipit-source-id: 723b71d7bd87c51c0fabc77204b5a26a2b7aa782
2018-10-06 11:41:34 -07:00
Alex Langenfeld
630982190b remove OculusDevice
Summary: Pretty sure this was meant to get removed before open sourcing, it isn't referenced anywhere.

Reviewed By: danielbuechele

Differential Revision: D10202081

fbshipit-source-id: 23d213b3a041acad85eb723d32b65f7da276003d
2018-10-06 11:18:18 -07:00
John Knox
4d50a5209c Skip failing test until oneworld is shipped
Summary:
The buck install command fails when xcode_dmg is used in sandcastle hosts, meaning xcode is mounted somewhere other than /Applications.
Skip the connection test for now. I'll get oneworld working with it instead.

Reviewed By: passy

Differential Revision: D10231097

fbshipit-source-id: 16e320070f8b3fd4f56ff919bdd3ec47355e342c
2018-10-06 06:12:51 -07:00
Pascal Hartig
6c3a6c0d66 Upgrade to Circle 2.1 (#289)
Summary:
Use CircleCI 2.1 for common executors and remove the common build step
as this is already done by Travis. Instead, focus on publishing either
snapshots or releases.
Pull Request resolved: https://github.com/facebook/flipper/pull/289

Reviewed By: jknoxville

Differential Revision: D10216413

Pulled By: passy

fbshipit-source-id: cfbc52c43187339ae6cb1c486d81e7c40216e86b
2018-10-05 07:59:19 -07:00
Jérémie Marguerie
145b94b47d Do not crash if there is no disk, just return nil instance
Summary: This should not affect prod as flipper (also called sonar) should only be an internal debug product but i needed to fix it to start the app.

Reviewed By: jknoxville

Differential Revision: D10156590

fbshipit-source-id: 84a76e5cbe2f4bbe89627895efcfb7e6cdadae13
2018-10-04 14:14:09 -07:00
Charles Dick
44fea6b9bc update metro to 0.47.1 to fix sourcemaps in plugins
Summary: Inline sourcemaps were broken in Metro until 0.47.1, so now we can debug flipper plugins again!

Reviewed By: passy

Differential Revision: D10200221

fbshipit-source-id: 919c1bc4f7aee720f25f2375ffbd8a786ebd0017
2018-10-04 12:13:46 -07:00
Pascal Hartig
d69fb9e6a1 Separate snapshot publish logic (#288)
Summary:
Snapshots should only ever be published off of master.
Pull Request resolved: https://github.com/facebook/flipper/pull/288

Reviewed By: danielbuechele

Differential Revision: D10161974

Pulled By: passy

fbshipit-source-id: dca8463ff80de9d407758405c24e6511bef534d1
2018-10-04 03:42:26 -07:00
Pascal Hartig
f39183b524 Skip yarn test for now (#287)
Summary:
This isn't working on Travis yet and will skip the subsequent steps
which do provide value if run right now.
Pull Request resolved: https://github.com/facebook/flipper/pull/287

Reviewed By: jknoxville

Differential Revision: D10161725

Pulled By: passy

fbshipit-source-id: 3502230e842c9451e8f33309b500a720cdaa5514
2018-10-04 02:17:08 -07:00
Hilal Alsibai
490f5e7f5a Fix Select onChange prop
Summary: Was passing in a Proxy instance before instead of a string. Now it passes the correct string that callers would expect.

Reviewed By: sjkirby

Differential Revision: D10181911

fbshipit-source-id: 8dfa677479a81de0f7b5be23f827ce7b52169931
2018-10-03 17:21:42 -07:00
Alex Langenfeld
a54b542d17 use portable SysStat.h
Summary: for Windows

Reviewed By: passy

Differential Revision: D9886244

fbshipit-source-id: d82b4a76efd1c200096bb6d3573b527ba058bf0b
2018-10-03 14:29:59 -07:00
Pascal Hartig
0a8eef466b Remove rename warning (#285)
Summary:
We're in a pretty good state now. Let's get rid of the big warning.
Pull Request resolved: https://github.com/facebook/flipper/pull/285

Reviewed By: jknoxville

Differential Revision: D10161261

Pulled By: passy

fbshipit-source-id: ef1fc03c289a0472916c67bf34c2f9e394c3fef2
2018-10-03 05:27:33 -07:00
Pascal Hartig
84384e523f Rename remaining tests
Summary: Something here must have conflicted upon landing. Redoing this again.

Reviewed By: danielbuechele

Differential Revision: D10145804

fbshipit-source-id: 1176167c7e3880055ff5e7b3d7f5723416f6131f
2018-10-03 03:44:20 -07:00
Pascal Hartig
8456a13ee6 Fix unit test setup
Summary:
There were still some tests with the internal test runner which
would fail in open source and with Gradle.

Reviewed By: priteshrnandgaonkar

Differential Revision: D10145759

fbshipit-source-id: 99915548441e426b88b1fa6ace1e852775e2a770
2018-10-02 09:29:37 -07:00
Pascal Hartig
b6445bb961 Update sonar reference in docs
Summary: Per title.

Reviewed By: danielbuechele

Differential Revision: D10114928

fbshipit-source-id: 80515b6df06939df3076fd75974cd9a044bce58b
2018-10-02 07:12:50 -07:00
John Knox
eebff1eb88 Run wilde on iOS emulator during electron tests
Summary:
Before running the test suite, build wilde and run it on a local emulator.

This takes about 15 mins on a lego-mac with a warm cache.
It's probably worth splitting out the normal unit tests into a separate job, so we get quicker feedback on them. I'll do that in a separate diff.

Lets run this for a while, and see how it goes, I'm wondering if it might get flaky because it will be building the master version of wilde, so potentially could be broken a lot, though it's passed evry time I've tried it so far.

If it's reliable, we can run the same thing with loads of other apps in parallel.

Reviewed By: passy

Differential Revision: D10110408

fbshipit-source-id: 61c549eb1b9d04729dcb5ed01271a484af4777f5
2018-10-02 06:57:38 -07:00
Pascal Hartig
344e6e7a04 Rename test classes
Summary: Take care of the test class names.

Reviewed By: danielbuechele

Differential Revision: D10113028

fbshipit-source-id: c8f0967fe2ae8c0f416e0f2f1eab30785fad01e8
2018-10-02 05:11:56 -07:00
Daniel Büchele
5aefb989e0 run jest tests
Summary:
Adding support for JS testing. Currently there are two environments tests can run in: node and electron. To select which environment to run a test in, name your test file accordingly `*.node.js` or `*.electron.js` and put it in a `__tests__` folder.

- `yarn test` to run node based tests
- `yarn test-electron` to run electron tests

A basic snapshot test of the empty app is added to make sure the app is rendering as expected. A test for the server is added to make sure when Flipper is started the two servers (secure and insecure) are started and ready to accept connections.

Reviewed By: passy

Differential Revision: D10050212

fbshipit-source-id: 8ef7f931339b43251d9d423886bcaca99ae691e4
2018-10-02 04:29:51 -07:00
Pascal Hartig
8c4e5ec647 Rename diagnostics AndroidManifest.xml
Summary:
The manifest is invalid without a package name and causes CI
to fail in some weird ways.

Reviewed By: jknoxville

Differential Revision: D10123737

fbshipit-source-id: d4adc84e6c1a4297fc1b30720f131fd06c22c4d3
2018-10-01 14:04:08 -07:00
Pascal Hartig
7c32e1163f Verbose snapshot building
Summary: Fails after 10 minutes of silence otherwise.

Reviewed By: danielbuechele

Differential Revision: D10123899

fbshipit-source-id: 5be9ae4cff7c72399d6d78d6248b710178953c22
2018-10-01 14:04:08 -07:00
Pascal Hartig
184d952a61 Update send-data Flipper references
Summary: Sonar -> Flipper

Reviewed By: danielbuechele

Differential Revision: D10114910

fbshipit-source-id: 28f5d6ac7a71ae645872adda820feea6adb21f73
2018-10-01 02:29:34 -07:00
Pascal Hartig
3e971775c3 Run unit tests in CI
Reviewed By: danielbuechele

Differential Revision: D10103229

fbshipit-source-id: 15f618bcd822588541de3b7c7988a1dec9c54e13
2018-09-30 04:13:56 -07:00
Pascal Hartig
e39b08cdbf Move test sonar package to flipper
Summary: This confused Android Studio real bad.

Reviewed By: danielbuechele

Differential Revision: D10103210

fbshipit-source-id: 20b28575942998fa0c646090e46a2f55983a26a6
2018-09-30 04:13:54 -07:00
Pascal Hartig
b756b5490f Set up unit test support in Gradle
Summary:
This works now:

```
./gradlew :android:testDebugUnitTest
BUILD SUCCESSFUL in 1s
39 actionable tasks: 39 up-to-date
```

Reviewed By: danielbuechele

Differential Revision: D10101985

fbshipit-source-id: e3d1f17b29652061498d50a9218a94aaebee67e2
2018-09-30 04:13:53 -07:00
Pascal Hartig
2a4df330b2 Fix robolectric test runner import
Summary: Can't use our internal test runner for this, d'uh.

Reviewed By: danielbuechele

Differential Revision: D10101984

fbshipit-source-id: 23f0af1c0b9e5d761de260643ef8d5546d9478eb
2018-09-30 04:13:53 -07:00