Skip to content

Commit 0083464

Browse files
committed
Refactor: 로그아웃, 회원탈퇴 다이얼로그 기능 분리
- 로그아웃 다이얼로그 디자인 수정 - 회원탈퇴 로직 제거
1 parent ec3c8ba commit 0083464

8 files changed

Lines changed: 50 additions & 141 deletions

File tree

core/designsystem/src/main/java/com/threegap/bitnagil/designsystem/component/atom/BitnagilTextButton.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,16 @@ data class BitnagilTextButtonColor(
110110
pressedTextColor = BitnagilTheme.colors.navy500,
111111
disabledTextColor = BitnagilTheme.colors.navy500,
112112
)
113+
114+
@Composable
115+
fun cancel(): BitnagilTextButtonColor = BitnagilTextButtonColor(
116+
defaultBackgroundColor = BitnagilTheme.colors.coolGray97,
117+
pressedBackgroundColor = BitnagilTheme.colors.coolGray97,
118+
disabledBackgroundColor = BitnagilTheme.colors.coolGray97,
119+
defaultTextColor = BitnagilTheme.colors.coolGray40,
120+
pressedTextColor = BitnagilTheme.colors.coolGray40,
121+
disabledTextColor = BitnagilTheme.colors.coolGray40,
122+
)
113123
}
114124
}
115125

core/designsystem/src/main/res/drawable/ic_modal_warning.xml

Lines changed: 0 additions & 18 deletions
This file was deleted.

presentation/src/main/java/com/threegap/bitnagil/presentation/setting/SettingScreen.kt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import com.threegap.bitnagil.designsystem.component.block.BitnagilTopBar
2929
import com.threegap.bitnagil.designsystem.modifier.clickableWithoutRipple
3030
import com.threegap.bitnagil.presentation.common.flow.collectAsEffect
3131
import com.threegap.bitnagil.presentation.setting.component.atom.settingtitle.SettingTitle
32-
import com.threegap.bitnagil.presentation.setting.component.block.ConfirmDialog
32+
import com.threegap.bitnagil.presentation.setting.component.block.LogoutConfirmDialog
3333
import com.threegap.bitnagil.presentation.setting.model.mvi.SettingSideEffect
3434
import com.threegap.bitnagil.presentation.setting.model.mvi.SettingState
3535

@@ -49,11 +49,10 @@ fun SettingScreenContainer(
4949
}
5050
}
5151

52-
state.showConfirmDialog?.let { dialogType ->
53-
ConfirmDialog(
54-
type = dialogType,
52+
if (state.logoutConfirmDialogVisible) {
53+
LogoutConfirmDialog(
5554
onDismiss = viewModel::hideConfirmDialog,
56-
onConfirm = viewModel::confirmDialogAction,
55+
onConfirm = viewModel::logout,
5756
)
5857
}
5958

@@ -66,7 +65,7 @@ fun SettingScreenContainer(
6665
onClickTermsOfService = navigateToTermsOfService,
6766
onClickPrivacyPolicy = navigateToPrivacyPolicy,
6867
onClickLogout = viewModel::showLogoutDialog,
69-
onClickWithdrawal = viewModel::showWithdrawalDialog,
68+
onClickWithdrawal = {},
7069
)
7170
}
7271

@@ -181,7 +180,7 @@ fun SettingScreenPreview() {
181180
version = "1.0.1",
182181
latestVersion = "1.0.0",
183182
loading = false,
184-
showConfirmDialog = null,
183+
logoutConfirmDialogVisible = false,
185184
),
186185
toggleServiceAlarm = {},
187186
togglePushAlarm = {},

presentation/src/main/java/com/threegap/bitnagil/presentation/setting/SettingViewModel.kt

Lines changed: 13 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ package com.threegap.bitnagil.presentation.setting
33
import androidx.lifecycle.SavedStateHandle
44
import androidx.lifecycle.viewModelScope
55
import com.threegap.bitnagil.domain.auth.usecase.LogoutUseCase
6-
import com.threegap.bitnagil.domain.auth.usecase.WithdrawalUseCase
76
import com.threegap.bitnagil.presentation.common.mviviewmodel.MviViewModel
8-
import com.threegap.bitnagil.presentation.setting.model.ConfirmDialogType
97
import com.threegap.bitnagil.presentation.setting.model.mvi.SettingIntent
108
import com.threegap.bitnagil.presentation.setting.model.mvi.SettingSideEffect
119
import com.threegap.bitnagil.presentation.setting.model.mvi.SettingState
@@ -20,7 +18,6 @@ import javax.inject.Inject
2018
class SettingViewModel @Inject constructor(
2119
savedStateHandle: SavedStateHandle,
2220
private val logoutUseCase: LogoutUseCase,
23-
private val withdrawalUseCase: WithdrawalUseCase,
2421
) : MviViewModel<SettingState, SettingSideEffect, SettingIntent>(
2522
initState = SettingState.Init,
2623
savedStateHandle = savedStateHandle,
@@ -49,57 +46,45 @@ class SettingViewModel @Inject constructor(
4946
}
5047

5148
is SettingIntent.ShowConfirmDialog -> {
52-
return state.copy(showConfirmDialog = intent.type)
49+
return state.copy(logoutConfirmDialogVisible = true)
5350
}
5451

5552
is SettingIntent.HideConfirmDialog -> {
56-
return state.copy(showConfirmDialog = null)
53+
return state.copy(logoutConfirmDialogVisible = false)
5754
}
5855

5956
SettingIntent.LogoutSuccess -> {
6057
sendSideEffect(SettingSideEffect.NavigateToLogin)
6158
return null
6259
}
60+
6361
SettingIntent.LogoutLoading -> {
6462
return state.copy(loading = true)
6563
}
64+
6665
SettingIntent.LogoutFailure -> {
6766
return state.copy(loading = false)
6867
}
69-
SettingIntent.WithdrawalSuccess -> {
70-
sendSideEffect(SettingSideEffect.NavigateToLogin)
71-
return null
72-
}
73-
SettingIntent.WithdrawalLoading -> {
74-
return state.copy(loading = true)
75-
}
76-
SettingIntent.WithdrawalFailure -> {
77-
return state.copy(loading = false)
78-
}
7968
}
8069
}
8170

8271
fun showLogoutDialog() {
83-
sendIntent(SettingIntent.ShowConfirmDialog(ConfirmDialogType.LOGOUT))
84-
}
85-
86-
fun showWithdrawalDialog() {
87-
sendIntent(SettingIntent.ShowConfirmDialog(ConfirmDialogType.WITHDRAW))
72+
sendIntent(SettingIntent.ShowConfirmDialog)
8873
}
8974

9075
fun hideConfirmDialog() {
9176
sendIntent(SettingIntent.HideConfirmDialog)
9277
}
9378

94-
fun confirmDialogAction() {
95-
val currentDialogType = container.stateFlow.value.showConfirmDialog
96-
79+
fun logout() {
9780
sendIntent(SettingIntent.HideConfirmDialog)
98-
99-
when (currentDialogType) {
100-
ConfirmDialogType.LOGOUT -> executeLogout()
101-
ConfirmDialogType.WITHDRAW -> executeWithdrawal()
102-
null -> {}
81+
viewModelScope.launch {
82+
sendIntent(SettingIntent.LogoutLoading)
83+
logoutUseCase().onSuccess {
84+
sendIntent(SettingIntent.LogoutSuccess)
85+
}.onFailure {
86+
sendIntent(SettingIntent.LogoutFailure)
87+
}
10388
}
10489
}
10590

@@ -118,26 +103,4 @@ class SettingViewModel @Inject constructor(
118103
delay(1000L)
119104
}
120105
}
121-
122-
private fun executeLogout() {
123-
viewModelScope.launch {
124-
sendIntent(SettingIntent.LogoutLoading)
125-
logoutUseCase().onSuccess {
126-
sendIntent(SettingIntent.LogoutSuccess)
127-
}.onFailure {
128-
sendIntent(SettingIntent.LogoutFailure)
129-
}
130-
}
131-
}
132-
133-
private fun executeWithdrawal() {
134-
viewModelScope.launch {
135-
sendIntent(SettingIntent.WithdrawalLoading)
136-
withdrawalUseCase().onSuccess {
137-
sendIntent(SettingIntent.WithdrawalSuccess)
138-
}.onFailure {
139-
sendIntent(SettingIntent.WithdrawalFailure)
140-
}
141-
}
142-
}
143106
}

0 commit comments

Comments
 (0)