Skip to content

Commit

Permalink
(Android) upgrade react-native to 0.72.4
Browse files Browse the repository at this point in the history
  • Loading branch information
siddarthkay committed Nov 19, 2023
1 parent 84457a4 commit fd67d4c
Show file tree
Hide file tree
Showing 32 changed files with 186 additions and 698 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ project.xcworkspace
**/android/.project
**/android/.settings/org.eclipse.buildship.core.prefs
local.properties
*.hprof
.cxx/
*.keystore
!debug.keystore

# Atom
.tags*
Expand Down
270 changes: 67 additions & 203 deletions android/app/build.gradle

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:installLocation="auto"
package="im.status.ethereum">
android:installLocation="auto">

<!-- non-dangerous permissions -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
Expand Down
27 changes: 25 additions & 2 deletions android/app/src/main/java/im/status/ethereum/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
import android.os.Bundle;
import android.os.Handler;
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
import com.facebook.react.defaults.DefaultReactActivityDelegate;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.WritableMap;
Expand All @@ -32,7 +33,6 @@
import com.reactnativenavigation.NavigationActivity;
import com.facebook.react.modules.core.PermissionListener;
import androidx.core.splashscreen.SplashScreen;
import com.facebook.react.ReactActivity;

import java.util.Properties;
import im.status.ethereum.module.StatusThreadPoolExecutor;
Expand All @@ -46,6 +46,29 @@ public class MainActivity extends NavigationActivity
private boolean keepSplash = true;
private final int SPLASH_DELAY = 3200;

/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
protected String getMainComponentName() {
return "StatusIm";
}

/**
* Returns the instance of the {@link ReactActivityDelegate}. Here we use a util class {@link
* DefaultReactActivityDelegate} which allows you to easily enable Fabric and Concurrent React
* (aka React 18) with two boolean flags.
*/
/** MainActivity.java:64: error: incompatible types: MainActivity cannot be converted to ReactActivity this, ^
protected ReactActivityDelegate createReactActivityDelegate() {
return new DefaultReactActivityDelegate(
this,
getMainComponentName(),
// If you opted-in for the New Architecture, we enable the Fabric Renderer.
DefaultNewArchitectureEntryPoint.getFabricEnabled()
);
}
*/
private static void registerUncaughtExceptionHandler(final Context context) {
final Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
Expand Down
38 changes: 19 additions & 19 deletions android/app/src/main/java/im/status/ethereum/MainApplication.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
package im.status.ethereum;

import androidx.multidex.MultiDexApplication;
import android.content.Context;
import android.webkit.WebView;
import im.status.ethereum.newarchitecture.MainApplicationReactNativeHost;
import java.lang.reflect.InvocationTargetException;
import com.facebook.react.PackageList;

import com.aakashns.reactnativedialogs.ReactNativeDialogsPackage;
import com.facebook.react.ReactApplication;
import cl.json.RNSharePackage;
import com.facebook.react.ReactNativeHost;
import com.reactnativenavigation.NavigationApplication;
import com.reactnativenavigation.react.NavigationReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.config.ReactFeatureFlags;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
import com.facebook.react.modules.network.OkHttpClientProvider;
import com.reactnativecommunity.blurview.BlurViewPackage;

Expand All @@ -27,7 +23,6 @@
import im.status.ethereum.StatusOkHttpClientFactory;

import com.facebook.react.bridge.JSIModulePackage;
import com.swmansion.reanimated.ReanimatedJSIModulePackage;

public class MainApplication extends NavigationApplication {

Expand All @@ -44,7 +39,6 @@ protected List<ReactPackage> getPackages() {

List<ReactPackage> packages = new PackageList(this).getPackages();
packages.add(statusPackage);
packages.add(new ReactNativeDialogsPackage());
packages.add(new RNStatusKeycardPackage());
packages.add(new PushNotificationPackage());
packages.add(new BlurViewPackage());
Expand All @@ -56,32 +50,38 @@ protected String getJSMainModuleName() {
return "index";
}

@Override
protected JSIModulePackage getJSIModulePackage() {
return new ReanimatedJSIModulePackage();
}

@Override
protected boolean isNewArchEnabled() {
return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
}

@Override
protected Boolean isHermesEnabled() {
return BuildConfig.IS_HERMES_ENABLED;
}

};

private final ReactNativeHost mNewArchitectureNativeHost = new MainApplicationReactNativeHost(this);

@Override
public ReactNativeHost getReactNativeHost() {
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
return mNewArchitectureNativeHost;
} else {
return mReactNativeHost;
}
return mReactNativeHost;
}

@Override
public void onCreate() {
super.onCreate();
// If you opted-in for the New Architecture, we enable the TurboModule system
ReactFeatureFlags.useTurboModules = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;

OkHttpClientProvider.setOkHttpClientFactory(new StatusOkHttpClientFactory());

WebView.setWebContentsDebuggingEnabled(BuildConfig.DEBUG_WEBVIEW == "1");

if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for this app.
DefaultNewArchitectureEntryPoint.load();
}

}

}

This file was deleted.

This file was deleted.

This file was deleted.

39 changes: 0 additions & 39 deletions android/app/src/main/jni/Android.mk

This file was deleted.

20 changes: 0 additions & 20 deletions android/app/src/main/jni/MainApplicationModuleProvider.cpp

This file was deleted.

Loading

0 comments on commit fd67d4c

Please sign in to comment.