Skip to content

Commit

Permalink
Merge pull request #6 from lilstiffy/tweak/env-variables
Browse files Browse the repository at this point in the history
Use of local environment variables instead of hard coding them in the…
  • Loading branch information
lilstiffy authored Aug 20, 2024
2 parents 2304ec4 + d6fdd7c commit 68309bc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
.externalNativeBuild
.cxx
local.properties
env.properties
keystore
app/release
11 changes: 11 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import java.io.FileInputStream
import java.util.Properties

plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
}

var props = Properties()
var propsFile = rootProject.file("env.properties")
if (propsFile.exists()) {
props.load(FileInputStream(propsFile))
}

android {
namespace = "com.lilstiffy.mockgps"
compileSdk = 34
Expand All @@ -14,6 +23,8 @@ android {
versionCode = 5
versionName = "1.0.4"

manifestPlaceholders["API_KEY"] = props.getProperty("MAPS_API_KEY")

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@
</intent-filter>
</activity>

<!-- Really bad remove -->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyCi2zGLGQvGFo0FqiQrIosK8sYB0c5dylA" />
android:value="${API_KEY}" />

<service
android:name=".service.MockLocationService"
Expand Down
4 changes: 1 addition & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,4 @@ kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
# Google Maps
MAPS_API_KEY=AIzaSyCi2zGLGQvGFo0FqiQrIosK8sYB0c5dylA
android.nonTransitiveRClass=true

0 comments on commit 68309bc

Please sign in to comment.