Skip to content

Commit 6f41d25

Browse files
authored
fix: 제보하기 QA 대응 (2차) (#84)
- 제보하기 제목 글자 수 제한 - 제보 히스토리에서 제보하기 제목을 최대 2줄로 표시하도록 수정
1 parent 7fd4e4f commit 6f41d25

File tree

5 files changed

+50
-12
lines changed

5 files changed

+50
-12
lines changed

Projects/Presentation/Sources/Report/View/Component/ReportHistory/ReportHistoryEmptyView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ final class ReportHistoryEmptyView: UIView {
5454

5555
labelStackView.snp.makeConstraints { make in
5656
make.center.equalToSuperview()
57-
make.height.equalTo(Layout.stackViewHeight)
57+
make.height.equalTo(Layout.stackViewHeight).priority(.medium)
5858
make.width.equalTo(Layout.stackViewWidth)
5959
}
6060

Projects/Presentation/Sources/Report/View/Component/ReportHistory/ReportHistoryTableViewCell.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ final class ReportHistoryTableViewCell: UITableViewCell {
5555
photoImageView.layer.cornerRadius = 9.25
5656
photoImageView.layer.masksToBounds = true
5757

58+
titleLabel.numberOfLines = 2
5859
titleLabel.textColor = BitnagilColor.gray10
5960
titleLabel.font = BitnagilFont.init(style: .body2, weight: .semiBold).font
6061
titleLabel.textAlignment = .left
@@ -93,9 +94,14 @@ final class ReportHistoryTableViewCell: UITableViewCell {
9394
}
9495

9596
photoImageView.snp.makeConstraints { make in
96-
make.verticalEdges
97+
make.top
98+
.equalToSuperview()
99+
.inset(Layout.verticalSpacing)
100+
101+
make.bottom
97102
.equalToSuperview()
98103
.inset(Layout.verticalSpacing)
104+
.priority(.low)
99105

100106
make.trailing
101107
.equalToSuperview()
@@ -130,6 +136,7 @@ final class ReportHistoryTableViewCell: UITableViewCell {
130136
make.bottom
131137
.equalToSuperview()
132138
.offset(-Layout.verticalSpacing)
139+
.priority(.medium)
133140

134141
make.width
135142
.equalTo(Layout.categoryLabelWidth)

Projects/Presentation/Sources/Report/View/ReportDetailViewController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ class ReportDetailViewController: BaseViewController<ReportDetailViewModel> {
152152
titleLabel.text = reportDetailContentType.title
153153
titleLabel.font = BitnagilFont(style: .body2, weight: .semiBold).font
154154
titleLabel.textColor = BitnagilColor.gray10
155+
titleLabel.numberOfLines = 2
155156

156157
backgroudView.layer.masksToBounds = true
157158
backgroudView.layer.cornerRadius = 12

Projects/Presentation/Sources/Report/View/ReportRegistrationViewController.swift

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ final class ReportRegistrationViewController: BaseViewController<ReportRegistrat
4444
static let registerButtonHeight: CGFloat = 54
4545
static let categoryBottomSheetHeight: CGFloat = 362
4646
static let cameraBottomSheetHeight: CGFloat = 174
47-
static let contentCountLabelTopSpacing: CGFloat = 6
48-
static let contentCountLabelHeight: CGFloat = 18
47+
static let countLabelTopSpacing: CGFloat = 6
48+
static let countLabelHeight: CGFloat = 18
4949
}
5050

5151
private typealias Section = ReportRegistrationViewController.CollectionViewSection
@@ -62,12 +62,16 @@ final class ReportRegistrationViewController: BaseViewController<ReportRegistrat
6262
private let cameraButton = ReportCameraButton(frame: .zero)
6363
private let photoCollectionView = UICollectionView(frame: .zero, collectionViewLayout: .init())
6464
private let categoryTextView = ReportTextView(type: .combo, placeholder: "카테고리 선택")
65-
private let reportTitleTextView = ReportTextView(type: .editable, placeholder: "제보 제목을 작성해주세요.")
65+
private let reportTitleTextView = ReportTextView(
66+
type: .editable,
67+
placeholder: "제보 제목을 작성해주세요."
68+
,maxLength: 50)
6669
private let reportContentTextView = ReportTextView(
6770
type: .editable,
6871
placeholder: "어떤 위험인지 간단히 설명해주세요.",
6972
maxLength: 150)
7073
private let locationTextView = ReportTextView(type: .nonEditable, placeholder: "현재 위치 검색")
74+
private let titleCountLabel = UILabel()
7175
private let contentTextCountLabel = UILabel()
7276
private let locationButton = LocationButton()
7377
private let registerButton = PrimaryButton(buttonState: .disabled, buttonTitle: "제출하기")
@@ -127,6 +131,9 @@ final class ReportRegistrationViewController: BaseViewController<ReportRegistrat
127131
},
128132
for: .touchUpInside)
129133

134+
titleCountLabel.font = BitnagilFont.init(style: .caption1, weight: .medium).font
135+
titleCountLabel.textColor = BitnagilColor.gray80
136+
130137
contentTextCountLabel.font = BitnagilFont.init(style: .caption1, weight: .medium).font
131138
contentTextCountLabel.textColor = BitnagilColor.gray80
132139

@@ -148,6 +155,7 @@ final class ReportRegistrationViewController: BaseViewController<ReportRegistrat
148155
scrollContentView.addSubview(collectionViewTitleLabel)
149156
scrollContentView.addSubview(categoryTitleLabel)
150157
scrollContentView.addSubview(nameTitleLabel)
158+
scrollContentView.addSubview(titleCountLabel)
151159
scrollContentView.addSubview(contentTitleLabel)
152160
scrollContentView.addSubview(locationTitleLabel)
153161
scrollContentView.addSubview(cameraButton)
@@ -238,9 +246,20 @@ final class ReportRegistrationViewController: BaseViewController<ReportRegistrat
238246
.equalTo(Layout.textViewHeight)
239247
}
240248

241-
categoryTitleLabel.snp.makeConstraints { make in
249+
titleCountLabel.snp.makeConstraints { make in
242250
make.top
243251
.equalTo(reportTitleTextView.snp.bottom)
252+
.offset(Layout.countLabelTopSpacing)
253+
254+
make.height
255+
.equalTo(Layout.countLabelHeight)
256+
257+
make.trailing.equalTo(reportTitleTextView)
258+
}
259+
260+
categoryTitleLabel.snp.makeConstraints { make in
261+
make.top
262+
.equalTo(titleCountLabel.snp.bottom)
244263
.offset(Layout.titleLabelTopSpacing)
245264

246265
make.leading
@@ -294,13 +313,13 @@ final class ReportRegistrationViewController: BaseViewController<ReportRegistrat
294313
contentTextCountLabel.snp.makeConstraints { make in
295314
make.top
296315
.equalTo(reportContentTextView.snp.bottom)
297-
.offset(Layout.contentCountLabelTopSpacing)
316+
.offset(Layout.countLabelTopSpacing)
298317

299318
make.trailing
300319
.equalToSuperview()
301320
.offset(-Layout.horizontalInset)
302321

303-
make.height.equalTo(Layout.contentCountLabelHeight)
322+
make.height.equalTo(Layout.countLabelHeight)
304323
}
305324

306325
locationTitleLabel.snp.makeConstraints { make in
@@ -374,17 +393,22 @@ final class ReportRegistrationViewController: BaseViewController<ReportRegistrat
374393
viewModel.output.titlePublisher
375394
.receive(on: DispatchQueue.main)
376395
.sink { [weak self] title in
377-
self?.reportTitleTextView.configure(text: title ?? "")
396+
guard let self else { return }
397+
398+
self.reportTitleTextView.configure(text: title ?? "")
399+
let title = title ?? ""
400+
self.titleCountLabel.text = "\(title.count) / \(viewModel.output.maxTitleLength)"
378401
}
379402
.store(in: &cancellables)
380403

381404
viewModel.output.contentPublisher
382405
.receive(on: DispatchQueue.main)
383406
.sink { [weak self] content in
384-
self?.reportContentTextView.configure(text: content ?? "")
407+
guard let self else { return }
408+
self.reportContentTextView.configure(text: content ?? "")
385409

386410
let content = content ?? ""
387-
self?.contentTextCountLabel.text = "\(content.count) / 150"
411+
self.contentTextCountLabel.text = "\(content.count) / \(viewModel.output.maxContentLength)"
388412
}
389413
.store(in: &cancellables)
390414

Projects/Presentation/Sources/Report/ViewModel/ReportRegistrationViewModel.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ final class ReportRegistrationViewModel: ViewModel {
3232
let exceptionPublisher: AnyPublisher<String, Never>
3333
let reportRegistrationCompletePublisher: AnyPublisher<Int?, Never>
3434
let maxPhotoCount: Int
35+
let maxContentLength: Int
36+
let maxTitleLength: Int
3537
}
3638

3739
private(set) var output: Output
@@ -46,6 +48,8 @@ final class ReportRegistrationViewModel: ViewModel {
4648
private let reportRegistrationCompleteSubject = PassthroughSubject<Int?, Never>()
4749
private let exceptionSubject = PassthroughSubject<String, Never>()
4850
private let maxPhotoCount = 3
51+
private let maxContentLength = 150
52+
private let maxTitleLength = 50
4953
private var location: LocationEntity? = nil
5054
private(set) var selectedReportType: ReportType?
5155
var selectedPhotoCount: Int {
@@ -65,7 +69,9 @@ final class ReportRegistrationViewModel: ViewModel {
6569
isReportValid: reportVerificationSubject.eraseToAnyPublisher(),
6670
exceptionPublisher: exceptionSubject.eraseToAnyPublisher(),
6771
reportRegistrationCompletePublisher: reportRegistrationCompleteSubject.eraseToAnyPublisher(),
68-
maxPhotoCount: maxPhotoCount)
72+
maxPhotoCount: maxPhotoCount,
73+
maxContentLength: maxContentLength,
74+
maxTitleLength: maxTitleLength)
6975
}
7076

7177
func action(input: Input) {

0 commit comments

Comments
 (0)