Skip to content

Commit 3c2c1ba

Browse files
committed
Moved information to secret variable
1 parent 4f0977a commit 3c2c1ba

File tree

5 files changed

+20
-3
lines changed

5 files changed

+20
-3
lines changed

androidApp/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@
1313
.externalNativeBuild
1414
.cxx
1515
local.properties
16+
/app/src/main/res/raw/config.properties

androidApp/app/build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ plugins {
33
id 'org.jetbrains.kotlin.android'
44
}
55

6+
def localPropertiesFile = rootProject.file("local.properties")
7+
def localProperties = new Properties()
8+
localProperties.load(new FileInputStream(localPropertiesFile))
9+
610
android {
711
compileSdk 33
812

@@ -14,6 +18,11 @@ android {
1418
versionName "1.0"
1519

1620
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
21+
22+
defaultConfig{
23+
buildConfigField "String", "API_KEY", localProperties['apiKey']
24+
}
25+
1726
}
1827

1928
buildTypes {

androidApp/app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
<meta-data
4444
android:name="preloaded_fonts"
4545
android:resource="@array/preloaded_fonts" />
46+
47+
4648
</application>
4749

4850
</manifest>

androidApp/app/src/main/java/edu/temple/vehiclecollisiondetection/MyBluetoothGattCallback.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,20 @@ import com.android.volley.toolbox.Volley
4141
import com.google.gson.Gson
4242
import com.google.gson.reflect.TypeToken
4343
import java.util.*
44+
import java.util.Properties
45+
4446
private const val SAVE_KEY = "save_key"
4547
private const val emergencyServiceNum = "+14846391351" //test number (OBV we can't test call 911 whenever we want
4648
class MyBluetoothGattCallback(currentContext: Context, currentActivity: Activity, connectionText: TextView, connectionTipText: TextView) : BluetoothGattCallback(), LocationListener {
4749
//inherited objects to use with rest of the app
4850
val activeContext = currentContext
4951
val activeActivity = currentActivity
5052
val connectionStatusText = connectionText
51-
val API_KEY = "AIzaSyAMxe8n3-KtX3cRs-4BKSd7lXovPlTvEZE" //Move later
53+
val KEY = BuildConfig.API_KEY
5254
val connectionTipText = connectionTipText
5355

56+
57+
5458
//countdown timer object
5559
private var mCountDownTimer: CountDownTimer? = null
5660
private val countdownStartTime: Long = 11000 //timer duration for when crashes are detected, current set at 11 seconds (takes a second to popup)
@@ -297,7 +301,7 @@ class MyBluetoothGattCallback(currentContext: Context, currentActivity: Activity
297301

298302
private fun getStreetAddress(latitude: Double, longitude: Double){
299303
val queue = Volley.newRequestQueue(activeContext)
300-
val url = "https://maps.googleapis.com/maps/api/geocode/json?latlng=${latitude},${longitude}&key=${API_KEY}"
304+
val url = "https://maps.googleapis.com/maps/api/geocode/json?latlng=${latitude},${longitude}&key=${KEY}"
301305

302306
Log.d("volley", "Starting volley")
303307
// Request a string response from the provided URL.

androidApp/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ plugins {
44
id 'com.android.library' version '7.2.2' apply false
55
id 'org.jetbrains.kotlin.android' version '1.6.21' apply false
66
id 'jacoco'
7+
id 'com.google.secrets_gradle_plugin' version '0.4'
78
}
89

910
task clean(type: Delete) {
1011
delete rootProject.buildDir
11-
}
12+
}

0 commit comments

Comments
 (0)