Skip to content

Commit

Permalink
#141 BaseUrl is depend on Build Varient
Browse files Browse the repository at this point in the history
  • Loading branch information
wnehdals committed Jan 29, 2024
1 parent c61e797 commit c370f35
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 2 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ android {
"proguard-rules.pro"
)
isDebuggable = true
buildConfigField("String", "BASE_URL", getPropertyKey("debug_url"))
}
getByName("release") {
isMinifyEnabled = true
Expand All @@ -56,6 +57,7 @@ android {
"proguard-rules.pro"
)
isDebuggable = false
buildConfigField("String", "BASE_URL", getPropertyKey("release_url"))
}
}

Expand Down
4 changes: 2 additions & 2 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 3,
"versionName": "1.0.2",
"versionCode": 1,
"versionName": "1.0.0",
"outputFile": "app-release.apk"
}
],
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/jjbaksa/jjbaksa/di/NetworkModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import android.content.Context
import android.content.Intent
import androidx.datastore.preferences.core.edit
import androidx.datastore.preferences.core.stringPreferencesKey
import com.jjbaksa.data.BASE_URL
import com.jjbaksa.data.api.AuthApi
import com.jjbaksa.data.api.NoAuthApi
import com.jjbaksa.data.api.RefreshApi
import com.jjbaksa.data.database.PreferenceKeys
import com.jjbaksa.data.database.userDataStore
import com.jjbaksa.jjbaksa.BuildConfig
import com.jjbaksa.jjbaksa.JjbaksaApp
import com.jjbaksa.jjbaksa.ui.login.LoginActivity
import com.jjbaksa.jjbaksa.util.RefreshManager
Expand Down Expand Up @@ -156,7 +156,7 @@ object NetworkModule {
fun provideNoAuthRetrofit(@NOAUTH okHttpClient: OkHttpClient): Retrofit {
return Retrofit.Builder()
.client(okHttpClient)
.baseUrl(BASE_URL)
.baseUrl(BuildConfig.BASE_URL)
.addConverterFactory(ScalarsConverterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
.build()
Expand All @@ -168,7 +168,7 @@ object NetworkModule {
fun provideAuthRetrofit(@AUTH okHttpClient: OkHttpClient): Retrofit {
return Retrofit.Builder()
.client(okHttpClient)
.baseUrl(BASE_URL)
.baseUrl(BuildConfig.BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build()
}
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/java/com/jjbaksa/jjbaksa/util/RefreshManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.jjbaksa.jjbaksa.util

import android.content.Context
import androidx.datastore.preferences.core.stringPreferencesKey
import com.jjbaksa.data.BASE_URL
import com.jjbaksa.data.database.userDataStore
import com.jjbaksa.jjbaksa.BuildConfig
import kotlinx.coroutines.flow.first
Expand Down Expand Up @@ -45,7 +44,7 @@ object RefreshManager {
if (retrofitClient == null) {
retrofitClient = Retrofit.Builder()
.client(okHttpClient)
.baseUrl(BASE_URL)
.baseUrl(BuildConfig.BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build()
}
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/java/Constants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ object Constants {
const val compileSdk = 33
const val minSdk = 24
const val targetSdk = 33
const val versionCode = 4
const val versionName = "1.0.3"
const val versionCode = 1
const val versionName = "1.0.0"
}
1 change: 0 additions & 1 deletion data/src/main/java/com/jjbaksa/data/ApiConst.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
package com.jjbaksa.data

const val BASE_URL = "https://api.stage.jjbaksa.com:443"
const val SUCCESS = 0

0 comments on commit c370f35

Please sign in to comment.