-
Notifications
You must be signed in to change notification settings - Fork 1
[Feat] 루틴/등록 수정 페이지 user interaction 추가 #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,8 +17,8 @@ final class RoutineNameContentView: UIView, RoutineCreationExpandable { | |
| static let textFieldHeight: CGFloat = 20 | ||
| static let divideLineHeight: CGFloat = 1.3 | ||
| static let textFieldTopSpacing: CGFloat = 23 | ||
| static let checkButtonViewTopSpacing: CGFloat = 24 | ||
| static let checkButtonViewSize: CGFloat = 18 | ||
| static let checkButtonImageViewTopSpacing: CGFloat = 24 | ||
| static let checkButtonImageViewSize: CGFloat = 18 | ||
| static let checkButtonLabelHeight: CGFloat = 20 | ||
| static let checkButtonLabelTrailingSpacing: CGFloat = 6 | ||
| static let foldedHeight: CGFloat = 0 | ||
|
|
@@ -29,7 +29,7 @@ final class RoutineNameContentView: UIView, RoutineCreationExpandable { | |
| case deleteAllSubroutines | ||
| } | ||
|
|
||
| struct Dependencies { | ||
| struct Dependency { | ||
| let subRoutines: [String] | ||
| } | ||
|
|
||
|
|
@@ -43,7 +43,7 @@ final class RoutineNameContentView: UIView, RoutineCreationExpandable { | |
| private let divideLine2 = UIImageView() | ||
| private let divideLine3 = UIImageView() | ||
| private let checkButtonLabel = UILabel() | ||
| private let checkButtonView = UIView() | ||
| private let checkButtonImageView = UIImageView() | ||
| private let checkButton = UIButton() | ||
| var heightConstraint: Constraint? | ||
| var action: ((Action) -> Void)? | ||
|
|
@@ -70,10 +70,10 @@ final class RoutineNameContentView: UIView, RoutineCreationExpandable { | |
| self.subviews.forEach { $0.isHidden = !expanded } | ||
| } | ||
|
|
||
| func configure(dependencies: Dependencies) { | ||
| guard !dependencies.subRoutines.isEmpty else { return } | ||
| func configure(dependency: Dependency) { | ||
| guard !dependency.subRoutines.isEmpty else { return } | ||
|
|
||
|
Comment on lines
+73
to
75
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion 빈 배열 입력 시에도 UI가 정상 초기화되도록 가드 제거 및 나머지 필드 초기화 빈 배열이면 return 되어 체크 아이콘/텍스트필드 초기화가 누락될 수 있습니다. 가드를 제거하고, 전달된 subRoutines 수보다 많은 텍스트필드는 비워 주세요. - func configure(dependency: Dependency) {
- guard !dependency.subRoutines.isEmpty else { return }
+ func configure(dependency: Dependency) {
let subRoutines = dependency.subRoutines
let subRoutineTextFields = [
subRoutineTextField1,
subRoutineTextField2,
subRoutineTextField3]
let minCount = min(subRoutines.count, subRoutineTextFields.count)
- zip(subRoutines, subRoutineTextFields).prefix(minCount).forEach {
- $1.text = $0
- }
+ zip(subRoutines, subRoutineTextFields).prefix(minCount).forEach { $1.text = $0 }
+ // 남은 필드는 초기화
+ subRoutineTextFields.dropFirst(minCount).forEach { $0.text = "" }Also applies to: 83-86 🤖 Prompt for AI Agents |
||
| let subRoutines = dependencies.subRoutines | ||
| let subRoutines = dependency.subRoutines | ||
| let subRoutineTextFields = [ | ||
| subRoutineTextField1, | ||
| subRoutineTextField2, | ||
|
|
@@ -83,6 +83,12 @@ final class RoutineNameContentView: UIView, RoutineCreationExpandable { | |
| zip(subRoutines, subRoutineTextFields).prefix(minCount).forEach { | ||
| $1.text = $0 | ||
| } | ||
|
|
||
| if dependency.subRoutines.filter({ !$0.isEmpty }).isEmpty { | ||
| checkButtonImageView.image = BitnagilIcon.checkedIcon | ||
| } else { | ||
| checkButtonImageView.image = BitnagilIcon.uncheckedIcon | ||
| } | ||
| } | ||
|
|
||
| private func configureAttribute() { | ||
|
|
@@ -100,15 +106,25 @@ final class RoutineNameContentView: UIView, RoutineCreationExpandable { | |
| subRoutineTextField2, | ||
| subRoutineTextField3] | ||
|
|
||
| zip(textFields, placeholders).forEach { textField, placeholder in | ||
| let attributes: [NSAttributedString.Key: Any] = [ | ||
| .font: BitnagilFont(style: .body2, weight: .medium).font, | ||
| .foregroundColor: BitnagilColor.gray90 ?? .systemGray] | ||
|
|
||
| textField.attributedPlaceholder = NSAttributedString(string: placeholder, attributes: attributes) | ||
| textField.font = BitnagilFont(style: .body2, weight: .medium).font | ||
| textField.textColor = BitnagilColor.gray30 | ||
| } | ||
| zip(textFields, placeholders) | ||
| .enumerated() | ||
| .forEach { | ||
| let index = $0 | ||
| let (textField, placeholder) = $1 | ||
|
|
||
| let attributes: [NSAttributedString.Key: Any] = [ | ||
| .font: BitnagilFont(style: .body2, weight: .medium).font, | ||
| .foregroundColor: BitnagilColor.gray90 ?? .systemGray | ||
| ] | ||
|
|
||
| textField.delegate = self | ||
| textField.attributedPlaceholder = NSAttributedString(string: placeholder, attributes: attributes) | ||
| textField.font = BitnagilFont(style: .body2, weight: .medium).font | ||
| textField.textColor = BitnagilColor.gray30 | ||
| textField.tag = index | ||
| textField.returnKeyType = .done | ||
| textField.addTarget(self, action: #selector(textFieldEditingChanged(_:)), for: .editingChanged) | ||
| } | ||
|
|
||
| divideLine1.image = BitnagilIcon.divideLineIcon | ||
| divideLine2.image = BitnagilIcon.divideLineIcon | ||
|
|
@@ -117,10 +133,16 @@ final class RoutineNameContentView: UIView, RoutineCreationExpandable { | |
| checkButtonLabel.text = "세부루틴 설정 안함" | ||
| checkButtonLabel.font = BitnagilFont.init(style: .body2, weight: .medium).font | ||
|
|
||
| checkButtonView.layer.cornerRadius = 4 | ||
| checkButtonView.layer.borderWidth = 1 | ||
| checkButtonView.backgroundColor = .white | ||
| checkButtonView.layer.borderColor = BitnagilColor.gray95?.cgColor | ||
| checkButtonImageView.layer.cornerRadius = 4 | ||
| checkButtonImageView.layer.masksToBounds = true | ||
| checkButtonImageView.layer.borderWidth = 1 | ||
| checkButtonImageView.backgroundColor = .white | ||
| checkButtonImageView.layer.borderColor = BitnagilColor.gray95?.cgColor | ||
| checkButton.addAction( | ||
| UIAction { [weak self] _ in | ||
| self?.action?(.deleteAllSubroutines) | ||
| }, | ||
| for: .touchUpInside) | ||
| } | ||
|
|
||
| private func configureLayout() { | ||
|
|
@@ -134,7 +156,7 @@ final class RoutineNameContentView: UIView, RoutineCreationExpandable { | |
| addSubview(divideLine2) | ||
| addSubview(divideLine3) | ||
| addSubview(checkButtonLabel) | ||
| addSubview(checkButtonView) | ||
| addSubview(checkButtonImageView) | ||
| addSubview(checkButton) | ||
|
|
||
| self.snp.makeConstraints { make in | ||
|
|
@@ -198,23 +220,33 @@ final class RoutineNameContentView: UIView, RoutineCreationExpandable { | |
| make.height.equalTo(Layout.divideLineHeight).priority(999) | ||
| } | ||
|
|
||
| checkButtonView.snp.makeConstraints { make in | ||
| make.top.equalTo(divideLine3.snp.bottom).offset(Layout.checkButtonViewTopSpacing).priority(999) | ||
| checkButtonImageView.snp.makeConstraints { make in | ||
| make.top.equalTo(divideLine3.snp.bottom).offset(Layout.checkButtonImageViewTopSpacing).priority(999) | ||
| make.bottom.equalToSuperview().offset(-Layout.edgeSpacing).priority(999) | ||
| make.trailing.equalToSuperview().offset(-Layout.edgeSpacing) | ||
| make.size.equalTo(Layout.checkButtonViewSize).priority(999) | ||
| make.size.equalTo(Layout.checkButtonImageViewSize).priority(999) | ||
| } | ||
|
|
||
| checkButtonLabel.snp.makeConstraints { make in | ||
| make.trailing.equalTo(checkButtonView.snp.leading).offset(-Layout.checkButtonLabelTrailingSpacing) | ||
| make.centerY.equalTo(checkButtonView) | ||
| make.trailing.equalTo(checkButtonImageView.snp.leading).offset(-Layout.checkButtonLabelTrailingSpacing) | ||
| make.centerY.equalTo(checkButtonImageView) | ||
| } | ||
|
|
||
| checkButton.snp.makeConstraints { make in | ||
| make.verticalEdges.equalTo(checkButtonView) | ||
| make.verticalEdges.equalTo(checkButtonImageView) | ||
| make.leading.equalTo(checkButtonLabel.snp.leading) | ||
| make.trailing.equalTo(checkButtonView.snp.trailing) | ||
| make.trailing.equalTo(checkButtonImageView.snp.trailing) | ||
| } | ||
| } | ||
|
|
||
|
|
||
| @objc private func textFieldEditingChanged(_ sender: UITextField) { | ||
| action?(.subroutineChanged(index: sender.tag, text: sender.text ?? "")) | ||
| } | ||
| } | ||
|
|
||
| extension RoutineNameContentView: UITextFieldDelegate { | ||
| func textFieldShouldReturn(_ textField: UITextField) -> Bool { | ||
| textField.resignFirstResponder() | ||
| return true | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
케이스 시그니처 변경(.weekly → .weekly(weeks:))에 따른 사용처 점검 필요
연관값 추가로 기존
.weekly패턴 매칭/생성이 컴파일 에러가 될 수 있습니다. 아래 스크립트로 레거시 사용을 찾아 점검해 주세요.🏁 Script executed:
Length of output: 2098
.weekly케이스 연관값 처리 누락으로 인한 컴파일 에러 수정 필요RepeatType에weekly(weeks: Set<Week>)가 추가되면서, 기존의.weekly패턴 매칭/생성 코드는 모두 컴파일 에러가 발생합니다. 아래 위치들을 확인해 패턴 매칭 시 연관값 처리를 추가하거나 와일드카드로 무시하도록 수정하세요.• 186줄:
• 187줄:
```diff
• 198줄:
```diff
• 190줄:
필요하다면
let weeks로 바인딩하여 UI 업데이트에 활용할 수 있습니다.