From b0e3e74fe25ef860fdd1a8d8d7a4a7be69996e75 Mon Sep 17 00:00:00 2001 From: "Don E. Llopis" Date: Mon, 6 Sep 2021 10:09:26 -0400 Subject: [PATCH] use local.properties for api key. update versioName to 1.1.3 --- README.md | 10 ++-------- app/build.gradle | 10 ++++++++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 9ea477f..1313d3e 100644 --- a/README.md +++ b/README.md @@ -35,16 +35,10 @@ The latest DEBUG APK can be found here: # APOD API KEY -The app looks for an APOD api key in this properties file: +The app looks for an APOD api key in the project local.properties file: ``` -~/.gradle/gradle.properties -``` - -The api key property key/value pair should be defined as: - -``` -apodktm_nasa_apod_api_key= +nasa_apod_api_key= ``` If an APOD api key is not found then the demo APOD api key is used: diff --git a/app/build.gradle b/app/build.gradle index 7c811f7..80897f2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,14 +11,20 @@ android { compileSdkVersion 30 buildToolsVersion "30.0.3" + def localProperties = new Properties() + def localPropertiesFile = "local.properties" + if (rootProject.file(localPropertiesFile).exists()) { + localProperties.load(new FileInputStream(rootProject.file(localPropertiesFile))) + } + defaultConfig { applicationId "com.machineinteractive.apodktm" minSdkVersion 22 targetSdkVersion 30 versionCode 1 - versionName "1.1.2" + versionName "1.1.3" - def apodApiKey = project.findProperty("apodktm_nasa_apod_api_key") ?: 'DEMO_KEY' + def apodApiKey = localProperties["nasa_apod_api_key"] ?: 'DEMO_KEY' println("APOD KEY: $apodApiKey") buildConfigField("String", "APOD_API_KEY", "\"${apodApiKey}\"")