Skip to content

Commit 4112ba7

Browse files
author
Lalit Sharma
committed
feat: integrate Google Maps API key handling and update dependencies
1 parent 0303c8e commit 4112ba7

5 files changed

Lines changed: 162 additions & 109 deletions

File tree

apps/mobile/android/app/build.gradle

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,18 @@ def enableMinifyInReleaseBuilds = (findProperty('android.enableMinifyInReleaseBu
8080
* this variant is about 6MiB larger per architecture than default.
8181
*/
8282
def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
83+
def googleMapsAndroidApiKey = ((System.getenv("GOOGLE_MAPS_ANDROID_API_KEY")
84+
?: findProperty("GOOGLE_MAPS_ANDROID_API_KEY")
85+
?: "") as String).trim()
86+
def isReleaseBuildRequested = gradle.startParameter.taskNames.any { taskName ->
87+
taskName.toLowerCase().contains("release")
88+
}
89+
90+
if (googleMapsAndroidApiKey.length() == 0 && isReleaseBuildRequested) {
91+
throw new GradleException("[maps] Missing GOOGLE_MAPS_ANDROID_API_KEY for release build.")
92+
} else if (googleMapsAndroidApiKey.length() == 0) {
93+
println("[maps] GOOGLE_MAPS_ANDROID_API_KEY is not set. Android debug MapView will fail until it is provided.")
94+
}
8395

8496
def sentryOrg = (System.getenv("SENTRY_ORG") ?: "").trim()
8597
def sentryProject = (System.getenv("SENTRY_PROJECT") ?: "").trim()
@@ -111,6 +123,7 @@ android {
111123
versionName "1.0.0"
112124

113125
buildConfigField "String", "REACT_NATIVE_RELEASE_LEVEL", "\"${findProperty('reactNativeReleaseLevel') ?: 'stable'}\""
126+
manifestPlaceholders += [GOOGLE_MAPS_ANDROID_API_KEY: googleMapsAndroidApiKey]
114127
}
115128
signingConfigs {
116129
debug {

apps/mobile/android/app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
</intent>
1515
</queries>
1616
<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme" android:supportsRtl="true" android:enableOnBackInvokedCallback="false">
17-
<meta-data android:name="com.google.android.geo.API_KEY" android:value="AIzaSyD7A_gIoLZvyQ2t50uzwumFNWjCpX5zuZs"/>
17+
<meta-data android:name="com.google.android.geo.API_KEY" android:value="${GOOGLE_MAPS_ANDROID_API_KEY}"/>
1818
<meta-data android:name="expo.modules.updates.ENABLED" android:value="true"/>
1919
<meta-data android:name="expo.modules.updates.EXPO_RUNTIME_VERSION" android:value="@string/expo_runtime_version"/>
2020
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
@@ -34,4 +34,4 @@
3434
</activity>
3535
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
3636
</application>
37-
</manifest>
37+
</manifest>

apps/mobile/eas.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,22 @@
55
},
66
"build": {
77
"development": {
8+
"environment": "development",
89
"developmentClient": true,
910
"distribution": "internal",
1011
"ios": {
1112
"simulator": true
1213
}
1314
},
1415
"preview": {
16+
"environment": "preview",
1517
"distribution": "internal",
1618
"ios": {
1719
"simulator": false
1820
}
1921
},
2022
"production": {
23+
"environment": "production",
2124
"autoIncrement": true
2225
}
2326
},

apps/mobile/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"@react-native-async-storage/async-storage": "^2.2.0",
2121
"@react-navigation/native": "^7.1.28",
2222
"@react-navigation/native-stack": "^7.12.0",
23-
"@sentry/react-native": "^8.0.0",
23+
"@sentry/react-native": "^7.2.0",
2424
"expo": "~54.0.33",
2525
"expo-location": "~19.0.8",
2626
"expo-notifications": "~0.32.16",

0 commit comments

Comments
 (0)