Skip to content

Commit 755ad3b

Browse files
axe-fbfacebook-github-bot
authored andcommitted
Move ReactNativeFlipper class to template
Reviewed By: mdvacca Differential Revision: D6101369 fbshipit-source-id: e1ae8f57136dd568b7c14fa873a50bb490d73808
1 parent 4bda2db commit 755ad3b

File tree

6 files changed

+12
-13
lines changed

6 files changed

+12
-13
lines changed

ReactAndroid/build.gradle

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -380,12 +380,6 @@ dependencies {
380380
androidTestImplementation("androidx.test:runner:1.1.0")
381381
androidTestImplementation("androidx.test:rules:1.1.0")
382382
androidTestImplementation("org.mockito:mockito-core:${MOCKITO_CORE_VERSION}")
383-
384-
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
385-
exclude group:'com.facebook.yoga'
386-
exclude group:'com.facebook.flipper', module: 'fbjni'
387-
exclude group:'com.facebook.litho', module: 'litho-annotations'
388-
}
389383
}
390384

391385
apply(from: "release.gradle")

ReactAndroid/gradle.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ BOOST_VERSION=1_63_0
2020
DOUBLE_CONVERSION_VERSION=1.1.6
2121
FOLLY_VERSION=2018.10.22.00
2222
GLOG_VERSION=0.3.5
23-
FLIPPER_VERSION=0.23.4
2423

2524
android.useAndroidX=true
2625
android.enableJetifier=true

template/android/app/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,12 @@ dependencies {
191191
implementation fileTree(dir: "libs", include: ["*.jar"])
192192
implementation "com.facebook.react:react-native:+" // From node_modules
193193

194+
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
195+
exclude group:'com.facebook.yoga'
196+
exclude group:'com.facebook.flipper', module: 'fbjni'
197+
exclude group:'com.facebook.litho', module: 'litho-annotations'
198+
}
199+
194200
if (enableHermes) {
195201
def hermesPath = "../../node_modules/hermes-engine/android/";
196202
debugImplementation files(hermesPath + "hermes-debug.aar")

ReactAndroid/src/debug/java/com/facebook/flipper/ReactNativeFlipper.java renamed to template/android/app/src/debug/java/com/helloworld/ReactNativeFlipper.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
55
* directory of this source tree.
66
*/
7-
package com.facebook.flipper;
7+
package com.helloworld;
88

99
import android.content.Context;
1010
import com.facebook.flipper.android.AndroidFlipperClient;
@@ -18,15 +18,12 @@
1818
import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
1919
import com.facebook.flipper.plugins.react.ReactFlipperPlugin;
2020
import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
21-
import com.facebook.react.BuildConfig;
2221
import com.facebook.react.modules.network.NetworkingModule;
2322
import okhttp3.OkHttpClient;
2423

2524
public class ReactNativeFlipper {
26-
public static final String CLASS_NAME = "com.facebook.flipper.ReactNativeFlipper";
27-
2825
public static void initializeFlipper(Context context) {
29-
if (BuildConfig.DEBUG && FlipperUtils.shouldEnableFlipper(context)) {
26+
if (FlipperUtils.shouldEnableFlipper(context)) {
3027
final FlipperClient client = AndroidFlipperClient.getInstance(context);
3128

3229
client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));

template/android/app/src/main/java/com/helloworld/MainApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ private static void initializeFlipper(Context context) {
5757
We use reflection here to pick up the class that initializes Flipper,
5858
since Flipper library is not available in release mode
5959
*/
60-
Class<?> aClass = Class.forName("com.facebook.flipper.ReactNativeFlipper");
60+
Class<?> aClass = Class.forName("com.helloworld.ReactNativeFlipper");
6161
aClass.getMethod("initializeFlipper", Context.class).invoke(null, context);
6262
} catch (ClassNotFoundException e) {
6363
e.printStackTrace();

template/android/gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@
2323
android.useAndroidX=true
2424
# Automatically convert third-party libraries to use AndroidX
2525
android.enableJetifier=true
26+
27+
# Version of flipper SDK to use with React Native
28+
FLIPPER_VERSION=0.23.4

0 commit comments

Comments
 (0)