From 2583efdba38c51cb04e5cd6cf585caae2f0c3bfa Mon Sep 17 00:00:00 2001 From: Siddarth Kumar Date: Thu, 18 Jul 2024 14:08:20 +0530 Subject: [PATCH] chore: nuke flipper --- Makefile | 1 + android/app/build.gradle | 11 --- .../status/ethereum/ReactNativeFlipper.java | 73 ------------------- .../im/status/ethereum/MainApplication.java | 31 -------- android/gradle.properties | 3 - ios/StatusIm/AppDelegate.m | 27 +------ 6 files changed, 2 insertions(+), 144 deletions(-) delete mode 100644 android/app/src/debug/java/im/status/ethereum/ReactNativeFlipper.java diff --git a/Makefile b/Makefile index 0e113548a5..44a01d91ea 100644 --- a/Makefile +++ b/Makefile @@ -195,6 +195,7 @@ release: release-android release-ios ##@build Build release for Android and iOS build-fdroid: export BUILD_ENV = prod build-fdroid: export BUILD_TYPE = release +build-fdroid: export BUILD_NUMBER ?= $(TMP_BUILD_NUMBER) build-fdroid: export ANDROID_ABI_SPLIT = false build-fdroid: export ANDROID_ABI_INCLUDE = armeabi-v7a;arm64-v8a;x86;x86_64 build-fdroid: ##@build Build release for F-Droid diff --git a/android/app/build.gradle b/android/app/build.gradle index d6cbd2d4f2..7f5ecf2823 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -299,17 +299,6 @@ dependencies { implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" - debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { - exclude group:'com.facebook.fbjni' - } - // TODO Uncomment once Flipper does not cause webview crashes in Debug mode - // debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { - // exclude group:'com.facebook.flipper' - // } - debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") { - exclude group:'com.facebook.flipper' - } - if (enableHermes) { def hermesPath = "../../node_modules/hermes-engine/android/"; debugImplementation files(hermesPath + "hermes-debug.aar") diff --git a/android/app/src/debug/java/im/status/ethereum/ReactNativeFlipper.java b/android/app/src/debug/java/im/status/ethereum/ReactNativeFlipper.java deleted file mode 100644 index bfcc62ef8c..0000000000 --- a/android/app/src/debug/java/im/status/ethereum/ReactNativeFlipper.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - *

This source code is licensed under the MIT license found in the LICENSE file in the root - * directory of this source tree. - */ -package im.status.ethereum; - -import android.content.Context; -import com.facebook.flipper.android.AndroidFlipperClient; -import com.facebook.flipper.android.utils.FlipperUtils; -import com.facebook.flipper.core.FlipperClient; -import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin; -import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin; -import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin; -import com.facebook.flipper.plugins.inspector.DescriptorMapping; -import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; -// import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; -// 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.ReactInstanceManager; -import com.facebook.react.bridge.ReactContext; -import com.facebook.react.modules.network.NetworkingModule; -import okhttp3.OkHttpClient; - -public class ReactNativeFlipper { - public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { - if (FlipperUtils.shouldEnableFlipper(context)) { - final FlipperClient client = AndroidFlipperClient.getInstance(context); - - client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())); - client.addPlugin(new ReactFlipperPlugin()); - client.addPlugin(new DatabasesFlipperPlugin(context)); - client.addPlugin(new SharedPreferencesFlipperPlugin(context)); - client.addPlugin(CrashReporterPlugin.getInstance()); - - // TODO Uncomment once Flipper does not cause webview crashes in Debug mode - // NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); - // NetworkingModule.setCustomClientBuilder( - // new NetworkingModule.CustomClientBuilder() { - // @Override - // public void apply(OkHttpClient.Builder builder) { - // builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)); - // } - // }); - // client.addPlugin(networkFlipperPlugin); - client.start(); - - // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized - // Hence we run if after all native modules have been initialized - ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); - if (reactContext == null) { - reactInstanceManager.addReactInstanceEventListener( - new ReactInstanceManager.ReactInstanceEventListener() { - @Override - public void onReactContextInitialized(ReactContext reactContext) { - reactInstanceManager.removeReactInstanceEventListener(this); - reactContext.runOnNativeModulesQueueThread( - new Runnable() { - @Override - public void run() { - client.addPlugin(new FrescoFlipperPlugin()); - } - }); - } - }); - } else { - client.addPlugin(new FrescoFlipperPlugin()); - } - } - } -} diff --git a/android/app/src/main/java/im/status/ethereum/MainApplication.java b/android/app/src/main/java/im/status/ethereum/MainApplication.java index ef93456092..00207871d0 100644 --- a/android/app/src/main/java/im/status/ethereum/MainApplication.java +++ b/android/app/src/main/java/im/status/ethereum/MainApplication.java @@ -70,36 +70,5 @@ public class MainApplication extends NavigationApplication { OkHttpClientProvider.setOkHttpClientFactory(new StatusOkHttpClientFactory()); WebView.setWebContentsDebuggingEnabled(BuildConfig.DEBUG_WEBVIEW == "1"); - initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); - } - /** - * Loads Flipper in React Native templates. Call this in the onCreate method with something like - * initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); - * - * @param context - * @param reactInstanceManager - */ - private static void initializeFlipper( - Context context, ReactInstanceManager reactInstanceManager) { - if (BuildConfig.DEBUG) { - try { - /* - 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("im.status.ethereum.ReactNativeFlipper"); - aClass - .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) - .invoke(null, context, reactInstanceManager); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } catch (InvocationTargetException e) { - e.printStackTrace(); - } - } } } diff --git a/android/gradle.properties b/android/gradle.properties index 921889c219..9d331d2d5a 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -47,6 +47,3 @@ org.gradle.jvmargs=-Xmx8704M versionCode=9999 commitHash=unknown - -# Flipper -FLIPPER_VERSION=0.56.0 diff --git a/ios/StatusIm/AppDelegate.m b/ios/StatusIm/AppDelegate.m index f7a9cb2245..1d6327f632 100644 --- a/ios/StatusIm/AppDelegate.m +++ b/ios/StatusIm/AppDelegate.m @@ -36,28 +36,6 @@ extern NSString* StatusgoImageServerTLSCert(); + (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler; @end - /* -#if DEBUG -#import -#import -#import -#import -#import -#import - */ - /* -static void InitializeFlipper(UIApplication *application) { - FlipperClient *client = [FlipperClient sharedClient]; - SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults]; - [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]]; - [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]]; - [client addPlugin:[FlipperKitReactPlugin new]]; - [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]]; - [client start]; - } -#endif - */ - @implementation AppDelegate { UIView *_blankView; @@ -65,9 +43,6 @@ static void InitializeFlipper(UIApplication *application) { - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - #if DEBUG - //InitializeFlipper(application); - #endif signal(SIGPIPE, SIG_IGN); NSURL *jsCodeLocation; @@ -247,4 +222,4 @@ didReceiveNotificationResponse:(UNNotificationResponse *)response } } -@end \ No newline at end of file +@end