From b511ec5df085b88bafaff338c5d9aa865868ef3b Mon Sep 17 00:00:00 2001 From: Van Leemput Dayron Date: Tue, 13 Jan 2026 17:15:22 +0100 Subject: [PATCH] Update map autocompletion --- lib/components/home/create_trip_content.dart | 12 ++-------- lib/components/map/map_content.dart | 12 ++-------- lib/firebase_options.dart | 23 -------------------- 3 files changed, 4 insertions(+), 43 deletions(-) diff --git a/lib/components/home/create_trip_content.dart b/lib/components/home/create_trip_content.dart index 2050c73..a67434f 100644 --- a/lib/components/home/create_trip_content.dart +++ b/lib/components/home/create_trip_content.dart @@ -24,6 +24,7 @@ import 'package:flutter_dotenv/flutter_dotenv.dart'; import '../../services/place_image_service.dart'; import '../../services/trip_geocoding_service.dart'; import '../../services/logger_service.dart'; +import '../../firebase_options.dart'; /// Create trip content widget for trip creation and editing functionality. /// @@ -86,16 +87,7 @@ class _CreateTripContentState extends State { /// Google Maps API key for location services static String get _apiKey { - if (Platform.isAndroid) { - return dotenv.env['GOOGLE_MAPS_API_KEY_ANDROID'] ?? - dotenv.env['GOOGLE_MAPS_API_KEY'] ?? - ''; - } else if (Platform.isIOS) { - return dotenv.env['GOOGLE_MAPS_API_KEY_IOS'] ?? - dotenv.env['GOOGLE_MAPS_API_KEY'] ?? - ''; - } - return dotenv.env['GOOGLE_MAPS_API_KEY'] ?? ''; + return DefaultFirebaseOptions.currentPlatform.apiKey; } /// Participant management diff --git a/lib/components/map/map_content.dart b/lib/components/map/map_content.dart index 3369cbc..c8af78a 100644 --- a/lib/components/map/map_content.dart +++ b/lib/components/map/map_content.dart @@ -6,6 +6,7 @@ import 'dart:convert'; import 'package:http/http.dart' as http; import 'dart:ui' as ui; import 'package:flutter_dotenv/flutter_dotenv.dart'; +import '../../firebase_options.dart'; import '../../services/error_service.dart'; import '../../services/map_navigation_service.dart'; import '../../services/logger_service.dart'; @@ -34,16 +35,7 @@ class _MapContentState extends State { List _suggestions = []; static String get _apiKey { - if (Platform.isAndroid) { - return dotenv.env['GOOGLE_MAPS_API_KEY_ANDROID'] ?? - dotenv.env['GOOGLE_MAPS_API_KEY'] ?? - ''; - } else if (Platform.isIOS) { - return dotenv.env['GOOGLE_MAPS_API_KEY_IOS'] ?? - dotenv.env['GOOGLE_MAPS_API_KEY'] ?? - ''; - } - return dotenv.env['GOOGLE_MAPS_API_KEY'] ?? ''; + return DefaultFirebaseOptions.currentPlatform.apiKey; } @override diff --git a/lib/firebase_options.dart b/lib/firebase_options.dart index 9cede1f..7fad5cd 100644 --- a/lib/firebase_options.dart +++ b/lib/firebase_options.dart @@ -27,18 +27,6 @@ class DefaultFirebaseOptions { return android; case TargetPlatform.iOS: return ios; - case TargetPlatform.macOS: - throw UnsupportedError( - 'DefaultFirebaseOptions have not been configured for macos - ' - 'you can reconfigure this by running the FlutterFire CLI again.', - ); - case TargetPlatform.windows: - return windows; - case TargetPlatform.linux: - throw UnsupportedError( - 'DefaultFirebaseOptions have not been configured for linux - ' - 'you can reconfigure this by running the FlutterFire CLI again.', - ); default: throw UnsupportedError( 'DefaultFirebaseOptions are not supported for this platform.', @@ -63,15 +51,4 @@ class DefaultFirebaseOptions { iosClientId: '521527250907-3i1qe2656eojs8k9hjdi573j09i9p41m.apps.googleusercontent.com', iosBundleId: 'com.example.travelMate', ); - - static const FirebaseOptions windows = FirebaseOptions( - apiKey: 'AIzaSyC4t-WOvp22zns9b9t58urznsNAhSHRAag', - appId: '1:521527250907:web:53ff98bcdb8c218f7da1fe', - messagingSenderId: '521527250907', - projectId: 'travelmate-a47f5', - authDomain: 'travelmate-a47f5.firebaseapp.com', - storageBucket: 'travelmate-a47f5.firebasestorage.app', - measurementId: 'G-J246Y7J61M', - ); - } \ No newline at end of file