Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsegura committed Feb 23, 2024
1 parent ed4e644 commit 7c10ccd
Show file tree
Hide file tree
Showing 11 changed files with 1,321 additions and 971 deletions.
6 changes: 4 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ source 'https://rubygems.org'
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby ">= 2.6.10"

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

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

Expand Down
16 changes: 8 additions & 8 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply plugin: "com.android.application"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"

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

compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdkVersion rootProject.ext.compileSdkVersion

flavorDimensions "default"

Expand All @@ -104,6 +105,11 @@ android {
// https://github.com/luggit/react-native-config#advanced-android-setup
resValue "string", "build_config_package", "fr.coopcycle"
}
packagingOptions {
jniLibs {
useLegacyPackaging (findProperty('expo.useLegacyPackaging')?.toBoolean() ?: false)
}
}
signingConfigs {
release {
// Caution! In production, you need to generate your own keystore file.
Expand Down Expand Up @@ -160,13 +166,7 @@ android {
dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")

debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.squareup.okhttp3', module:'okhttp'
}

debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
implementation("com.facebook.react:flipper-integration")
if (hermesEnabled.toBoolean()) {
implementation("com.facebook.react:hermes-android")
} else {
Expand Down
4 changes: 1 addition & 3 deletions android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@
<application
android:usesCleartextTraffic="true"
tools:targetApi="28"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false" />
</application>
tools:ignore="GoogleAppIndexingWarning"/>
</manifest>
75 changes: 0 additions & 75 deletions android/app/src/debug/java/fr/coopcycle/ReactNativeFlipper.java

This file was deleted.

65 changes: 0 additions & 65 deletions android/app/src/main/java/fr/coopcycle/MainActivity.java

This file was deleted.

64 changes: 64 additions & 0 deletions android/app/src/main/java/fr/coopcycle/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package fr.coopcycle

import expo.modules.ReactActivityDelegateWrapper

import android.app.NotificationChannel
import android.app.NotificationManager
import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.Bundle
import android.view.WindowManager

import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
import com.facebook.react.defaults.DefaultReactActivityDelegate

class MainActivity : ReactActivity() {

override fun onCreate(savedInstanceState: Bundle?) {

// On Android the View state is not persisted consistently across Activity restarts, which can lead to crashes in those cases.
// It is recommended to override the native Android method called on Activity restarts in your main Activity, to avoid these crashes.
// https://github.com/software-mansion/react-native-screens#android
// https://github.com/software-mansion/react-native-screens/issues/17#issuecomment-424704633
super.onCreate(null)

// @see https://github.com/invertase/react-native-firebase/issues/2791
// @see https://developer.android.com/training/notify-user/channels
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {

NotificationChannel notificationChannel = new NotificationChannel(
"coopcycle_important",
"Service Updates",
NotificationManager.IMPORTANCE_HIGH
)
notificationChannel.setDescription("CoopCycle Service Updates")

NotificationManager notificationManager = (NotificationManager) getSystemService(NotificationManager.class)
notificationManager.createNotificationChannel(notificationChannel)
}
}

/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
override fun getMainComponentName(): String = "CoopCycle"

/**
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
*/
override fun createReactActivityDelegate(): ReactActivityDelegate {
return ReactActivityDelegateWrapper(
this,
BuildConfig.IS_NEW_ARCHITECTURE_ENABLED,
object : DefaultReactActivityDelegate(
this,
mainComponentName,
fabricEnabled
){})
}
}
97 changes: 0 additions & 97 deletions android/app/src/main/java/fr/coopcycle/MainApplication.java

This file was deleted.

Loading

0 comments on commit 7c10ccd

Please sign in to comment.