-
Notifications
You must be signed in to change notification settings - Fork 1
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
Feature/jaino/#86 #99
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μ§νΈμ κ³ μνμ ¨μ΅λλ€ ~~ ππ
μ λ μ§νΈμ μμ νκ±Έ λ°νμΌλ‘ μμ νλ©΄μ
λͺ¨λ₯΄λ κ±° μκΈΈ λλ§λ€ μ§λ¬Έ 곡격ν κ²μ!!
class DeleteUserUseCase @Inject constructor( | ||
private val authRepository: AuthRepository, | ||
private val userRepository: UserRepository, | ||
private val managementRepository: ManagementRepository, | ||
private val getUserRoleUseCase: GetUserRoleUseCase, | ||
) { | ||
suspend operator fun invoke(): Result<Unit> = | ||
authRepository.deleteUser() | ||
suspend operator fun invoke(userId: String): Result<Unit> = runCatching { | ||
val userRole = getUserRoleUseCase().getOrThrow() | ||
when (userRole) { | ||
UserRole.GUEST -> { return@runCatching } | ||
|
||
UserRole.MEMBER -> { | ||
userRepository.deleteUserProfile(userId) | ||
} | ||
|
||
UserRole.MANAGER -> { | ||
userRepository.deleteUserProfile(userId) | ||
managementRepository.deleteManager(userId) | ||
} | ||
} | ||
|
||
authRepository.deleteUser().getOrThrow() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μμ° UseCase λ΄λΆμμ UseCaseλ₯Ό μ¬μ©ν μ μλ€λ κ²μ μκ³ μμλλ°,
μ§μ μ μΌλ‘ μ¬μ©ν κ²μ μ²μ λ΄€μ΄μ.
λλ° μ κΈ°νλ€μ.
μ΄λ° μμΌλ‘ μ¬μ©λ μ μκ² κ΅°μ!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μΊ¬μΊ¬ μ’μ΅λλ€μ!
when (event) { | ||
is SplashViewModel.SplashEvent.TimerDone -> navigateToAuth() | ||
is SplashViewModel.SplashEvent.SignInUser -> { navigateToNotice() } | ||
is SplashViewModel.SplashEvent.NonSignInUser -> { navigateToAuth() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μ΄ λΆλΆμμ μ€μ½νλ₯Ό μ¬μ©ν μ΄μ κ° μμκΉμ?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
μΊ¬μΊ¬ μ€μ½νλ₯Ό μκ±°ν μ μλ€λ μκ°μ λͺ»νλ€μ, λ°λ‘ μκ±°νκ² μ΅λλ€μ!
init { | ||
viewModelScope.launch { | ||
delay(2000) | ||
event(SplashEvent.TimerDone) | ||
isUserSignIn() | ||
} | ||
} | ||
|
||
private fun isUserSignIn() { | ||
viewModelScope.launch { | ||
isUserSignInUseCase() | ||
.onSuccess { isSignIn -> | ||
if (isSignIn) { | ||
_splashUiEvent.emit(SplashEvent.SignInUser) | ||
} else { | ||
_splashUiEvent.emit(SplashEvent.NonSignInUser) | ||
} | ||
}.onFailure { throwable -> | ||
_splashUiEvent.emit(SplashEvent.Failure(throwable)) | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
viewModelScope
λ₯Ό νλ² λ μ¬μ μ΄μ κ° μμκΉμ?
suspend funμΌλ‘ μ μΈνλ κ²μ μ΄λ¨κΉμ?!
νΉμ delayλ₯Ό ν¨μ λ΄λΆμ νλΌλ―Έν°λ‘ λ겨μ€λ€λμ§?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
κΈ°μ‘΄ init λ‘μ§μ μ λλ‘ λ€μ¬λ€ λ³΄μ§ λͺ»νκ³ , μμ±νμ΅λλ€ γ γ
suspend function μμ£Ό κ΅Ώ μΈμ¬μ΄νΈμ
λλ€ ~ !
suspend functionμΌλ‘ λ³κ²½ν κ²μ©~
β¦, νλμ viewModelScope λ΄μμ λμνλλ‘ μμ
1. π κ΄λ ¨λ μ΄μ λ° μκ°
#86 νμ μμ μ λ°μ΄ν°λ ν¨κ» μμ νλ λ‘μ§ κ΅¬ν
2. π₯λ³κ²½λ μ
νμ μ 보 μμ λ‘μ§ κ΅¬ν
맀λμ μ 보 μμ λ‘μ§ κ΅¬ν
νμ κΆνμ λ°λΌ νν΄νλ μ μ€μΌμ΄μ€ ꡬν
3. πΈ μ€ν¬λ¦°μ·(μ ν)
4. π‘μκ²λ νΉμ κΆκΈν μ¬νλ€