Skip to content

Commit

Permalink
Move ReactNativeFlipper class to template
Browse files Browse the repository at this point in the history
Reviewed By: mdvacca

Differential Revision: D6101369

fbshipit-source-id: e1ae8f57136dd568b7c14fa873a50bb490d73808
  • Loading branch information
axe-fb authored and facebook-github-bot committed Sep 3, 2019
1 parent 4bda2db commit 755ad3b
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 13 deletions.
6 changes: 0 additions & 6 deletions ReactAndroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -380,12 +380,6 @@ dependencies {
androidTestImplementation("androidx.test:runner:1.1.0")
androidTestImplementation("androidx.test:rules:1.1.0")
androidTestImplementation("org.mockito:mockito-core:${MOCKITO_CORE_VERSION}")

debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.yoga'
exclude group:'com.facebook.flipper', module: 'fbjni'
exclude group:'com.facebook.litho', module: 'litho-annotations'
}
}

apply(from: "release.gradle")
1 change: 0 additions & 1 deletion ReactAndroid/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ BOOST_VERSION=1_63_0
DOUBLE_CONVERSION_VERSION=1.1.6
FOLLY_VERSION=2018.10.22.00
GLOG_VERSION=0.3.5
FLIPPER_VERSION=0.23.4

android.useAndroidX=true
android.enableJetifier=true
Expand Down
6 changes: 6 additions & 0 deletions template/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,12 @@ dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.facebook.react:react-native:+" // From node_modules

debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.yoga'
exclude group:'com.facebook.flipper', module: 'fbjni'
exclude group:'com.facebook.litho', module: 'litho-annotations'
}

if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* <p>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;
package com.helloworld;

import android.content.Context;
import com.facebook.flipper.android.AndroidFlipperClient;
Expand All @@ -18,15 +18,12 @@
import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
import com.facebook.flipper.plugins.react.ReactFlipperPlugin;
import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
import com.facebook.react.BuildConfig;
import com.facebook.react.modules.network.NetworkingModule;
import okhttp3.OkHttpClient;

public class ReactNativeFlipper {
public static final String CLASS_NAME = "com.facebook.flipper.ReactNativeFlipper";

public static void initializeFlipper(Context context) {
if (BuildConfig.DEBUG && FlipperUtils.shouldEnableFlipper(context)) {
if (FlipperUtils.shouldEnableFlipper(context)) {
final FlipperClient client = AndroidFlipperClient.getInstance(context);

client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private static void initializeFlipper(Context context) {
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.facebook.flipper.ReactNativeFlipper");
Class<?> aClass = Class.forName("com.helloworld.ReactNativeFlipper");
aClass.getMethod("initializeFlipper", Context.class).invoke(null, context);
} catch (ClassNotFoundException e) {
e.printStackTrace();
Expand Down
3 changes: 3 additions & 0 deletions template/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

# Version of flipper SDK to use with React Native
FLIPPER_VERSION=0.23.4

0 comments on commit 755ad3b

Please sign in to comment.