Skip to content

Commit 236ab43

Browse files
author
Lalit Sharma
committed
feat: integrate Google Maps API key handling for Android and update related documentation
1 parent e5f23a2 commit 236ab43

12 files changed

Lines changed: 103 additions & 8 deletions

File tree

.github/workflows/eas-build.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ jobs:
6363
name: EAS Build (${{ github.event.inputs.platform || 'all' }})
6464
needs: ci
6565
runs-on: ubuntu-latest
66+
env:
67+
GOOGLE_MAPS_ANDROID_API_KEY: ${{ secrets.GOOGLE_MAPS_ANDROID_API_KEY }}
6668

6769
steps:
6870
- name: Checkout
@@ -88,6 +90,15 @@ jobs:
8890
eas-version: latest
8991
token: ${{ secrets.EXPO_TOKEN }}
9092

93+
- name: Validate Google Maps Android key
94+
if: ${{ (github.event.inputs.platform || 'all') != 'ios' }}
95+
run: |
96+
if [ -z "$GOOGLE_MAPS_ANDROID_API_KEY" ]; then
97+
echo "Missing GOOGLE_MAPS_ANDROID_API_KEY GitHub secret."
98+
echo "Add it in: Settings -> Secrets and variables -> Actions."
99+
exit 1
100+
fi
101+
91102
- name: Build
92103
working-directory: apps/mobile
93104
run: eas build --profile production --platform ${{ github.event.inputs.platform || 'all' }} --non-interactive

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ dist
55
build
66
coverage
77
.DS_Store
8-
*.log
8+
*.log
9+
apps/mobile/.env
10+
apps/mobile/.env.local

PRIVACY_POLICY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ If we update this Privacy Policy, we will revise the "Last Updated" date at the
8484

8585
If you have questions about this Privacy Policy, you can reach us at:
8686

87-
- **GitHub:** [https://github.com/lallimaven/eclipse-timer](https://github.com/lallimaven/eclipse-timer)
87+
- **GitHub:** [https://github.com/c0d3rb4b4/eclipse-timer](https://github.com/c0d3rb4b4/eclipse-timer)
8888

8989
---
9090

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,47 @@ pnpm install
232232

233233
If you already have the repo locally, running `pnpm install` at the root is enough.
234234

235+
## Google Maps API Key Setup (Local + CI)
236+
237+
Android uses `react-native-maps`, so a Google Maps Android API key is required.
238+
This repo now reads the key from `GOOGLE_MAPS_ANDROID_API_KEY` at build/config time.
239+
240+
### Local development
241+
242+
1. Copy the example env file:
243+
```bash
244+
cp apps/mobile/.env.example apps/mobile/.env.local
245+
```
246+
On Windows PowerShell:
247+
```powershell
248+
Copy-Item apps/mobile/.env.example apps/mobile/.env.local
249+
```
250+
2. Edit `apps/mobile/.env.local` and set:
251+
```env
252+
GOOGLE_MAPS_ANDROID_API_KEY=your_real_android_maps_key
253+
```
254+
3. Rebuild the Android app after changing the key:
255+
```bash
256+
pnpm -C apps/mobile android
257+
```
258+
259+
### GitHub Actions (EAS build workflow)
260+
261+
1. In GitHub, add repository secret:
262+
- Name: `GOOGLE_MAPS_ANDROID_API_KEY`
263+
- Value: your Android Maps key
264+
2. The workflow `.github/workflows/eas-build.yml` injects this secret into the build job.
265+
3. Android/all builds fail early with a clear message if the secret is missing.
266+
267+
### Security recommendations
268+
269+
- Restrict the key in Google Cloud Console to:
270+
- Application restriction: `Android apps`
271+
- Package: `com.lallimaven.eclipsetimer`
272+
- SHA-1: your debug/release certificate fingerprints
273+
- Restrict API usage to `Maps SDK for Android`.
274+
- If a key was ever committed, rotate it in Google Cloud and replace it in local/CI secrets.
275+
235276
## Getting Started (Quick Start)
236277

237278
From the repo root:

apps/mobile/.env.example

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Environment variables for Eclipse Timer
2-
# Copy this file to .env and fill in real values before production builds.
2+
# Copy this file to .env.local and fill in real values before production builds.
3+
4+
# Google Maps Android SDK key (required for react-native-maps on Android)
5+
GOOGLE_MAPS_ANDROID_API_KEY=
36

47
# Sentry — crash reporting (used in App.tsx Sentry.init)
58
SENTRY_DSN=

apps/mobile/android/app/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ def enableMinifyInReleaseBuilds = (findProperty('android.enableMinifyInReleaseBu
8181
*/
8282
def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
8383

84+
apply from: new File(["node", "--print", "require('path').dirname(require.resolve('@sentry/react-native/package.json'))"].execute().text.trim(), "sentry.gradle")
85+
8486
android {
8587
ndkVersion rootProject.ext.ndkVersion
8688

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@
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"/>
1718
<meta-data android:name="expo.modules.updates.ENABLED" android:value="true"/>
19+
<meta-data android:name="expo.modules.updates.EXPO_RUNTIME_VERSION" android:value="@string/expo_runtime_version"/>
1820
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
1921
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
2022
<meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="https://u.expo.dev/a29a7662-96be-4509-a79e-fbe4b5dac1ff"/>
21-
<meta-data android:name="expo.modules.updates.EXPO_RUNTIME_VERSION" android:value="@string/expo_runtime_version"/>
2223
<activity android:name=".MainActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen" android:exported="true" android:screenOrientation="portrait">
2324
<intent-filter>
2425
<action android:name="android.intent.action.MAIN"/>
@@ -31,5 +32,6 @@
3132
<data android:scheme="eclipsetimer"/>
3233
</intent-filter>
3334
</activity>
35+
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
3436
</application>
3537
</manifest>

apps/mobile/android/app/src/main/java/com/lallimaven/eclipsetimer/MainActivity.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
package com.lallimaven.eclipsetimer
2+
import expo.modules.splashscreen.SplashScreenManager
23

34
import android.os.Build
45
import android.os.Bundle
@@ -15,7 +16,10 @@ class MainActivity : ReactActivity() {
1516
// Set the theme to AppTheme BEFORE onCreate to support
1617
// coloring the background, status bar, and navigation bar.
1718
// This is required for expo-splash-screen.
18-
setTheme(R.style.AppTheme);
19+
// setTheme(R.style.AppTheme);
20+
// @generated begin expo-splashscreen - expo prebuild (DO NOT MODIFY) sync-f3ff59a738c56c9a6119210cb55f0b613eb8b6af
21+
SplashScreenManager.registerOnActivity(this)
22+
// @generated end expo-splashscreen
1923
super.onCreate(null)
2024
}
2125

apps/mobile/android/app/src/main/res/values/styles.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
<item name="colorPrimary">@color/colorPrimary</item>
66
<item name="android:statusBarColor">#0b0b0b</item>
77
</style>
8-
<style name="Theme.App.SplashScreen" parent="AppTheme">
9-
<item name="android:windowBackground">@drawable/ic_launcher_background</item>
8+
<style name="Theme.App.SplashScreen" parent="Theme.SplashScreen">
9+
<item name="windowSplashScreenBackground">@color/splashscreen_background</item>
10+
<item name="windowSplashScreenAnimatedIcon">@drawable/splashscreen_logo</item>
11+
<item name="postSplashScreenTheme">@style/AppTheme</item>
12+
<item name="android:windowSplashScreenBehavior">icon_preferred</item>
1013
</style>
1114
</resources>

apps/mobile/android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
3535
# your application. You should enable this flag either if you want
3636
# to write custom TurboModules/Fabric components OR use libraries that
3737
# are providing them.
38-
newArchEnabled=true
38+
newArchEnabled=false
3939

4040
# Use this property to enable or disable the Hermes JS engine.
4141
# If set to false, you will be using JSC instead.

0 commit comments

Comments
 (0)