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
|
// Config dinámica: inyecta las API keys de Google Maps (Android e iOS) desde
|
||||||
// desde la variable de entorno GOOGLE_MAPS_API_KEY (secreto de EAS), para no
|
// variables de entorno / secretos de EAS, para no committearlas.
|
||||||
// commitearla. En local puedes exportarla antes de `npx expo run:android`.
|
// 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 }) => {
|
module.exports = ({ config }) => {
|
||||||
const apiKey = process.env.GOOGLE_MAPS_API_KEY;
|
const androidKey = process.env.GOOGLE_MAPS_API_KEY;
|
||||||
if (apiKey) {
|
if (androidKey) {
|
||||||
config.android = config.android || {};
|
config.android = config.android || {};
|
||||||
config.android.config = {
|
config.android.config = {
|
||||||
...(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;
|
return config;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,7 +7,9 @@
|
|||||||
"icon": "./assets/icon.png",
|
"icon": "./assets/icon.png",
|
||||||
"userInterfaceStyle": "light",
|
"userInterfaceStyle": "light",
|
||||||
"ios": {
|
"ios": {
|
||||||
"supportsTablet": true
|
"supportsTablet": true,
|
||||||
|
"bundleIdentifier": "group.mai.avante",
|
||||||
|
"buildNumber": "1"
|
||||||
},
|
},
|
||||||
"android": {
|
"android": {
|
||||||
"package": "group.mai.avante",
|
"package": "group.mai.avante",
|
||||||
|
|||||||
@@ -9,21 +9,30 @@
|
|||||||
"distribution": "internal",
|
"distribution": "internal",
|
||||||
"android": {
|
"android": {
|
||||||
"buildType": "apk"
|
"buildType": "apk"
|
||||||
|
},
|
||||||
|
"ios": {
|
||||||
|
"simulator": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"preview": {
|
"preview": {
|
||||||
"distribution": "internal",
|
"distribution": "internal",
|
||||||
"android": {
|
"android": {
|
||||||
"buildType": "apk"
|
"buildType": "apk"
|
||||||
}
|
},
|
||||||
|
"ios": {}
|
||||||
},
|
},
|
||||||
"production": {
|
"production": {
|
||||||
"android": {
|
"android": {
|
||||||
"buildType": "app-bundle"
|
"buildType": "app-bundle"
|
||||||
}
|
},
|
||||||
|
"ios": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"submit": {
|
"submit": {
|
||||||
"production": {}
|
"production": {
|
||||||
|
"ios": {
|
||||||
|
"appleId": "Javier.Brana@mai.group"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,12 @@
|
|||||||
*/
|
*/
|
||||||
import * as Location from 'expo-location';
|
import * as Location from 'expo-location';
|
||||||
import React, { useMemo, useRef } from 'react';
|
import React, { useMemo, useRef } from 'react';
|
||||||
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
import { Platform, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
||||||
import MapView, { Marker, Polygon, Polyline, PROVIDER_GOOGLE } from 'react-native-maps';
|
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 { Feature } from '../api/types';
|
||||||
import { COLORS } from './components';
|
import { COLORS } from './components';
|
||||||
import { geometryToShapes, LatLng, regionFor } from './geojson';
|
import { geometryToShapes, LatLng, regionFor } from './geojson';
|
||||||
@@ -70,7 +74,7 @@ export function FeatureMap({
|
|||||||
<MapView
|
<MapView
|
||||||
ref={mapRef}
|
ref={mapRef}
|
||||||
style={StyleSheet.absoluteFill}
|
style={StyleSheet.absoluteFill}
|
||||||
provider={PROVIDER_GOOGLE}
|
provider={MAP_PROVIDER}
|
||||||
initialRegion={region}
|
initialRegion={region}
|
||||||
showsUserLocation
|
showsUserLocation
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user