software-mansion-labs / expo-maps

81 stars 3 forks source link

Create config plugin for Expo Maps #90

Closed szdziedzic closed 2 years ago

szdziedzic commented 2 years ago

Why

This PR creates our own config plugin, which makes it easy to configure the app using Expo Maps for people who don't know how the library works under the hood. After these changes, you just need to have the right API key in the JSON config file at the root of the example app and run the expo prebuild command to activate the plugin. To run the demo app you no longer need to have our git crypt key or change anything manually in AndroidManifest or Info.plist files.

Starting from now, it will be necessary to run cd example && cp google-maps-api-keys.json.example google-maps-api-keys.json && expo prebuild --clean command to have our demo app configured properly (but it's the only additional command required and it needs to be run just ones).

If you want to change the Google Maps API key which is used by our library in the app, please change the googleMapsApiKey value in the google-maps-api-keys.json file and run expo prebuild --clean again.

It's also worth noticing, that our free key doesn't support querying for POIs.

How

I created a config plugin for the Expo Maps project and added a sample Google Maps API keys config file containing our free key as default data, which is the data source for the plugin. I also ignored Info.plist and AndroidManifest.xml files in git to prevent accidentally leaking the non-free key in their bodies.

Test plan

Android and iOS

Run cd example && cp google-maps-api-keys.json.example google-maps-api-keys.json && expo prebuild --clean and go through the example app