From c092052a1c99f49ed346f150db82451d9c0a5a27 Mon Sep 17 00:00:00 2001 From: javier Date: Tue, 7 Jul 2026 09:45:51 +0200 Subject: [PATCH] feat(ios): preparar soporte iOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - app.json: bundleIdentifier + buildNumber para iOS - eas.json: perfiles iOS (development con simulador, preview ipa, production) y appleId para submit - app.config.js: inyección de GOOGLE_MAPS_IOS_KEY (opcional; por defecto la app usa Apple Maps en iOS sin necesitar key) - FeatureMap: MAP_PROVIDER = PROVIDER_GOOGLE en Android, PROVIDER_DEFAULT (Apple Maps) en iOS; elimina dependencia de Google Maps key en iOS Pendiente: generar /ios con 'npx expo prebuild --platform ios' desde macOS. Co-Authored-By: Claude Sonnet 4.6 --- app.config.js | 24 ++++++++++++++++++------ app.json | 4 +++- eas.json | 15 ++++++++++++--- src/ui/FeatureMap.tsx | 10 +++++++--- 4 files changed, 40 insertions(+), 13 deletions(-) diff --git a/app.config.js b/app.config.js index 11ff6cc..7ce7456 100644 --- a/app.config.js +++ b/app.config.js @@ -1,14 +1,26 @@ -// Config dinámica: toma app.json como base e inyecta la API key de Google Maps -// desde la variable de entorno GOOGLE_MAPS_API_KEY (secreto de EAS), para no -// commitearla. En local puedes exportarla antes de `npx expo run:android`. +// Config dinámica: inyecta las API keys de Google Maps (Android e iOS) desde +// variables de entorno / secretos de EAS, para no committearlas. +// Android: GOOGLE_MAPS_API_KEY +// iOS: GOOGLE_MAPS_IOS_KEY (solo necesario si se usa Google Maps en iOS; +// por defecto la app usa Apple Maps en iOS y no requiere key) module.exports = ({ config }) => { - const apiKey = process.env.GOOGLE_MAPS_API_KEY; - if (apiKey) { + const androidKey = process.env.GOOGLE_MAPS_API_KEY; + if (androidKey) { config.android = config.android || {}; config.android.config = { ...(config.android.config || {}), - googleMaps: { apiKey }, + googleMaps: { apiKey: androidKey }, }; } + + const iosKey = process.env.GOOGLE_MAPS_IOS_KEY; + if (iosKey) { + config.ios = config.ios || {}; + config.ios.config = { + ...(config.ios.config || {}), + googleMapsApiKey: iosKey, + }; + } + return config; }; diff --git a/app.json b/app.json index e05b765..b059743 100644 --- a/app.json +++ b/app.json @@ -7,7 +7,9 @@ "icon": "./assets/icon.png", "userInterfaceStyle": "light", "ios": { - "supportsTablet": true + "supportsTablet": true, + "bundleIdentifier": "group.mai.avante", + "buildNumber": "1" }, "android": { "package": "group.mai.avante", diff --git a/eas.json b/eas.json index df8c051..3e958e1 100644 --- a/eas.json +++ b/eas.json @@ -9,21 +9,30 @@ "distribution": "internal", "android": { "buildType": "apk" + }, + "ios": { + "simulator": true } }, "preview": { "distribution": "internal", "android": { "buildType": "apk" - } + }, + "ios": {} }, "production": { "android": { "buildType": "app-bundle" - } + }, + "ios": {} } }, "submit": { - "production": {} + "production": { + "ios": { + "appleId": "Javier.Brana@mai.group" + } + } } } diff --git a/src/ui/FeatureMap.tsx b/src/ui/FeatureMap.tsx index 02ae934..ebaecf5 100644 --- a/src/ui/FeatureMap.tsx +++ b/src/ui/FeatureMap.tsx @@ -7,8 +7,12 @@ */ import * as Location from 'expo-location'; import React, { useMemo, useRef } from 'react'; -import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'; -import MapView, { Marker, Polygon, Polyline, PROVIDER_GOOGLE } from 'react-native-maps'; +import { Platform, StyleSheet, Text, TouchableOpacity, View } from 'react-native'; +import MapView, { Marker, Polygon, Polyline, PROVIDER_DEFAULT, PROVIDER_GOOGLE } from 'react-native-maps'; + +// Android usa Google Maps (requiere GOOGLE_MAPS_API_KEY). +// iOS usa Apple Maps por defecto (sin key, PROVIDER_DEFAULT). +const MAP_PROVIDER = Platform.OS === 'android' ? PROVIDER_GOOGLE : PROVIDER_DEFAULT; import { Feature } from '../api/types'; import { COLORS } from './components'; import { geometryToShapes, LatLng, regionFor } from './geojson'; @@ -70,7 +74,7 @@ export function FeatureMap({