Skip to content

Commit fd1712b

Browse files
committed
[Feat] #188 - 미지원 브랜드 감지 시 웹훅 발송
1 parent 72f2e45 commit fd1712b

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

Neki-iOS/Features/QRCodeScanner/Sources/Data/Sources/Repositories/DefaultQRCodeScanRepository.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import Foundation
99
import Dependencies
10+
import os
1011

1112
struct DefaultQRCodeScanRepository: QRCodeScanRepository {
1213
private let strategies: [QRCodeParsingStrategy] = [
@@ -19,14 +20,23 @@ struct DefaultQRCodeScanRepository: QRCodeScanRepository {
1920

2021
@Dependency(\.networkProvider) private var networkProvider
2122

22-
func parse(_ url: URL) async throws(QRParseError) -> ParsedQRResult {
23+
func parse(_ url: URL, user: User) async throws(QRParseError) -> ParsedQRResult {
2324
guard let host = url.host() else { throw .invalidURL }
2425

2526
for strategy in strategies {
2627
guard strategy.canHandle(host: host) else { continue }
2728
return try await strategy.parse(url, networkProvider: networkProvider)
2829
}
2930

31+
Task.detached(priority: .background) {
32+
do {
33+
let endpoint = QRCodeScannerEndpoint.notifyUnsupportedBrand(url: url, user: user)
34+
try await networkProvider.requestVoid(endpoint: endpoint)
35+
} catch {
36+
Logger.network.error("미지원 브랜드 디스코드 웹훅 발송 실패: \(error)")
37+
}
38+
}
39+
3040
throw .unsupportedBrand
3141
}
3242
}

0 commit comments

Comments
 (0)