Skip to content

Commit 0f7887f

Browse files
committed
Bump React Native, Expo & esc-pos-encoder.
1 parent ed4e644 commit 0f7887f

22 files changed

+2789
-1725
lines changed

Gemfile

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ source 'https://rubygems.org'
33
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
44
ruby ">= 2.6.10"
55

6-
gem 'cocoapods', '~> 1.12'
7-
gem 'activesupport', '>= 6.1.7.3', '< 7.1.0'
6+
# Cocoapods 1.15 introduced a bug which break the build. We will remove the upper
7+
# bound in the template on Cocoapods with next React Native release.
8+
gem 'cocoapods', '>= 1.13', '< 1.15'
9+
gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'
810

911
gem "cocoapods-user-defined-build-types"
1012

android/app/build.gradle

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
apply plugin: "com.android.application"
2+
apply plugin: "org.jetbrains.kotlin.android"
23
apply plugin: "com.facebook.react"
34

45
apply plugin: "com.google.gms.google-services"
@@ -78,8 +79,8 @@ def jscFlavor = 'org.webkit:android-jsc:+'
7879
android {
7980
ndkVersion rootProject.ext.ndkVersion
8081

81-
compileSdkVersion rootProject.ext.compileSdkVersion
8282
buildToolsVersion rootProject.ext.buildToolsVersion
83+
compileSdkVersion rootProject.ext.compileSdkVersion
8384

8485
flavorDimensions "default"
8586

@@ -104,6 +105,11 @@ android {
104105
// https://github.com/luggit/react-native-config#advanced-android-setup
105106
resValue "string", "build_config_package", "fr.coopcycle"
106107
}
108+
packagingOptions {
109+
jniLibs {
110+
useLegacyPackaging (findProperty('expo.useLegacyPackaging')?.toBoolean() ?: false)
111+
}
112+
}
107113
signingConfigs {
108114
release {
109115
// Caution! In production, you need to generate your own keystore file.
@@ -160,13 +166,7 @@ android {
160166
dependencies {
161167
// The version of react-native is set by the React Native Gradle Plugin
162168
implementation("com.facebook.react:react-android")
163-
164-
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
165-
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
166-
exclude group:'com.squareup.okhttp3', module:'okhttp'
167-
}
168-
169-
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
169+
implementation("com.facebook.react:flipper-integration")
170170
if (hermesEnabled.toBoolean()) {
171171
implementation("com.facebook.react:hermes-android")
172172
} else {

android/app/src/debug/AndroidManifest.xml

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,5 @@
33
<application
44
android:usesCleartextTraffic="true"
55
tools:targetApi="28"
6-
tools:ignore="GoogleAppIndexingWarning">
7-
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false" />
8-
</application>
6+
tools:ignore="GoogleAppIndexingWarning"/>
97
</manifest>

android/app/src/debug/java/fr/coopcycle/ReactNativeFlipper.java

-75
This file was deleted.

android/app/src/main/java/fr/coopcycle/MainActivity.java

-65
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
package fr.coopcycle
2+
3+
import expo.modules.ReactActivityDelegateWrapper
4+
5+
import android.app.NotificationChannel
6+
import android.app.NotificationManager
7+
import android.content.Context
8+
import android.content.Intent
9+
import android.os.Build
10+
import android.os.Bundle
11+
import android.view.WindowManager
12+
13+
import com.facebook.react.ReactActivity
14+
import com.facebook.react.ReactActivityDelegate
15+
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
16+
import com.facebook.react.defaults.DefaultReactActivityDelegate
17+
18+
class MainActivity : ReactActivity() {
19+
20+
override fun onCreate(savedInstanceState: Bundle?) {
21+
22+
// On Android the View state is not persisted consistently across Activity restarts, which can lead to crashes in those cases.
23+
// It is recommended to override the native Android method called on Activity restarts in your main Activity, to avoid these crashes.
24+
// https://github.com/software-mansion/react-native-screens#android
25+
// https://github.com/software-mansion/react-native-screens/issues/17#issuecomment-424704633
26+
super.onCreate(null)
27+
28+
// @see https://github.com/invertase/react-native-firebase/issues/2791
29+
// @see https://developer.android.com/training/notify-user/channels
30+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
31+
32+
NotificationChannel notificationChannel = new NotificationChannel(
33+
"coopcycle_important",
34+
"Service Updates",
35+
NotificationManager.IMPORTANCE_HIGH
36+
)
37+
notificationChannel.setDescription("CoopCycle Service Updates")
38+
39+
NotificationManager notificationManager = (NotificationManager) getSystemService(NotificationManager.class)
40+
notificationManager.createNotificationChannel(notificationChannel)
41+
}
42+
}
43+
44+
/**
45+
* Returns the name of the main component registered from JavaScript. This is used to schedule
46+
* rendering of the component.
47+
*/
48+
override fun getMainComponentName(): String = "CoopCycle"
49+
50+
/**
51+
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
52+
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
53+
*/
54+
override fun createReactActivityDelegate(): ReactActivityDelegate {
55+
return ReactActivityDelegateWrapper(
56+
this,
57+
BuildConfig.IS_NEW_ARCHITECTURE_ENABLED,
58+
object : DefaultReactActivityDelegate(
59+
this,
60+
mainComponentName,
61+
fabricEnabled
62+
){})
63+
}
64+
}

android/app/src/main/java/fr/coopcycle/MainApplication.java

-97
This file was deleted.

0 commit comments

Comments
 (0)