diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index d9d92e7..e5f8fdc 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,3 +1,2 @@
- template
\ No newline at end of file
diff --git a/build-logic/convention/src/main/kotlin/template/Flavor.kt b/build-logic/convention/src/main/kotlin/template/Flavor.kt
index aa2799f..d940568 100644
--- a/build-logic/convention/src/main/kotlin/template/Flavor.kt
+++ b/build-logic/convention/src/main/kotlin/template/Flavor.kt
@@ -5,25 +5,28 @@ import com.android.build.api.dsl.ApplicationProductFlavor
import com.android.build.api.dsl.CommonExtension
import org.gradle.api.Project
+@Suppress("EnumEntryName", "EnumNaming")
enum class FlavorDimension {
- CONTENT_TYPE
+ contentType
}
// The content for the app can either come from local static data which is useful for demo
// purposes, or from a production backend server which supplies up-to-date, real content.
// These two product flavors reflect this behaviour.
-enum class Flavor (val dimension : FlavorDimension, val applicationIdSuffix : String? = null) {
- DEMO(FlavorDimension.CONTENT_TYPE),
- PROD(FlavorDimension.CONTENT_TYPE, ".prod")
+@Suppress("EnumEntryName", "EnumNaming")
+enum class Flavor(val dimension: FlavorDimension, val applicationIdSuffix: String? = null) {
+ dev(FlavorDimension.contentType, ".dev"),
+ beta(FlavorDimension.contentType, ".beta"),
+ prod(FlavorDimension.contentType)
}
fun Project.configureFlavors(
- commonExtension: CommonExtension<*, *, *, *, *>
+ commonExtension: CommonExtension<*, *, *, *, *>,
) {
commonExtension.apply {
- flavorDimensions += FlavorDimension.CONTENT_TYPE.name
+ flavorDimensions += FlavorDimension.contentType.name
productFlavors {
- Flavor.values().forEach{
+ Flavor.values().forEach {
create(it.name) {
dimension = it.dimension.name
if (this@apply is ApplicationExtension && this is ApplicationProductFlavor) {
@@ -31,6 +34,14 @@ fun Project.configureFlavors(
this.applicationIdSuffix = it.applicationIdSuffix
}
}
+ val appName = buildString {
+ append("template")
+ if (it.applicationIdSuffix != null) {
+ append(" - ")
+ append(it.applicationIdSuffix.uppercase())
+ }
+ }
+ resValue("string", "app_name", appName)
}
}
}
diff --git a/buildscripts/setup.gradle b/buildscripts/setup.gradle
index 5f17cd8..f70f871 100644
--- a/buildscripts/setup.gradle
+++ b/buildscripts/setup.gradle
@@ -102,9 +102,9 @@ task replaceTemplateReferences {
)
replaceTextInFile(
- "${rootDir}/app/src/main/res/values/strings.xml",
- "${renameConfig.templateName}",
- "${renameConfig.newProjectName}",
+ "${rootDir}/build-logic/convention/src/main/kotlin/template/Flavor.kt",
+ "append\\(\"${renameConfig.templateName}\"",
+ "append\\(\"${renameConfig.newProjectName}\"",
)
replaceTextInFile(