Skip to content

Commit bd6d87c

Browse files
Merge pull request #343 from BCSDLab/qa/lostitem
fix: 분실물 도메인 분리 QA 이슈 해결
2 parents b69790c + b430fd1 commit bd6d87c

37 files changed

Lines changed: 477 additions & 167 deletions

File tree

Koin/Apps/SceneDelegate.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
3232
}
3333
private func handleIncomingDeepLink(url: URL, navigationController: UINavigationController) {
3434
// URL 경로가 "/articles/lost-item"인 경우에 처리
35-
if url.path == "/articles/lost-item" {
35+
if url.path == "/articles/lost-item" || url.path == "/lost-item" {
3636
let userRepository = DefaultUserRepository(service: DefaultUserService())
3737
let lostItemRepository = DefaultLostItemRepository(service: DefaultLostItemService())
3838
let checkLoginUseCase = DefaultCheckLoginUseCase(userRepository: userRepository)
@@ -48,7 +48,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
4848
let incomingURL = userActivity.webpageURL else { return }
4949

5050
// URL의 경로가 "/articles/lost-item"인지 확인
51-
if incomingURL.path == "/articles/lost-item" {
51+
if incomingURL.path == "/articles/lost-item" || incomingURL.path == "/lost-item" {
5252
if let navigationController = window?.rootViewController as? UINavigationController {
5353
let userRepository = DefaultUserRepository(service: DefaultUserService())
5454
let lostItemRepository = DefaultLostItemRepository(service: DefaultLostItemService())

Koin/Core/View/ZoomedImageViewControllerB/Subviews/ZoomedImageCollectionView.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ final class ZoomedImageCollectionView: UICollectionView {
1515
private var initialIndexPath: IndexPath = IndexPath(row: 0, section: 0)
1616
let updateTitlePublisher = PassthroughSubject<String, Never>()
1717
let hideNavigationBarPublisher = PassthroughSubject<Bool, Never>()
18-
private var subscriptions: Set<AnyCancellable> = []
1918
private var isInitialized = false
2019

2120
// MARK: - Initializer
@@ -61,9 +60,6 @@ extension ZoomedImageCollectionView: UICollectionViewDataSource {
6160
return UICollectionViewCell()
6261
}
6362
cell.configure(url: urls[indexPath.row])
64-
cell.hideNavigationBarPublisher.sink { [weak self] isHidden in
65-
self?.hideNavigationBarPublisher.send(isHidden)
66-
}.store(in: &subscriptions)
6763
return cell
6864
}
6965
}

Koin/Core/View/ZoomedImageViewControllerB/Subviews/ZoomedImageCollectionViewCell.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ import Combine
1010

1111
final class ZoomedImageCollectionViewCell: UICollectionViewCell {
1212

13-
// MARK: - Properties
14-
let hideNavigationBarPublisher = PassthroughSubject<Bool, Never>()
15-
1613
// MARK: - UI Components
1714
let scrollView = UIScrollView().then {
1815
$0.minimumZoomScale = 1.0
@@ -56,15 +53,10 @@ extension ZoomedImageCollectionViewCell: UIScrollViewDelegate {
5653
return imageView
5754
}
5855

59-
func scrollViewDidZoom(_ scrollView: UIScrollView) {
60-
hideNavigationBarPublisher.send(true)
61-
}
62-
6356
func scrollViewDidEndZooming(_ scrollView: UIScrollView, with view: UIView?, atScale scale: CGFloat) {
6457
UIView.animate(withDuration: 0.3) { [weak self] in
6558
self?.scrollView.zoomScale = 1.0
6659
}
67-
hideNavigationBarPublisher.send(false)
6860
}
6961
}
7062

Koin/Core/View/ZoomedImageViewControllerB/Subviews/ZoomedImageRootViewController.swift

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@ final class ZoomedImageRootViewController: UIViewController {
1616

1717
// MARK: - UI Components
1818
private let zoomedImageCollectionView = ZoomedImageCollectionView()
19+
private let gradientView = UIView()
20+
private let gradientLayer = CAGradientLayer().then {
21+
$0.colors = [
22+
UIColor.black.withAlphaComponent(0.4).cgColor,
23+
UIColor.black.withAlphaComponent(0.03).cgColor,
24+
UIColor.black.withAlphaComponent(0.0).cgColor
25+
]
26+
$0.locations = [0.0, 0.9, 1.0]
27+
$0.startPoint = CGPoint(x: 0.0, y: 0.0)
28+
$0.endPoint = CGPoint(x: 0.0, y: 1.0)
29+
}
1930

2031
// MARK: - Life Cycle
2132
override func viewDidLoad() {
@@ -30,6 +41,11 @@ final class ZoomedImageRootViewController: UIViewController {
3041
configureNavigationBar(style: .transparentWhite)
3142
}
3243

44+
override func viewDidLayoutSubviews() {
45+
super.viewDidLayoutSubviews()
46+
gradientLayer.frame = gradientView.bounds
47+
}
48+
3349
// MARK: - Configure
3450
func configure(urls: [String], initialIndexPath: IndexPath) {
3551
zoomedImageCollectionView.configure(urls: urls, initialIndexPath: initialIndexPath)
@@ -92,11 +108,17 @@ extension ZoomedImageRootViewController {
92108
extension ZoomedImageRootViewController {
93109

94110
private func configureView() {
95-
[zoomedImageCollectionView].forEach {
111+
[zoomedImageCollectionView, gradientView].forEach {
96112
view.addSubview($0)
97113
}
98114
zoomedImageCollectionView.snp.makeConstraints {
99115
$0.edges.equalToSuperview()
100116
}
117+
gradientView.snp.makeConstraints {
118+
$0.top.leading.trailing.equalToSuperview()
119+
$0.bottom.equalTo(view.safeAreaLayoutGuide.snp.top)
120+
}
121+
122+
gradientView.layer.addSublayer(gradientLayer)
101123
}
102124
}

Koin/Core/View/ZoomedImageViewControllerB/ZoomedImageViewControllerB.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ final class ZoomedImageViewControllerB: UINavigationController {
2323
fatalError("init(coder:) has not been implemented")
2424
}
2525

26+
override var preferredStatusBarStyle: UIStatusBarStyle {
27+
return .lightContent
28+
}
29+
2630
// MARK: - Configure
2731
func configure(urls: [String], initialIndexPath: IndexPath) {
2832
rootViewController.configure(urls: urls, initialIndexPath: initialIndexPath)

Koin/Data/DTOs/Decodable/LostItem/LostItemDataDto.swift

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ struct LostItemDataDto: Decodable {
1212
let boardId: Int
1313
let type: LostItemType
1414
let category: String
15-
let foundPlace: String
15+
let foundPlace: String?
1616
let foundDate: String
1717
let content: String?
1818
let author: String
19-
let isCouncil: Bool
19+
let organization: Organization?
2020
let isMine: Bool
2121
let isFound: Bool
2222
let images: [Image]
23-
let prevID: Int?
24-
let nextID: Int?
23+
let prevId: Int?
24+
let nextId: Int?
2525
let registeredAt: String
2626
let updatedAt: String
27-
27+
2828
enum CodingKeys: String, CodingKey {
2929
case id
3030
case boardId = "board_id"
@@ -34,34 +34,44 @@ struct LostItemDataDto: Decodable {
3434
case foundDate = "found_date"
3535
case content
3636
case author
37-
case isCouncil = "is_council"
37+
case organization
3838
case isMine = "is_mine"
3939
case isFound = "is_found"
4040
case images
41-
case prevID = "prev_id"
42-
case nextID = "next_id"
41+
case prevId = "prev_id"
42+
case nextId = "next_id"
4343
case registeredAt = "registered_at"
4444
case updatedAt = "updated_at"
4545
}
4646
}
4747

48+
struct Organization: Decodable {
49+
let name: String
50+
let location: String
51+
52+
enum CodingKeys: String, CodingKey {
53+
case name
54+
case location
55+
}
56+
}
57+
58+
4859
extension LostItemDataDto {
4960

5061
func toDomain() -> LostItemData {
51-
LostItemData(
62+
return LostItemData(
5263
id: self.id,
5364
type: self.type,
5465
category: self.category,
5566
foundPlace: self.foundPlace,
5667
foundDate: self.foundDate,
5768
content: self.content,
5869
author: self.author,
59-
isCouncil: self.isCouncil,
70+
organization: self.organization,
6071
isMine: self.isMine,
6172
isFound: self.isFound,
6273
images: self.images,
63-
registeredAt: self.registeredAt,
64-
updatedAt: self.updatedAt
74+
registeredAt: self.registeredAt
6575
)
6676
}
6777
}

Koin/Data/DTOs/Decodable/NoticeList/LostArticleDetailDto.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ struct LostArticleDetailDto: Decodable {
5757
}
5858

5959
struct Image: Decodable {
60-
let id: Int
60+
let id: Int?
6161
let imageUrl: String
6262

6363
enum CodingKeys: String, CodingKey {

Koin/Data/DTOs/Encodable/LostItem/FetchLostItemListRequest.swift

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ struct FetchLostItemListRequest: Encodable {
1111
var type: LostItemType? = nil
1212
var page: Int = 1
1313
var limit: Int = 10
14-
var category: LostItemCategory = .all
14+
var category: Set<LostItemCategory> = [.all]
1515
var foundStatus: LostItemFoundStatus = .all
1616
let sort: LostItemSort = .latest
1717
var author: LostItemAuthor = .all
@@ -32,6 +32,29 @@ enum LostItemCategory: String, Encodable {
3232
case wallet = "WALLET"
3333
case electronics = "ELECTRONICS"
3434
case etc = "ETC"
35+
36+
var description: String {
37+
switch self {
38+
case .all: return "전체"
39+
case .card: return "카드"
40+
case .wallet: return "지갑"
41+
case .id: return "신분증"
42+
case .electronics: return "전자제품"
43+
case .etc: return "기타"
44+
}
45+
}
46+
47+
init?(description: String) {
48+
switch description {
49+
case "전체": self = .all
50+
case "카드": self = .card
51+
case "지갑": self = .wallet
52+
case "신분증": self = .id
53+
case "전자제품": self = .electronics
54+
case "기타": self = .etc
55+
default: return nil
56+
}
57+
}
3558
}
3659

3760
enum LostItemFoundStatus: String, Encodable {

Koin/Data/Service/Network/API/LostItemAPI.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ extension LostItemAPI: Router, URLRequestConvertible {
2525
public var path: String {
2626
switch self {
2727
case .fetchLostItemList: return "/articles/lost-item/v2"
28-
case .fetchLostItemData(let id): return "/articles/lost-item/\(id)"
28+
case .fetchLostItemData(let id): return "/articles/lost-item/v2/\(id)"
2929
case .changeListItemState(let id): return "/articles/lost-item/\(id)/found"
3030
case .deleteLostItem(let id): return "/articles/lost-item/\(id)"
3131
case .updateLostItem((let id, _)): return "/articles/lost-item/\(id)"
@@ -71,7 +71,7 @@ extension LostItemAPI: Router, URLRequestConvertible {
7171

7272
public var encoding: ParameterEncoding? {
7373
switch self {
74-
case .fetchLostItemList: return URLEncoding.default
74+
case .fetchLostItemList: return URLEncoding(arrayEncoding: .noBrackets)
7575
case .fetchLostItemData: return URLEncoding.default
7676
case .changeListItemState: return URLEncoding.default
7777
case .deleteLostItem: return URLEncoding.default

Koin/Domain/Model/LostItem/LostItemData.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ struct LostItemData {
1616
let foundDate: String
1717
let content: String?
1818
let author: String
19-
let isCouncil: Bool
19+
let organization: Organization?
2020
let isMine: Bool
2121
let isFound: Bool
2222
let images: [Image]
2323
let registeredAt: String
24-
let updatedAt: String
2524
}

0 commit comments

Comments
 (0)