Conversation
개요주문 배송 현황 시각화 컴포넌트와 예치금 충전 기능을 추가하고, 주문 상세/확인 페이지를 리팩토링하여 동적 데이터 바인딩을 구현합니다. 결제 API 계층, 저장소 패턴, 뷰모델을 포함한 완전한 예치금 관리 스택을 도입합니다. 변경 사항
시퀀스 다이어그램sequenceDiagram
participant User
participant OrderInfoView
participant DepositViewModel
participant PaymentRepositoryImpl
participant PaymentApi
participant API
User->>OrderInfoView: View loads
OrderInfoView->>DepositViewModel: fetchDepositAmount()
DepositViewModel->>DepositViewModel: set isLoading = true
DepositViewModel->>PaymentRepositoryImpl: fetchDepositAmount()
PaymentRepositoryImpl->>PaymentApi: getPaymentAmount()
PaymentApi->>API: GET /api/v1/payment/amount
API-->>PaymentApi: ApiResponse<PaymentAmount>
PaymentApi-->>PaymentRepositoryImpl: DataRequest result
PaymentRepositoryImpl-->>DepositViewModel: AppResult<PaymentAmount>
DepositViewModel->>DepositViewModel: update balance, set isLoading = false
DepositViewModel-->>OrderInfoView: @Published balance changed
User->>OrderInfoView: Tap charge button
OrderInfoView->>DepositViewModel: showChargeSheet = true
User->>DepositChargeView: Enter amount & confirm
DepositChargeView->>DepositViewModel: chargeDeposit(amount: Int)
DepositViewModel->>PaymentRepositoryImpl: chargeDeposit(amount:)
PaymentRepositoryImpl->>PaymentApi: chargeDeposit(amount:)
PaymentApi->>API: POST /api/v1/payment/charge?amount=X
API-->>PaymentApi: ApiResponse<String>
PaymentApi-->>PaymentRepositoryImpl: DataRequest result
PaymentRepositoryImpl-->>DepositViewModel: AppResult<String>
DepositViewModel->>DepositViewModel: fetchDepositAmount() to refresh
DepositViewModel-->>DepositChargeView: return true
DepositChargeView->>DepositChargeView: dismiss & hide sheet
sequenceDiagram
participant User
participant OrderDetailView
participant DeliveryStatusView
participant OrderDetailViewModel
User->>OrderDetailView: View appears
OrderDetailView->>OrderDetailViewModel: Fetch order data
OrderDetailViewModel-->>OrderDetailView: order loaded
OrderDetailView->>OrderDetailView: deliveryStep(for: order.status) → Int
OrderDetailView->>DeliveryStatusView: DeliveryStatusView(currentStep: step)
DeliveryStatusView->>DeliveryStatusView: Render 5 steps<br/>Color/icon based on completion
DeliveryStatusView-->>OrderDetailView: Display updated
User->>OrderDetailView: Observe order status
alt ORDER_COMPLETED
OrderDetailView->>OrderDetailView: Show "주문 취소" button
else PENDING_RECEIVING
OrderDetailView->>OrderDetailView: Show "입고 처리" button
else Other
OrderDetailView->>OrderDetailView: Show "재주문하기" button
end
예상 코드 리뷰 노력🎯 4 (복잡함) | ⏱️ ~50분 추가 검토 항목:
관련 PR
제안 검토자
시
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
@coderabbitai review |
|
@Yoo-Hyuna: I'll review the changes in this pull request now. ✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 9
🧹 Nitpick comments (1)
StockMate/StockMate/app/feature/cart/ui/DeliveryStatusView.swift (1)
28-32: GeometryReader 매개변수 미사용 정리 필요
Line 28에서GeometryReader { geo in ... }로 선언했지만geo를 전혀 사용하지 않아 SwiftLint가 경고를 내고 있습니다. 언더스코어로 치환하면 경고를 해소하면서 의미를 유지할 수 있습니다.- GeometryReader { geo in + GeometryReader { _ in
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (10)
StockMate/.DS_Storeis excluded by!**/.DS_StoreStockMate/StockMate/resources/Assets.xcassets/check.imageset/check.svgis excluded by!**/*.svgStockMate/StockMate/resources/Assets.xcassets/deposit_background.imageset/deposit_background@1x.pngis excluded by!**/*.pngStockMate/StockMate/resources/Assets.xcassets/deposit_background.imageset/deposit_background@2x.pngis excluded by!**/*.pngStockMate/StockMate/resources/Assets.xcassets/deposit_background.imageset/deposit_background@3x.pngis excluded by!**/*.pngStockMate/StockMate/resources/Assets.xcassets/dottedline.imageset/dottedline.svgis excluded by!**/*.svgStockMate/StockMate/resources/Assets.xcassets/hourglass.imageset/hourglass.svgis excluded by!**/*.svgStockMate/StockMate/resources/Assets.xcassets/pindrop.imageset/pindrop.svgis excluded by!**/*.svgStockMate/StockMate/resources/Assets.xcassets/rocket.imageset/rocket.svgis excluded by!**/*.svgStockMate/StockMate/resources/Assets.xcassets/uploadprogress.imageset/uploadprogress.svgis excluded by!**/*.svg
📒 Files selected for processing (18)
StockMate/StockMate/ContentView.swift(1 hunks)StockMate/StockMate/app/feature/cart/ui/DeliveryStatusView.swift(1 hunks)StockMate/StockMate/app/feature/orders/ui/OrderDetailView.swift(6 hunks)StockMate/StockMate/app/feature/orders/ui/OrderInfoView.swift(4 hunks)StockMate/StockMate/app/feature/orders/ui/ReceiptView.swift(3 hunks)StockMate/StockMate/app/feature/payment/data/PaymentApi.swift(1 hunks)StockMate/StockMate/app/feature/payment/data/PaymentRepositoryImpl.swift(1 hunks)StockMate/StockMate/app/feature/payment/domain/PaymentRepositoryProtocol.swift(1 hunks)StockMate/StockMate/app/feature/payment/ui/DepositChargeView.swift(1 hunks)StockMate/StockMate/app/feature/payment/viewmodel/DepositViewModel.swift(1 hunks)StockMate/StockMate/resources/Assets.xcassets/check.imageset/Contents.json(1 hunks)StockMate/StockMate/resources/Assets.xcassets/deposit_background.imageset/Contents.json(1 hunks)StockMate/StockMate/resources/Assets.xcassets/dottedline.imageset/Contents.json(1 hunks)StockMate/StockMate/resources/Assets.xcassets/hourglass.imageset/Contents.json(1 hunks)StockMate/StockMate/resources/Assets.xcassets/pindrop.imageset/Contents.json(1 hunks)StockMate/StockMate/resources/Assets.xcassets/rocket.imageset/Contents.json(1 hunks)StockMate/StockMate/resources/Assets.xcassets/uploadprogress.imageset/Contents.json(1 hunks)StockMate/StockMate/resources/Color.swift(1 hunks)
🧰 Additional context used
🪛 SwiftLint (0.57.0)
StockMate/StockMate/app/feature/cart/ui/DeliveryStatusView.swift
[Warning] 28-28: Unused parameter in a closure should be replaced with _
(unused_closure_parameter)
StockMate/StockMate/app/feature/orders/ui/OrderDetailView.swift
[Error] 174-174: Duplicate sets of conditions in the same branch instruction should be avoided
(duplicate_conditions)
[Error] 190-190: Duplicate sets of conditions in the same branch instruction should be avoided
(duplicate_conditions)
[Warning] 193-193: TODOs should be resolved (입고 처리 버튼)
(todo)
[Warning] 207-207: TODOs should be resolved (평가 액션 처리)
(todo)
🔇 Additional comments (2)
StockMate/StockMate/resources/Assets.xcassets/deposit_background.imageset/Contents.json (1)
1-23: 좋습니다! 에셋 카탈로그 구성이 완벽합니다.모든 스케일(1x, 2x, 3x)에 대한 파일명이 올바르게 지정되어 있어 화면 해상도에 관계없이 최적의 이미지 렌더링이 보장됩니다.
StockMate/StockMate/resources/Assets.xcassets/check.imageset/Contents.json (1)
1-21: 이 리뷰 코멘트는 부정확합니다. 무시하세요.
check.imageset폴더를 확인한 결과,check.svg파일 1개만 존재합니다. 2x 또는 3x용 별도 파일이 없으므로, 리뷰에서 제안한 2x/3xfilename추가는 불가능합니다. 이렇게 하면 빌드 시 참조할 수 없는 파일을 지정하게 되어 오류가 발생합니다.현재 구조의 문제점:
- 1x scale에만
"filename" : "check.svg"있음- 2x/3x scale에는
filename없음 (실제 파일도 없음)올바른 수정 방식:
- 단일 벡터 파일 방식 (권장):
scale항목 제거,filename만 유지 → Xcode가 자동 처리- 명시적 다중 스케일: 2x/3x용 별도 SVG 파일 생성 후 각 scale에
filename추가Likely an incorrect or invalid review comment.
| { | ||
| "images" : [ | ||
| { | ||
| "filename" : "dottedline.svg", | ||
| "idiom" : "universal", | ||
| "scale" : "1x" | ||
| }, | ||
| { | ||
| "idiom" : "universal", | ||
| "scale" : "2x" | ||
| }, | ||
| { | ||
| "idiom" : "universal", | ||
| "scale" : "3x" | ||
| } | ||
| ], | ||
| "info" : { | ||
| "author" : "xcode", | ||
| "version" : 1 | ||
| } | ||
| } |
There was a problem hiding this comment.
2x/3x 스케일 이미지 파일명이 누락되었습니다.
dottedline.imageset의 2x 및 3x 스케일에 filename 항목이 없습니다. Xcode 에셋 카탈로그의 표준 관행상 모든 스케일에 대한 이미지 파일을 명시해야 합니다. SVG는 스케일 독립적이지만, 카탈로그 구조상 다음과 같이 수정되어야 합니다:
- 2x:
"dottedline@2x.svg"또는"dottedline.svg"(스케일 무시) - 3x:
"dottedline@3x.svg"또는"dottedline.svg"(스케일 무시)
{
"idiom" : "universal",
+ "filename" : "dottedline.svg",
"scale" : "2x"
},
{
"idiom" : "universal",
+ "filename" : "dottedline.svg",
"scale" : "3x"
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| { | |
| "images" : [ | |
| { | |
| "filename" : "dottedline.svg", | |
| "idiom" : "universal", | |
| "scale" : "1x" | |
| }, | |
| { | |
| "idiom" : "universal", | |
| "scale" : "2x" | |
| }, | |
| { | |
| "idiom" : "universal", | |
| "scale" : "3x" | |
| } | |
| ], | |
| "info" : { | |
| "author" : "xcode", | |
| "version" : 1 | |
| } | |
| } | |
| { | |
| "images" : [ | |
| { | |
| "filename" : "dottedline.svg", | |
| "idiom" : "universal", | |
| "scale" : "1x" | |
| }, | |
| { | |
| "idiom" : "universal", | |
| "filename" : "dottedline.svg", | |
| "scale" : "2x" | |
| }, | |
| { | |
| "idiom" : "universal", | |
| "filename" : "dottedline.svg", | |
| "scale" : "3x" | |
| } | |
| ], | |
| "info" : { | |
| "author" : "xcode", | |
| "version" : 1 | |
| } | |
| } |
🤖 Prompt for AI Agents
In StockMate/StockMate/resources/Assets.xcassets/dottedline.imageset around
lines 1-21, the JSON entries for the 2x and 3x images are missing the "filename"
keys; add a "filename" field for the 2x and 3x objects (e.g. "dottedline@2x.svg"
and "dottedline@3x.svg" or simply "dottedline.svg") so each scale object
includes a filename, keeping idiom and scale unchanged and preserving the
existing 1x entry.
| { | ||
| "images" : [ | ||
| { | ||
| "filename" : "hourglass.svg", | ||
| "idiom" : "universal", | ||
| "scale" : "1x" | ||
| }, | ||
| { | ||
| "idiom" : "universal", | ||
| "scale" : "2x" | ||
| }, | ||
| { | ||
| "idiom" : "universal", | ||
| "scale" : "3x" | ||
| } | ||
| ], | ||
| "info" : { | ||
| "author" : "xcode", | ||
| "version" : 1 | ||
| } | ||
| } |
There was a problem hiding this comment.
2x/3x 스케일 이미지 파일명이 누락되었습니다.
hourglass.imageset의 2x 및 3x 스케일에 filename 항목이 없습니다. 다른 에셋과의 일관성과 표준 Xcode 관행을 위해 다음과 같이 수정하세요:
{
"idiom" : "universal",
+ "filename" : "hourglass.svg",
"scale" : "2x"
},
{
"idiom" : "universal",
+ "filename" : "hourglass.svg",
"scale" : "3x"
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| { | |
| "images" : [ | |
| { | |
| "filename" : "hourglass.svg", | |
| "idiom" : "universal", | |
| "scale" : "1x" | |
| }, | |
| { | |
| "idiom" : "universal", | |
| "scale" : "2x" | |
| }, | |
| { | |
| "idiom" : "universal", | |
| "scale" : "3x" | |
| } | |
| ], | |
| "info" : { | |
| "author" : "xcode", | |
| "version" : 1 | |
| } | |
| } | |
| { | |
| "images" : [ | |
| { | |
| "filename" : "hourglass.svg", | |
| "idiom" : "universal", | |
| "scale" : "1x" | |
| }, | |
| { | |
| "idiom" : "universal", | |
| "filename" : "hourglass.svg", | |
| "scale" : "2x" | |
| }, | |
| { | |
| "idiom" : "universal", | |
| "filename" : "hourglass.svg", | |
| "scale" : "3x" | |
| } | |
| ], | |
| "info" : { | |
| "author" : "xcode", | |
| "version" : 1 | |
| } | |
| } |
🤖 Prompt for AI Agents
In
StockMate/StockMate/resources/Assets.xcassets/hourglass.imageset/Contents.json
lines 1-21, the 2x and 3x image entries are missing their "filename" keys;
update those entries to include the correct filenames (e.g. "hourglass@2x.png"
and "hourglass@3x.png" or whatever the actual asset filenames are) and ensure
the corresponding image files exist in the imageset directory so Xcode can
locate them.
| { | ||
| "images" : [ | ||
| { | ||
| "filename" : "pindrop.svg", | ||
| "idiom" : "universal", | ||
| "scale" : "1x" | ||
| }, | ||
| { | ||
| "idiom" : "universal", | ||
| "scale" : "2x" | ||
| }, | ||
| { | ||
| "idiom" : "universal", | ||
| "scale" : "3x" | ||
| } | ||
| ], | ||
| "info" : { | ||
| "author" : "xcode", | ||
| "version" : 1 | ||
| } | ||
| } |
There was a problem hiding this comment.
2x/3x 스케일 이미지 파일명이 누락되었습니다.
pindrop.imageset의 2x 및 3x 스케일에 filename 항목이 없습니다. 이전 에셋들과 동일한 이슈입니다. 다음과 같이 수정하세요:
{
"idiom" : "universal",
+ "filename" : "pindrop.svg",
"scale" : "2x"
},
{
"idiom" : "universal",
+ "filename" : "pindrop.svg",
"scale" : "3x"
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| { | |
| "images" : [ | |
| { | |
| "filename" : "pindrop.svg", | |
| "idiom" : "universal", | |
| "scale" : "1x" | |
| }, | |
| { | |
| "idiom" : "universal", | |
| "scale" : "2x" | |
| }, | |
| { | |
| "idiom" : "universal", | |
| "scale" : "3x" | |
| } | |
| ], | |
| "info" : { | |
| "author" : "xcode", | |
| "version" : 1 | |
| } | |
| } | |
| { | |
| "images" : [ | |
| { | |
| "filename" : "pindrop.svg", | |
| "idiom" : "universal", | |
| "scale" : "1x" | |
| }, | |
| { | |
| "idiom" : "universal", | |
| "filename" : "pindrop.svg", | |
| "scale" : "2x" | |
| }, | |
| { | |
| "idiom" : "universal", | |
| "filename" : "pindrop.svg", | |
| "scale" : "3x" | |
| } | |
| ], | |
| "info" : { | |
| "author" : "xcode", | |
| "version" : 1 | |
| } | |
| } |
🤖 Prompt for AI Agents
StockMate/StockMate/resources/Assets.xcassets/pindrop.imageset/Contents.json
around lines 1 to 21: the 2x and 3x image entries are missing the "filename"
fields; add "filename" keys for those entries using the project's naming
convention (e.g. pindrop@2x.png and pindrop@3x.png or the correct existing
filenames), ensure those image files are present in the imageset folder, and
keep the idiom/scale entries unchanged.
| { | ||
| "images" : [ | ||
| { | ||
| "filename" : "rocket.svg", | ||
| "idiom" : "universal", | ||
| "scale" : "1x" | ||
| }, | ||
| { | ||
| "idiom" : "universal", | ||
| "scale" : "2x" | ||
| }, | ||
| { | ||
| "idiom" : "universal", | ||
| "scale" : "3x" | ||
| } | ||
| ], | ||
| "info" : { | ||
| "author" : "xcode", | ||
| "version" : 1 | ||
| } | ||
| } |
There was a problem hiding this comment.
2x/3x 스케일 이미지 파일명이 누락되었습니다.
rocket.imageset의 2x 및 3x 스케일에 filename 항목이 없습니다. 이전 에셋들과 동일한 패턴입니다. 다음과 같이 수정하세요:
{
"idiom" : "universal",
+ "filename" : "rocket.svg",
"scale" : "2x"
},
{
"idiom" : "universal",
+ "filename" : "rocket.svg",
"scale" : "3x"
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| { | |
| "images" : [ | |
| { | |
| "filename" : "rocket.svg", | |
| "idiom" : "universal", | |
| "scale" : "1x" | |
| }, | |
| { | |
| "idiom" : "universal", | |
| "scale" : "2x" | |
| }, | |
| { | |
| "idiom" : "universal", | |
| "scale" : "3x" | |
| } | |
| ], | |
| "info" : { | |
| "author" : "xcode", | |
| "version" : 1 | |
| } | |
| } | |
| { | |
| "images" : [ | |
| { | |
| "filename" : "rocket.svg", | |
| "idiom" : "universal", | |
| "scale" : "1x" | |
| }, | |
| { | |
| "idiom" : "universal", | |
| "filename" : "rocket.svg", | |
| "scale" : "2x" | |
| }, | |
| { | |
| "idiom" : "universal", | |
| "filename" : "rocket.svg", | |
| "scale" : "3x" | |
| } | |
| ], | |
| "info" : { | |
| "author" : "xcode", | |
| "version" : 1 | |
| } | |
| } |
🤖 Prompt for AI Agents
StockMate/StockMate/resources/Assets.xcassets/rocket.imageset/Contents.json
lines 1-21: the 2x and 3x image entries are missing their "filename" fields; add
"filename" for the 2x entry (e.g. "rocket@2x.png") and for the 3x entry (e.g.
"rocket@3x.png") to match the existing pattern, and ensure the referenced image
files are present in the imageset.
| { | ||
| "images" : [ | ||
| { | ||
| "filename" : "uploadprogress.svg", | ||
| "idiom" : "universal", | ||
| "scale" : "1x" | ||
| }, | ||
| { | ||
| "idiom" : "universal", | ||
| "scale" : "2x" | ||
| }, | ||
| { | ||
| "idiom" : "universal", | ||
| "scale" : "3x" | ||
| } | ||
| ], | ||
| "info" : { | ||
| "author" : "xcode", | ||
| "version" : 1 | ||
| } | ||
| } |
There was a problem hiding this comment.
2x/3x 스케일 이미지 파일명이 누락되었습니다.
uploadprogress.imageset의 2x 및 3x 스케일에 filename 항목이 없습니다. 이전 에셋들과 동일한 패턴입니다. 다음과 같이 수정하세요:
{
"idiom" : "universal",
+ "filename" : "uploadprogress.svg",
"scale" : "2x"
},
{
"idiom" : "universal",
+ "filename" : "uploadprogress.svg",
"scale" : "3x"
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| { | |
| "images" : [ | |
| { | |
| "filename" : "uploadprogress.svg", | |
| "idiom" : "universal", | |
| "scale" : "1x" | |
| }, | |
| { | |
| "idiom" : "universal", | |
| "scale" : "2x" | |
| }, | |
| { | |
| "idiom" : "universal", | |
| "scale" : "3x" | |
| } | |
| ], | |
| "info" : { | |
| "author" : "xcode", | |
| "version" : 1 | |
| } | |
| } | |
| { | |
| "images" : [ | |
| { | |
| "filename" : "uploadprogress.svg", | |
| "idiom" : "universal", | |
| "scale" : "1x" | |
| }, | |
| { | |
| "idiom" : "universal", | |
| "filename" : "uploadprogress.svg", | |
| "scale" : "2x" | |
| }, | |
| { | |
| "idiom" : "universal", | |
| "filename" : "uploadprogress.svg", | |
| "scale" : "3x" | |
| } | |
| ], | |
| "info" : { | |
| "author" : "xcode", | |
| "version" : 1 | |
| } | |
| } |
🤖 Prompt for AI Agents
In
StockMate/StockMate/resources/Assets.xcassets/uploadprogress.imageset/Contents.json
lines 1-21, the image entries for 2x and 3x are missing their "filename" keys;
add "filename" properties for those entries using the same naming pattern as
other assets (e.g. uploadprogress@2x.svg and uploadprogress@3x.svg), keeping the
idiom "universal" and scale values "2x" and "3x" respectively so Xcode can
locate the correct image files.
@coderabbitai review |
|
@Yoo-Hyuna: 네, 변경 사항을 다시 검토하겠습니다. 리뷰를 시작합니다. ✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (6)
StockMate/StockMate/app/feature/orders/ui/OrderDetailView.swift (4)
76-84: 운송장 정보 처리 로직 간소화 고려현재 클로저를 사용한 trackingText 계산은 안전하지만, 더 간결하게 작성할 수 있습니다.
다음과 같이 리팩토링을 고려해보세요:
- // ✅ 운송장정보 안전 처리 - let trackingText: String = { - if let carrier = order.carrier, - let trackingNo = order.trackingNumber, - !carrier.isEmpty, - !trackingNo.isEmpty { - return "\(carrier): \(trackingNo)" - } - return "-" - }() - infoRow("운송장번호", trackingText) + let trackingText = order.carrier.flatMap { carrier in + order.trackingNumber.map { trackingNo in + !carrier.isEmpty && !trackingNo.isEmpty ? "\(carrier): \(trackingNo)" : "-" + } + } ?? "-" + infoRow("운송장번호", trackingText)
203-203: TODO 구현 필요"입고 처리"와 "재주문하기" 버튼의 액션 로직이 아직 구현되지 않았습니다. 이 기능들의 구현이 필요합니다.
이슈를 생성하여 추적하거나, 구현 코드 생성을 도와드릴까요?
Also applies to: 217-217
297-316: 헬퍼 함수 위치 개선 권장deliveryStep 함수가 파일 레벨에 정의되어 있습니다. Swift에서는 구조체 내부에 static 메서드로 정의하거나 extension으로 분리하는 것이 더 좋은 구조입니다.
다음과 같이 리팩토링을 권장합니다:
extension OrderDetailView { static func deliveryStep(for status: String) -> Int { switch status { case "ORDER_COMPLETED": return 0 case "PAY_COMPLETED": return 0 case "PENDING_APPROVAL": return 1 case "FAILED": return 6 case "PENDING_SHIPPING": return 2 case "SHIPPING": return 3 case "PENDING_RECEIVING": return 4 case "REJECTED": return 6 case "DELIVERED": return 4 case "RECEIVED": return 4 case "REFUNDED": return 6 case "REFUND_REJECTED": return 6 case "CANCELLED": return 6 default: return 6 } } }또는 OrderDetailView 내부에 private 메서드로 정의하는 것도 좋습니다.
318-379: 모든 헬퍼 함수 구조 개선 권장formatDate, statusText, statusColor, statusBdColor 함수들이 파일 레벨에 정의되어 있습니다. 이들을 하나의 extension으로 그룹화하거나 OrderDetailView 내부로 이동하여 응집도를 높이는 것을 권장합니다.
예시:
extension OrderDetailView { static func formatDate(_ isoDate: String) -> String { let comps = isoDate.split(separator: "T").first?.split(separator: "-") ?? [] guard comps.count == 3 else { return isoDate } return "\(comps[0])년 \(comps[1])월 \(comps[2])일" } static func statusText(_ status: String) -> String { switch status { case "ORDER_COMPLETED": return "주문 완료" // ... 나머지 케이스들 default: return "알 수 없음" } } static func statusColor(_ status: String) -> Color { // ... } static func statusBdColor(_ status: String) -> Color { // ... } }이렇게 하면 관련 함수들이 OrderDetailView와 함께 그룹화되어 유지보수가 용이해집니다.
StockMate/StockMate/app/feature/payment/ui/DepositChargeView.swift (2)
49-56: 주석 처리된 코드를 제거하세요.개발 과정에서 남은 주석 코드(lines 49-56, 70, 114)는 코드베이스를 깔끔하게 유지하기 위해 제거하는 것이 좋습니다.
- // 아래 작은 라벨 -// Text("\(formattedNumberString)원") -// .font(.system(size: 15)) -// .foregroundColor(.textGray1) -// .padding(.horizontal, 10) -// .padding(.vertical, 4) -// .background(Color.white.opacity(0.9)) -// .cornerRadius(12) - Spacer().frame(height: 80)Text(key) .font(.system(size: 20)) .frame(width: 50, height: 45) .foregroundColor(Color.black) -// .background(Color.red.opacity(0.5)) .padding(.horizontal, 4).padding(.horizontal, 20) -// .padding(.top, 20) .background(Color.white)Also applies to: 70-70, 114-114
94-105: 버튼 높이를 일관되게 맞춰주세요.ProgressView의 높이가 56pt(line 97)이고 Text의 높이가 59pt(line 103)로 서로 다릅니다. 로딩 상태 전환 시 버튼이 미세하게 움직일 수 있으므로 동일한 높이로 통일하는 것이 좋습니다.
if isCharging { ProgressView() .tint(.white) - .frame(height: 56) + .frame(height: 59) .frame(maxWidth: .infinity) } else {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (21)
StockMate/StockMate/app/feature/orders/ui/OrderDetailView.swift(5 hunks)StockMate/StockMate/app/feature/orders/ui/OrderInfoView.swift(4 hunks)StockMate/StockMate/app/feature/orders/ui/OrderListView.swift(0 hunks)StockMate/StockMate/app/feature/payment/ui/DepositChargeView.swift(1 hunks)StockMate/StockMate/resources/Assets.xcassets/chair.imageset/Contents.json(1 hunks)StockMate/StockMate/resources/Assets.xcassets/check.imageset/Contents.json(1 hunks)StockMate/StockMate/resources/Assets.xcassets/cog.imageset/Contents.json(1 hunks)StockMate/StockMate/resources/Assets.xcassets/dottedline.imageset/Contents.json(1 hunks)StockMate/StockMate/resources/Assets.xcassets/hourglass.imageset/Contents.json(1 hunks)StockMate/StockMate/resources/Assets.xcassets/lightbulb.imageset/Contents.json(1 hunks)StockMate/StockMate/resources/Assets.xcassets/location.imageset/Contents.json(1 hunks)StockMate/StockMate/resources/Assets.xcassets/notification.imageset/Contents.json(1 hunks)StockMate/StockMate/resources/Assets.xcassets/package.imageset/Contents.json(1 hunks)StockMate/StockMate/resources/Assets.xcassets/pindrop.imageset/Contents.json(1 hunks)StockMate/StockMate/resources/Assets.xcassets/rocket.imageset/Contents.json(1 hunks)StockMate/StockMate/resources/Assets.xcassets/spanner.imageset/Contents.json(1 hunks)StockMate/StockMate/resources/Assets.xcassets/tabHome.imageset/Contents.json(1 hunks)StockMate/StockMate/resources/Assets.xcassets/tabInventory.imageset/Contents.json(1 hunks)StockMate/StockMate/resources/Assets.xcassets/tabPackage.imageset/Contents.json(1 hunks)StockMate/StockMate/resources/Assets.xcassets/tabProfile.imageset/Contents.json(1 hunks)StockMate/StockMate/resources/Assets.xcassets/uploadprogress.imageset/Contents.json(1 hunks)
💤 Files with no reviewable changes (1)
- StockMate/StockMate/app/feature/orders/ui/OrderListView.swift
✅ Files skipped from review due to trivial changes (1)
- StockMate/StockMate/resources/Assets.xcassets/dottedline.imageset/Contents.json
🚧 Files skipped from review as they are similar to previous changes (3)
- StockMate/StockMate/app/feature/orders/ui/OrderInfoView.swift
- StockMate/StockMate/resources/Assets.xcassets/rocket.imageset/Contents.json
- StockMate/StockMate/resources/Assets.xcassets/hourglass.imageset/Contents.json
🧰 Additional context used
🪛 SwiftLint (0.57.0)
StockMate/StockMate/app/feature/orders/ui/OrderDetailView.swift
[Warning] 203-203: TODOs should be resolved (입고 처리 버튼)
(todo)
[Warning] 217-217: TODOs should be resolved (평가 액션 처리)
(todo)
🔇 Additional comments (14)
StockMate/StockMate/resources/Assets.xcassets/uploadprogress.imageset/Contents.json (1)
1-12: 에셋 구조 변경 의도 확인 필요이전 리뷰에서는 2x/3x 스케일 엔트리에
filename항목을 추가하도록 지적했으나, 현재 버전에서는 이들 엔트리가 완전히 제거되고 단일universal엔트리만 남아 있습니다.이는 두 가지 가능성이 있습니다:
의도된 변경: SVG 벡터 포맷을 사용하여 단일 에셋으로 통합한 경우
- 이 경우
uploadprogress.svg파일이 실제로 존재하고 빌드되는지 확인 필요실수: 2x/3x 엔트리를 삭제한 것이 아니라 고쳐야 하는 경우
- 라스터 이미지를 사용한다면 1x, 2x, 3x 엔트리가 필요할 수 있음
변경 의도를 명확히 하고, 실제 이미지 파일이 제대로 참조되는지 검증해 주세요.
StockMate/StockMate/resources/Assets.xcassets/pindrop.imageset/Contents.json (1)
1-12: SVG 단일 항목 접근 방식이 이전 피드백과 다릅니다 — 의도적인지 확인이 필요합니다.이전 검토 의견에서 2x/3x 스케일 항목에
filename필드를 추가하도록 제안했으나, 현재 코드는 스케일 속성 없이 단일"universal"항목만 포함하고 있습니다. SVG 자산의 경우 Xcode에서 단일 universal 항목을 사용하는 것이 올바른 현대식 방식이나, 이것이 의도적인 접근 방식 변경인지 확인이 필요합니다.또한 다음 항목들을 검증해 주세요:
pindrop.svg파일이 실제로 imageset 폴더에 존재하는지 확인- 이 구조가 PR에서 추가된 다른 배송 상태 아이콘들(예: check.svg, hourglass, rocket 등)과 일관성 있게 구성되어 있는지 확인
- 이것이 다중 스케일에서 SVG universal로의 의도적인 구조 변경인지 확인
StockMate/StockMate/app/feature/orders/ui/OrderDetailView.swift (4)
22-26: 배송 현황 UI 통합 잘 되었습니다!DeliveryStatusView가 적절하게 통합되었으며, deliveryStep 헬퍼 함수를 통해 주문 상태를 단계로 변환하는 방식도 명확합니다.
29-58: 주문 정보 레이아웃 개선 확인주문번호와 상태를 2열 레이아웃으로 표시하는 방식이 깔끔하며, 상태별 색상 및 텍스트 매핑 함수를 활용한 점이 좋습니다.
165-177: 영수증 페이지 연결 확인NavigationLink가 올바르게 orderId를 전달하며, 버튼 스타일도 일관성 있게 적용되었습니다.
181-228: 조건부 버튼 로직 수정 확인 완료이전 리뷰에서 지적된 중복 조건 문제가 해결되었습니다. 현재 세 가지 상태 그룹이 명확하게 구분되어 올바른 버튼이 표시됩니다:
- 주문/결제 완료, 승인 대기 → "주문 취소"
- 입고 대기, 배송 완료 → "입고 처리"
- 그 외 상태 → "재주문하기"
다만 Lines 203, 217에 TODO가 남아있어 구현이 필요합니다.
StockMate/StockMate/app/feature/payment/ui/DepositChargeView.swift (3)
3-14: 구조와 상태 관리가 적절합니다.SwiftUI 패턴을 올바르게 따르고 있으며, 상태 변수와 뷰모델 바인딩이 적절합니다.
16-25: 금액 포맷팅 로직이 올바릅니다.숫자 형식 변환과 fallback 처리가 적절하며, 현지화된 숫자 포맷을 사용하고 있습니다.
27-33: 키패드 입력 처리가 정확합니다.백스페이스와 숫자 입력 로직이 올바르게 구현되어 있습니다.
StockMate/StockMate/resources/Assets.xcassets/tabInventory.imageset/Contents.json (1)
1-12: SVG 자산 통합 패턴 검증 완료8개 모든 자산 파일의 JSON 형식이 유효하고, 각 파일이 정확히 1개의 이미지 항목을 단일 "universal" idiom으로 가지고 있습니다. 스케일 항목(1x/2x/3x)이 완전히 제거되었으며, 대응하는 모든 SVG 파일이 존재하고 있습니다. SVG는 벡터 자산이므로 iOS에서 자동으로 모든 디바이스 밀도에 대응되어 렌더링됩니다. 변경 사항이 표준 Xcode 자산 형식을 따르고 있어 빌드 호환성에 문제가 없습니다.
StockMate/StockMate/resources/Assets.xcassets/check.imageset/Contents.json (1)
1-12: SVG 리소스의 scale 정의 제거 — 장치 렌더링 일관성 검증 필요이 파일은 명시적 scale 정의(1x/2x/3x) 없이
universalidiom만 사용합니다. SVG는 벡터 기반이므로 이론상 모든 화면 밀도에서 확대/축소될 수 있지만, iOS 기기의 렌더링 품질이 일관성 있게 유지되는지 확인이 필요합니다.다음을 검증해주세요:
- 모든 대상 iOS 기기(1x, 2x, 3x 화면 밀도)에서 SVG 렌더링 품질 확인
- 이전 explicit scale 정의 버전과 비교하여 시각적 품질 저하 유무
StockMate/StockMate/resources/Assets.xcassets/notification.imageset/Contents.json (1)
1-12: 명시적 scale 변수 제거로 인한 렌더링 영향 검증기존의 1x/2x/3x scale 정의가 제거되고
universalidiom만 남았습니다. 이는 PR 전반에 걸친 체계적인 변경이지만, iOS가 기본 스케일링 동작만으로 모든 기기 화면 밀도에서 올바르게 렌더링하는지 확인이 필요합니다.
- notification.svg가 iPhone SE(1x), 표준 모델(2x), Plus/Pro 모델(3x)에서 동일한 시각적 품질로 렌더링되는지 테스트
- 필요시 SVG 최적화 여부 검토
StockMate/StockMate/resources/Assets.xcassets/location.imageset/Contents.json (1)
1-12: 자산 카탈로그 통합 패턴 — 다중 스케일 정의 제거이 자산도 1x/2x/3x 정의가 제거되고
universal입력으로 통합되었습니다. 이 변경 사항이 시스템 전반에 걸쳐 적용되는 것으로 보이므로, 모든 영향받는 SVG 자산이 예상대로 렌더링되는지 종합적으로 검증해주세요.StockMate/StockMate/resources/Assets.xcassets/tabProfile.imageset/Contents.json (1)
1-12: 체계적인 자산 카탈로그 scale 통합 — 포괄 검증 권장이 자산을 포함하여 PR 전체에서 여러 image set이 명시적 scale 정의(1x/2x/3x)에서
universal입력으로 통합되었습니다. SVG 형식은 벡터 기반이므로 일반적으로 확대/축소에 유리하지만, 모든 대상 기기에서 렌더링 품질이 일관되게 유지되는지 최종 검증을 권장합니다.특히 다음을 확인해주세요:
- 낮은 해상도 기기(1x)에서 SVG 렌더링 선명도
- 고해상도 기기(3x)에서 과도한 확대로 인한 artifacts 여부
- UI 테스트에서 모든 screen scale 대상 시각적 회귀 테스트
| Button { | ||
| guard !isCharging else { return } | ||
| Task { | ||
| guard let amount = Int(amountText), amount > 0 else { return } | ||
| isCharging = true | ||
| let success = await viewModel.chargeDeposit(amount: amount) | ||
| isCharging = false | ||
| if success { | ||
| viewModel.showChargeSheet = false | ||
| dismiss() | ||
| } | ||
| } |
There was a problem hiding this comment.
이전 리뷰의 중복 충전 방지가 올바르게 적용되었습니다!
Line 82의 guard !isCharging와 line 111의 .disabled(isCharging)가 정확히 구현되어 중복 요청을 효과적으로 차단합니다.
다만, 입력 검증 실패 시 사용자 피드백이 없습니다. Line 84에서 amount가 유효하지 않을 때 조용히 반환하므로, 사용자가 왜 충전이 진행되지 않는지 알 수 없습니다. 간단한 알림이나 토스트 메시지를 추가하는 것을 권장합니다.
🤖 Prompt for AI Agents
In StockMate/StockMate/app/feature/payment/ui/DepositChargeView.swift around
lines 81 to 92, the guard at line 84 silently returns when the entered amount is
invalid, giving no user feedback; update the button action to set a local state
(e.g., showInvalidAmountAlert or invalidAmountMessage) when Int(amountText) is
nil or <= 0, and present that state as an Alert or toast in the view so the user
sees a clear validation message (ensure you don't change isCharging on
validation failure and keep existing .disabled(isCharging) behavior).
📣 Related Issue
📝 Summary
Summary by CodeRabbit
릴리스 노트
새로운 기능
UI 개선
디자인