Rename sonar to flipper in the docs
Summary: Sonar->Flipper Reviewed By: passy Differential Revision: D10032191 fbshipit-source-id: 5e5230a02e34b9d1c7c355701daef984dc779f35
This commit is contained in:
committed by
Facebook Github Bot
parent
588d61efc6
commit
3699a0667a
@@ -34,13 +34,13 @@ public class MyFlipperPlugin implements FlipperPlugin {
|
||||
### iOS
|
||||
|
||||
```objective-c
|
||||
@interface MySonarPlugin : NSObject<SonarPlugin>
|
||||
@interface MyFlipperPlugin : NSObject<FlipperPlugin>
|
||||
@end
|
||||
|
||||
@implementation MySonarPlugin
|
||||
@implementation MyFlipperPlugin
|
||||
|
||||
- (NSString*)identifier { return @"MySonarPlugin"; }
|
||||
- (void)didConnect:(SonarConnection*)connection {}
|
||||
- (NSString*)identifier { return @"MyFlipperPlugin"; }
|
||||
- (void)didConnect:(FlipperConnection*)connection {}
|
||||
- (void)didDisonnect {}
|
||||
|
||||
@end
|
||||
@@ -49,9 +49,9 @@ public class MyFlipperPlugin implements FlipperPlugin {
|
||||
### C++
|
||||
|
||||
```c++
|
||||
class MySonarPlugin : public SonarPlugin {
|
||||
class MyFlipperPlugin : public FlipperPlugin {
|
||||
public:
|
||||
std::string identifier() const override { return "MySonarPlugin"; }
|
||||
std::string identifier() const override { return "MyFlipperPlugin"; }
|
||||
void didConnect(std::shared_ptr<FlipperConnection> conn) override;
|
||||
void didDisconnect() override;
|
||||
};
|
||||
@@ -78,14 +78,14 @@ connection.receive("getData", new FlipperReceiver() {
|
||||
### iOS
|
||||
|
||||
```objective-c
|
||||
@interface MySonarPlugin : NSObject<SonarPlugin>
|
||||
@interface MyFlipperPlugin : NSObject<FlipperPlugin>
|
||||
@end
|
||||
|
||||
@implementation MySonarPlugin
|
||||
@implementation MyFlipperPlugin
|
||||
|
||||
- (NSString*)identifier { return @"MySonarPlugin"; }
|
||||
- (NSString*)identifier { return @"MyFlipperPlugin"; }
|
||||
|
||||
- (void)didConnect:(SonarConnection*)connection
|
||||
- (void)didConnect:(FlipperConnection*)connection
|
||||
{
|
||||
[connection receive:@"getData" withBlock:^(NSDictionary *params, FlipperResponder *responder) {
|
||||
[responder success:@{
|
||||
@@ -102,7 +102,7 @@ connection.receive("getData", new FlipperReceiver() {
|
||||
### C++
|
||||
|
||||
```c++
|
||||
void MySonarPlugin::didConnect(std::shared_ptr<FlipperConnection> conn) {
|
||||
void MyFlipperPlugin::didConnect(std::shared_ptr<FlipperConnection> conn) {
|
||||
conn->receive("getData", [](const folly::dynamic ¶ms,
|
||||
std::unique_ptr<FlipperResponder> responder) {
|
||||
dynamic response = folly::dynamic::object("data", getMyData());
|
||||
@@ -133,7 +133,7 @@ connection.send("MyMessage",
|
||||
### C++
|
||||
|
||||
```c++
|
||||
void MySonarPlugin::didConnect(std::shared_ptr<FlipperConnection> conn) {
|
||||
void MyFlipperPlugin::didConnect(std::shared_ptr<FlipperConnection> conn) {
|
||||
dynamic message = folly::dynamic::object("message", "hello");
|
||||
conn->send("getData", message);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ Always use `ErrorReportingRunnable` for error handling instead of `try`/`catch`
|
||||
|
||||
## C++
|
||||
|
||||
To gracefully handle errors in Flipper we perform all transactions inside of a try block which catches all exceptions, stopping them from crashing the application and reporting them to the plugin developer. This includes your own customs implementations of `SonarPlugin::didConnect()` and `FlipperConnection::send()` and `::receive()`!
|
||||
To gracefully handle errors in Flipper we perform all transactions inside of a try block which catches all exceptions, stopping them from crashing the application and reporting them to the plugin developer. This includes your own customs implementations of `FlipperPlugin::didConnect()` and `FlipperConnection::send()` and `::receive()`!
|
||||
|
||||
That means you can safely throw exceptions in your plugin code. The exception messages will be sent to the Flipper desktop app. During plugin development the exception messages are surfaced in the Chrome dev console.
|
||||
|
||||
|
||||
@@ -94,14 +94,14 @@ project 'MyApp.xcodeproj'
|
||||
source 'https://github.com/facebook/flipper.git'
|
||||
source 'https://github.com/CocoaPods/Specs'
|
||||
swift_version = "4.1"
|
||||
sonarkit_version = '0.7.2'
|
||||
flipperkit_version = '0.7.2'
|
||||
|
||||
target 'MyApp' do
|
||||
|
||||
pod 'SonarKit', '~>'+sonarkit_version
|
||||
pod 'FlipperKit', '~>'+flipperkit_version
|
||||
# Layout and network plugins are not yet supported for swift projects
|
||||
pod 'SonarKit/SonarKitLayoutComponentKitSupport', '~>' + sonarkit_version
|
||||
pod 'SonarKit/SKIOSNetworkPlugin', '~>' + sonarkit_version
|
||||
pod 'FlipperKit/FlipperKitLayoutComponentKitSupport', '~>' + flipperkit_version
|
||||
pod 'FlipperKit/SKIOSNetworkPlugin', '~>' + flipperkit_version
|
||||
|
||||
post_install do |installer|
|
||||
|
||||
@@ -119,16 +119,16 @@ end
|
||||
and install the dependencies by running `pod install`. When you open the Xcode workspace file for your app, you now can import and initialize Flipper in your AppDelegate.
|
||||
|
||||
```objective-c
|
||||
#import <SonarKit/SonarClient.h>
|
||||
#import <FlipperKit/FlipperClient.h>
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||
{
|
||||
#if DEBUG
|
||||
SonarClient *client = [SonarClient sharedClient];
|
||||
FlipperClient *client = [FlipperClient sharedClient];
|
||||
SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
|
||||
[client addPlugin:[[SonarKitLayoutPlugin alloc] initWithRootNode: application
|
||||
[client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode: application
|
||||
withDescriptorMapper: layoutDescriptorMapper]];
|
||||
[client start];
|
||||
#endif
|
||||
@@ -140,7 +140,7 @@ and install the dependencies by running `pod install`. When you open the Xcode w
|
||||
<div class="warning">
|
||||
|
||||
- We haven't released the dependency to CocoaPods yet, here is the [issue](https://github.com/facebook/flipper/issues/132) by which you can track.
|
||||
- If you do not use CocoaPods as a dependency management tool then currently there is no way to integrate SonarKit other than manually including all the dependencies and building it.
|
||||
- If you do not use CocoaPods as a dependency management tool then currently there is no way to integrate FlipperKit other than manually including all the dependencies and building it.
|
||||
- For Android, Flipper works with both emulators and physical devices connected through USB. However on iOS, we don't yet support physical devices.
|
||||
- The Flipper layout plugin isn't supported in Swift projects since they include C++ dependencies. We're working on supporting it for Swift apps. You can join the discussion on the [issues page](https://github.com/facebook/flipper/issues).
|
||||
|
||||
|
||||
@@ -64,11 +64,11 @@ dependencies {
|
||||
### iOS
|
||||
|
||||
```objective-c
|
||||
#import <SonarKitLayoutPlugin/SonarKitLayoutPlugin.h>
|
||||
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
|
||||
#import <FlipperKitLayoutPlugin/SKDescriptorMapper.h>
|
||||
|
||||
SKDescriptorMapper *mapper = [[SKDescriptorMapper alloc] initWithDefaults];
|
||||
[client addPlugin:[[SonarKitLayoutPlugin alloc] initWithRootNode:context.application withDescriptorMapper:mapper]]
|
||||
[client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:context.application withDescriptorMapper:mapper]]
|
||||
```
|
||||
|
||||
## Quick edits
|
||||
|
||||
@@ -37,9 +37,9 @@ As interceptors can modify the request and response, add the Flipper interceptor
|
||||
### iOS
|
||||
|
||||
```objective-c
|
||||
#import <SonarKitNetworkPlugin/SonarKitNetworkPlugin.h>
|
||||
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
|
||||
|
||||
[client addPlugin: [SonarKitNetworkPlugin new]]
|
||||
[client addPlugin: [FlipperKitNetworkPlugin new]]
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -25,8 +25,8 @@ if (client != null) {
|
||||
### iOS
|
||||
|
||||
```objective-c
|
||||
SonarClient *client = [SonarClient sharedClient];
|
||||
MySonarPlugin *myPlugin = [client pluginWithIdentifier:@"MySonarPlugin"];
|
||||
FlipperClient *client = [FlipperClient sharedClient];
|
||||
MyFlipperPlugin *myPlugin = [client pluginWithIdentifier:@"MyFlipperPlugin"];
|
||||
[myPlugin sendData:myData];
|
||||
```
|
||||
|
||||
|
||||
@@ -50,10 +50,10 @@ public void myTest() {
|
||||
|
||||
## C++
|
||||
|
||||
Start by creating your first test file in this directory `MySonarPluginTests.cpp` and import the testing utilities from `//xplat/sonar-client:FlipperTestLib`. These utilities mock out core pieces of the communication channel so that you can test your plugin in isolation.
|
||||
Start by creating your first test file in this directory `MyFlipperPluginTests.cpp` and import the testing utilities from `xplat//sonar/xplat:FlipperTestLib`. These utilities mock out core pieces of the communication channel so that you can test your plugin in isolation.
|
||||
|
||||
```
|
||||
#include <MySonarPlugin/MySonarPlugin.h>
|
||||
#include <MyFlipperPlugin/MyFlipperPlugin.h>
|
||||
#include <FlipperTestLib/FlipperConnectionMock.h>
|
||||
#include <FlipperTestLib/FlipperResponderMock.h>
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace facebook {
|
||||
namespace flipper {
|
||||
namespace test {
|
||||
|
||||
TEST(MySonarPluginTests, testDummy) {
|
||||
TEST(MyFlipperPluginTests, testDummy) {
|
||||
EXPECT_EQ(1 + 1, 2);
|
||||
}
|
||||
|
||||
@@ -76,12 +76,12 @@ TEST(MySonarPluginTests, testDummy) {
|
||||
Here is a simple test using these mock utilities to create a plugin, send some data, and assert that the result is as expected.
|
||||
|
||||
```
|
||||
TEST(MySonarPluginTests, testDummy) {
|
||||
TEST(MyFlipperPluginTests, testDummy) {
|
||||
std::vector<folly::dynamic> successfulResponses;
|
||||
auto responder = std::make_unique<FlipperResponderMock>(&successfulResponses);
|
||||
auto conn = std::make_shared<FlipperConnectionMock>();
|
||||
|
||||
MySonarPlugin plugin;
|
||||
MyFlipperPlugin plugin;
|
||||
plugin.didConnect(conn);
|
||||
|
||||
folly::dynamic message = folly::dynamic::object("param1", "hello");
|
||||
|
||||
@@ -42,7 +42,7 @@ adb shell am start -n <APP_PACKAGE>/com.facebook.flipper.android.diagnostics.Fli
|
||||
This will only work if you added `FlipperDiagnosticActivity` to your `AndroidManifest.xml`. See [getting started](getting-started.html) for help.
|
||||
|
||||
#### iOS
|
||||
You'll need to manually add this [ViewController](https://github.com/facebook/flipper/blob/master/iOS/SonarKit/FlipperDiagnosticsViewController.m) to your app to see the in-app diagnostics.
|
||||
You'll need to manually add this [ViewController](https://github.com/facebook/flipper/blob/master/iOS/FlipperKit/FlipperDiagnosticsViewController.m) to your app to see the in-app diagnostics.
|
||||
|
||||
### Known Incompatibilities
|
||||
The following devices are known to be incompatible or face issues with flipper:
|
||||
|
||||
Reference in New Issue
Block a user