Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
90b9ba0
[feat] 토큰 작업 중
kangyuri1114 Apr 16, 2025
80521ce
[feat] TokenAuthenticator hilt provide 로직으로 수정
kangyuri1114 Apr 17, 2025
54ae6f7
[feat] Fragment @AndroidEntryPoint 추가
kangyuri1114 Apr 17, 2025
ce2014c
[feat] 로그인 에러 토스트 메시지 줄바꿈 삭제
kangyuri1114 Apr 17, 2025
9ae0b78
[feat] oauthService 주입 방식 수정
kangyuri1114 Apr 17, 2025
7f71442
[feat] 토큰이 있는 경우와 없는 경우의 retrofit, okhttp 분리
kangyuri1114 Apr 17, 2025
e404ac4
[feat] 디버깅 okhttp에 authenticator 추가, 백그라운드 환경에서 toast 사용하도록 공통 클래스 추가…
kangyuri1114 Apr 17, 2025
6b14144
[feat] LogoutUseCase 수정
kangyuri1114 Apr 17, 2025
78100a8
[feat] 불필요 파일 및 코드 삭제
kangyuri1114 Apr 18, 2025
6f84fdd
[feat] @Named 어노테이션 @Qualifier 로 변경
kangyuri1114 Apr 18, 2025
36b671c
[feat] 토큰 재발급 로직을 ReissueTokenUseCase 사용하도록 수정
kangyuri1114 Apr 18, 2025
057c7c9
[feat] 불필요 임포트 삭제
kangyuri1114 Apr 18, 2025
d9bd354
[feat] LogoutUseCase 및 사용 화면 코드 복구
kangyuri1114 Apr 18, 2025
ec138da
[feat] 임시커밋
kangyuri1114 Apr 24, 2025
628c458
feat: 토큰뷰모델 도입, baseActivity에서 토큰 뷰모델 감지 로직으로 수정
kangyuri1114 Apr 24, 2025
6f327c8
[feat] 임시커밋
kangyuri1114 Apr 25, 2025
21e8df0
feat: 토큰이벤트버스 도입 및 전체적인 토큰 갱신 구조 변경 완료
kangyuri1114 Apr 26, 2025
0022ba5
feat: ShowToastSafely 삭제
kangyuri1114 Apr 26, 2025
7e4ec17
feat: 불필요한 import 삭제
kangyuri1114 Apr 26, 2025
7801fe4
feat: AuthUtil 삭제
kangyuri1114 Apr 26, 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
28 changes: 28 additions & 0 deletions app/src/main/java/com/eatssu/android/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,30 @@ package com.eatssu.android

import android.app.Application
import android.content.Context
import com.eatssu.android.domain.model.TokenState
import com.eatssu.android.domain.model.TokenStateManager
import com.eatssu.android.presentation.base.TokenEventBus
import com.google.firebase.FirebaseApp
import com.kakao.sdk.common.KakaoSdk
import dagger.hilt.android.HiltAndroidApp
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.launch
import timber.log.Timber

/** App: 앱이 살아있는 동안 공통 리소스 관리를 위한 클래스 */
@HiltAndroidApp
class App: Application() {
companion object{
lateinit var appContext: Context //todo 이거 빼기
}

/** 앱 전체에서 사용할 수 있는 CoroutineScope(독립적인 공간을 만들어 안정성 높임)
* 자식 CoroutineScope가 취소되더라도 부모 CoroutineScope는 취소되지 않음
* */
private val appScope = CoroutineScope(SupervisorJob() + Dispatchers.Main)

override fun onCreate() {
super.onCreate()
FirebaseApp.initializeApp(this)
Expand All @@ -23,5 +36,20 @@ class App: Application() {
if (BuildConfig.DEBUG) {
Timber.plant(Timber.DebugTree())
}

collectTokenState()
}

/** 토큰 상태를 application에서 감지하여 TokenEventBus에 전달 */
private fun collectTokenState(){
appScope.launch {
TokenStateManager.state.collect { state ->
if (state == TokenState.EXPIRED) {
TokenEventBus.notifyTokenExpired()
} else if(state == TokenState.ERROR) {
TokenEventBus.notifyServerError()
}
}
}
}
}
211 changes: 0 additions & 211 deletions app/src/main/java/com/eatssu/android/data/RetrofitImpl.kt

This file was deleted.

Loading