Add dev and prod flavors
continuous-integration/drone/push Build is passing Details

pull/5/head
avalin 7 months ago
parent c0442243a8
commit aa8058ef93

@ -75,6 +75,19 @@ android {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
flavorDimensions += listOf("env")
productFlavors {
create("dev") {
dimension = "env"
versionNameSuffix = "-dev"
applicationIdSuffix = ".dev"
}
create("prod") {
dimension = "env"
}
}
}
easylauncher {

@ -37,6 +37,22 @@ android {
kotlinOptions {
jvmTarget = "1.8"
}
buildFeatures {
buildConfig = true
}
flavorDimensions += listOf("env")
productFlavors {
create("dev") {
dimension = "env"
}
create("prod") {
dimension = "env"
}
}
}
dependencies {

@ -0,0 +1,17 @@
package fr.iut.alldev.allin.data.di
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import fr.iut.alldev.allin.data.api.AllInApi
import fr.iut.alldev.allin.data.api.MockAllInApi
import javax.inject.Singleton
@Module
@InstallIn(SingletonComponent::class)
internal object ApiModule {
@Provides
@Singleton
internal fun provideAllInApi(): AllInApi = MockAllInApi()
}

@ -5,27 +5,17 @@ import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import fr.iut.alldev.allin.data.api.AllInApi
import fr.iut.alldev.allin.data.api.MockAllInApi
import fr.iut.alldev.allin.data.di.NetworkModule.createRetrofit
import okhttp3.HttpUrl
import okhttp3.OkHttpClient
import javax.inject.Singleton
@Module
@InstallIn(SingletonComponent::class)
class ApiModule {
internal object ApiModule {
@Provides
@Singleton
fun provideAllInApi(@AllInUrl url: HttpUrl, okHttpClient: OkHttpClient): AllInApi {
return if (MOCK) {
MockAllInApi()
} else {
val retrofit = createRetrofit(url = url, okHttpClient = okHttpClient)
retrofit.create(AllInApi::class.java)
}
}
companion object {
const val MOCK = true
val retrofit = NetworkModule.createRetrofit(url = url, okHttpClient = okHttpClient)
return retrofit.create(AllInApi::class.java)
}
}
Loading…
Cancel
Save