53 lines
2.0 KiB
Dart
53 lines
2.0 KiB
Dart
// Explicit QA-only entry point. Never use this for a release build.
|
|
// flutter run -t tools/qa_auth_main.dart --dart-define=R2_WORKER_URL=http://127.0.0.1:1
|
|
// Android emulator: reverse tcp:9299 -> host 9299 and tcp:8288 -> host 8288.
|
|
import 'package:cloud_firestore/cloud_firestore.dart';
|
|
import 'package:firebase_auth/firebase_auth.dart';
|
|
import 'package:firebase_core/firebase_core.dart';
|
|
import 'package:flutter/foundation.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:marionette_flutter/marionette_flutter.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
import 'package:motorcycle_dash/main.dart' show MotorcycleDashApp;
|
|
import 'package:motorcycle_dash/features/records/records_service.dart';
|
|
|
|
Future<void> main() async {
|
|
if (!kDebugMode) throw StateError('QA entry requires debug mode');
|
|
const worker = String.fromEnvironment('R2_WORKER_URL');
|
|
if (worker != 'http://127.0.0.1:1') {
|
|
throw StateError('QA requires R2_WORKER_URL=http://127.0.0.1:1');
|
|
}
|
|
MarionetteBinding.ensureInitialized();
|
|
final app = await Firebase.initializeApp(
|
|
options: const FirebaseOptions(
|
|
apiKey: 'demo-key',
|
|
appId: '1:123456789:android:qa',
|
|
messagingSenderId: '123456789',
|
|
projectId: 'demo-motorsignal-qa',
|
|
),
|
|
);
|
|
if (!app.options.projectId.startsWith('demo-')) {
|
|
throw StateError('QA requires a demo-* Firebase project');
|
|
}
|
|
// Force loopback and disable FlutterFire's emulator-host remapping so adb
|
|
// reverse forwards only to the isolated host-local emulator listeners.
|
|
await FirebaseAuth.instance.useAuthEmulator(
|
|
'127.0.0.1',
|
|
9299,
|
|
automaticHostMapping: false,
|
|
);
|
|
FirebaseFirestore.instance.useFirestoreEmulator(
|
|
'127.0.0.1',
|
|
8288,
|
|
automaticHostMapping: false,
|
|
);
|
|
final preferences = await SharedPreferences.getInstance();
|
|
runApp(
|
|
ProviderScope(
|
|
overrides: [sharedPreferencesProvider.overrideWithValue(preferences)],
|
|
child: const MotorcycleDashApp(),
|
|
),
|
|
);
|
|
}
|