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
This commit is contained in:
committed by
Facebook Github Bot
parent
b1c674f6f9
commit
2e65ab7133
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
package com.facebook.flipper.plugins.example;
|
||||
|
||||
import android.app.Activity;
|
||||
import com.facebook.flipper.core.FlipperPlugin;
|
||||
|
||||
// No-Op implementation to satisfy the interface.
|
||||
public class ExampleFlipperPlugin implements FlipperPlugin {
|
||||
public void setActivity(Activity a) {
|
||||
// no-op
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
package com.facebook.flipper.sample;
|
||||
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
public final class ExampleActions {
|
||||
|
||||
public static void sendPostRequest(OkHttpClient client) {}
|
||||
|
||||
public static void sendGetRequest(OkHttpClient client) {}
|
||||
|
||||
public static void sendNotification() {}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*
|
||||
*/
|
||||
package com.facebook.flipper.sample;
|
||||
|
||||
import android.content.Context;
|
||||
import com.facebook.flipper.core.FlipperClient;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
public final class FlipperInitializer {
|
||||
public interface IntializationResult {
|
||||
OkHttpClient getOkHttpClient();
|
||||
}
|
||||
|
||||
public static IntializationResult initFlipperPlugins(Context context, FlipperClient client) {
|
||||
final OkHttpClient okHttpClient =
|
||||
new OkHttpClient.Builder()
|
||||
.connectTimeout(60, TimeUnit.SECONDS)
|
||||
.readTimeout(60, TimeUnit.SECONDS)
|
||||
.writeTimeout(10, TimeUnit.MINUTES)
|
||||
.build();
|
||||
|
||||
return new IntializationResult() {
|
||||
@Override
|
||||
public OkHttpClient getOkHttpClient() {
|
||||
return okHttpClient;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user