feat: Switch API key retrieval from flutter_dotenv to firebase_options.dart and update build version.
All checks were successful
Deploy Flutter to Firebase (Mac) / deploy-android (push) Successful in 3m4s
All checks were successful
Deploy Flutter to Firebase (Mac) / deploy-android (push) Successful in 3m4s
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
import '../firebase_options.dart'; // Add this import
|
||||||
import '../models/activity.dart';
|
import '../models/activity.dart';
|
||||||
import '../services/error_service.dart';
|
import '../services/error_service.dart';
|
||||||
import '../services/logger_service.dart';
|
import '../services/logger_service.dart';
|
||||||
@@ -16,7 +16,14 @@ class ActivityPlacesService {
|
|||||||
final ErrorService _errorService = ErrorService();
|
final ErrorService _errorService = ErrorService();
|
||||||
|
|
||||||
static String get _apiKey {
|
static String get _apiKey {
|
||||||
return dotenv.env['GOOGLE_MAPS_API_KEY'] ?? '';
|
try {
|
||||||
|
return DefaultFirebaseOptions.currentPlatform.apiKey;
|
||||||
|
} catch (e) {
|
||||||
|
LoggerService.error(
|
||||||
|
'ActivityPlacesService: Impossible de récupérer la clé API Firebase: $e',
|
||||||
|
);
|
||||||
|
return '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Recherche des activités près d'une destination
|
/// Recherche des activités près d'une destination
|
||||||
@@ -107,10 +114,8 @@ class ActivityPlacesService {
|
|||||||
LoggerService.error(
|
LoggerService.error(
|
||||||
'ActivityPlacesService: Clé API Google Maps manquante',
|
'ActivityPlacesService: Clé API Google Maps manquante',
|
||||||
);
|
);
|
||||||
// Debug: Lister les clés disponibles pour comprendre le problème
|
|
||||||
final availableKeys = dotenv.env.keys.join(', ');
|
|
||||||
throw Exception(
|
throw Exception(
|
||||||
'Clé API Google Maps non configurée. Clés disponibles: [$availableKeys]. Platform: ${Platform.isAndroid
|
'Clé API Google Maps non configurée dans DefaultFirebaseOptions. Platform: ${Platform.isAndroid
|
||||||
? 'Android'
|
? 'Android'
|
||||||
: Platform.isIOS
|
: Platform.isIOS
|
||||||
? 'iOS'
|
? 'iOS'
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
# In Windows, build-name is used as the major, minor, and patch parts
|
# In Windows, build-name is used as the major, minor, and patch parts
|
||||||
# of the product and file versions while build-number is used as the build suffix.
|
# of the product and file versions while build-number is used as the build suffix.
|
||||||
version: 2025.12.1+3
|
version: 2025.12.1+4
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.9.2
|
sdk: ^3.9.2
|
||||||
|
|||||||
Reference in New Issue
Block a user