Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
473fca7
chore: Non android test 플러그인 추가
ThirFir Jun 28, 2025
ae312f7
chore: domain에 테스트 플러그인 추가
ThirFir Jun 28, 2025
d455da3
test: 거리계산 UseCase 테스트 코드 작성
ThirFir Jun 28, 2025
12e447a
chore: common 모듈에 테스트 의존성 추가
ThirFir Jun 28, 2025
45775ab
test: Time 유틸 테스트 코드 작성
ThirFir Jun 28, 2025
b5cfc76
refactor: Non안드로이드 테스트 플러그인 제거 -> 그냥 bundle을 이용하도록 수정, Android 테스트 번들 추가
ThirFir Jun 28, 2025
9756966
chore: 단일 이벤트 측정 함수 추상화
ThirFir Jun 28, 2025
bfdf2a8
chore: app 모듈 테스트 의존성 추가
ThirFir Jun 28, 2025
705039f
refactor: User/Profile Repository 관심사 정리
ThirFir Jun 28, 2025
6c60fdb
fix: espresso - mocck 충돌 문제 해결
ThirFir Jun 28, 2025
9f295af
chore: implementation -> testImplementation 수정
ThirFir Jun 28, 2025
3c200c1
refactor: Authenticate의 재시작 로직을 AppNavigator로 위임
ThirFir Jun 29, 2025
2056187
test: Authenticator 테스트 코드 작성
ThirFir Jun 29, 2025
d81f8bc
chore: TokenSource 미사용 함수 제거
ThirFir Jun 29, 2025
d1bc186
refactor: Navigator 인터페이스 core:navigation모듈로 이동
ThirFir Jun 29, 2025
3948405
chore: core-launcher 모듈 생성
ThirFir Jun 29, 2025
08b254e
chore: launcher 모듈 build-logic 적용
ThirFir Jun 29, 2025
a59dafc
refactor: Navigator -> Launcher 네이밍 변경
ThirFir Jun 29, 2025
ed48a0e
chore: launcher 모듈 의존 주입
ThirFir Jun 29, 2025
9b7626c
refactor: Authenticator data 모듈로 이동
ThirFir Jun 29, 2025
40a06a9
chore: data 모듈 테스트 의존성 추가
ThirFir Jun 29, 2025
75c3666
chore: Token Source 함수 접근 제어 internal
ThirFir Jun 29, 2025
277a624
chore: logout -> signOut
ThirFir Jun 29, 2025
000f445
refactor: Session 관리 UserRepository로 통합
ThirFir Jun 29, 2025
c37764e
chore: Authenticator 빌드 에러 수정
ThirFir Jun 29, 2025
3df7825
refactor: Authenticator 테스트 app -> data 모듈로 이동
ThirFir Jun 29, 2025
8800f67
chore: turbine 의존성 새로 추가
ThirFir Jun 29, 2025
dfa0997
refactor: 테스트 가능한 구조로 UserType 초기화 방식 개선
ThirFir Jun 29, 2025
60d871c
chore: junit5 의존성 추가 | 4,5 혼용 관련 호환 문제 fix
ThirFir Jun 29, 2025
6425a88
chore: Logout -> SignOut
ThirFir Jun 29, 2025
871f4dc
test: User Repository 테스트 코드 작성
ThirFir Jun 29, 2025
c5d141f
fix: 순환 참조 해결 > SessionHandler로 관리
ThirFir Jun 30, 2025
9413f7b
test: UserRepository 테스트 일부를 SessionHandler 테스트로 분리
ThirFir Jun 30, 2025
b5487f6
chore: SessionHandler 패키지 정리
ThirFir Jun 30, 2025
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: 6 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import utils.androidTestImplementation

/** See AndroidApplicationConventionPlugin.kt */

plugins {
Expand Down Expand Up @@ -41,6 +43,7 @@ dependencies {
implementation(projects.core.analytics)
implementation(projects.core.navigation)
implementation(projects.core.ui)
implementation(projects.core.launcher)

implementation(projects.domain)
implementation(projects.data)
Expand All @@ -60,4 +63,7 @@ dependencies {
implementation(libs.play.services.location)

implementation(libs.androidx.core.splashscreen)

testImplementation(libs.bundles.non.android.test)
androidTestImplementation(libs.bundles.android.test)
}
23 changes: 18 additions & 5 deletions app/src/main/java/com/acon/acon/di/AuthenticatorModule.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.acon.acon.di

import android.content.Context
import com.acon.acon.authentication.AuthAuthenticator
import com.acon.acon.data.SessionManager
import com.acon.acon.data.authentication.AuthAuthenticator
import com.acon.acon.core.launcher.AppLauncher
import com.acon.acon.data.session.SessionHandler
import com.acon.acon.data.api.remote.ReissueTokenApi
import com.acon.acon.data.datasource.local.TokenLocalDataSource
import com.acon.acon.launcher.AppLauncherImpl
import dagger.Binds
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
Expand All @@ -19,10 +22,20 @@ object AuthenticatorModule {

@Provides
@Singleton
fun bindsAuthAuthenticator(
fun providesAuthAuthenticator(
@ApplicationContext context: Context,
tokenLocalDataSource: TokenLocalDataSource,
sessionHandler: SessionHandler,
reissueTokenApi: ReissueTokenApi,
sessionManager: SessionManager
): Authenticator = AuthAuthenticator(context, tokenLocalDataSource, reissueTokenApi, sessionManager)
appLauncher: AppLauncher
): Authenticator = AuthAuthenticator(context, tokenLocalDataSource, sessionHandler, reissueTokenApi, appLauncher)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

기존에 여기에서 순환참조 문제가 발생했었나요?? 간단히 설명해주실 수 있나요??

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

기존에 Authenticator에서 SessionManager를 사용하던걸 그냥 UserRepository를 사용하는걸로 리팩토링했는데,
여기서 순환참조 발생하더라구여
UserRepository -> UserRemoteDataSource -> UserApi -> Retrofit -> OkHttpClient -> Authenticator -> UserRepository -> ...

그래서 다시 SessionHandler라는 이름으로 부활시켰습니다,,,

}

@Module
@InstallIn(SingletonComponent::class)
abstract class LauncherModule {

@Binds
@Singleton
abstract fun bindsAppLauncher(impl: AppLauncherImpl): AppLauncher
}
17 changes: 17 additions & 0 deletions app/src/main/java/com/acon/acon/launcher/AppLauncherImpl.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.acon.acon.launcher

import android.content.Context
import android.content.Intent
import com.acon.acon.MainActivity
import com.acon.acon.core.launcher.AppLauncher
import javax.inject.Inject

class AppLauncherImpl @Inject constructor(): AppLauncher {

override fun restartApp(context: Context) {
val intent = Intent(context, MainActivity::class.java).apply {
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK)
}
context.startActivity(intent)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class AndroidApplicationConventionPlugin : Plugin<Project> {
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
excludes += "META-INF/LICENSE.md"
excludes += "META-INF/LICENSE-notice.md"
}
}
}
Expand All @@ -68,11 +70,6 @@ class AndroidApplicationConventionPlugin : Plugin<Project> {
implementation(catalog.findBundle("android-defaults").get())
implementation(catalog.findBundle("play-app-update").get())
implementation(catalog.findLibrary("timber").get())

testImplementation(catalog.findLibrary("junit").get())
androidTestImplementation(catalog.findLibrary("androidx-junit").get())
androidTestImplementation(catalog.findLibrary("androidx-espresso-core").get())
androidTestImplementation(catalog.findLibrary("androidx-ui-test-junit4").get())
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.project
import utils.androidTestImplementation
import utils.catalog
import utils.configureKotlinAndroid
import utils.implementation
import utils.testImplementation

class AndroidLibraryConventionPlugin: Plugin<Project> {

Expand Down Expand Up @@ -44,11 +42,6 @@ class AndroidLibraryConventionPlugin: Plugin<Project> {
implementation(project(":core:common"))
implementation(catalog.findBundle("android-defaults").get())
implementation(catalog.findLibrary("timber").get())

testImplementation(catalog.findLibrary("junit").get())
androidTestImplementation(catalog.findLibrary("androidx-junit").get())
androidTestImplementation(catalog.findLibrary("androidx-espresso-core").get())
androidTestImplementation(catalog.findLibrary("androidx-ui-test-junit4").get())
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions core/analytics/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ android {

dependencies {
implementation(libs.amplitude)

testImplementation(libs.bundles.android.test)
testImplementation(libs.bundles.non.android.test)
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ abstract class EventTracker {
abstract fun setUserId(userId: String)
abstract fun clearUserId()
abstract fun trackEvent(eventName: String, properties: Map<String, Any>)
abstract fun trackEvent(eventName: String, property: Pair<String, Any>)
abstract fun setUserProperties(properties: Map<String, String> = emptyMap())
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ object AconAmplitude: EventTracker() {
* @param eventName 이벤트 이름
* @param properties 이벤트 속성
*
* @sample com.acon.core.analytics.sample.sampleAmplitudeTrack
* @sample com.acon.acon.core.analytics.sample.sampleAmplitudeTrack
*/
override fun trackEvent(eventName: String, properties: Map<String, Any>) {
if (AconAmplitude::amplitude.isInitialized) {
amplitude.track(eventName, properties)
}
}

fun trackEvent(eventName: String, property: Pair<String, Any>) {
override fun trackEvent(eventName: String, property: Pair<String, Any>) {
if (AconAmplitude::amplitude.isInitialized) {
trackEvent(eventName, mapOf(property))
}
Expand All @@ -55,7 +55,7 @@ object AconAmplitude: EventTracker() {
* Amplitude에 사용자 속성을 전송
* @param properties 사용자 속성
*
* @sample com.acon.core.analytics.sample.sampleAmplitudeProperties
* @sample com.acon.acon.core.analytics.sample.sampleAmplitudeProperties
*/
override fun setUserProperties(properties: Map<String, String>) {
if (AconAmplitude::amplitude.isInitialized) {
Expand Down

This file was deleted.

2 changes: 2 additions & 0 deletions core/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ plugins {
dependencies {
implementation(libs.javax.inject)
implementation(libs.kotlinx.coroutines.core)

testImplementation(libs.bundles.non.android.test)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.acon.acon.core.common

import com.acon.acon.core.common.utils.toHHmm
import com.acon.acon.core.common.utils.toLocalTime
import org.junit.Test
import java.time.LocalTime
import kotlin.test.assertEquals

class TimeExtensionsTest {

@Test
fun `String_toLocalTime은 24시간 단위 시-분 문자열을 LocalTime으로 변환한다`() {
val timeString = "15:34"
val expectedTime = LocalTime.of(15, 34)
val actualTime = timeString.toLocalTime()

assertEquals(expectedTime, actualTime)
}

@Test
fun `LocalTime_toHHmm은 LocalTime을 24시간 단위 시-분 문자열로 변환한다`() {
val time = LocalTime.of(15, 34)
val expectedTimeString = "15:34"
val actualTimeString = time.toHHmm()
}

@Test
fun `LocalTime_toHHmmss은 LocalTime을 24시간 단위 시-분 문자열로 변환한다`() {
val time = LocalTime.of(15, 34, 21)
val expectedTimeString = "15:34:21"
val actualTimeString = time.toHHmm()
}
}
1 change: 1 addition & 0 deletions core/launcher/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
7 changes: 7 additions & 0 deletions core/launcher/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
alias(libs.plugins.acon.android.library)
}

android {
namespace = "com.acon.acon.core.launcher"
}
Empty file.
21 changes: 21 additions & 0 deletions core/launcher/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.acon.acon.core.launcher

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.acon.acon.core.launcher.test", appContext.packageName)
}
}
4 changes: 4 additions & 0 deletions core/launcher/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.acon.acon.core.launcher

import android.content.Context

interface AppLauncher {
fun restartApp(context: Context)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.acon.acon
package com.acon.acon.core.launcher

import org.junit.Test

Expand Down
10 changes: 10 additions & 0 deletions data/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import utils.androidTestImplementation
import java.util.Properties

plugins {
Expand Down Expand Up @@ -25,6 +26,7 @@ dependencies {

implementation(projects.domain)
implementation(projects.core.analytics)
implementation(projects.core.launcher)

implementation(platform(libs.okhttp.bom))
implementation(libs.okhttp)
Expand All @@ -39,4 +41,12 @@ dependencies {
implementation(libs.bundles.googleSignIn)

implementation(libs.preferences.datastore)

testImplementation(libs.bundles.non.android.test)
testRuntimeOnly(libs.bundles.junit5.runtime)
androidTestImplementation(libs.bundles.android.test)
}

tasks.withType<Test> {
useJUnitPlatform()
}
49 changes: 0 additions & 49 deletions data/src/main/kotlin/com/acon/acon/data/SessionManager.kt

This file was deleted.

Loading