Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AN/USER] 유저 어플 클린아키텍쳐 적용 (#650) #651

Merged
merged 23 commits into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
69599dd
chore(data): 데이터 레이어 추가
re4rk Jan 11, 2024
a67e01e
chore(presentation): 프레젠테이션 레이어 추가
re4rk Jan 11, 2024
d15ad07
chore(common): common 레이어 추가
re4rk Jan 11, 2024
a343498
refactor(common): analytics를 common 레이어 밑으로 이동
re4rk Jan 11, 2024
8edf2bb
refactor(common): analytics의 모듈 변경
re4rk Jan 11, 2024
71d4989
refactor(data): app에서 data 레이어로 이동
re4rk Jan 11, 2024
ff4cb5c
refactor(presentation): app에서 presentation 레이어로 이동
re4rk Jan 11, 2024
f32380a
refactor(presentation): 리소스 경로 presentation으로 이동
re4rk Jan 11, 2024
30b6460
refactor(presentation): 테스트 케이스 presentation으로 이동
re4rk Jan 11, 2024
55e48de
chore(app): 사용하지 않는 build.gradle.kts 정리
re4rk Jan 11, 2024
0d10f56
chore(gradle): 추가 된 내옹 제거
re4rk Jan 11, 2024
5e7fc76
refactor: ktlint 적용
re4rk Jan 12, 2024
b8447aa
refactor(data): 파일 경로와 패키지명 일치
re4rk Jan 12, 2024
cdc656b
refactor(data): ktlint 적용
re4rk Jan 12, 2024
dfb314b
fix(data): 모듈 변경 후 통과하지 못하는 테스트 케이스 수정
re4rk Jan 12, 2024
9581c4d
fix(gradle): 그래들 빌드 실패 케이스 통과하게 수정
re4rk Jan 12, 2024
403a582
refactor(common): di 의존성 각 모듈에서 담당하도록 변경
re4rk Jan 13, 2024
0b92261
refactor(app): app 사용 하지 않는 의존성 정리
re4rk Jan 13, 2024
9f3083a
chore(common): 사용하지 않는 의존성 정리
re4rk Jan 13, 2024
7ff301a
refactor(presentation): 파일 수정시 절대 경로가 입력되는 현상 수정
re4rk Jan 13, 2024
a567028
refactor(app): 카카오 sdk 초기화를 presentation splash에서 하도록 변경
re4rk Jan 13, 2024
745dd68
refactor(docs): docs 제거
re4rk Jan 14, 2024
acb5fd3
refactor(presentation): 레거시 테스트 제거
re4rk Jan 14, 2024
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
6 changes: 4 additions & 2 deletions android/festago/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion android/festago/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

99 changes: 2 additions & 97 deletions android/festago/app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties

plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("kotlin-parcelize")
id("kotlin-kapt")
kotlin("plugin.serialization") version "1.8.22"
id("com.google.gms.google-services")
id("com.google.firebase.crashlytics")
id("org.jlleitschuh.gradle.ktlint")
Expand All @@ -24,10 +20,6 @@ android {
versionName = "1.2.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

buildConfigField("String", "BASE_URL", getSecretKey("base_url"))
buildConfigField("String", "KAKAO_NATIVE_APP_KEY", getSecretKey("kakao_native_app_key"))
resValue("string", "kakao_redirection_scheme", getSecretKey("kakao_redirection_scheme"))
}

buildFeatures {
Expand Down Expand Up @@ -69,97 +61,10 @@ kapt {
}

dependencies {
// domain
implementation(project(":domain"))

// android
implementation("androidx.core:core-ktx:1.10.1")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.9.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation(project(":data"))
implementation(project(":presentation"))

// hilt
implementation("com.google.dagger:hilt-android:2.44")
kapt("com.google.dagger:hilt-android-compiler:2.44")

// recyclerview
implementation("androidx.recyclerview:recyclerview:1.3.1-rc01")

// lifecycle
implementation("androidx.lifecycle:lifecycle-extensions:2.2.0")

// glide
implementation("com.github.bumptech.glide:glide:4.15.1")

// okhttp3
implementation("com.squareup.okhttp3:okhttp:4.11.0")

// retrofit
implementation("com.squareup.retrofit2:retrofit:2.9.0")

// kotlin-serialization
implementation("com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:1.0.0")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1")

// junit4
testImplementation("junit:junit:4.13.2")
testImplementation("androidx.test.ext:junit:1.1.5")
testImplementation("androidx.test:runner:1.5.2")

// assertJ
testImplementation("org.assertj:assertj-core:3.22.0")

// android-test
testImplementation("androidx.arch.core:core-testing:2.2.0")

// mock
testImplementation("io.mockk:mockk-android:1.13.5")

// okhttp3-mockwebserver
implementation("com.squareup.okhttp3:mockwebserver:4.11.0")

// espresso
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
androidTestImplementation("androidx.test.ext:junit:1.1.5")

// coroutine
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.6.4")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4")

// viewModel
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1")
implementation("androidx.activity:activity-ktx:1.7.2")
implementation("androidx.fragment:fragment-ktx:1.6.0")

// zxing
implementation("com.journeyapps:zxing-android-embedded:4.3.0")

// firebase
implementation(platform("com.google.firebase:firebase-bom:32.2.0"))
implementation("com.google.firebase:firebase-analytics-ktx")
implementation("com.google.firebase:firebase-crashlytics-ktx")
implementation("com.google.firebase:firebase-messaging-ktx:23.2.1")

// swiperefreshlayout
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")

// kakao login
implementation("com.kakao.sdk:v2-user:2.12.0")

// Encrypted SharedPreference
implementation("androidx.security:security-crypto-ktx:1.1.0-alpha06")

// turbine
testImplementation("app.cash.turbine:turbine:1.0.0")

// inApp Update
implementation("com.google.android.play:app-update-ktx:2.1.0")

// splash
implementation("androidx.core:core-splashscreen:1.1.0-alpha02")
}

fun getSecretKey(propertyKey: String): String {
return gradleLocalProperties(rootDir).getProperty(propertyKey)
}

This file was deleted.

57 changes: 0 additions & 57 deletions android/festago/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,63 +17,6 @@
android:theme="@style/Theme.Festago"
android:usesCleartextTraffic="true"
tools:targetApi="31">
<activity
android:name=".presentation.ui.splash.SplashActivity"
android:exported="true"
android:theme="@style/Theme.App.Starting">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".presentation.ui.selectschool.SelectSchoolActivity"
android:exported="false" />
<activity
android:name=".presentation.ui.studentverification.StudentVerificationActivity"
android:exported="false" />
<activity
android:name=".presentation.ui.signin.SignInActivity"
android:exported="false" />
<activity
android:name=".presentation.ui.reservationcomplete.ReservationCompleteActivity"
android:exported="false" />
<activity
android:name=".presentation.ui.home.HomeActivity"
android:exported="false" />
<activity
android:name=".presentation.ui.ticketreserve.TicketReserveActivity"
android:exported="false" />
<activity
android:name=".presentation.ui.ticketentry.TicketEntryActivity"
android:exported="false" />
<activity
android:name="com.kakao.sdk.auth.AuthCodeHandlerActivity"
android:exported="true"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host="oauth"
android:scheme="@string/kakao_redirection_scheme" />
</intent-filter>
</activity>
<activity
android:name=".presentation.ui.tickethistory.TicketHistoryActivity"
android:exported="false" />

<service
android:name=".presentation.fcm.TicketEntryService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,23 @@ import android.app.Application
import android.app.NotificationChannel
import android.app.NotificationManager
import android.content.Context
import com.festago.festago.presentation.R
import com.festago.festago.presentation.fcm.FcmMessageType
import com.kakao.sdk.common.KakaoSdk
import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp
class FestagoApplication : Application() {

override fun onCreate() {
super.onCreate()
initKakaoSdk()
initNotificationChannel()
}

private fun initKakaoSdk() {
KakaoSdk.init(this, BuildConfig.KAKAO_NATIVE_APP_KEY)
}

private fun initNotificationChannel() {
val channel = NotificationChannel(
FcmMessageType.ENTRY_ALERT.channelId,
getString(R.string.entry_alert_channel_name),
NotificationManager.IMPORTANCE_DEFAULT
NotificationManager.IMPORTANCE_DEFAULT,
)
val notificationManager =
getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
Expand Down
4 changes: 4 additions & 0 deletions android/festago/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ plugins {
val kotlinVersion = "1.8.20"
kotlin("android") version kotlinVersion apply false
kotlin("jvm") version kotlinVersion apply false
kotlin("kapt") version kotlinVersion apply false

id("org.jlleitschuh.gradle.ktlint") version "11.1.0" apply false

id("com.google.gms.google-services") version "4.3.15" apply false

id("com.google.firebase.crashlytics") version "2.9.7" apply false

id("com.google.dagger.hilt.android") version "2.44" apply false

id("org.jetbrains.kotlin.plugin.serialization") version "1.8.10" apply false
}
1 change: 1 addition & 0 deletions android/festago/common/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
46 changes: 46 additions & 0 deletions android/festago/common/build.gradle.kts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

common 모듈에 어떤 코드가 위치하게 되는건지 잘 이해하지 못했어요! analytics 로깅 관련 코드가 이곳으로 옮겨진 것 같은데 현재 presentation 레이어에서만 로그를 남기고 있으니 presentation에서만 필요한 코드 아닌가요??
app -> common, data -> common 의존이 왜 필요한지 궁금!
이후에 data나 app에서 common 모듈을 사용하게 되는걸까요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

�현재 analytics는 presentation만 사용되고 있지만 팀내에서 모든 레이어에서 로깅하기로 했기 때문에 모든 모듈에서 접근 가능한 모듈을 작성을 해야 했습니다!
현재 app, domain, data, presentation 모듈 모두 접근 가능한 모듈에 배치하시 위해서는 domain 레이어가 가장 적합하다고 판단이 되었지만 analytics는 안드로이드 의존성을 가지고 있습니다. 그래서 저희는 domain 레이어는 코틀린 라이브러리로 두기로 하여서 별도의 모듈이 필요하다고 생각하였습니다.

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
kotlin("kapt")
}

android {
namespace = "com.festago.festago.common"
compileSdk = 34

defaultConfig {
minSdk = 26
consumerProguardFiles("consumer-rules.pro")
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
}

kotlin.jvmToolchain(17)

dependencies {
// hilt
implementation("com.google.dagger:hilt-android:2.44")
kapt("com.google.dagger:hilt-android-compiler:2.44")

// firebase
implementation(platform("com.google.firebase:firebase-bom:32.2.0"))
implementation("com.google.firebase:firebase-analytics-ktx")
implementation("com.google.firebase:firebase-crashlytics-ktx")
implementation("com.google.firebase:firebase-messaging-ktx:23.2.1")
}
Empty file.
Loading