feat(build): add dev/staging/prod flavors for client_app + mitra_app

Android product flavors (.dev/.staging suffixes, prod clean) + per-flavor
Dart entrypoints, dart-define env files, and per-flavor Firebase config for
both platforms across 3 projects (halobestie-clone-dev / my-bestie-876ec /
my-bestie-production).

- Android: flavorDimensions("env") + productFlavors; @string/app_name label;
  per-flavor src/<flavor>/google-services.json (clients verified to match each
  applicationId).
- iOS: customer app re-based to the EXISTING App Store identity
  com.asc.hallobestie (dev/staging suffix it; ships as an update to the live
  app). mitra is a new app (com.mybestie.mitra). Per-flavor plists staged in
  ios/config/<flavor>/; Xcode scheme wiring deferred (Mac follow-up).
- firebase_options_{dev,staging,prod}.dart filled with real android + iOS
  values (regenerated from the native config files).
- BUILD_FLAVORS.md per app documents flavor table, build commands, iOS
  identity decision, and the remaining iOS Xcode steps.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-04 22:21:50 +08:00
parent 76d74aa7b5
commit 22743c81e1
53 changed files with 1891 additions and 178 deletions

View File

@@ -24,7 +24,10 @@ android {
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
// Base application ID. Per-flavor suffixes below produce the final IDs:
// dev -> com.mybestie.dev
// staging -> com.mybestie.staging
// prod -> com.mybestie
applicationId = "com.mybestie"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
@@ -34,6 +37,34 @@ android {
versionName = flutter.versionName
}
// Build flavors for the three environments. Each flavor:
// - sets its final applicationId (via suffix, except prod)
// - injects an `app_name` string resource consumed by
// AndroidManifest.xml's android:label="@string/app_name"
// - selects its own Firebase config via the matching source set
// (android/app/src/<flavor>/google-services.json)
// NOTE: once these flavors exist, a bare `flutter build apk` (no --flavor)
// fails. All build/install/run commands MUST pass --flavor. See
// BUILD_FLAVORS.md.
flavorDimensions += "env"
productFlavors {
create("dev") {
dimension = "env"
applicationIdSuffix = ".dev"
resValue("string", "app_name", "HaloBestie Dev")
}
create("staging") {
dimension = "env"
applicationIdSuffix = ".staging"
resValue("string", "app_name", "HaloBestie Staging")
}
create("prod") {
dimension = "env"
// No applicationIdSuffix -> final applicationId stays "com.mybestie".
resValue("string", "app_name", "HaloBestie")
}
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.

View File

@@ -61,6 +61,44 @@
"other_platform_oauth_client": []
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:1068156046511:android:1f589ed358ccdad0b8185a",
"android_client_info": {
"package_name": "com.mybestie.dev"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyDFWlLSWytqwI7LSdUbVrO7J5De9L2LV2U"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:1068156046511:android:8a873c8b7e64410ab8185a",
"android_client_info": {
"package_name": "com.mybestie.mitra"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyDFWlLSWytqwI7LSdUbVrO7J5De9L2LV2U"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
}
],
"configuration_version": "1"

View File

@@ -3,7 +3,7 @@
Phase 4 Stage 4 notif-gate via permission_handler. -->
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<application
android:label="HaloBestie"
android:label="@string/app_name"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"
android:usesCleartextTraffic="true">

View File

@@ -0,0 +1,70 @@
{
"project_info": {
"project_number": "953866659887",
"project_id": "my-bestie-production",
"storage_bucket": "my-bestie-production.firebasestorage.app"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:953866659887:android:55dfbf97ac7c26e7183eda",
"android_client_info": {
"package_name": "com.mybestie"
}
},
"oauth_client": [
{
"client_id": "953866659887-5a62u0tdce92i0gmfo0gf3dt0dnlre42.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.mybestie",
"certificate_hash": "3c43db3c9ac7f6d7e2fa03b8dbcaf7e5d12c97f3"
}
},
{
"client_id": "953866659887-kebg3eijcomtv97q6v03fm8i30kj7r9r.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.mybestie",
"certificate_hash": "7119b6cf7091074759450c899191905a5a4d0369"
}
},
{
"client_id": "953866659887-vvur2mnmbu8ljmnmmg01hqsrj0ocssu9.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.mybestie",
"certificate_hash": "6e23f0164af04ddf200f769c460caac3ee2b91ac"
}
},
{
"client_id": "953866659887-9ro36er68qupv00rgokjignnu2hs85v8.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAxAp8hcXO-P7HwwVsS3vFe0OX5ZkIyyWI"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "953866659887-9ro36er68qupv00rgokjignnu2hs85v8.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "953866659887-bsb3c2a6ir10u47q8vcacre2tmnk59jb.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.asc.hallobestie"
}
}
]
}
}
}
],
"configuration_version": "1"
}

View File

@@ -0,0 +1,36 @@
PROD google-services.json — NOT YET PRESENT
===========================================
The Gradle google-services plugin reads this flavor's Firebase config from:
android/app/src/prod/google-services.json <-- MISSING
This file is deliberately a README, NOT a fabricated google-services.json.
A wrong/placeholder google-services.json compiles fine but SILENTLY breaks
Firebase Analytics and FCM at runtime (no build error, no crash — just no
events / no push). Do not invent one.
How to produce the real file
----------------------------
1. In the Firebase Console for the PRODUCTION project, register an Android app
with package name:
com.mybestie
(no suffix — prod is the un-suffixed applicationId). Use the SEPARATE prod
Firebase console, NOT halobestie-clone-dev. See BUILD_FLAVORS.md.
2. Download the generated google-services.json.
3. Drop it here, replacing this README:
android/app/src/prod/google-services.json
4. Also generate the Dart options:
flutterfire configure --project=<prod-project> \
--out=lib/firebase/firebase_options_prod.dart
(firebase_options_prod.dart currently holds PLACEHOLDER values.)
Until both files hold real values, do NOT release a production build.

View File

@@ -0,0 +1,106 @@
{
"project_info": {
"project_number": "650461407929",
"project_id": "my-bestie-876ec",
"storage_bucket": "my-bestie-876ec.firebasestorage.app"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:650461407929:android:92d95eb766802bcf504968",
"android_client_info": {
"package_name": "com.mybestie"
}
},
"oauth_client": [
{
"client_id": "650461407929-ofuff9cv8d4fj79efj9e2ovt2nj9b83a.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAOPkPJkHXLFzo9ICOHyjee2Vn_EUqt1Pc"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "650461407929-ofuff9cv8d4fj79efj9e2ovt2nj9b83a.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "650461407929-2o7eo5ts2k389pa3l16sq26l3107b52f.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.example.halloBestie"
}
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:650461407929:android:05754df9552e0529504968",
"android_client_info": {
"package_name": "com.mybestie.staging"
}
},
"oauth_client": [
{
"client_id": "650461407929-3els6l9cegtiphe930vtjr80ffa2p1uv.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.mybestie.staging",
"certificate_hash": "a46c19a615b3c21b529240dabc8f1cd68bcbd449"
}
},
{
"client_id": "650461407929-8lo71sr668gvvj0ntpjjemoqrkr82uid.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.mybestie.staging",
"certificate_hash": "6e23f0164af04ddf200f769c460caac3ee2b91ac"
}
},
{
"client_id": "650461407929-lmj6n5jt818fkdjhjpbhabdd19g82f48.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.mybestie.staging",
"certificate_hash": "937ecfa181a695a5f1fb5d04df15e490c174caea"
}
},
{
"client_id": "650461407929-ofuff9cv8d4fj79efj9e2ovt2nj9b83a.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAOPkPJkHXLFzo9ICOHyjee2Vn_EUqt1Pc"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "650461407929-ofuff9cv8d4fj79efj9e2ovt2nj9b83a.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "650461407929-2o7eo5ts2k389pa3l16sq26l3107b52f.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.example.halloBestie"
}
}
]
}
}
}
],
"configuration_version": "1"
}

View File

@@ -0,0 +1,37 @@
STAGING google-services.json — NOT YET PRESENT
==============================================
The Gradle google-services plugin reads this flavor's Firebase config from:
android/app/src/staging/google-services.json <-- MISSING
This file is deliberately a README, NOT a fabricated google-services.json.
A wrong/placeholder google-services.json compiles fine but SILENTLY breaks
Firebase Analytics and FCM at runtime (no build error, no crash — just no
events / no push). Do not invent one.
How to produce the real file
----------------------------
1. In the Firebase Console for the STAGING project, register an Android app
with package name:
com.mybestie.staging
(this is the dev/staging Firebase project today — see BUILD_FLAVORS.md for
the "register com.mybestie.staging in halobestie-clone-dev" decision, or a
dedicated staging project if/when one exists).
2. Download the generated google-services.json.
3. Drop it here, replacing this README:
android/app/src/staging/google-services.json
4. Also generate the Dart options:
flutterfire configure --project=<staging-project> \
--out=lib/firebase/firebase_options_staging.dart
(firebase_options_staging.dart currently holds PLACEHOLDER values.)
Until both files hold real values, do NOT distribute a staging build.