Skip to content

Commit

Permalink
moved BASE_URL to BuildConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas-Israel committed Jul 30, 2024
1 parent 60352a4 commit 32f2005
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
7 changes: 7 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ android {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}

debug {
buildConfigField("String", "BASE_URL", BASEURL)
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
Expand All @@ -50,6 +54,9 @@ android {
dataBinding {
enabled = true
}
buildFeatures {
buildConfig true
}
}

dependencies {
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/java/com/betrybe/trybnb/data/config/Configs.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.betrybe.trybnb.data.config

object Configs {
const val BASE_URL = "https://restful-booker.herokuapp.com/"
const val QUANTITY_OF_BOOKINGS_AT_A_TIME = 5
}
}
4 changes: 2 additions & 2 deletions app/src/main/java/com/betrybe/trybnb/di/AppModule.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.betrybe.trybnb.di

import com.betrybe.trybnb.BuildConfig.BASE_URL
import com.betrybe.trybnb.data.api.ApiService
import com.betrybe.trybnb.data.config.Configs.BASE_URL
import com.betrybe.trybnb.data.network.BookingDataSource
import com.betrybe.trybnb.data.network.LoginDataSource
import com.betrybe.trybnb.data.repository.BookingRepository
Expand Down Expand Up @@ -51,4 +51,4 @@ object AppModule {
fun provideLoginRepository(dataSource: LoginDataSource) : LoginRepository {
return LoginRepository(dataSource)
}
}
}
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.nonTransitiveRClass=true
BASEURL="https://restful-booker.herokuapp.com/"

0 comments on commit 32f2005

Please sign in to comment.