From 4c620439de5ac2647541e0107b254152c59ac18f Mon Sep 17 00:00:00 2001 From: sgsk88 Date: Wed, 8 Nov 2023 23:55:48 +0900 Subject: [PATCH] =?UTF-8?q?[feature/api=5Fget=5Funiversity]=20BuildConfig?= =?UTF-8?q?=20=EC=A0=81=EC=9A=A9=20(#83)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 9 +++++++++ .../com/everymeal/everymeal_android/di/NetworkModule.kt | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 67a5e01e..4f4cd357 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,3 +1,4 @@ +import org.jetbrains.kotlin.konan.properties.Properties @Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed plugins { id("com.android.application") @@ -23,6 +24,10 @@ android { } } + val localPropertiesFile = rootProject.file("local.properties") + val localProperties = Properties() + localProperties.load(localPropertiesFile.inputStream()) + buildTypes { release { isMinifyEnabled = false @@ -31,6 +36,9 @@ android { "proguard-rules.pro" ) } + debug { + buildConfigField("String", "BASE_URL", "\"${localProperties.getProperty("BASE_URL")}\"") + } } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 @@ -41,6 +49,7 @@ android { } buildFeatures { compose = true + buildConfig = true } composeOptions { kotlinCompilerExtensionVersion = "1.4.7" diff --git a/app/src/main/java/com/everymeal/everymeal_android/di/NetworkModule.kt b/app/src/main/java/com/everymeal/everymeal_android/di/NetworkModule.kt index ea5b1669..207c5046 100644 --- a/app/src/main/java/com/everymeal/everymeal_android/di/NetworkModule.kt +++ b/app/src/main/java/com/everymeal/everymeal_android/di/NetworkModule.kt @@ -1,6 +1,7 @@ package com.everymeal.everymeal_android.di import com.everymeal.data.service.onboarding.OnboardingApi +import com.everymeal.everymeal_android.BuildConfig import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory import dagger.Module import dagger.Provides @@ -19,7 +20,7 @@ object NetworkModule { private val contentType = "application/json".toMediaType() private val json = Json { ignoreUnknownKeys = true } - private const val BASE_URL = "http://dev.everymeal.shop:8085" + private const val BASE_URL = BuildConfig.BASE_URL @Provides @Singleton