(config, props)
| 16 | /\bsuper\.application\(\w+?, didFinishLaunchingWithOptions: \w+?\)/g; |
| 17 | |
| 18 | export const withMapsIOS: ConfigPlugin<ConfigPluginProps> = (config, props) => { |
| 19 | // Set in Info.plist |
| 20 | if (props?.iosGoogleMapsApiKey) { |
| 21 | config = withInfoPlist(config, async conf => { |
| 22 | if (!conf.ios) { |
| 23 | conf.ios = {}; |
| 24 | } |
| 25 | if (!conf.ios.infoPlist) { |
| 26 | conf.ios.infoPlist = {}; |
| 27 | } |
| 28 | |
| 29 | conf.ios.infoPlist.GMSApiKey = props?.iosGoogleMapsApiKey; |
| 30 | return conf; |
| 31 | }); |
| 32 | } |
| 33 | |
| 34 | // Technically adds react-native-maps (Apple maps) and google maps. |
| 35 | config = withMapsCocoaPods(config, { |
| 36 | useGoogleMaps: !!props?.iosGoogleMapsApiKey, |
| 37 | }); |
| 38 | |
| 39 | // Adds/Removes AppDelegate setup for Google Maps API on iOS |
| 40 | config = withGoogleMapsAppDelegate(config, { |
| 41 | apiKey: props?.iosGoogleMapsApiKey || null, |
| 42 | }); |
| 43 | |
| 44 | return config; |
| 45 | }; |
| 46 | |
| 47 | export function addGoogleMapsAppDelegateImport(src: string): MergeResults { |
| 48 | const newSrc = ['#if canImport(GoogleMaps)', 'import GoogleMaps', '#endif']; |
no test coverage detected
searching dependent graphs…