@@ -74,14 +74,11 @@ final public class ReportViewController: UIViewController {
7474 case . errorMessage( let message) :
7575 self ? . showAlert ( message: message)
7676
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 ( )
8582 }
8683 } ) . store ( in: & cancellables)
8784 }
@@ -109,6 +106,21 @@ final public class ReportViewController: UIViewController {
109106
110107 }
111108
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+
112124 @objc func didTapUserReportButton( _ sender: Any ? ) {
113125 coordinator. showDetailReport ( . userReport, userToken: userToken, boardToken: boardToken)
114126 }
@@ -118,11 +130,11 @@ final public class ReportViewController: UIViewController {
118130 }
119131
120132 @objc func didTapUserBlockButton( _ sender: Any ? ) {
121- viewModel . input . didTapBlockButton ( . userReport)
133+ showBlockAlert ( . userReport)
122134 }
123135
124136 @objc func didTapPostBlockButton( _ sender: Any ? ) {
125- viewModel . input . didTapBlockButton ( . postReport)
137+ showBlockAlert ( . postReport)
126138 }
127139
128140}
0 commit comments