Skip to content

Commit

Permalink
upgrade react-native to 0.72.5
Browse files Browse the repository at this point in the history
This PR does many things :
- Upgrade `react-native ` to `0.72.5`
- Upgrade `react-native-reanimated` to  `3.5.4`
- Upgrade `react-native-navigation` to `7.37.0`
- `ndkVersion` has been bumped to `25.2.9519653`
- `cmakeVersion` has been bumped to `3.22.1`
- `kotlinVersion` has been bumped to `1.7.22`
- `AGP` has been bumped to `7.4.2`
- `Gradle` has been upgraded to `8.0.1`
- Android `CompileSDK` and `TargetSDK` have been bumped to 33
- `@react-native-async-storage/async-storage` has been upgraded to `1.19.3`
- `@walletconnect/client` has been nuked
- some of the old `react-native-reanimated` code has been nuked
- `react-native-keychain` fork has been replaced with `8.1.2`

- On Android we are currently relying on `Hermes` Engine.
- On iOS we are currently relying on JSC
- We are not enabling new architecture for now (I have plans for that in the future) ref: #18138

IOS only PR : #16721
Android only PR : #17062

- `make run-metro` now has a target of `android` which was `clojure` earlier, this will increase the time it takes to start metro terminal but this is needed otherwise you will get a nasty error while developing for android locally.
  • Loading branch information
siddarthkay committed Dec 11, 2023
1 parent f155d95 commit 008ee0d
Show file tree
Hide file tree
Showing 56 changed files with 5,595 additions and 4,768 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
root: true,
extends: '@react-native-community',
extends: '@react-native',
};
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
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ run-clojure: export TARGET := clojure
run-clojure: ##@run Watch for and build Clojure changes for mobile
yarn shadow-cljs watch mobile

run-metro: export TARGET := clojure
run-metro: export TARGET := android
run-metro: ##@run Start Metro to build React Native changes
@scripts/start-react-native.sh

Expand Down Expand Up @@ -368,7 +368,7 @@ component-test-watch: ##@ Watch tests and re-run no changes to cljs files
@@scripts/check-metro-shadow-process.sh
rm -rf ./component-spec
yarn install
nodemon --exec 'yarn shadow-cljs compile component-test && jest --config=test/jest/jest.config.js' -e cljs
nodemon --exec 'yarn shadow-cljs compile component-test && jest --config=test/jest/jest.config.js --testEnvironment node ' -e cljs

component-test: export TARGET := clojure
component-test: export COMPONENT_TEST := true
Expand All @@ -378,7 +378,7 @@ component-test: ##@test Run component tests once in NodeJS
rm -rf ./component-spec
yarn install
yarn shadow-cljs compile component-test && \
jest --config=test/jest/jest.config.js
jest --clearCache && jest --config=test/jest/jest.config.js --testEnvironment node

#--------------
# Other
Expand Down
276 changes: 62 additions & 214 deletions android/app/build.gradle

Large diffs are not rendered by default.

9 changes: 4 additions & 5 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 All @@ -17,11 +16,11 @@
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="28" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />

<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />

<application
Expand Down
12 changes: 10 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,14 @@ 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";
}

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.

Loading

0 comments on commit 008ee0d

Please sign in to comment.