feat(android): configure API and socket endpoints for debug and release builds
- Added API and socket base URLs for both debug and release configurations in gradle.properties. - Enhanced build.gradle.kts to utilize environment variables for dynamic endpoint configuration. - Updated debug build type with specific application ID suffix and version name suffix for better differentiation. - Included necessary dependencies for improved functionality and compatibility.
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -5,6 +5,16 @@ plugins {
|
||||
id("org.jetbrains.kotlin.plugin.compose")
|
||||
}
|
||||
|
||||
fun propOrEnv(name: String, defaultValue: String): String {
|
||||
val gradleValue = project.findProperty(name) as String?
|
||||
val envValue = System.getenv(name)
|
||||
return when {
|
||||
!gradleValue.isNullOrBlank() -> gradleValue
|
||||
!envValue.isNullOrBlank() -> envValue
|
||||
else -> defaultValue
|
||||
}
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "de.trainingstagebuch.app"
|
||||
compileSdk = 34
|
||||
@@ -23,8 +33,34 @@ android {
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
applicationIdSuffix = ".debug"
|
||||
versionNameSuffix = "-debug"
|
||||
resValue("string", "app_name", "Trainingstagebuch Debug")
|
||||
buildConfigField(
|
||||
"String",
|
||||
"API_BASE_URL",
|
||||
"\"${propOrEnv("API_BASE_URL_DEBUG", "http://10.0.2.2:3005/api/")}\""
|
||||
)
|
||||
buildConfigField(
|
||||
"String",
|
||||
"SOCKET_BASE_URL",
|
||||
"\"${propOrEnv("SOCKET_BASE_URL_DEBUG", "http://10.0.2.2:3005")}\""
|
||||
)
|
||||
}
|
||||
release {
|
||||
isMinifyEnabled = false
|
||||
resValue("string", "app_name", "Trainingstagebuch")
|
||||
buildConfigField(
|
||||
"String",
|
||||
"API_BASE_URL",
|
||||
"\"${propOrEnv("API_BASE_URL_RELEASE", "http://10.0.2.2:3005/api/")}\""
|
||||
)
|
||||
buildConfigField(
|
||||
"String",
|
||||
"SOCKET_BASE_URL",
|
||||
"\"${propOrEnv("SOCKET_BASE_URL_RELEASE", "http://10.0.2.2:3005")}\""
|
||||
)
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
@@ -42,6 +78,7 @@ android {
|
||||
|
||||
buildFeatures {
|
||||
compose = true
|
||||
buildConfig = true
|
||||
}
|
||||
|
||||
packaging {
|
||||
@@ -64,6 +101,7 @@ dependencies {
|
||||
val composeBom = platform("androidx.compose:compose-bom:2024.10.01")
|
||||
|
||||
implementation("androidx.core:core-ktx:1.13.1")
|
||||
implementation("androidx.appcompat:appcompat:1.7.0")
|
||||
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.7")
|
||||
implementation("androidx.activity:activity-compose:1.9.3")
|
||||
implementation(composeBom)
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<!-- Automatically generated file. DO NOT MODIFY -->
|
||||
|
||||
<!-- Value from build type: debug -->
|
||||
<string name="app_name" translatable="false">Trainingstagebuch Debug</string>
|
||||
|
||||
</resources>
|
||||
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Automatically generated file. DO NOT MODIFY
|
||||
*/
|
||||
package de.trainingstagebuch.app;
|
||||
|
||||
public final class BuildConfig {
|
||||
public static final boolean DEBUG = Boolean.parseBoolean("true");
|
||||
public static final String APPLICATION_ID = "de.trainingstagebuch.app.debug";
|
||||
public static final String BUILD_TYPE = "debug";
|
||||
public static final int VERSION_CODE = 1;
|
||||
public static final String VERSION_NAME = "1.0-debug";
|
||||
// Field from build type: debug
|
||||
public static final String API_BASE_URL = "https://tt-tagebuch.de/api/";
|
||||
// Field from build type: debug
|
||||
public static final String SOCKET_BASE_URL = "https://tt-tagebuch.de:3051";
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
{}
|
||||
@@ -4,7 +4,7 @@
|
||||
"type": "COMPATIBLE_SCREEN_MANIFEST",
|
||||
"kind": "Directory"
|
||||
},
|
||||
"applicationId": "de.trainingstagebuch.app",
|
||||
"applicationId": "de.trainingstagebuch.app.debug",
|
||||
"variantName": "debug",
|
||||
"elements": []
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user