Skip to content

Commit

Permalink
[MERGE] #1 -> develop
Browse files Browse the repository at this point in the history
[ADD/#1] �멀티모듈 프로젝트 초기세팅
  • Loading branch information
Marchbreeze authored Dec 28, 2023
2 parents 35a93d7 + f5880a0 commit dd8585b
Show file tree
Hide file tree
Showing 83 changed files with 1,457 additions and 118 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ render.experimental.xml
.idea/gradle.xml
.idea/jarRepositories.xml
.idea/navEditor.xml
.idea/kotlinc.xml

# Legacy Eclipse project files
.classpath
Expand Down
5 changes: 0 additions & 5 deletions .idea/.gitignore

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/kotlinc.xml

This file was deleted.

43 changes: 0 additions & 43 deletions app/build.gradle

This file was deleted.

98 changes: 98 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties

plugins {
id("com.android.application")
kotlin("android")
kotlin("kapt")
id("kotlin-parcelize")
id("dagger.hilt.android.plugin")
id("com.google.android.gms.oss-licenses-plugin")
}

android {
namespace = Constants.packageName
compileSdk = Constants.compileSdk

defaultConfig {
applicationId = Constants.packageName
minSdk = Constants.minSdk
targetSdk = Constants.targetSdk
versionCode = Constants.versionCode
versionName = Constants.versionName

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

buildConfigField(
"String",
"BASE_URL",
gradleLocalProperties(rootDir).getProperty("base.url"),
)
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
)
}
}

compileOptions {
sourceCompatibility = Versions.javaVersion
targetCompatibility = Versions.javaVersion
}

kotlinOptions {
jvmTarget = Versions.jvmVersion
}

buildFeatures {
buildConfig = true
dataBinding = true
viewBinding = true
}
}

dependencies {
implementation(project(":core-ui"))
implementation(project(":data"))
implementation(project(":domain"))
implementation(project(":presentation"))

KotlinDependencies.run {
implementation(kotlin)
implementation(coroutines)
implementation(jsonSerialization)
}

AndroidXDependencies.run {
implementation(coreKtx)
implementation(appCompat)
implementation(hilt)
implementation(workManager)
implementation(hiltWorkManager)
}

KaptDependencies.run {
kapt(hiltCompiler)
kapt(hiltWorkManagerCompiler)
}

TestDependencies.run {
testImplementation(jUnit)
androidTestImplementation(androidTest)
androidTestImplementation(espresso)
}

ThirdPartyDependencies.run {
implementation(platform(okHttpBom))
implementation(okHttp)
implementation(okHttpLoggingInterceptor)
implementation(retrofit)
implementation(retrofitJsonConverter)
implementation(timber)
implementation(ossLicense)
}
}
2 changes: 1 addition & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
Expand Down
21 changes: 18 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,30 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />

<application
android:name=".MyApp"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.GoingGoing"
tools:targetApi="31" />
android:usesCleartextTraffic="true"
tools:targetApi="31">

<activity
android:name="com.going.presentation.mock.MockActivity"
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

</application>

</manifest>
26 changes: 26 additions & 0 deletions app/src/main/java/com/going/going/MyApp.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.going.going

import android.app.Application
import androidx.appcompat.app.AppCompatDelegate
import dagger.hilt.android.HiltAndroidApp
import timber.log.Timber

@HiltAndroidApp
class MyApp : Application() {

override fun onCreate() {
super.onCreate()

initTimber()
setDayMode()
}

private fun initTimber() {
if (BuildConfig.DEBUG) Timber.plant(Timber.DebugTree())
}

private fun setDayMode() {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
}

}
20 changes: 20 additions & 0 deletions app/src/main/java/com/going/going/di/DataSourceModule.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.going.going.di

import com.going.data.datasource.MockDataSource
import com.going.data.datasourceImpl.MockDataSourceImpl
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton

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

@Provides
@Singleton
fun provideMockDataSource(mockDataSourceImpl: MockDataSourceImpl): MockDataSource =
mockDataSourceImpl

}
20 changes: 20 additions & 0 deletions app/src/main/java/com/going/going/di/RepositoryModule.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.going.going.di

import com.going.data.repositoryImpl.MockRepositoryImpl
import com.going.domain.repository.MockRepository
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton

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

@Provides
@Singleton
fun provideMockRepository(mockRepositoryImpl: MockRepositoryImpl): MockRepository =
mockRepositoryImpl

}
59 changes: 59 additions & 0 deletions app/src/main/java/com/going/going/di/RetrofitModule.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package com.going.going.di

import com.going.going.BuildConfig.BASE_URL
import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import kotlinx.serialization.json.Json
import okhttp3.Interceptor
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Converter
import retrofit2.Retrofit
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
object RetrofitModule {
private const val APPLICATION_JSON = "application/json"

@Provides
@Singleton
fun provideJson(): Json = Json {
ignoreUnknownKeys = true
prettyPrint = true
}

@Provides
@Singleton
fun provideJsonConverter(json: Json): Converter.Factory =
json.asConverterFactory(APPLICATION_JSON.toMediaType())

@Provides
@Singleton
fun provideHttpLoggingInterceptor(): Interceptor = HttpLoggingInterceptor().apply {
level = HttpLoggingInterceptor.Level.BODY
}

@Provides
@Singleton
fun provideOkHttpClient(
loggingInterceptor: Interceptor
): OkHttpClient = OkHttpClient.Builder()
.addInterceptor(loggingInterceptor)
.build()

@Provides
@Singleton
fun provideRetrofit(
client: OkHttpClient,
factory: Converter.Factory,
): Retrofit = Retrofit.Builder()
.baseUrl(BASE_URL)
.client(client)
.addConverterFactory(factory)
.build()
}
20 changes: 20 additions & 0 deletions app/src/main/java/com/going/going/di/ServiceModule.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.going.going.di

import com.going.data.service.MockService
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import retrofit2.Retrofit
import javax.inject.Singleton

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

@Provides
@Singleton
fun provideMockService(retrofit: Retrofit): MockService =
retrofit.create(MockService::class.java)

}
16 changes: 0 additions & 16 deletions app/src/main/res/values-night/themes.xml

This file was deleted.

3 changes: 0 additions & 3 deletions app/src/main/res/values/strings.xml

This file was deleted.

Loading

0 comments on commit dd8585b

Please sign in to comment.