Skip to content

Commit

Permalink
feat: update gradle config (#25)
Browse files Browse the repository at this point in the history
* chore: update library version

* wip: update gradle config

* feat: update gradle config

* feat: update firebase config using FlutterFire CLI

* chore: remove firebase messaging since we are not use it

* feat: improve implementation FlutterFire CLI for multi env
  • Loading branch information
Lzyct authored Mar 3, 2024
1 parent 9cbe2c3 commit acb5540
Show file tree
Hide file tree
Showing 16 changed files with 289 additions and 107 deletions.
15 changes: 14 additions & 1 deletion .env.prd.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
{
"ENV": "production",
"BASE_URL": "https://reqres.in"
"BASE_URL": "https://reqres.in",
"ANDROID_API_KEY": "AIzaSyCdU1UveIWYwX-Lsmtl7pIigbu5lug-pTU",
"ANDROID_APP_ID": "1:933342696488:android:2a6b2649b130a09e87511d",
"ANDROID_SENDER_ID": "933342696488",
"ANDROID_PROJECT_ID": "mobile-app-bd59b",
"ANDROID_STORAGE_BUCKET": "mobile-app-bd59b.appspot.com",
"IOS_API_KEY": "AIzaSyAPG4_LhFSS94Jez8k20Mu4i7cyCn26hzc",
"IOS_APP_ID": "1:933342696488:ios:3ddb617c88b0363187511d",
"IOS_SENDER_ID": "933342696488",
"IOS_PROJECT_ID": "mobile-app-bd59b",
"IOS_STORAGE_BUCKET": "mobile-app-bd59b.appspot.com",
"IOS_ANDROID_CLIENT_ID": "933342696488-i2co7br6pib2js7a8vsjpio4164n0qci.apps.googleusercontent.com",
"IOS_IOS_CLIENT_ID": "933342696488-ekbqsc1q8pkvk61nj5p0f04061ivr0ug.apps.googleusercontent.com",
"IOS_BUNDLE_ID": "com.lazycatlabs.auths"
}
15 changes: 14 additions & 1 deletion .env.stg.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
{
"ENV": "staging",
"BASE_URL": "https://reqres.in"
"BASE_URL": "https://reqres.in",
"ANDROID_API_KEY": "AIzaSyAXDLxYlgYywHeVs8Ch8uOq2t2BmtjOM0s",
"ANDROID_APP_ID": "1:520881115656:android:5ce1808f01692ab2fd77bd",
"ANDROID_SENDER_ID": "520881115656",
"ANDROID_PROJECT_ID": "sample-49e7c",
"ANDROID_STORAGE_BUCKET": "sample-49e7c.appspot.com",
"IOS_API_KEY": "AIzaSyCgylLbnzngRGnumT5dnyfx4foQ2Qdu3dY",
"IOS_APP_ID": "1:520881115656:ios:db518045ccad29fffd77bd",
"IOS_SENDER_ID": "520881115656",
"IOS_PROJECT_ID": "sample-49e7c",
"IOS_STORAGE_BUCKET": "sample-49e7c.appspot.com",
"IOS_ANDROID_CLIENT_ID": "520881115656-a76c2vaojcsa2kj1qk243eclfna6j6ff.apps.googleusercontent.com",
"IOS_IOS_CLIENT_ID": "520881115656-e14k5pcrklmsih46r01nh1fm9gt4oaf0.apps.googleusercontent.com",
"IOS_BUNDLE_ID": "com.lazycatlabs.auths.stg"
}
21 changes: 7 additions & 14 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
id "com.google.gms.google-services"
id "com.google.firebase.crashlytics"
}

def localProperties = new Properties()
Expand All @@ -13,11 +14,6 @@ if (localPropertiesFile.exists()) {
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
Expand All @@ -28,9 +24,9 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0'
}


android {
namespace "com.lazycatlabs.auth"
compileSdk 34
compileSdk 33

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -52,8 +48,8 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.lazycatlabs.auth"
minSdkVersion 21
targetSdkVersion 34
minSdkVersion 20
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
Expand Down Expand Up @@ -108,11 +104,8 @@ flutter {
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0"
implementation platform('com.google.firebase:firebase-bom:32.5.0')
implementation 'com.google.firebase:firebase-messaging-ktx'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.google.firebase:firebase-analytics-ktx'
}

apply plugin: 'com.google.firebase.crashlytics'
}
48 changes: 42 additions & 6 deletions android/app/google-services.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,42 @@
"storage_bucket": "mobile-app-bd59b.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:933342696488:android:38f3c637080d914d87511d",
"android_client_info": {
"package_name": "com.james.weighttracker"
}
},
"oauth_client": [
{
"client_id": "933342696488-65r3ei8hig6p8d4mhng670foqjr63ntt.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCdU1UveIWYwX-Lsmtl7pIigbu5lug-pTU"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "933342696488-65r3ei8hig6p8d4mhng670foqjr63ntt.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "933342696488-ekbqsc1q8pkvk61nj5p0f04061ivr0ug.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.lazycatlabs.auths"
}
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:933342696488:android:2a6b2649b130a09e87511d",
Expand All @@ -31,10 +67,10 @@
"client_type": 3
},
{
"client_id": "933342696488-vko2c10hpi09cvvkbpt9eeau6vfavpnq.apps.googleusercontent.com",
"client_id": "933342696488-ekbqsc1q8pkvk61nj5p0f04061ivr0ug.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.lazycatlabs.base"
"bundle_id": "com.lazycatlabs.auths"
}
}
]
Expand Down Expand Up @@ -67,10 +103,10 @@
"client_type": 3
},
{
"client_id": "933342696488-vko2c10hpi09cvvkbpt9eeau6vfavpnq.apps.googleusercontent.com",
"client_id": "933342696488-ekbqsc1q8pkvk61nj5p0f04061ivr0ug.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.lazycatlabs.base"
"bundle_id": "com.lazycatlabs.auths"
}
}
]
Expand Down Expand Up @@ -111,10 +147,10 @@
"client_type": 3
},
{
"client_id": "933342696488-vko2c10hpi09cvvkbpt9eeau6vfavpnq.apps.googleusercontent.com",
"client_id": "933342696488-ekbqsc1q8pkvk61nj5p0f04061ivr0ug.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.lazycatlabs.base"
"bundle_id": "com.lazycatlabs.auths"
}
}
]
Expand Down
72 changes: 72 additions & 0 deletions android/app/src/stg/google-services.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,78 @@
"storage_bucket": "sample-49e7c.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:520881115656:android:854b1e7d966a0555fd77bd",
"android_client_info": {
"package_name": "com.james.weighttracker"
}
},
"oauth_client": [
{
"client_id": "520881115656-b0iggeu3s5ophb4p94caa0h5jsmd9j7d.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAXDLxYlgYywHeVs8Ch8uOq2t2BmtjOM0s"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "520881115656-b0iggeu3s5ophb4p94caa0h5jsmd9j7d.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "520881115656-c82m945c9cc483231hmgn0g8nke7c3q8.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.lazycatlabs.base.stg"
}
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:520881115656:android:5ce1808f01692ab2fd77bd",
"android_client_info": {
"package_name": "com.lazycatlabs.auth"
}
},
"oauth_client": [
{
"client_id": "520881115656-b0iggeu3s5ophb4p94caa0h5jsmd9j7d.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAXDLxYlgYywHeVs8Ch8uOq2t2BmtjOM0s"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "520881115656-b0iggeu3s5ophb4p94caa0h5jsmd9j7d.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "520881115656-c82m945c9cc483231hmgn0g8nke7c3q8.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.lazycatlabs.base.stg"
}
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:520881115656:android:2ccc910b48e53ef3fd77bd",
Expand Down
18 changes: 3 additions & 15 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
buildscript {
ext.kotlin_version = '1.8.0'
repositories {

}

dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.15'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.4'
}
}

allprojects {
repositories {
google()
Expand All @@ -22,9 +8,11 @@ allprojects {
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}

tasks.register('clean', Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
16 changes: 12 additions & 4 deletions android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,19 @@ pluginManagement {

includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")

plugins {
id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

include ":app"
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.1" apply false
id "org.jetbrains.kotlin.android" version "1.8.0" apply false
id "com.google.gms.google-services" version "4.4.0" apply false
id "com.google.firebase.crashlytics" version "2.9.9" apply false
}

apply from: "${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle/app_plugin_loader.gradle"
include ":app"
2 changes: 1 addition & 1 deletion ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<string>12.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '11.0'
# platform :ios, '12.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
Loading

0 comments on commit acb5540

Please sign in to comment.