Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
f8dbc6e
refactor: 패키지 수정
s9hn May 8, 2025
e59830d
refactor: 반환타입 추가
s9hn May 8, 2025
d8e2460
refactor: 시그니처 수정
s9hn May 8, 2025
f3e24ef
feat: 토큰 api 통신 및 저장 로직 구현
s9hn May 8, 2025
8f492d1
build: resolve merge conflict
s9hn May 8, 2025
95ea494
refactor: 로그인 뷰 로직 수정
s9hn May 8, 2025
4515e37
feat: AccountTokenProvider 구현
s9hn May 8, 2025
57270d1
refactor: network 모듈 가시성제어자 수정
s9hn May 8, 2025
3a20765
refactor: app 모듈 사용하지 않는 파일 및 코드 제거
s9hn May 8, 2025
b80380e
feat: AuthorizationInterceptor 구현
s9hn May 8, 2025
300f13e
refactor: datastore 모듈 가시성 제어자 수정
s9hn May 8, 2025
faef7c0
refactor: DefaultAccountDataSource 싱글톤 어노테이션 제거
s9hn May 8, 2025
84eb2f2
refactor: AuthorizationInterceptor 로직 수정 및 순환참조 문제 해결
s9hn May 8, 2025
bb2b401
feat: AuthorizationAuthenticator 구현
s9hn May 9, 2025
8f750c5
refactor: common 의존성 추가
s9hn May 10, 2025
38b0942
refactor: common 의존성 추가
s9hn May 11, 2025
cf55bd9
refactor: 토큰엔티티 추가 및 적용
s9hn May 12, 2025
9a483dd
refactor: 리이슈api 모듈 분리 및 미사용 코드 제거
s9hn May 12, 2025
c5d3c73
refactor: AuthorizationInterceptor 함수 네이밍 수정 및 디스패처 생성자 주입
s9hn May 12, 2025
0f4e106
feat: AuthSessionManager 생성
s9hn May 12, 2025
454c204
feat: DispatchersModule 생성
s9hn May 12, 2025
a527172
feat: NavigatorProvider 구현
s9hn May 12, 2025
86de330
refactor: DefaultAccountDataSource 반환 함수 수정
s9hn May 12, 2025
d8389d8
refactor: 네비게이터 SignInScreen 주입
s9hn May 12, 2025
4c0b977
feat: WebsosoAuthSessionManager 구현
s9hn May 12, 2025
8cf130a
refactor: AuthorizationAuthenticator 리프레시 로직 구현
s9hn May 12, 2025
19a426b
feat: WebsosoApp subscribeSessionState 함수 구현
s9hn May 12, 2025
119fd05
feat: ThrottleHelper 구현
s9hn May 13, 2025
b0163a3
refactor: maxRequestsPerHost 20으로 수정
s9hn May 13, 2025
5c90e3f
refactor: AuthorizationAuthenticator에 스로틀링 추가 및 이벤트 전파 로직 수정
s9hn May 13, 2025
4a920ba
refactor: 불필요한 파일 제거
s9hn May 13, 2025
4f828a4
refactor: 누락 코드 추가, DefaultAccountDataSource 모듈등록
s9hn May 14, 2025
82c36ca
refactor: AuthorizationInterceptor 토큰이 빈값인 경우 리턴 로직 추가
s9hn May 14, 2025
0daf45e
refactor: AuthorizationAuthenticator 토큰 재발급 실패인 경우 얼리 리턴 로직 추가
s9hn May 14, 2025
da36020
refactor: 불필요한 리프레시 토큰 빈값 로직 제거 및 when문 적용
s9hn May 14, 2025
7dcfe82
refactor: WebsosoAuthSessionManager replay 1 추가
s9hn May 14, 2025
462d300
refactor: renewToken delay 함수 제거
s9hn May 14, 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
10 changes: 2 additions & 8 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ android {
isDebuggable = true
applicationIdSuffix = ".debug"

buildConfigs(rootDir) {
string(name = "BASE_URL", key = "debug.base.url")
}

manifestPlaceholders {
"appName" to "@string/app_name_debug"
"appIcon" to "@mipmap/ic_wss_logo_debug"
Expand All @@ -61,10 +57,6 @@ android {
"proguard-rules.pro",
)

buildConfigs(rootDir) {
string(name = "BASE_URL", key = "release.base.url")
}

manifestPlaceholders {
"appName" to "@string/app_name"
"appIcon" to "@mipmap/ic_wss_logo"
Expand All @@ -84,9 +76,11 @@ dependencies {
// 프로젝트 의존성
implementation(projects.core.resource)
implementation(projects.core.designsystem)
implementation(projects.core.common)
implementation(projects.core.auth)
implementation(projects.core.authKakao)
implementation(projects.core.network)
implementation(projects.core.datastore)

implementation(projects.feature.signin)

Expand Down
18 changes: 18 additions & 0 deletions app/src/main/java/com/into/websoso/WebsosoApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,34 @@ package com.into.websoso

import android.app.Application
import androidx.appcompat.app.AppCompatDelegate
import androidx.lifecycle.ProcessLifecycleOwner
import com.into.websoso.BuildConfig.KAKAO_APP_KEY
import com.into.websoso.core.auth.AuthSessionManager
import com.into.websoso.core.common.navigator.NavigatorProvider
import com.into.websoso.core.common.util.collectWithLifecycle
import com.kakao.sdk.common.KakaoSdk
import dagger.hilt.android.HiltAndroidApp
import javax.inject.Inject

@HiltAndroidApp
class WebsosoApp : Application() {
@Inject
lateinit var sessionManager: AuthSessionManager

@Inject
lateinit var navigatorProvider: NavigatorProvider

override fun onCreate() {
super.onCreate()
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)

subscribeSessionState()
KakaoSdk.init(this, KAKAO_APP_KEY)
}

private fun subscribeSessionState() {
sessionManager.sessionExpired.collectWithLifecycle(ProcessLifecycleOwner.get()) {
navigatorProvider.navigateToLoginActivity()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.into.websoso.core.common.util.navigator

import android.content.Context
import com.into.websoso.core.common.navigator.NavigatorProvider
import com.into.websoso.ui.login.LoginActivity
import com.into.websoso.ui.main.MainActivity
import com.into.websoso.ui.onboarding.OnboardingActivity
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import javax.inject.Inject
import javax.inject.Singleton

internal class WebsosoNavigator
@Inject
constructor(
@ApplicationContext private val context: Context,
) : NavigatorProvider {
override fun navigateToLoginActivity() {
val intent = LoginActivity.getIntent(context)
context.startActivity(intent)
}

override fun navigateToMainActivity() {
val intent = MainActivity.getIntent(context, true)
context.startActivity(intent)
}

override fun navigateToOnboardingActivity() {
val intent = OnboardingActivity.getIntent(context)
context.startActivity(intent)
}
}

@Module
@InstallIn(SingletonComponent::class)
internal interface NavigatorModule {
@Binds
@Singleton
fun bindWebsosoNavigator(websosoNavigator: WebsosoNavigator): NavigatorProvider
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.into.websoso.core.common.util.sessionManager

import com.into.websoso.core.auth.AuthSessionManager
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.SharedFlow
import kotlinx.coroutines.flow.asSharedFlow
import javax.inject.Inject
import javax.inject.Singleton

internal class WebsosoAuthSessionManager
@Inject
constructor() : AuthSessionManager {
private val _sessionExpired = MutableSharedFlow<Unit>(replay = 1, extraBufferCapacity = 1)
override val sessionExpired: SharedFlow<Unit> get() = _sessionExpired.asSharedFlow()

override suspend fun onSessionExpired() {
_sessionExpired.emit(Unit)
}
Comment on lines +17 to +22
Copy link
Member

Choose a reason for hiding this comment

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

c: Unit을 가진 SharedFlow가 있는 이유가 있으실까요?

Copy link
Member Author

Choose a reason for hiding this comment

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

AuthSessionManager는 단발성 트리거로 '세션이 만료되었음' 만을 전파합니다.
해당 이벤트는 단 1회만 수신해야하며, 별 다른 상태를 가질 필요가 없습니다!
추후 해당 이벤트 분기가 추가된다면, 이벤트 상태 객체가 추가될테지만 현재로썬 달리 추가될 기능이 없어보입니다!

}

@Module
@InstallIn(SingletonComponent::class)
internal interface WebsosoAuthSessionManagerModule {
@Binds
@Singleton
fun bindWebsosoAuthSessionManager(websosoAuthSessionManager: WebsosoAuthSessionManager): AuthSessionManager
}

This file was deleted.

42 changes: 10 additions & 32 deletions app/src/main/java/com/into/websoso/data/di/ApiModule.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.into.websoso.data.di

import com.into.websoso.data.qualifier.Secured
import com.into.websoso.data.qualifier.Unsecured
import com.into.websoso.data.remote.api.AuthApi
import com.into.websoso.data.remote.api.AvatarApi
import com.into.websoso.data.remote.api.FeedApi
Expand All @@ -24,61 +22,41 @@ import javax.inject.Singleton
object ApiModule {
@Provides
@Singleton
fun provideAuthApi(
@Unsecured retrofit: Retrofit,
): AuthApi = retrofit.create(AuthApi::class.java)
fun provideAuthApi(retrofit: Retrofit): AuthApi = retrofit.create(AuthApi::class.java)

@Provides
@Singleton
fun provideNovelApi(
@Secured retrofit: Retrofit,
): NovelApi = retrofit.create(NovelApi::class.java)
fun provideNovelApi(retrofit: Retrofit): NovelApi = retrofit.create(NovelApi::class.java)

@Provides
@Singleton
fun provideUserNovelApi(
@Secured retrofit: Retrofit,
): UserNovelApi = retrofit.create(UserNovelApi::class.java)
fun provideUserNovelApi(retrofit: Retrofit): UserNovelApi = retrofit.create(UserNovelApi::class.java)

@Provides
@Singleton
fun provideNotificationApi(
@Secured retrofit: Retrofit,
): NotificationApi = retrofit.create(NotificationApi::class.java)
fun provideNotificationApi(retrofit: Retrofit): NotificationApi = retrofit.create(NotificationApi::class.java)

@Provides
@Singleton
fun provideFeedApi(
@Secured retrofit: Retrofit,
): FeedApi = retrofit.create(FeedApi::class.java)
fun provideFeedApi(retrofit: Retrofit): FeedApi = retrofit.create(FeedApi::class.java)

@Provides
@Singleton
fun provideUserApi(
@Secured retrofit: Retrofit,
): UserApi = retrofit.create(UserApi::class.java)
fun provideUserApi(retrofit: Retrofit): UserApi = retrofit.create(UserApi::class.java)

@Provides
@Singleton
fun provideKeywordApi(
@Secured retrofit: Retrofit,
): KeywordApi = retrofit.create(KeywordApi::class.java)
fun provideKeywordApi(retrofit: Retrofit): KeywordApi = retrofit.create(KeywordApi::class.java)

@Provides
@Singleton
fun provideAvatarApi(
@Secured retrofit: Retrofit,
): AvatarApi = retrofit.create(AvatarApi::class.java)
fun provideAvatarApi(retrofit: Retrofit): AvatarApi = retrofit.create(AvatarApi::class.java)

@Provides
@Singleton
fun provideVersionApi(
@Secured retrofit: Retrofit,
): VersionApi = retrofit.create(VersionApi::class.java)
fun provideVersionApi(retrofit: Retrofit): VersionApi = retrofit.create(VersionApi::class.java)

@Provides
@Singleton
fun providePushMessageApi(
@Secured retrofit: Retrofit,
): PushMessageApi = retrofit.create(PushMessageApi::class.java)
fun providePushMessageApi(retrofit: Retrofit): PushMessageApi = retrofit.create(PushMessageApi::class.java)
}
115 changes: 0 additions & 115 deletions app/src/main/java/com/into/websoso/data/di/NetworkModule.kt

This file was deleted.

Loading