feat(wear): expose PROFILE_NAME and IS_DEV_PROFILE to the app
BuildConfig now carries the active profile name plus an isDev boolean (profile name ends in '-dev'). The manifestPlaceholder 'appLabel' switches between 'Doctate' and 'Doctate (Dev)' for the launcher. refs #3
This commit is contained in:
@@ -28,6 +28,8 @@ android {
|
|||||||
// profile concept.
|
// profile concept.
|
||||||
fun resolveProp(key: String, default: String): String =
|
fun resolveProp(key: String, default: String): String =
|
||||||
(project.findProperty(key) as? String) ?: default
|
(project.findProperty(key) as? String) ?: default
|
||||||
|
val profileName = resolveProp("doctate.profileName", "unknown")
|
||||||
|
val isDevProfile = profileName.endsWith("-dev")
|
||||||
buildConfigField(
|
buildConfigField(
|
||||||
"String", "SERVER_URL",
|
"String", "SERVER_URL",
|
||||||
"\"${resolveProp("doctate.serverUrl", "http://10.0.2.2:3000")}\""
|
"\"${resolveProp("doctate.serverUrl", "http://10.0.2.2:3000")}\""
|
||||||
@@ -36,6 +38,15 @@ android {
|
|||||||
"String", "API_KEY",
|
"String", "API_KEY",
|
||||||
"\"${resolveProp("doctate.apiKey", "MISSING_API_KEY")}\""
|
"\"${resolveProp("doctate.apiKey", "MISSING_API_KEY")}\""
|
||||||
)
|
)
|
||||||
|
buildConfigField(
|
||||||
|
"String", "PROFILE_NAME",
|
||||||
|
"\"$profileName\""
|
||||||
|
)
|
||||||
|
buildConfigField(
|
||||||
|
"boolean", "IS_DEV_PROFILE",
|
||||||
|
"$isDevProfile"
|
||||||
|
)
|
||||||
|
manifestPlaceholders["appLabel"] = if (isDevProfile) "Doctate (Dev)" else "Doctate"
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
|||||||
Reference in New Issue
Block a user