[Feat] #233 - 모노맨션 브랜드 QR 파싱 전략 추가#234
Conversation
Walkthrough모노맨션 브랜드용 QR 파싱 전략을 추가하고, 브랜드 열거형에 케이스를 추가했으며 리포지토리의 전략 목록에 새 전략을 등록했습니다. 새 전략은 HTML에서 ncloudstorage 이미지 URL을 추출해 이미지를 다운로드합니다. Changes모노맨션 브랜드 파싱 전략
개요이 PR은 모노맨션 브랜드를 위한 새로운 QR 코드 파싱 전략을 구현하며, HTML 응답에서 이미지 URL을 추출하고 ncloudstorage에서 이미지를 다운로드합니다. 변경사항모노맨션 브랜드 지원
예상 코드 리뷰 노력🎯 3 (중간) | ⏱️ ~25분 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@Neki-iOS/Features/QRCodeScanner/Sources/Data/Sources/Strategies/Implementations/MonomansionStrategy.swift`:
- Around line 38-49: The regex pattern stored in pattern currently requires the
captured URL to end with ".jpg" and therefore fails when the Naver Cloud Storage
URL includes query params (e.g. ?type=w1200); update the pattern string (the
pattern variable used to build NSRegularExpression) to allow characters after
".jpg" before the closing quote (for example by appending [^"']* after \.jpg) so
the captured group includes URLs with query parameters, then keep the rest of
the extraction logic (regex, match, Range(match.range(at: 1), in: htmlString))
and still throw .fallbackToWebView(url) on failure.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 38145207-bca2-40d3-a7e6-82ba8d38687b
📒 Files selected for processing (3)
Neki-iOS/Features/QRCodeScanner/Sources/Data/Sources/Repositories/DefaultQRCodeScanRepository.swiftNeki-iOS/Features/QRCodeScanner/Sources/Data/Sources/Strategies/Implementations/MonomansionStrategy.swiftNeki-iOS/Features/QRCodeScanner/Sources/Domain/Sources/Entities/QRCodeBrand.swift
There was a problem hiding this comment.
🧹 Nitpick comments (1)
Neki-iOS/Features/QRCodeScanner/Sources/Data/Sources/Strategies/Implementations/MonomansionStrategy.swift (1)
23-23: ⚖️ Poor tradeoff
networkProvider파라미터가 사용되지 않고URLSession.shared를 직접 호출합니다.HTML 페치(Line 23)와 이미지 다운로드(Line 60) 모두 프로토콜 계약에 명시된
networkProvider를 무시하고URLSession.shared를 직접 사용합니다. 이로 인해 타임아웃 설정, 공통 헤더, 인증 처리 등NetworkProvider가 제공할 수 있는 구성을 우회하며,URLProtocol스텁 없이는 단위 테스트가 불가능합니다.컨텍스트 스니펫에 따르면 이는 모든 전략 구현에 걸친 시스템적인 패턴이지만, 신규 전략 추가 시점이 개선하기에 적절한 기회입니다.
♻️ 개선 방향 예시
- (htmlData, _) = try await URLSession.shared.data(for: request) + (htmlData, _) = try await networkProvider.data(for: request)- let (data, response) = try await URLSession.shared.data(from: imageURL) + let (data, response) = try await networkProvider.data(from: imageURL)단,
NetworkProvider가 해당 메서드를 노출하도록 인터페이스 확장이 선행되어야 합니다.Also applies to: 60-60
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Neki-iOS/Features/QRCodeScanner/Sources/Data/Sources/Strategies/Implementations/MonomansionStrategy.swift` at line 23, The MonomansionStrategy implementation ignores the injected networkProvider by calling URLSession.shared directly for both HTML fetch (the line with (htmlData, _) = try await URLSession.shared.data(for: request)) and image download, which bypasses timeouts, headers, auth and breaks testability; update MonomansionStrategy to use the injected networkProvider API instead of URLSession.shared (extend the NetworkProvider protocol first if needed to expose an async data(for: URLRequest) -> (Data, URLResponse) method or an equivalent download API), then replace calls in the HTML-fetching code path and the image download path to invoke networkProvider.data(for: request) so all requests go through the configurable provider.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@Neki-iOS/Features/QRCodeScanner/Sources/Data/Sources/Strategies/Implementations/MonomansionStrategy.swift`:
- Line 23: The MonomansionStrategy implementation ignores the injected
networkProvider by calling URLSession.shared directly for both HTML fetch (the
line with (htmlData, _) = try await URLSession.shared.data(for: request)) and
image download, which bypasses timeouts, headers, auth and breaks testability;
update MonomansionStrategy to use the injected networkProvider API instead of
URLSession.shared (extend the NetworkProvider protocol first if needed to expose
an async data(for: URLRequest) -> (Data, URLResponse) method or an equivalent
download API), then replace calls in the HTML-fetching code path and the image
download path to invoke networkProvider.data(for: request) so all requests go
through the configurable provider.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 0015c6f6-02c8-4cce-addc-09f1473d9b47
📒 Files selected for processing (1)
Neki-iOS/Features/QRCodeScanner/Sources/Data/Sources/Strategies/Implementations/MonomansionStrategy.swift
🌴 작업한 브랜치
✅ 작업한 내용
qr.mono-mansion.com)를 인식하도록 host keyword를 등록했습니다.MonomansionStrategy를.htmlCrawling전략으로 구현했습니다.ncloudstorage.com원본 이미지 URL을 추출하도록 구현했습니다.DefaultQRCodeScanRepository에MonomansionStrategy를 등록했습니다.❗️PR Point
https://qr.mono-mansion.com/nO7qKdnR)을 QR 이미지로 생성해 스캐너로 검증했습니다.📸 스크린샷
생략합니다.
📟 관련 이슈
Summary by CodeRabbit