feat(ios): preparar soporte iOS
- 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 <noreply@anthropic.com>
This commit is contained in:
+18
-6
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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({
|
||||
<MapView
|
||||
ref={mapRef}
|
||||
style={StyleSheet.absoluteFill}
|
||||
provider={PROVIDER_GOOGLE}
|
||||
provider={MAP_PROVIDER}
|
||||
initialRegion={region}
|
||||
showsUserLocation
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user