Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 33 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,48 @@ plugins {
android {
namespace = Configuration.APPLICATION_ID

defaultConfig {
val localProperties = Properties().apply {
load(rootProject.file("local.properties").bufferedReader())
}
val localProperties = Properties().apply {
load(rootProject.file("local.properties").bufferedReader())
}

defaultConfig {
manifestPlaceholders["MAPS_API_KEY"] = localProperties.getProperty("MAPS_API_KEY", "")
}

signingConfigs {
create("release") {
storeFile = file(localProperties.getProperty("KEYSTORE_PATH"))
storePassword = localProperties.getProperty("KEYSTORE_STORE_PASSWORD")
keyAlias = localProperties.getProperty("KEYSTORE_ALIAS")
keyPassword = localProperties.getProperty("KEYSTORE_KEY_PASSWORD")
}
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

buildFeatures {
buildConfig = true
}

buildTypes {
all {
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
)
buildConfigField("String", "NDGL_API_KEY", "\"${localProperties.getProperty("NDGL_API_KEY", "")}\"")
}
debug {
applicationIdSuffix = ".debug"
isDebuggable = true
isMinifyEnabled = false
isShrinkResources = false
buildConfigField("String", "NDGL_BASE_URL", "\"${localProperties.getProperty("NDGL_BASE_URL_DEBUG")}\"")
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}
release {
signingConfig = signingConfigs.getByName("release")
isDebuggable = false
isMinifyEnabled = true
isShrinkResources = true
buildConfigField("String", "NDGL_BASE_URL", "\"${localProperties.getProperty("NDGL_BASE_URL_RELEASE")}\"")
}
}
}
Expand All @@ -36,6 +63,8 @@ dependencies {
implementation(project(":feature:travel"))
implementation(project(":feature:travel-helper"))

implementation(project(":data:core"))

implementation(project(":core:ui"))

implementation(libs.androidx.navigation3.runtime)
Expand Down
6 changes: 5 additions & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-renamesourcefileattribute SourceFile

# j2objc annotations are not available on Android
-dontwarn com.google.j2objc.annotations.ReflectionSupport
-dontwarn com.google.j2objc.annotations.RetainedWith
3 changes: 3 additions & 0 deletions app/src/debug/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<resources>
<string name="app_name">NDGL.debug</string>
</resources>
25 changes: 25 additions & 0 deletions app/src/main/java/com/yapp/ndgl/di/AppNetworkModule.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.yapp.ndgl.di

import com.yapp.ndgl.BuildConfig
import com.yapp.ndgl.data.core.di.ApiKey
import com.yapp.ndgl.data.core.di.BaseUrl
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
object AppNetworkModule {

@BaseUrl
@Singleton
@Provides
fun provideBaseUrl(): String = BuildConfig.NDGL_BASE_URL

@ApiKey
@Singleton
@Provides
fun provideApiKey(): String = BuildConfig.NDGL_API_KEY
}
5 changes: 5 additions & 0 deletions build-logic/src/main/kotlin/NDGLAndroidLibraryPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import convention.configureTimber
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies
import util.libraryExtension
import util.libs

class NDGLAndroidLibraryPlugin : Plugin<Project> {
Expand All @@ -19,6 +20,10 @@ class NDGLAndroidLibraryPlugin : Plugin<Project> {
configureComposeAndroid()
configureTimber()

libraryExtension.defaultConfig {
consumerProguardFiles("consumer-rules.pro")
}

dependencies {
"implementation"(libs.findLibrary("kotlinx-immutable").get())
}
Expand Down
5 changes: 5 additions & 0 deletions build-logic/src/main/kotlin/NDGLDataPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import convention.configureTimber
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies
import util.libraryExtension
import util.libs

class NDGLDataPlugin : Plugin<Project> {
Expand All @@ -19,6 +20,10 @@ class NDGLDataPlugin : Plugin<Project> {
configureCoroutineAndroid()
configureTimber()

libraryExtension.defaultConfig {
consumerProguardFiles("consumer-rules.pro")
}

if (path != ":data:core") {
dependencies.add("implementation", project(":data:core"))
}
Expand Down
9 changes: 0 additions & 9 deletions build-logic/src/main/kotlin/convention/KotlinAndroid.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,6 @@ internal fun Project.configureKotlinAndroid() {
defaultConfig {
minSdk = Configuration.MIN_SDK
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
)
}
}
compileOptions {
sourceCompatibility = Configuration.JAVA_VERSION
targetCompatibility = Configuration.JAVA_VERSION
Expand Down
Empty file added core/base/consumer-rules.pro
Empty file.
Empty file added core/ui/consumer-rules.pro
Empty file.
21 changes: 0 additions & 21 deletions core/ui/proguard-rules.pro

This file was deleted.

2 changes: 2 additions & 0 deletions data/auth/consumer-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-keep class com.yapp.ndgl.data.auth.model.** { *; }
-keep interface com.yapp.ndgl.data.auth.api.** { *; }
21 changes: 0 additions & 21 deletions data/auth/proguard-rules.pro

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFact
import com.yapp.ndgl.data.auth.api.AuthApi
import com.yapp.ndgl.data.core.adapter.NDGLCallAdapterFactory
import com.yapp.ndgl.data.core.di.AuthClient
import com.yapp.ndgl.data.core.di.BaseUrl
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
Expand All @@ -21,7 +22,7 @@ object AuthNetworkModule {
@Singleton
fun provideAuthApi(
json: Json,
baseUrl: String,
@BaseUrl baseUrl: String,
@AuthClient okHttpClient: OkHttpClient,
callAdapterFactory: NDGLCallAdapterFactory,
): AuthApi = Retrofit.Builder()
Expand Down
11 changes: 0 additions & 11 deletions data/core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
import java.util.Properties
import kotlin.apply

plugins {
id("ndgl.data")
}

android {
namespace = "com.yapp.ndgl.data.core"

defaultConfig {
val localProperties = Properties().apply {
load(rootProject.file("local.properties").bufferedReader())
}

buildConfigField("String", "NDGL_BASE_URL", "\"${localProperties["NDGL_BASE_URL"]}\"")
}

buildFeatures {
buildConfig = true
}
Expand Down
2 changes: 2 additions & 0 deletions data/core/consumer-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-keep class com.yapp.ndgl.data.core.model.** { *; }
-keep class com.yapp.ndgl.data.core.serializer.** { *; }
21 changes: 0 additions & 21 deletions data/core/proguard-rules.pro

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFact
import com.yapp.ndgl.data.core.BuildConfig
import com.yapp.ndgl.data.core.adapter.NDGLCallAdapterFactory
import com.yapp.ndgl.data.core.authenticator.NDGLAuthenticator
import com.yapp.ndgl.data.core.interceptor.ApiKeyInterceptor
import com.yapp.ndgl.data.core.interceptor.NDGLInterceptor
import dagger.Module
import dagger.Provides
Expand All @@ -30,10 +31,6 @@ object NetworkModule {
ignoreUnknownKeys = true
}

@Singleton
@Provides
fun provideBaseUrl(): String = BuildConfig.NDGL_BASE_URL

@Singleton
@Provides
fun provideHttpLoggingInterceptor(): HttpLoggingInterceptor =
Expand All @@ -60,11 +57,13 @@ object NetworkModule {
@Singleton
@Provides
fun provideDefaultOkHttpClient(
apiKeyInterceptor: ApiKeyInterceptor,
interceptor: NDGLInterceptor,
authenticator: NDGLAuthenticator,
httpLoggingInterceptor: HttpLoggingInterceptor,
): OkHttpClient {
val builder = OkHttpClient.Builder()
.addInterceptor(apiKeyInterceptor)
.addInterceptor(interceptor)
.authenticator(authenticator)
.addInterceptor(httpLoggingInterceptor)
Expand All @@ -75,7 +74,7 @@ object NetworkModule {
@Provides
fun provideRetrofit(
json: Json,
baseUrl: String,
@BaseUrl baseUrl: String,
okHttpClient: OkHttpClient,
callAdapterFactory: NDGLCallAdapterFactory,
): Retrofit {
Expand All @@ -91,14 +90,25 @@ object NetworkModule {
@Singleton
@Provides
fun provideAuthOkHttpClient(
apiKeyInterceptor: ApiKeyInterceptor,
httpLoggingInterceptor: HttpLoggingInterceptor,
): OkHttpClient {
val builder = OkHttpClient.Builder()
.addInterceptor(apiKeyInterceptor)
.addInterceptor(httpLoggingInterceptor)

return builder.build()
}
}

@Qualifier
@Retention(AnnotationRetention.BINARY)
annotation class AuthClient

@Qualifier
@Retention(AnnotationRetention.BINARY)
annotation class BaseUrl

@Qualifier
@Retention(AnnotationRetention.BINARY)
annotation class ApiKey
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.yapp.ndgl.data.core.interceptor

import com.yapp.ndgl.data.core.di.ApiKey
import okhttp3.Interceptor
import okhttp3.Response
import javax.inject.Inject

class ApiKeyInterceptor @Inject constructor(
@ApiKey private val apiKey: String,
) : Interceptor {
override fun intercept(chain: Interceptor.Chain): Response {
val request = chain.request().newBuilder()
.addHeader("X-API-KEY", apiKey)
.build()
return chain.proceed(request)
}
}
2 changes: 2 additions & 0 deletions data/travel/consumer-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-keep class com.yapp.ndgl.data.travel.model.** { *; }
-keep interface com.yapp.ndgl.data.travel.api.** { *; }
21 changes: 0 additions & 21 deletions data/travel/proguard-rules.pro

This file was deleted.

Empty file added feature/auth/consumer-rules.pro
Empty file.
Loading
Loading