diff --git a/docs/create-plugin.md b/docs/create-plugin.md index c99746193..d877c598e 100644 --- a/docs/create-plugin.md +++ b/docs/create-plugin.md @@ -4,23 +4,23 @@ title: Mobile Setup sidebar_label: Mobile Setup --- -## Implement SonarPlugin +## Implement FlipperPlugin -Create a class implementing `SonarPlugin`. +Create a class implementing `FlipperPlugin`. ### Android ```java -public class MySonarPlugin implements SonarPlugin { - private SonarConnection mConnection; +public class MyFlipperPlugin implements FlipperPlugin { + private FlipperConnection mConnection; @Override public String getId() { - return "MySonarPlugin"; + return "MyFlipperPlugin"; } @Override - public void onConnect(SonarConnection connection) throws Exception { + public void onConnect(FlipperConnection connection) throws Exception { mConnection = connection; } @@ -57,18 +57,18 @@ public: }; ``` -## Using SonarConnection +## Using FlipperConnection -Using the `SonarConnection` object you can register a receiver of a desktop method call and respond with data. +Using the `FlipperConnection` object you can register a receiver of a desktop method call and respond with data. ### Android ```java -connection.receive("getData", new SonarReceiver() { +connection.receive("getData", new FlipperReceiver() { @Override - public void onReceive(SonarObject params, FlipperResponder responder) throws Exception { + public void onReceive(FlipperObject params, FlipperResponder responder) throws Exception { responder.success( - new SonarObject.Builder() + new FlipperObject.Builder() .put("data", MyData.get()) .build()); } @@ -119,7 +119,7 @@ You don't have to wait for the desktop to request data though, you can also push ```java connection.send("MyMessage", - new SonarObject.Builder() + new FlipperObject.Builder() .put("message", "Hello") .build() ``` diff --git a/docs/getting-started.md b/docs/getting-started.md index 6bbcf5474..d81df5da3 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -33,7 +33,7 @@ Add the following permissions to your AndroidManifest.xml. The SDK needs these t It's recommended that you add the following activity to the manifest too, which can help diagnose integration issues and other problems: ```xml - ``` @@ -59,9 +59,9 @@ public class MyApplication extends Application { super.onCreate(); SoLoader.init(this, false); - if (BuildConfig.DEBUG && SonarUtils.shouldEnableSonar(this)) { - final SonarClient client = AndroidFlipperClient.getInstance(this); - client.addPlugin(new InspectorSonarPlugin(this, DescriptorMapping.withDefaults())); + if (BuildConfig.DEBUG && FlipperUtils.shouldEnableFlipper(this)) { + final FlipperClient client = AndroidFlipperClient.getInstance(this); + client.addPlugin(new InspectorFlipperPlugin(this, DescriptorMapping.withDefaults())); client.start(); } } diff --git a/docs/layout-plugin.md b/docs/layout-plugin.md index ddf459e08..81105bfcd 100644 --- a/docs/layout-plugin.md +++ b/docs/layout-plugin.md @@ -20,11 +20,11 @@ To use the layout inspector plugin, you need to add the plugin to your Flipper c **Standard Android View Only** ```java -import com.facebook.sonar.plugins.inspector.DescriptorMapping; -import com.facebook.sonar.plugins.inspector.InspectorSonarPlugin; +import com.facebook.flipper.plugins.inspector.DescriptorMapping; +import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; final DescriptorMapping descriptorMapping = DescriptorMapping.withDefaults(); -client.addPlugin(new InspectorSonarPlugin(mApplicationContext, descriptorMapping)); +client.addPlugin(new InspectorFlipperPlugin(mApplicationContext, descriptorMapping)); ``` **With Litho Support** @@ -34,9 +34,9 @@ the descriptor with Litho-specific settings and add some addition dependencies. ```java import com.facebook.litho.config.ComponentsConfiguration; -import com.facebook.sonar.plugins.inspector.DescriptorMapping; -import com.facebook.sonar.plugins.inspector.InspectorSonarPlugin; -import com.facebook.sonar.plugins.litho.LithoFlipperDescriptors; +import com.facebook.flipper.plugins.inspector.DescriptorMapping; +import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; +import com.facebook.flipper.plugins.litho.LithoFlipperDescriptors; // Instead of hard-coding this setting, it's a good practice to tie // this to a BuildConfig flag, that you only enable for debug builds @@ -47,7 +47,7 @@ final DescriptorMapping descriptorMapping = DescriptorMapping.withDefaults(); // This adds Litho capabilities to the layout inspector. LithoFlipperDescriptors.add(descriptorMapping); -client.addPlugin(new InspectorSonarPlugin(mApplicationContext, descriptorMapping)); +client.addPlugin(new InspectorFlipperPlugin(mApplicationContext, descriptorMapping)); ``` You also need to compile in the `litho-annotations` package, as Flipper reflects diff --git a/docs/leak-canary-plugin.md b/docs/leak-canary-plugin.md index 401ee53df..107b90c48 100644 --- a/docs/leak-canary-plugin.md +++ b/docs/leak-canary-plugin.md @@ -13,14 +13,14 @@ Note: this plugin is only available for Android. First, add the plugin to your Flipper client instance: ```java -import com.facebook.sonar.plugins.leakcanary.LeakCanaryFlipperPlugin; +import com.facebook.flipper.plugins.leakcanary.LeakCanaryFlipperPlugin; client.addPlugin(new LeakCanaryFlipperPlugin()); ``` Next, build a custom RefWatcher using RecordLeakService: (see [LeakCanary docs](https://github.com/square/leakcanary/wiki/Customizing-LeakCanary#uploading-to-a-server) for more information on RefWatcher) ```java -import com.facebook.sonar.plugins.leakcanary.RecordLeakService; +import com.facebook.flipper.plugins.leakcanary.RecordLeakService; RefWatcher refWatcher = LeakCanary.refWatcher(this) .listenerServiceClass(RecordLeakService.class); diff --git a/docs/network-plugin.md b/docs/network-plugin.md index 632e8d356..db8761ded 100644 --- a/docs/network-plugin.md +++ b/docs/network-plugin.md @@ -14,10 +14,10 @@ To use the network plugin, you need to add the plugin to your Flipper client ins ### Android ```java -import com.facebook.sonar.plugins.network.NetworkFlipperPlugin; +import com.facebook.Flipper.plugins.network.NetworkFlipperPlugin; -NetworkFlipperPlugin networkSonarPlugin = new NetworkFlipperPlugin(); -client.addPlugin(networkSonarPlugin); +NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); +client.addPlugin(networkFlipperPlugin); ``` #### OkHttp Integration @@ -25,10 +25,10 @@ client.addPlugin(networkSonarPlugin); If you are using the popular OkHttp library, you can use the Interceptors system to automatically hook into your existing stack. ```java -import com.facebook.sonar.plugins.network.FlipperOkhttpInterceptor; +import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; new OkHttpClient.Builder() - .addNetworkInterceptor(new FlipperOkhttpInterceptor(networkSonarPlugin)) + .addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)) .build(); ``` diff --git a/docs/sandbox-plugin.md b/docs/sandbox-plugin.md index 1eca1fb03..f07e34c8b 100644 --- a/docs/sandbox-plugin.md +++ b/docs/sandbox-plugin.md @@ -13,8 +13,8 @@ To use the sandbox plugin, you need to add the plugin to your Flipper client ins ### Android ```java -import com.facebook.sonar.plugins.SandboxSonarPlugin; -import com.facebook.sonar.plugins.SandboxSonarPluginStrategy; +import com.facebook.flipper.plugins.SandboxSonarPlugin; +import com.facebook.flipper.plugins.SandboxSonarPluginStrategy; final SandboxSonarPluginStrategy strategy = getStrategy(); // Your strategy goes here client.addPlugin(new SandboxSonarPlugin(strategy)); diff --git a/docs/shared-preferences-plugin.md b/docs/shared-preferences-plugin.md index 28e775837..ddf566516 100644 --- a/docs/shared-preferences-plugin.md +++ b/docs/shared-preferences-plugin.md @@ -14,10 +14,10 @@ Note: this plugin is only available for Android. ### Android ```java -import com.facebook.sonar.plugins.sharedpreferences.SharedPreferencesSonarPlugin; +import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin; client.addPlugin( - new SharedPreferencesSonarPlugin(context, "my_shared_preference_file")); + new SharedPreferencesFlipperPlugin(context, "my_shared_preference_file")); ``` ## Usage diff --git a/docs/testing.md b/docs/testing.md index 41d698ae8..ab1c40e99 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -8,16 +8,16 @@ Developer tools are only used if they work. We have built APIs to test plugins. ## Android -Start by creating your first test file in this directory `MySonarPluginTest.java`. In the test method body we create our plugin which we want to test as well as a `SonarConnectionMock`. In this contrived example we simply assert that our plugin's connected status is what we expect. +Start by creating your first test file in this directory `MyFlipperPluginTest.java`. In the test method body we create our plugin which we want to test as well as a `FlipperConnectionMock`. In this contrived example we simply assert that our plugin's connected status is what we expect. ```java @RunWith(RobolectricTestRunner.class) -public class MySonarPluginTest { +public class MyFlipperPluginTest { @Test public void myTest() { - final MySonarPlugin plugin = new MySonarPlugin(); - final SonarConnectionMock connection = new SonarConnectionMock(); + final MyFlipperPlugin plugin = new MyFlipperPlugin(); + final FlipperConnectionMock connection = new FlipperConnectionMock(); plugin.onConnect(connection); assertThat(plugin.connected(), equalTo(true)); @@ -25,24 +25,24 @@ public class MySonarPluginTest { } ``` -There are two mock classes that are used to construct tests `SonarConnectionMock` and `SonarResponderMock`. Together these can be used to write very powerful tests to verify the end to end behavior of your plugin. For example we can test if for a given incoming message our plugin responds as we expect. +There are two mock classes that are used to construct tests `FlipperConnectionMock` and `FlipperResponderMock`. Together these can be used to write very powerful tests to verify the end to end behavior of your plugin. For example we can test if for a given incoming message our plugin responds as we expect. ```java @Test public void myTest() { - final MySonarPlugin plugin = new MySonarPlugin(); - final SonarConnectionMock connection = new SonarConnectionMock(); - final SonarResponderMock responder = new SonarResponderMock(); + final MyFlipperPlugin plugin = new MyFlipperPlugin(); + final FlipperConnectionMock connection = new FlipperConnectionMock(); + final FlipperResponderMock responder = new FlipperResponderMock(); plugin.onConnect(connection); - final SonarObject params = new SonarObject.Builder() + final FlipperObject params = new FlipperObject.Builder() .put("phrase", "sonar") .build(); connection.receivers.get("myMethod").onReceive(params, responder); assertThat(responder.successes, hasItem( - new SonarObject.Builder() + new FlipperObject.Builder() .put("phrase", "ranos") .build())); } diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 35f80eb87..4b823802f 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -37,7 +37,7 @@ The Flipper SDK includes an in-app connection diagnostics screen to help you dia Replace `` below with the package name of your app, e.g. `com.facebook.flipper.sample`. On a terminal, run the following: ```bash -adb shell am start -n /com.facebook.sonar.android.diagnostics.FlipperDiagnosticActivity +adb shell am start -n /com.facebook.flipper.android.diagnostics.FlipperDiagnosticActivity ``` This will only work if you added `FlipperDiagnosticActivity` to your `AndroidManifest.xml`. See [getting started](getting-started.html) for help.