Merge branch 'feat/build-flavors'

dev/staging/prod build flavors for client_app + mitra_app: Android product
flavors, per-flavor Dart entrypoints + env files, per-flavor Firebase config
(both platforms, 3 projects), customer iOS re-based to com.asc.hallobestie.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

# Conflicts:
#	mitra_app/lib/firebase/firebase_options_dev.dart
This commit is contained in:
2026-06-05 08:02:08 +08:00
53 changed files with 1891 additions and 178 deletions

View File

@@ -15,10 +15,23 @@ import 'core/chat/chat_notifier.dart';
import 'core/notifications/notification_service.dart';
import 'core/pairing/pairing_notifier.dart';
import 'core/theme/halo_theme.dart';
import 'firebase_options.dart';
import 'firebase/firebase_options_dev.dart';
import 'router.dart';
void main() async {
/// Shared app bootstrap, parameterised per build flavor.
///
/// The flavor entrypoints (`main_dev.dart`, `main_staging.dart`,
/// `main_prod.dart`) each call this with their environment's
/// [FirebaseOptions] and a [flavor] tag. The bare [main] below delegates to
/// dev so a plain `flutter run` (no `-t`) still launches the dev environment.
///
/// `flavor` is currently informational (kept on hand for future flavor-gated
/// behaviour / analytics tagging); the API base URL is supplied separately via
/// `--dart-define-from-file=env/<flavor>.json` (see BUILD_FLAVORS.md).
Future<void> bootstrap({
required FirebaseOptions firebaseOptions,
required String flavor,
}) async {
WidgetsFlutterBinding.ensureInitialized();
// Pre-warm flutter_secure_storage. The first call triggers AndroidX
@@ -28,7 +41,7 @@ void main() async {
// splash instead of paying it on the user's first interaction.
unawaited(TokenStorage().readRefreshToken());
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
await Firebase.initializeApp(options: firebaseOptions);
// Enable GA4 collection. Fire-and-forget so it never adds to cold-start
// latency; the SDK queues events until collection is on.
@@ -42,6 +55,16 @@ void main() async {
runApp(const ProviderScope(child: App()));
}
void main() async {
// Bare `flutter run` (no `-t lib/main_<flavor>.dart`) defaults to dev so
// local development works out of the box. Build-flavor APKs use the
// flavor-specific entrypoints instead.
await bootstrap(
firebaseOptions: DevFirebaseOptions.currentPlatform,
flavor: 'dev',
);
}
class App extends ConsumerStatefulWidget {
const App({super.key});