@@ -95,10 +95,21 @@ extension MyPageFeature {
95
95
await send ( . withdrawalDidCompleted)
96
96
}
97
97
98
+ case . dismissAlert:
99
+ state. destination = nil
100
+ return . send( . configureLoadingProgressView( isShow: false ) )
101
+
98
102
case . dismissContactsAlert:
99
103
state. destination = nil
100
104
URLHandler . shared. openURL ( urlType: . setting)
101
105
return . none
106
+
107
+ case let . confirmBlockContacts( contacts) :
108
+ return . run { send in
109
+ try await userClient. updateBlockContacts ( contacts: contacts)
110
+ await send ( . updatePhoneNumberForBlockCompleted( count: contacts. count) )
111
+ await send ( . configureLoadingProgressView( isShow: false ) )
112
+ }
102
113
}
103
114
104
115
case . userProfileDidFetched( let userProfile) :
@@ -147,9 +158,7 @@ extension MyPageFeature {
147
158
return . run { send in
148
159
await send ( . configureLoadingProgressView( isShow: true ) )
149
160
let contacts = try await userClient. fetchContacts ( )
150
- try await userClient. updateBlockContacts ( contacts: contacts)
151
- await send ( . updatePhoneNumberForBlockCompleted( count: contacts. count) )
152
- await send ( . configureLoadingProgressView( isShow: false ) )
161
+ await send ( . contactsDidReceived( contacts: contacts) )
153
162
} catch: { error, send in
154
163
await send ( . configureLoadingProgressView( isShow: false ) )
155
164
if let userError = error as? UserError {
@@ -161,12 +170,24 @@ extension MyPageFeature {
161
170
}
162
171
}
163
172
}
173
+
174
+ case let . contactsDidReceived( contacts) :
175
+ let count = contacts. count
176
+ state. destination = . alert( . init(
177
+ title: { TextState ( " 연락처 차단 " ) } ,
178
+ actions: {
179
+ ButtonState ( role: . cancel, action: . dismissAlert, label: { TextState ( " 취소하기 " ) } )
180
+ ButtonState ( role: . destructive, action: . confirmBlockContacts( contacts: contacts) , label: { TextState ( " 차단하기 " ) } )
181
+ } ,
182
+ message: { TextState ( " 주소록에 있는 \( count) 개의 \n 전화번호를 차단할까요? " ) } ) )
183
+ return . none
164
184
165
185
case . updateApplicationButtonTapped:
166
186
URLHandler . shared. openURL ( urlType: . bottleAppStore)
167
187
return . none
168
188
169
189
case let . updatePhoneNumberForBlockCompleted( count) :
190
+ toastClient. presentToast ( message: " 차단이 완료됐어요 " )
170
191
state. blockedContactsCount = count
171
192
return . none
172
193
0 commit comments