@@ -74,14 +74,11 @@ final public class ReportViewController: UIViewController {
74
74
case . errorMessage( let message) :
75
75
self ? . showAlert ( message: message)
76
76
77
- case . completed( let reportType) :
78
- let message = reportType == . userReport ? " 계정 " : " 게시글 "
79
- let alert = UIAlertController ( title: " " , message: " \( message) 가리기를 완료했어요. " , preferredStyle: . alert)
80
- alert. addAction ( UIAlertAction ( title: " 메인 화면으로 돌아가기 " , style: . default, handler: { _ in
81
- self ? . coordinator. popToRoot ( )
82
- } ) )
83
- self ? . present ( alert, animated: true )
84
-
77
+ case . completed( let completed) :
78
+ guard completed else {
79
+ return
80
+ }
81
+ self ? . coordinator. popToRoot ( )
85
82
}
86
83
} ) . store ( in: & cancellables)
87
84
}
@@ -109,6 +106,21 @@ final public class ReportViewController: UIViewController {
109
106
110
107
}
111
108
109
+ private func showBlockAlert( _ reportType: ReportType ) {
110
+ let message = reportType == . userReport ? " 계정 " : " 게시글 "
111
+ let alert = UIAlertController ( title: " 정말 이 \( message) 을 차단할까요? " , message: nil , preferredStyle: . alert)
112
+ alert. addAction ( UIAlertAction ( title: " 취소 " , style: . default) )
113
+ alert. addAction ( UIAlertAction ( title: " 차단하기 " , style: . default, handler: { _ in
114
+ switch reportType {
115
+ case . userReport:
116
+ self . viewModel. input. didTapBlockButton ( . userReport)
117
+ case . postReport:
118
+ self . viewModel. input. didTapBlockButton ( . postReport)
119
+ }
120
+ } ) )
121
+ present ( alert, animated: true )
122
+ }
123
+
112
124
@objc func didTapUserReportButton( _ sender: Any ? ) {
113
125
coordinator. showDetailReport ( . userReport, userToken: userToken, boardToken: boardToken)
114
126
}
@@ -118,11 +130,11 @@ final public class ReportViewController: UIViewController {
118
130
}
119
131
120
132
@objc func didTapUserBlockButton( _ sender: Any ? ) {
121
- viewModel . input . didTapBlockButton ( . userReport)
133
+ showBlockAlert ( . userReport)
122
134
}
123
135
124
136
@objc func didTapPostBlockButton( _ sender: Any ? ) {
125
- viewModel . input . didTapBlockButton ( . postReport)
137
+ showBlockAlert ( . postReport)
126
138
}
127
139
128
140
}
0 commit comments