@@ -12,6 +12,7 @@ import com.kakao.sdk.auth.model.OAuthToken
12
12
import com.kakao.sdk.common.model.ClientError
13
13
import com.kakao.sdk.common.model.ClientErrorCause
14
14
import com.kakao.sdk.user.UserApiClient
15
+ import com.sopt.core.type.DialogType
15
16
import com.sopt.core.type.SocialType
16
17
import com.sopt.core.util.BaseViewModel
17
18
import com.sopt.domain.entity.UserEntity
@@ -32,15 +33,11 @@ class LoginViewModel @Inject constructor(
32
33
private val userInfoRepository : UserInfoRepository
33
34
) : BaseViewModel<LoginSideEffect>() {
34
35
35
- private val _showDialog = MutableStateFlow (false )
36
- val showDialog: StateFlow <Boolean > get() = _showDialog
36
+ private val _showDialog = MutableStateFlow (Pair ( DialogType . LOGIN_GOOGLE , false ) )
37
+ val showDialog: StateFlow <Pair < DialogType , Boolean > > get() = _showDialog
37
38
38
- private val _dialogDescription = MutableStateFlow (" " )
39
- val dialogDescription: StateFlow <String > get() = _dialogDescription
40
-
41
- fun showFailLoginDialog (show : Boolean , description : String = "") {
42
- _showDialog .update { show }
43
- _dialogDescription .update { description }
39
+ fun showDialog (dialogType : DialogType , isVisible : Boolean ) {
40
+ _showDialog .update { it.copy(first = dialogType, second = isVisible) }
44
41
}
45
42
46
43
// Kakao Login
@@ -65,7 +62,7 @@ class LoginViewModel @Inject constructor(
65
62
66
63
error != null -> {
67
64
handleError(error, R .string.toast_kakao_login_failed)
68
- showFailLoginDialog( true , description = KAKAO )
65
+ showDialog( DialogType . LOGIN_KAKAO , true )
69
66
}
70
67
}
71
68
}
@@ -91,7 +88,7 @@ class LoginViewModel @Inject constructor(
91
88
handleGoogleLoginResult(result.credential)
92
89
}.onFailure { exception ->
93
90
handleError(exception, R .string.toast_google_login_failed)
94
- showFailLoginDialog( true , description = GOOGLE )
91
+ showDialog( DialogType . LOGIN_GOOGLE , true )
95
92
}
96
93
}
97
94
}
@@ -105,7 +102,7 @@ class LoginViewModel @Inject constructor(
105
102
R .string.toast_google_login_success
106
103
)
107
104
} else {
108
- showFailLoginDialog( true , description = GOOGLE )
105
+ showDialog( DialogType . LOGIN_GOOGLE , true )
109
106
}
110
107
}
111
108
0 commit comments