feat: configure Firebase and signing for multiple environments in mobile app

This commit is contained in:
Achintha Isuru
2025-11-18 17:52:23 -05:00
parent ef35554635
commit c6ccd1e2e3
16 changed files with 443 additions and 59 deletions

View File

@@ -35,11 +35,47 @@ android {
flavorDimensions "release-type"
def keystorePropertiesFileNameDev = "key_dev.properties"
def keystorePropertiesDev = new Properties()
keystorePropertiesDev.load(new FileInputStream(rootProject.file(keystorePropertiesFileNameDev)))
def keystorePropertiesFileNameStaging = "key_staging.properties"
def keystorePropertiesStaging = new Properties()
keystorePropertiesStaging.load(new FileInputStream(rootProject.file(keystorePropertiesFileNameStaging)))
def keystorePropertiesFileNameProd = "key_prod.properties"
def keystorePropertiesProd = new Properties()
keystorePropertiesProd.load(new FileInputStream(rootProject.file(keystorePropertiesFileNameProd)))
signingConfigs {
configDev {
keyAlias keystorePropertiesDev['keyAlias']
keyPassword keystorePropertiesDev['keyPassword']
storeFile file('../key_dev.jks')
storePassword keystorePropertiesDev['storePassword']
}
configStaging {
keyAlias keystorePropertiesStaging['keyAlias']
keyPassword keystorePropertiesStaging['keyPassword']
storeFile file('../key_staging.jks')
storePassword keystorePropertiesStaging['storePassword']
}
configProd {
keyAlias keystorePropertiesProd['keyAlias']
keyPassword keystorePropertiesProd['keyPassword']
storeFile file('../key_staging.jks')
storePassword keystorePropertiesProd['storePassword']
}
}
productFlavors {
dev {
dimension "release-type"
applicationIdSuffix ".dev"
versionNameSuffix "-dev"
signingConfig signingConfigs.configDev
manifestPlaceholders = [
appLabel: "Krow Business dev",
appIcon: "@mipmap/ic_launcher_dev"
@@ -50,6 +86,7 @@ android {
dimension "release-type"
applicationIdSuffix ".staging"
versionNameSuffix "-staging"
signingConfig signingConfigs.configStaging
manifestPlaceholders = [
appLabel: "Krow Business staging",
appIcon: "@mipmap/ic_launcher_dev"
@@ -58,27 +95,13 @@ android {
prod {
dimension "release-type"
signingConfig signingConfigs.configProd
manifestPlaceholders = [
appLabel: "Krow Business",
appIcon: "@mipmap/ic_launcher"
]
}
}
signingConfigs {
release {
keyAlias = keystoreProperties['keyAliasClient']
keyPassword = keystoreProperties['keyPassword']
storeFile = keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword = keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig = signingConfigs.release
}
}
}
flutter {

View File

@@ -0,0 +1,4 @@
storePassword=krowdev
keyPassword=krowdev
keyAlias=staff-dev
storeFile=kast_android_dev.jks

View File

@@ -0,0 +1,4 @@
storePassword=krowstaging
keyPassword=krowstaging
keyAlias=staff-staging
storeFile=key_staging.jks

View File

@@ -0,0 +1,4 @@
storePassword=krowstaging
keyPassword=krowstaging
keyAlias=staff-staging
storeFile=key_staging.jks

View File

@@ -1 +1,64 @@
{"flutter":{"platforms":{"android":{"default":{"projectId":"krow-staging","appId":"1:14482748607:android:85b147490ff76b6924820a","fileOutput":"android/app/google-services.json"},"buildConfigurations":{"src/dev":{"projectId":"krow-workforce-dev","appId":"1:933560802882:android:edcddb83ea4bbb517757db","fileOutput":"android/app/src/dev/google-services.json"},"src/staging":{"projectId":"krow-workforce-staging","appId":"1:1032971403708:android:d35f6d13a9e03bcb356bb9","fileOutput":"android/app/src/staging/google-services.json"}}},"ios":{"default":{"projectId":"krow-staging","appId":"1:14482748607:ios:229a7ce2d64cb09f24820a","uploadDebugSymbols":false,"fileOutput":"ios/Runner/GoogleService-Info.plist"},"targets":{"Runner":{"projectId":"krow-workforce-staging","appId":"1:1032971403708:ios:b1a21a7337a268b3356bb9","uploadDebugSymbols":false,"fileOutput":"ios/flavors/staging/GoogleService-Info.plist"}}},"dart":{"lib/firebase_options.dart":{"projectId":"krow-staging","configurations":{"android":"1:14482748607:android:85b147490ff76b6924820a","ios":"1:14482748607:ios:229a7ce2d64cb09f24820a"}},"lib/firebase_options_dev.dart":{"projectId":"krow-workforce-dev","configurations":{"android":"1:933560802882:android:edcddb83ea4bbb517757db","ios":"1:933560802882:ios:7f0632ecbeff8f027757db"}},"lib/firebase_options_staging.dart":{"projectId":"krow-workforce-staging","configurations":{"android":"1:1032971403708:android:d35f6d13a9e03bcb356bb9","ios":"1:1032971403708:ios:b1a21a7337a268b3356bb9"}}}}}}
{
"flutter": {
"platforms": {
"android": {
"default": {
"projectId": "krow-staging",
"appId": "1:14482748607:android:85b147490ff76b6924820a",
"fileOutput": "android/app/google-services.json"
},
"buildConfigurations": {
"src/dev": {
"projectId": "krow-workforce-dev",
"appId": "1:933560802882:android:edcddb83ea4bbb517757db",
"fileOutput": "android/app/src/dev/google-services.json"
},
"src/staging": {
"projectId": "krow-workforce-staging",
"appId": "1:1032971403708:android:d35f6d13a9e03bcb356bb9",
"fileOutput": "android/app/src/staging/google-services.json"
}
}
},
"ios": {
"default": {
"projectId": "krow-staging",
"appId": "1:14482748607:ios:229a7ce2d64cb09f24820a",
"uploadDebugSymbols": false,
"fileOutput": "ios/Runner/GoogleService-Info.plist"
},
"targets": {
"Runner": {
"projectId": "krow-workforce-staging",
"appId": "1:1032971403708:ios:b1a21a7337a268b3356bb9",
"uploadDebugSymbols": false,
"fileOutput": "ios/flavors/staging/GoogleService-Info.plist"
}
}
},
"dart": {
"lib/firebase_options.dart": {
"projectId": "krow-staging",
"configurations": {
"android": "1:14482748607:android:85b147490ff76b6924820a",
"ios": "1:14482748607:ios:229a7ce2d64cb09f24820a"
}
},
"lib/firebase_options_dev.dart": {
"projectId": "krow-workforce-dev",
"configurations": {
"android": "1:933560802882:android:edcddb83ea4bbb517757db",
"ios": "1:933560802882:ios:7f0632ecbeff8f027757db"
}
},
"lib/firebase_options_staging.dart": {
"projectId": "krow-workforce-staging",
"configurations": {
"android": "1:1032971403708:android:d35f6d13a9e03bcb356bb9",
"ios": "1:1032971403708:ios:b1a21a7337a268b3356bb9"
}
}
}
}
}
}