feat: implement conditional google-services processing and update Firebase configurations for staging and production environments

This commit is contained in:
Achintha Isuru
2026-03-09 18:09:25 -04:00
parent fe98462431
commit 972951fd96
10 changed files with 67 additions and 117 deletions

View File

@@ -108,6 +108,20 @@ android {
} }
} }
// Skip google-services processing for flavors whose google-services.json
// contains placeholder values (e.g. prod before the Firebase project exists).
// Once a real config is dropped in, the task automatically re-enables.
afterEvaluate {
tasks.matching {
it.name.startsWith("process") && it.name.endsWith("GoogleServices")
}.configureEach {
val taskFlavor = name.removePrefix("process").removeSuffix("GoogleServices")
.removeSuffix("Debug").removeSuffix("Release").lowercase()
val configFile = file("src/$taskFlavor/google-services.json")
enabled = configFile.exists() && configFile.readText().contains("\"mobilesdk_app_id\": \"1:")
}
}
flutter { flutter {
source = "../.." source = "../.."
} }

View File

@@ -1,24 +0,0 @@
{
"project_info": {
"project_number": "",
"project_id": "krow-workforce-prod",
"storage_bucket": "krow-workforce-prod.firebasestorage.app"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "",
"android_client_info": {
"package_name": "prod.krowwithus.client"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": ""
}
]
}
],
"configuration_version": "1"
}

View File

@@ -1 +1,31 @@
{"flutter":{"platforms":{"android":{"default":{"projectId":"krow-workforce-dev","appId":"1:933560802882:android:da13569105659ead7757db","fileOutput":"android/app/google-services.json"}},"ios":{"default":{"projectId":"krow-workforce-dev","appId":"1:933560802882:ios:d2b6d743608e2a527757db","uploadDebugSymbols":false,"fileOutput":"ios/Runner/GoogleService-Info.plist"}},"dart":{"lib/firebase_options.dart":{"projectId":"krow-workforce-dev","configurations":{"android":"1:933560802882:android:da13569105659ead7757db","ios":"1:933560802882:ios:d2b6d743608e2a527757db","web":"1:933560802882:web:173a841992885bb27757db"}}}}}} {
"flutter": {
"platforms": {
"android": {
"default": {
"projectId": "krow-workforce-dev",
"appId": "1:933560802882:android:da13569105659ead7757db",
"fileOutput": "android/app/google-services.json"
}
},
"ios": {
"default": {
"projectId": "krow-workforce-dev",
"appId": "1:933560802882:ios:d2b6d743608e2a527757db",
"uploadDebugSymbols": false,
"fileOutput": "ios/Runner/GoogleService-Info.plist"
}
},
"dart": {
"lib/firebase_options.dart": {
"projectId": "krow-workforce-dev",
"configurations": {
"android": "1:933560802882:android:da13569105659ead7757db",
"ios": "1:933560802882:ios:d2b6d743608e2a527757db",
"web": "1:933560802882:web:173a841992885bb27757db"
}
}
}
}
}
}

View File

@@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>API_KEY</key>
<string></string>
<key>GCM_SENDER_ID</key>
<string></string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>prod.krowwithus.client</string>
<key>PROJECT_ID</key>
<string>krow-workforce-prod</string>
<key>STORAGE_BUCKET</key>
<string>krow-workforce-prod.firebasestorage.app</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<true></true>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string></string>
</dict>
</plist>

View File

@@ -112,6 +112,20 @@ android {
} }
} }
// Skip google-services processing for flavors whose google-services.json
// contains placeholder values (e.g. prod before the Firebase project exists).
// Once a real config is dropped in, the task automatically re-enables.
afterEvaluate {
tasks.matching {
it.name.startsWith("process") && it.name.endsWith("GoogleServices")
}.configureEach {
val taskFlavor = name.removePrefix("process").removeSuffix("GoogleServices")
.removeSuffix("Debug").removeSuffix("Release").lowercase()
val configFile = file("src/$taskFlavor/google-services.json")
enabled = configFile.exists() && configFile.readText().contains("\"mobilesdk_app_id\": \"1:")
}
}
flutter { flutter {
source = "../.." source = "../.."
} }

View File

@@ -1,24 +0,0 @@
{
"project_info": {
"project_number": "",
"project_id": "krow-workforce-prod",
"storage_bucket": "krow-workforce-prod.firebasestorage.app"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "",
"android_client_info": {
"package_name": "prod.krowwithus.staff"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": ""
}
]
}
],
"configuration_version": "1"
}

View File

@@ -3,9 +3,9 @@
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CLIENT_ID</key> <key>CLIENT_ID</key>
<string>933560802882-fphpkdjubve8k7e8ogqj3fk1qducv3sg.apps.googleusercontent.com</string> <string>933560802882-jpv087j5jenp1h63mc9ge51767s3l2ac.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key> <key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.933560802882-fphpkdjubve8k7e8ogqj3fk1qducv3sg</string> <string>com.googleusercontent.apps.933560802882-jpv087j5jenp1h63mc9ge51767s3l2ac</string>
<key>ANDROID_CLIENT_ID</key> <key>ANDROID_CLIENT_ID</key>
<string>933560802882-fbqg2icq24bmci3f84evjrbth5huh87f.apps.googleusercontent.com</string> <string>933560802882-fbqg2icq24bmci3f84evjrbth5huh87f.apps.googleusercontent.com</string>
<key>API_KEY</key> <key>API_KEY</key>
@@ -15,7 +15,7 @@
<key>PLIST_VERSION</key> <key>PLIST_VERSION</key>
<string>1</string> <string>1</string>
<key>BUNDLE_ID</key> <key>BUNDLE_ID</key>
<string>dev.krowwithus.staff</string> <string>dev.krowwithus.client</string>
<key>PROJECT_ID</key> <key>PROJECT_ID</key>
<string>krow-workforce-dev</string> <string>krow-workforce-dev</string>
<key>STORAGE_BUCKET</key> <key>STORAGE_BUCKET</key>
@@ -31,6 +31,6 @@
<key>IS_SIGNIN_ENABLED</key> <key>IS_SIGNIN_ENABLED</key>
<true></true> <true></true>
<key>GOOGLE_APP_ID</key> <key>GOOGLE_APP_ID</key>
<string>1:933560802882:ios:edf97dab6eb87b977757db</string> <string>1:933560802882:ios:7e179dfdd1a8994c7757db</string>
</dict> </dict>
</plist> </plist>

View File

@@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>API_KEY</key>
<string></string>
<key>GCM_SENDER_ID</key>
<string></string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>prod.krowwithus.staff</string>
<key>PROJECT_ID</key>
<string>krow-workforce-prod</string>
<key>STORAGE_BUCKET</key>
<string>krow-workforce-prod.firebasestorage.app</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<true></true>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string></string>
</dict>
</plist>

View File

@@ -9,7 +9,7 @@
<key>PLIST_VERSION</key> <key>PLIST_VERSION</key>
<string>1</string> <string>1</string>
<key>BUNDLE_ID</key> <key>BUNDLE_ID</key>
<string>stage.krowwithus.staff</string> <string>stage.krowwithus.client</string>
<key>PROJECT_ID</key> <key>PROJECT_ID</key>
<string>krow-workforce-staging</string> <string>krow-workforce-staging</string>
<key>STORAGE_BUCKET</key> <key>STORAGE_BUCKET</key>
@@ -25,6 +25,6 @@
<key>IS_SIGNIN_ENABLED</key> <key>IS_SIGNIN_ENABLED</key>
<true></true> <true></true>
<key>GOOGLE_APP_ID</key> <key>GOOGLE_APP_ID</key>
<string>1:1032971403708:ios:8c2bbd76bc4f55d9356bb9</string> <string>1:1032971403708:ios:0ff547e80f5324ed356bb9</string>
</dict> </dict>
</plist> </plist>

View File

@@ -55,7 +55,7 @@ mobile-client-build: dataconnect-generate-sdk
@cd $(MOBILE_DIR) && \ @cd $(MOBILE_DIR) && \
melos run gen:l10n && \ melos run gen:l10n && \
melos run gen:build && \ melos run gen:build && \
melos run build:client -- $(PLATFORM) --$(MODE) --flavor $(ENV) --dart-define-from-file=../../config.$(ENV).json melos exec --scope="krowwithus_client" -- flutter build $(PLATFORM) --$(MODE) --flavor $(ENV) --dart-define-from-file=../../config.$(ENV).json
# --- Staff App --- # --- Staff App ---
mobile-staff-dev-android: dataconnect-generate-sdk mobile-staff-dev-android: dataconnect-generate-sdk
@@ -71,7 +71,7 @@ mobile-staff-build: dataconnect-generate-sdk
@cd $(MOBILE_DIR) && \ @cd $(MOBILE_DIR) && \
melos run gen:l10n && \ melos run gen:l10n && \
melos run gen:build && \ melos run gen:build && \
melos run build:staff -- $(PLATFORM) --$(MODE) --flavor $(ENV) --dart-define-from-file=../../config.$(ENV).json melos exec --scope="krowwithus_staff" -- flutter build $(PLATFORM) --$(MODE) --flavor $(ENV) --dart-define-from-file=../../config.$(ENV).json
# --- E2E (Maestro) --- # --- E2E (Maestro) ---
# Set env before running: TEST_CLIENT_EMAIL, TEST_CLIENT_PASSWORD, TEST_CLIENT_COMPANY, TEST_STAFF_PHONE, TEST_STAFF_OTP, TEST_STAFF_SIGNUP_PHONE # Set env before running: TEST_CLIENT_EMAIL, TEST_CLIENT_PASSWORD, TEST_CLIENT_COMPANY, TEST_STAFF_PHONE, TEST_STAFF_OTP, TEST_STAFF_SIGNUP_PHONE