-
Notifications
You must be signed in to change notification settings - Fork 1
[Feat-T3-134] 루틴 삭제 구현 #35
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
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c293ab9
Feat: 루틴 삭제 AlertView 구현 및 HomeView에 적용 (#T3-134)
choijungp 9748d0e
Feat: 반복 루틴 전체 삭제 구현 (#T3-134)
choijungp 2f37e99
Feat: 당일 루틴 삭제 구현 (#T3-134)
choijungp 18a980f
Refactor: 서버 Request에 routineType 추가 및 Layout enum 정의
choijungp e56623d
Refactor: 오타 및 컨벤션 수정
choijungp 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| // | ||
| // DeleteRoutineDTO.swift | ||
| // DataSource | ||
| // | ||
| // Created by 최정인 on 8/4/25. | ||
| // | ||
|
|
||
| struct DeleteRoutineDTO: Encodable { | ||
| let routineId: String | ||
| let routineCompletionId: Int? | ||
| let historySeq: Int | ||
| let routineType: String | ||
| let performedDate: String | ||
| let subRoutineInfosForDelete: [DeleteSubRoutineDTO] | ||
| } | ||
|
|
||
| struct DeleteSubRoutineDTO: Encodable { | ||
| let subRoutineId: String | ||
| let routineCompletionId: Int? | ||
| } |
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
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 |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| // | ||
| // DeleteRoutineEntity.swift | ||
| // Domain | ||
| // | ||
| // Created by 최정인 on 8/4/25. | ||
| // | ||
|
|
||
| public struct DeleteRoutineEntity: Encodable { | ||
| public let routineId: String | ||
| public let routineCompletionId: Int? | ||
| public let historySeq: Int | ||
| public let performedDate: String | ||
| public let routineType: String | ||
| public let subRoutineInfosForDelete: [DeleteSubRoutineEntity] | ||
|
|
||
| public init( | ||
| routineId: String, | ||
| routineCompletionId: Int?, | ||
| historySeq: Int, | ||
| performedDate: String, | ||
| routineType: String, | ||
| subRoutineInfosForDelete: [DeleteSubRoutineEntity] | ||
| ) { | ||
| self.routineId = routineId | ||
| self.routineCompletionId = routineCompletionId | ||
| self.historySeq = historySeq | ||
| self.performedDate = performedDate | ||
| self.routineType = routineType | ||
| self.subRoutineInfosForDelete = subRoutineInfosForDelete | ||
| } | ||
| } | ||
|
|
||
| public struct DeleteSubRoutineEntity: Encodable { | ||
| public let subRoutineId: String | ||
| public let routineCompletionId: Int? | ||
|
|
||
| public init(subRoutineId: String, routineCompletionId: Int?) { | ||
| self.subRoutineId = subRoutineId | ||
| self.routineCompletionId = routineCompletionId | ||
| } | ||
| } | ||
This file was deleted.
Oops, something went wrong.
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
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
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
120 changes: 120 additions & 0 deletions
120
Projects/Presentation/Sources/Home/View/Component/RoutineDeleteAlertView.swift
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 |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| // | ||
| // RoutineDeleteAlertView.swift | ||
| // Presentation | ||
| // | ||
| // Created by 최정인 on 8/4/25. | ||
| // | ||
|
|
||
| import SnapKit | ||
| import UIKit | ||
|
|
||
| protocol RoutineDeleteAlertViewDelegate: AnyObject { | ||
| func routineDeleteAlertViewDidTapDeleteAllRoutine(_ sender: RoutineDeleteAlertView) | ||
| func routineDeleteAlertViewDidTapDeleteDailyRoutine(_ sender: RoutineDeleteAlertView) | ||
| } | ||
|
|
||
| final class RoutineDeleteAlertView: UIView { | ||
|
|
||
| private enum Layout { | ||
| static let deleteLabelHeight: CGFloat = 48 | ||
| static let deleteLabelTopSpacing: CGFloat = 23 | ||
| static let buttonHorizontalMargin: CGFloat = 23 | ||
| static let buttonHeight: CGFloat = 44 | ||
| static let deleteDailyRoutineButtonTopSpacing: CGFloat = 22 | ||
| static let deleteAllRoutineButtonTopSpacing: CGFloat = 10 | ||
| } | ||
|
|
||
| private let contentView = UIView() | ||
| private let deleteLabel = UILabel() | ||
| private let deleteDailyRoutineButton = UIButton() | ||
| private let deleteAllRoutineButton = UIButton() | ||
| weak var delegate: RoutineDeleteAlertViewDelegate? | ||
|
|
||
| init() { | ||
| super.init(frame: .zero) | ||
| configureAttribute() | ||
| configureLayout() | ||
| } | ||
|
|
||
| required init?(coder: NSCoder) { | ||
| fatalError("init(coder:) has not been implemented") | ||
| } | ||
|
|
||
| private func configureAttribute() { | ||
| contentView.backgroundColor = .white | ||
| contentView.layer.masksToBounds = true | ||
| contentView.layer.cornerRadius = 20 | ||
|
|
||
| deleteLabel.text = "해당 루틴은\n반복 루틴으로 설정되어 있어요" | ||
| deleteLabel.numberOfLines = 2 | ||
| deleteLabel.textAlignment = .center | ||
| deleteLabel.font = BitnagilFont(style: .body1, weight: .semiBold).font | ||
| deleteLabel.textColor = BitnagilColor.gray10 | ||
|
|
||
| var deleteDailyRoutineButtonConfiguration = UIButton.Configuration.filled() | ||
| deleteDailyRoutineButtonConfiguration.baseBackgroundColor = .white | ||
| deleteDailyRoutineButtonConfiguration.background.cornerRadius = 8 | ||
| deleteDailyRoutineButtonConfiguration.attributedTitle = AttributedString( | ||
| "당일만 삭제", | ||
| attributes: .init([.font: BitnagilFont(style: .body2, weight: .medium).font])) | ||
| deleteDailyRoutineButtonConfiguration.baseForegroundColor = BitnagilColor.navy500 | ||
| deleteDailyRoutineButtonConfiguration.background.strokeColor = BitnagilColor.navy500 | ||
| deleteDailyRoutineButtonConfiguration.background.strokeWidth = 1 | ||
| deleteDailyRoutineButton.configuration = deleteDailyRoutineButtonConfiguration | ||
| deleteDailyRoutineButton.addAction( | ||
| UIAction { [weak self] _ in | ||
| guard let self else { return } | ||
| self.delegate?.routineDeleteAlertViewDidTapDeleteDailyRoutine(self) | ||
| }, | ||
| for: .touchUpInside) | ||
|
|
||
| var deleteAllRoutineButtonConfiguration = UIButton.Configuration.filled() | ||
| deleteAllRoutineButtonConfiguration.baseBackgroundColor = .white | ||
| deleteAllRoutineButtonConfiguration.background.cornerRadius = 8 | ||
| deleteAllRoutineButtonConfiguration.attributedTitle = AttributedString( | ||
| "전체 루틴 삭제", | ||
| attributes: .init([.font: BitnagilFont(style: .body2, weight: .medium).font])) | ||
| deleteAllRoutineButtonConfiguration.baseForegroundColor = BitnagilColor.navy500 | ||
| deleteAllRoutineButtonConfiguration.background.strokeColor = BitnagilColor.navy500 | ||
| deleteAllRoutineButtonConfiguration.background.strokeWidth = 1 | ||
| deleteAllRoutineButton.configuration = deleteAllRoutineButtonConfiguration | ||
| deleteAllRoutineButton.addAction( | ||
| UIAction { [weak self] _ in | ||
| guard let self else { return } | ||
| self.delegate?.routineDeleteAlertViewDidTapDeleteAllRoutine(self) | ||
| }, | ||
| for: .touchUpInside) | ||
| } | ||
|
|
||
| private func configureLayout() { | ||
| addSubview(contentView) | ||
|
|
||
| contentView.snp.makeConstraints { make in | ||
| make.edges.equalToSuperview() | ||
| } | ||
|
|
||
| [deleteLabel, deleteDailyRoutineButton, deleteAllRoutineButton].forEach { | ||
| contentView.addSubview($0) | ||
| } | ||
|
|
||
| deleteLabel.snp.makeConstraints { make in | ||
| make.height.equalTo(Layout.deleteLabelHeight) | ||
| make.centerX.equalToSuperview() | ||
| make.top.equalToSuperview().offset(Layout.deleteLabelTopSpacing) | ||
| } | ||
|
|
||
| deleteDailyRoutineButton.snp.makeConstraints { make in | ||
| make.top.equalTo(deleteLabel.snp.bottom).offset(Layout.deleteDailyRoutineButtonTopSpacing) | ||
| make.leading.equalToSuperview().offset(Layout.buttonHorizontalMargin) | ||
| make.trailing.equalToSuperview().inset(Layout.buttonHorizontalMargin) | ||
| make.height.equalTo(Layout.buttonHeight) | ||
| } | ||
|
|
||
| deleteAllRoutineButton.snp.makeConstraints { make in | ||
| make.top.equalTo(deleteDailyRoutineButton.snp.bottom).offset(Layout.deleteAllRoutineButtonTopSpacing) | ||
| make.leading.equalToSuperview().offset(Layout.buttonHorizontalMargin) | ||
| make.trailing.equalToSuperview().inset(Layout.buttonHorizontalMargin) | ||
| make.height.equalTo(Layout.buttonHeight) | ||
| } | ||
| } | ||
| } |
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.
아직 정리도 못했고, 굉장히 막연한 생각이지만, Routine이라는 Entity 하나만으로 굴러가게 하기는 힘들까요?
저도 루틴 추가/수정을 하며 새로운 엔티티를 만들었는데요, 뭔가 루틴에 대한 정책이 바뀌거나 하면 수정할 사항이 굉장히 많아질 것 같다는 생각이 듭니다..!
그리고 '루틴'에 대한 엔티티라 하면, 루틴이 가지고 있는 속성들을 다 가지고 있기 때문에, 추가/수정이든 삭제든 해당 엔티티로 처리할 수 있어야 하지 않을까? 싶기도 하구요!
다만 엔티티 하나로 통일하게 되면, RoutineEntity 내의 프로퍼티들이 옵셔널로 선언되는 경우가 많을것 같아 고민입니다.
오늘 회의에서 가볍게라도 짚고 넘어가면 좋을것 같습니다~!
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.
사실 서버에서 Routine에 관련된 Response 를 받을 때 DTO에 모든 값들을 저장하고 Entity로 변환할 때에도 모든 값을 다 갖고 있어서 하나의 Entity로만 굴러가게 할 수 있을 것 같아요 !!
하지만 ...... 흠 네네네 !!!! 오늘 회의에서 마저 이야기 해부아요 ㅠㅠ !!!