Skip to content

Commit

Permalink
feat: upgrade RN (#85)
Browse files Browse the repository at this point in the history
Co-authored-by: Arnaud AMBROSELLI <arnaudambroselli@pc72.home>
  • Loading branch information
arnaudambro and Arnaud AMBROSELLI authored Nov 8, 2021
1 parent 62090e4 commit a684540
Show file tree
Hide file tree
Showing 23 changed files with 2,625 additions and 2,610 deletions.
4 changes: 3 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
*.pbxproj -text
# Windows files should use crlf line endings
# https://help.github.com/articles/dealing-with-line-endings/
*.bat text eol=crlf
60 changes: 27 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,62 +1,56 @@
![Mobile version](https://img.shields.io/badge/mobile%20app%20version-1.14.21-blue)

# Mon Suivi Psy

Permettre à chacun de mieux connaitre son trouble pour faciliter le choix du bon traitement

## Run the application in development mode
## Deploy

### For all: bump versions

```
yarn start
```
#### Concept

Then, open another terminal and run:
### On iOS
Both android and ios have two kind of build numbers:

```
yarn ios
```
- android: you can see in `'/android/app/build.gradle` file `versionCode` and `versionName`. Usually, `versionCode` is incremented by 1 for every release, and `versionName` is basic versioning like `1.0.0` or whatever.

### On Android
- ios: you can see in `./ios/BalaBenzine.xcodeproj/project.pbxproj` two lines called `CURRENT_PROJECT_VERSION` and two other called `MARKETING_VERSION`. Usually, `CURRENT_PROJECT_VERSION` is incremented by 1 for every release, and `MARKETING_VERSION` is basic versioning like `1.0.0` or whatever.

```
yarn android
```
#### Automatic bump

## Run tests
```
yarn test
```
run `yarn update-mobile-app-version` with the proper arguments:

## Check lint
```
yarn lint
```
- `yarn update-mobile-app-version bump`: it will just increment +1 `versionCode` and `CURRENT_PROJECT_VERSION`
- `yarn update-mobile-app-version patch`: it will increment +1 `versionCode` and `CURRENT_PROJECT_VERSION` and increment `MARKETING_VERSION` and `versionName` from, for example, 1.0.0 to 1.0.1
- `yarn update-mobile-app-version minor`: it will increment +1 `versionCode` and `CURRENT_PROJECT_VERSION` and increment `MARKETING_VERSION` and `versionName` from, for example, 1.0.1 to 1.1.0
- `yarn update-mobile-app-version major`: it will increment +1 `versionCode` and `CURRENT_PROJECT_VERSION` and increment `MARKETING_VERSION` and `versionName` from, for example, 1.1.0 to 2.0.0

## Publish the app
#### Manual bump

### On Android
Just update manually the versions where you need to do it.

- Edit `android/app/build.gradle` lines 135 and 136 to change versionCode and version name
You can't upload twice the same `versionCode`/`CURRENT_PROJECT_VERSION`, whereas you can upload twice `versionName`/`MARKETING_VERSION`.
In any case, you can't upload any version lower than the previous.

- Edit `android/gradle.properties` lines 29 and 30 to add the keystore password
So be careful when you name those.

- Then, run the following command :
```
yarn build:android
```
### Android

This will generate a .aab file that you can upload in Google Play Console. This file can be found in `android/app/build/outputs/bundle/release/app.aab` and uploaded in a new Play Store release.
Just run `yarn build:android`.
Get the `.aab` file located at `./android/app/build/outputs/bundle/release/app-release.aab`

### On iOS
Upload it in Google Play console, Internal Testing or Production directly, as you prefer. Better to have at least one Internal Testing tester that can check the app is properly compiled (like with a real API connection, not localhost).

- Check `ios/monsuivipsy/Info.plist` line 29 to put `NSAllowsArbitraryLoads` to false and remove `localhost` from `NSExceptionDomains`
### iOS

- Open `ios/monsuivipsy.xcodeproj`, and click Product > Archive

- At the end of archiving, a new window opens: click "Distribute App". Then:

- Select "App Store Connect", and click "Next"
- Select "Upload", and click "Next"
- Select all three checkoxes ("Include bitcode for iOS content", "Strip Swift symbols" and "Upload your app's symbols"), and click "Next"
- In "Distribution certificate", select the default one, and in "monsuivipsy.app", select "iOS provisionning", and click "Next"
- Finally, click on "Upload"

- Your app is now in the Test Flight tab in your App Store Connect. After it is reviewed, you can use it in your next App Store release.
27 changes: 6 additions & 21 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,6 @@ apply plugin: "com.android.application"
import com.android.build.OutputFile
import groovy.json.JsonSlurper

def getVersionFromNpm(key) {
// Read and parse package.json file from project root
def inputFile = new File("$rootDir/../package.json")
def packageJson = new JsonSlurper().parseText(inputFile.text)

// Return the version, you can get any value this way
return packageJson[key]
}

println "VersionCode : ${getVersionFromNpm('versionCode')}"
println "version : ${getVersionFromNpm('version')}"

/**
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
* and bundleReleaseJsAndAssets).
Expand Down Expand Up @@ -134,20 +122,17 @@ def jscFlavor = 'org.webkit:android-jsc:+'
def enableHermes = project.ext.react.get("enableHermes", false);

android {
compileSdkVersion rootProject.ext.compileSdkVersion
ndkVersion rootProject.ext.ndkVersion

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
compileSdkVersion rootProject.ext.compileSdkVersion

defaultConfig {
applicationId "com.monsuivipsy"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled true
versionCode getVersionFromNpm('versionCode')
versionName getVersionFromNpm('version')
versionCode 64
versionName "1.14.21"
}
splits {
abi {
Expand Down Expand Up @@ -195,7 +180,7 @@ android {
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
}

}
Expand Down Expand Up @@ -234,7 +219,7 @@ dependencies {
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
from configurations.implementation
into 'libs'
}

Expand Down
7 changes: 6 additions & 1 deletion android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,10 @@

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

<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
<application
android:usesCleartextTraffic="true"
tools:targetApi="28"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>
1 change: 0 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<!-- Change the value to true to enable pop-up for in foreground (remote-only, for local use ignoreInForeground) -->
<meta-data android:name="com.dieam.reactnativepushnotification.notification_foreground"
android:value="false"/>
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:textColor">#000000</item>
</style>
Expand Down
15 changes: 8 additions & 7 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,26 @@

buildscript {
ext {
buildToolsVersion = "29.0.2"
minSdkVersion = 16
compileSdkVersion = 29
targetSdkVersion = 29
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "20.1.5948944"
}
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:3.5.3")
classpath("com.android.tools.build:gradle:4.2.1")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
mavenCentral()
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
Expand All @@ -31,7 +33,6 @@ allprojects {
}

google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
2 changes: 1 addition & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ MYAPP_UPLOAD_KEY_ALIAS=msp-key
MYAPP_UPLOAD_STORE_PASSWORD=****
MYAPP_UPLOAD_KEY_PASSWORD=****
# Version of flipper SDK to use with React Native
FLIPPER_VERSION=0.54.0
FLIPPER_VERSION=0.98.0
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
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
22 changes: 4 additions & 18 deletions android/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,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 @@ -54,7 +54,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 @@ -64,28 +64,14 @@ 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
8 changes: 6 additions & 2 deletions app.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"name": "monsuivipsy",
"displayName": "monsuivipsy"
}
"displayName": "Mon Suivi Psy",
"version": {
"buildNumber": 64,
"buildName": "1.14.21"
}
}
29 changes: 13 additions & 16 deletions ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '10.0'
platform :ios, '11.0'

target 'monsuivipsy' do
config = use_native_modules!

use_react_native!(:path => config["reactNativePath"])


use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => false
)

target 'monsuivipsyTests' do
inherit! :complete
Expand All @@ -18,18 +20,13 @@ target 'monsuivipsy' do
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
use_flipper!
post_install do |installer|
flipper_post_install(installer)
end
end

target 'monsuivipsy-tvOS' do
# Pods for monsuivipsy-tvOS
# you should disable the next line.
use_flipper!()

target 'monsuivipsy-tvOSTests' do
inherit! :search_paths
# Pods for testing
post_install do |installer|
react_native_post_install(installer)
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
end
Loading

0 comments on commit a684540

Please sign in to comment.