Skip to content

Commit

Permalink
Upgrade React Native 0.66.4 (1697)
Browse files Browse the repository at this point in the history
### Description

Upgrade react native to 0.66.4.

Notable changes in this PR include:
- Android: upgrade to gradle version 4.2.2
- Android: use mavenCentral as [JCenter has been sunset](https://github.com/facebook/react-native/releases/tag/v0.65.0) - [exoplayer is not available on mavenCentral yet](doublesymmetry/react-native-track-player#1235) so make an exception for that in build.gradle
- Patch react-native-fast-crypto which is [not compatible with gradle 4 yet](EdgeApp/react-native-fast-crypto#36)
- Update Hermes to compatible version
- Update react native/react/react-test-renderer which required many test snapshots to be updated
- Remove references to deprecated `AppState.removeListener` (https://reactnative.dev/docs/appstate#removeeventlistener)
- Verified with activation team that Plaid button is still working correctly on Android. There was a runtime error on app launch which RN suggested to remove the Plaid package from Android Manifest, no official mention of this in the react-native-plaid-link-sdk project but following the RN suggestion worked (even though the react-native-plaid-link-sdk docs still mention [these lines in the setup steps](https://github.com/plaid/react-native-plaid-link-sdk#2-add-plaidpackage-to-your-application))


### Other changes

N/A

### Tested

E2E tests should work as usual, app should build and function as usual.


### How others should test

A basic regression - click around the app and see no broken functionalities

### Related issues

- Fixes #1145 

### Backwards compatibility

N/A
  • Loading branch information
kathaypacific authored Jan 12, 2022
1 parent 2765358 commit 15c68ad
Show file tree
Hide file tree
Showing 94 changed files with 2,390 additions and 1,596 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
},
"devDependencies": {
"@actions/github": "^5.0.0",
"@babel/core": "^7.8.4",
"@babel/runtime": "^7.8.4",
"@babel/core": "^7.12.9",
"@babel/runtime": "^7.12.5",
"@types/jest": "^26.0.20",
"babel-jest": "^26.6.3",
"codecov": "^3.6.5",
Expand Down
14 changes: 13 additions & 1 deletion packages/mobile/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ def jscFlavor = 'org.webkit:android-jsc:+'
*/
def enableHermes = project.ext.react.get("enableHermes", false);

/**
* Architectures to build native code for in debug.
*/
def nativeArchitectures = project.getProperties().get("reactNativeDebugArchitectures")

def appVersionCode = Integer.valueOf(System.env.CIRCLE_BUILD_NUM ?: VERSION_CODE)

android {
Expand Down Expand Up @@ -209,6 +214,11 @@ android {
// minifyEnabled true
// proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro", "devsupport.pro"
signingConfig signingConfigs.debug
if (nativeArchitectures) {
ndk {
abiFilters nativeArchitectures.split(',')
}
}
}

release {
Expand Down Expand Up @@ -268,7 +278,9 @@ android {


dependencies {
androidTestImplementation('com.wix:detox:+')
androidTestImplementation('com.wix:detox:+') {
exclude group: 'com.google.android.material'
}
androidTestImplementation('com.linkedin.testbutler:test-butler-library:2.2.1')

implementation 'androidx.multidex:multidex:2.0.1'
Expand Down
4 changes: 3 additions & 1 deletion packages/mobile/android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@

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

<application android:usesCleartextTraffic="true" tools:ignore="GoogleAppIndexingWarning" android:networkSecurityConfig="@xml/network_security_config" />
<application android:usesCleartextTraffic="true" tools:ignore="GoogleAppIndexingWarning" android:networkSecurityConfig="@xml/network_security_config" >
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>
3 changes: 0 additions & 3 deletions packages/mobile/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA" />

<uses-sdk android:minSdkVersion="21" />

<application android:name=".MainApplication" android:allowBackup="false" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:label="@string/app_name" android:theme="@style/AppTheme" android:networkSecurityConfig="@xml/network_security_config">
<activity android:name=".MainActivity" android:screenOrientation="portrait" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:label="@string/app_name" android:launchMode="singleTop" android:theme="@style/AppTheme" android:windowSoftInputMode="adjustResize">
<intent-filter>
Expand All @@ -39,7 +37,6 @@
<data android:scheme="http" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />

<!-- Set custom default icon. This is used when no icon is set for incoming notification messages.
See README(https://goo.gl/l4GJaQ) for more. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import com.facebook.react.bridge.JSIModulePackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import com.plaid.PlaidPackage;
import com.swmansion.reanimated.ReanimatedJSIModulePackage;
import io.sentry.react.RNSentryPackage;
import java.lang.reflect.InvocationTargetException;
Expand All @@ -38,7 +37,6 @@ public boolean getUseDeveloperSupport() {
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
packages.add(new PlaidPackage());
return packages;
}

Expand Down
3 changes: 1 addition & 2 deletions packages/mobile/android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<style name="AppTheme" parent="Base.V0.AppTheme"/>

<!-- Base theme, also see API specific overrides in values-vXX/styles.xml -->
<style name="Base.V0.AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<style name="Base.V0.AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/black</item>
<!-- The window is always allowed to extend into then notch area -->
Expand All @@ -11,7 +11,6 @@
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<!-- Without this we briefly see the theme preview before our own splash screen -->
<item name="android:windowDisablePreview">true</item>
<item name="android:textColor">#000000</item>
</style>

<!-- Theme for the splash screen, based on AppTheme -->
Expand Down
14 changes: 10 additions & 4 deletions packages/mobile/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ buildscript {
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "21.4.7075529"
supportLibVersion = "30.0.0"
kotlinVersion = "1.5.10"
kotlinVersion = "1.5.21"
// Change this to change the geth version
celoClientDirectory = new File(rootProject.projectDir, '../../../node_modules/@celo/client/build/bin')
}
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.4'
classpath 'com.android.tools.build:gradle:4.2.2'
classpath 'com.google.gms:google-services:4.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlinVersion"
Expand All @@ -28,6 +29,7 @@ buildscript {

allprojects {
repositories {
mavenCentral()
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
Expand All @@ -44,7 +46,11 @@ allprojects {
dirs celoClientDirectory
}
google()
jcenter()
jcenter() {
content {
includeGroup("com.google.android.exoplayer")
}
}
maven { url 'https://www.jitpack.io' }
maven {
url 'https://sdk.withpersona.com/android/releases'
Expand Down
2 changes: 1 addition & 1 deletion packages/mobile/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ android.useAndroidX=true
android.enableJetifier=true

# Version of flipper SDK to use with React Native
FLIPPER_VERSION=0.69.0
FLIPPER_VERSION=0.99.0
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
21 changes: 3 additions & 18 deletions packages/mobile/android/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand All @@ -35,7 +35,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
Expand All @@ -45,28 +45,13 @@ echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
Expand Down
31 changes: 21 additions & 10 deletions packages/mobile/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ $static_framework = [
'Flipper-Glog',
'Flipper-PeerTalk',
'Flipper-RSocket',
'Flipper-Fmt',
]

require_relative "../../../node_modules/react-native/scripts/react_native_pods"
Expand Down Expand Up @@ -49,7 +50,7 @@ target "celo" do
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
use_flipper!({ 'Flipper-Folly' => '2.5.3', 'Flipper' => '0.87.0', 'Flipper-RSocket' => '1.3.1' })
use_flipper!()
end

target 'NotificationService' do
Expand All @@ -69,7 +70,8 @@ pre_install do |installer|
end

post_install do |installer|
flipper_post_install(installer)
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)

installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
Expand All @@ -80,14 +82,23 @@ post_install do |installer|
end
end

installer.pods_project.build_configurations.each do |config|
# Needed for now as Xcode 12 now tries to build/link both arm64 and x86_64 slices for the simulator
# but some of our prebuilt deps don't support this
# See:
# - https://stackoverflow.com/a/63955114/158525
# - https://github.com/facebook/react-native/issues/29984
# - https://apontious.com/2020/08/23/arm-wrestling-your-ios-simulator-builds/
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
projects = installer.aggregate_targets
.map{ |t| t.user_project }
.uniq{ |p| p.path }
.push(installer.pods_project)

# This block is needed for preserving the EXCLUDED_ARCHS setting on M1 machines
projects.each do |project|
project.build_configurations.each do |config|
# Needed for now as Xcode 12 now tries to build/link both arm64 and x86_64 slices for the simulator
# but some of our prebuilt deps don't support this
# See:
# - https://stackoverflow.com/a/63955114/158525
# - https://github.com/facebook/react-native/issues/29984
# - https://apontious.com/2020/08/23/arm-wrestling-your-ios-simulator-builds/
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64 "
end
project.save()
end

# Include env xccconfig generated by React Native Config
Expand Down
Loading

0 comments on commit 15c68ad

Please sign in to comment.