Skip to content

Commit 15dfec8

Browse files
committed
updating template
1 parent 2d8f340 commit 15dfec8

File tree

13 files changed

+668
-270
lines changed

13 files changed

+668
-270
lines changed

.gitignore

Lines changed: 1 addition & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -2,76 +2,6 @@
22
#
33
.DS_Store
44

5-
# Xcode
6-
#
7-
template/build/
8-
template/*.pbxuser
9-
template/!default.pbxuser
10-
template/*.mode1v3
11-
template/!default.mode1v3
12-
template/*.mode2v3
13-
template/!default.mode2v3
14-
template/*.perspectivev3
15-
template/!default.perspectivev3
16-
template/xcuserdata
17-
template/*.xccheckout
18-
template/*.moved-aside
19-
template/DerivedData
20-
template/*.hmap
21-
template/*.ipa
22-
template/*.xcuserstate
23-
template/Pods/
24-
25-
# Android/IntelliJ
26-
#
27-
template/build/
28-
template/.idea
29-
template/.gradle
30-
template/local.properties
31-
template/*.iml
32-
33-
# Visual Studio Code
34-
#
35-
.vscode/
36-
37-
38-
# node.js
39-
#
40-
template/node_modules/
41-
template/npm-debug.log
42-
template/yarn-error.log
43-
44-
# BUCK
45-
buck-out/
46-
\.buckd/
47-
*.keystore
48-
!debug.keystore
49-
50-
# fastlane
51-
#
52-
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
53-
# screenshots whenever they are needed.
54-
# For more information about the recommended setup visit:
55-
# https://docs.fastlane.tools/best-practices/source-control/
56-
57-
*/fastlane/report.xml
58-
*/fastlane/Preview.html
59-
*/fastlane/screenshots
60-
61-
# Bundle artifact
62-
*.jsbundle
63-
64-
# CocoaPods
65-
template/ios/Pods/
66-
template/ios/Podfile.lock
67-
template/android/build/
68-
69-
.DS_Store
70-
71-
# OSX
72-
#
73-
.DS_Store
74-
755
# Xcode
766
#
777
build/
@@ -125,6 +55,7 @@ buck-out/
12555
*/fastlane/report.xml
12656
*/fastlane/Preview.html
12757
*/fastlane/screenshots
58+
*/fastlane/firebaseFastlane.json
12859

12960
# Bundle artifact
13061
*.jsbundle

template/App.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ import { FileLogger } from 'react-native-file-logger';
66
import { SENTRY_DSN, ENV, ONESIGNAL_ANDROID_KEY } from '@env';
77
import * as Sentry from '@sentry/react-native';
88
import codePush, { CodePushOptions } from 'react-native-code-push';
9-
import useAppState from 'react-native-appstate-hook';
109
import { Provider } from 'react-redux';
1110
import store from '@store/index';
1211
import { QueryClient, QueryClientProvider } from 'react-query';
13-
import { warn } from '@utils/console';
1412
import { theme } from 'theme';
1513
import { ThemeProvider } from 'styled-components';
1614

@@ -37,12 +35,6 @@ const queryClient = new QueryClient();
3735
const App = () => {
3836
useNavigationMounting();
3937

40-
useAppState({
41-
onChange: (newAppState) => warn('App state changed to ', newAppState),
42-
onForeground: () => warn('App went to Foreground'),
43-
onBackground: () => warn('App went to background'),
44-
});
45-
4638
return (
4739
<Provider store={store}>
4840
<QueryClientProvider client={queryClient}>

template/_gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ buck-out/
5757
*/fastlane/report.xml
5858
*/fastlane/Preview.html
5959
*/fastlane/screenshots
60+
*/fastlane/firebaseFastlane.json
6061

6162
# Bundle artifact
6263
*.jsbundle

template/android/app/build.gradle

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ android {
155155
testBuildType System.getProperty('testBuildType', 'debug') // This will later be used to control the test apk build type
156156
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
157157
}
158+
158159
splits {
159160
abi {
160161
reset()
@@ -183,8 +184,17 @@ android {
183184
buildTypes {
184185
debug {
185186
signingConfig signingConfigs.debug
187+
debuggable true
186188
resValue "string", "CodePushDeploymentKey", '""'
189+
applicationIdSuffix ".debug"
190+
}
191+
192+
staging {
193+
initWith debug
194+
manifestPlaceholders = [hostName:"internal.helloWorld.com"]
195+
applicationIdSuffix ".debugStaging"
187196
}
197+
188198
release {
189199
// Caution! In production, you need to generate your own keystore file.
190200
// see https://reactnative.dev/docs/signed-apk-android.
@@ -194,6 +204,18 @@ android {
194204
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
195205
}
196206
}
207+
// https://developer.android.com/studio/build/build-variants#groovy
208+
productFlavors {
209+
development {
210+
applicationIdSuffix ".development"
211+
versionNameSuffix "-development"
212+
}
213+
214+
staging {
215+
applicationIdSuffix ".staging"
216+
versionNameSuffix "-staging"
217+
}
218+
}
197219

198220
// applicationVariants are e.g. debug, release
199221
applicationVariants.all { variant ->
@@ -222,7 +244,7 @@ dependencies {
222244
implementation 'com.google.firebase:firebase-core:16.0.0'
223245
// implementation platform('com.google.firebase:firebase-bom:28.0.1')
224246
implementation 'androidx.multidex:multidex:2.0.1'
225-
compile project(':react-native-vector-icons')
247+
implementation project(':react-native-vector-icons')
226248

227249
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
228250
exclude group:'com.facebook.fbjni'

template/android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ buildscript {
44
ext {
55
buildToolsVersion = "29.0.3"
66
minSdkVersion = 21
7-
compileSdkVersion = 29
8-
targetSdkVersion = 29
7+
compileSdkVersion = 30
8+
targetSdkVersion = 30
99
ndkVersion = "20.1.5948944"
1010
androidXCore = "1.3.2"
1111
kotlinVersion = '1.4.0'

template/fastlane/AppFile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
json_key_file "fastlane/firebaseFastlane.json"
2+
# package_name "example.react.native.HelloWorld"

template/fastlane/Fastfile

Lines changed: 73 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,64 +6,108 @@ platform :android do
66
# For android, you should setup signing for release builds.
77
# Currently, the default debug keystore is used.
88
desc 'Build the staging release APK.'
9-
private_lane :build_staging do
9+
private_lane :build_staging_apk do
1010
gradle(task: 'clean', project_dir: 'android/')
1111
gradle(
1212
project_dir: "android/",
1313
task: "assemble",
14+
flavor: "Development",
1415
build_type: "Release"
1516
)
16-
end
17+
end
1718

1819
desc 'Build the production release APK.'
19-
private_lane :build_production do
20+
private_lane :build_production_apk do
2021
gradle(task: 'clean', project_dir: 'android/')
21-
sh("npm", "run", "make-apk:productionRelease")
22+
gradle(
23+
project_dir: "android/",
24+
task: "assemble",
25+
build_type: "Release"
26+
)
2227
end
2328

29+
desc 'Build the staging release bundle.'
30+
private_lane :build_staging_bundle do
31+
gradle(task: 'clean', project_dir: 'android/')
32+
gradle(
33+
project_dir: "android/",
34+
task: "bundle",
35+
flavor: "Development",
36+
build_type: "Release"
37+
)
38+
end
39+
40+
desc 'Build the product release bundle.'
41+
private_lane :build_production_bundle do
42+
gradle(task: 'clean', project_dir: 'android/')
43+
gradle(
44+
project_dir: "android/",
45+
task: "bundle",
46+
build_type: "Release"
47+
)
48+
end
49+
2450
desc 'Upload the release APK to App Center.'
25-
private_lane :upload do |options|
51+
private_lane :upload_apk_app_center do |options|
2652
release_notes = options[:notes]
2753
appcenter_upload(
2854
api_token: ENV["APPCENTER_API_TOKEN"],
2955
owner_name: ENV["APPCENTER_OWNER_NAME"],
3056
app_name: ENV["APPCENTER_APP_NAME"],
31-
apk: "./android/app/build/outputs/apk/release/app-release.apk",
57+
file: "./android/app/build/outputs/apk/release/app-release.apk",
3258
notify_testers: ENV["NOTIFY_TESTERS"],
3359
destinations: ENV["DESTINATIONS"],
3460
release_notes: release_notes
3561
)
3662
end
3763

38-
desc 'Build, deploy staging Android.'
39-
lane :deploy_staging do
40-
build_staging
41-
upload
64+
desc 'Upload the release Bundle to App Center.'
65+
private_lane :upload_bundle_app_center do |options|
66+
release_notes = options[:notes]
67+
appcenter_upload(
68+
api_token: ENV["APPCENTER_API_TOKEN"],
69+
owner_name: ENV["APPCENTER_OWNER_NAME"],
70+
app_name: ENV["APPCENTER_APP_NAME"],
71+
file: "./android/app/build/outputs/bundle/release/app-release.aab",
72+
notify_testers: ENV["NOTIFY_TESTERS"],
73+
destinations: ENV["DESTINATIONS"],
74+
release_notes: release_notes
75+
)
4276
end
4377

44-
desc 'Build, deploy production Android.'
45-
lane :deploy_production do
46-
build_production
47-
upload
78+
desc 'Upload the release Bundle to Google Play Console with Roll out in 50%.'
79+
private_lane :upload_bundle_play_console do
80+
upload_to_play_store(
81+
track: 'production',
82+
rollout: '0.5',
83+
aab: "./android/app/build/outputs/bundle/release/app-release.aab"
84+
)
4885
end
4986

50-
desc 'Bump, badge, deploy staging Android.'
51-
lane :bump_badge_deploy_staging do
87+
desc 'Bump badge and build staging Android APK.'
88+
lane :bump_badge_build_staging_apk do
5289
bump_badge
53-
deploy_staging
90+
build_staging_apk
5491
end
5592

56-
desc 'Bump, badge, build staging Android.'
57-
lane :bump_badge_build_staging do
58-
bump_badge
59-
build_staging
93+
desc 'Build and deploy staging Android APK.'
94+
lane :deploy_staging do
95+
bump_badge_build_staging_apk
96+
upload_apk_app_center
6097
end
61-
62-
desc 'Bump, badge, deploy production Android.'
63-
lane :bump_badge_deploy_prod do
98+
99+
desc 'Bump badge and build production Bundle Android.'
100+
lane :bump_badge_build_production_bundle do
64101
bump_badge
65-
deploy_production
102+
build_production_bundle
66103
end
104+
105+
desc 'Bump, build and deploy production Bundle Android.'
106+
lane :deploy_production do
107+
bump_badge_build_production_bundle
108+
upload_bundle_app_center
109+
end
110+
67111
end
68112

69113
# -------------iOS Sign, Build & Deploy-------------#
@@ -84,7 +128,7 @@ platform :ios do
84128
end
85129

86130
desc 'Build the staging release iOS application.'
87-
private_lane :build_staging do
131+
private_lane :build_staging_apk do
88132
package = load_json(json_path: "./package.json")
89133
gym(
90134
scheme: "STAGING",
@@ -94,7 +138,7 @@ platform :ios do
94138
end
95139

96140
desc 'Build the production release iOS application.'
97-
private_lane :build_production do
141+
private_lane :build_production_apk do
98142
package = load_json(json_path: "./package.json")
99143
gym(
100144
scheme: "PRODUCTION",
@@ -121,14 +165,14 @@ platform :ios do
121165
desc 'Sign, build, deploy staging iOS.'
122166
lane :deploy_staging do
123167
certificates
124-
build_staging
168+
build_staging_apk
125169
upload
126170
end
127171

128172
desc 'Sign, build, deploy production iOS.'
129173
lane :deploy_production do
130174
certificates
131-
build_production
175+
build_production_apk
132176
upload
133177
end
134178

0 commit comments

Comments
 (0)