From 4af96374efbf0ba54ba45fbacc12d8f6878cfb81 Mon Sep 17 00:00:00 2001 From: dlwns33 Date: Mon, 1 May 2023 18:47:12 +0900 Subject: [PATCH 01/17] =?UTF-8?q?fix:=20=EA=B7=B8=EB=A3=B9=20=EB=AA=A8?= =?UTF-8?q?=EB=8D=B8=20=EC=88=98=EC=A0=95=20(#464)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Factory/ModuleFactory.swift | 4 ++-- .../NetworkService/Group/GroupAPI.swift | 2 +- ...oupNameEditBottomSheetViewController.swift | 4 ++-- .../Group/GroupViewController.swift | 12 +++++----- .../VC/GroupEditViewController.swift | 24 +++++++++---------- .../ViewModel/GroupEditViewModel.swift | 6 ++--- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/NADA-iOS-forRelease/Sources/Factory/ModuleFactory.swift b/NADA-iOS-forRelease/Sources/Factory/ModuleFactory.swift index fba3eff1..88de02b1 100644 --- a/NADA-iOS-forRelease/Sources/Factory/ModuleFactory.swift +++ b/NADA-iOS-forRelease/Sources/Factory/ModuleFactory.swift @@ -25,7 +25,7 @@ protocol ModuleFactoryProtocol { func makeAroundMeVC() -> AroundMeViewController func makeUpdateVC() -> UpdateViewController func makeCardDetailVC() -> CardDetailViewController - func makeGroupEditVC(groupList: [Group]) -> GroupEditViewController + func makeGroupEditVC(groupList: [String]) -> GroupEditViewController } final class ModuleFactory: ModuleFactoryProtocol { @@ -58,7 +58,7 @@ final class ModuleFactory: ModuleFactoryProtocol { return cardDetailVC } - func makeGroupEditVC(groupList: [Group]) -> GroupEditViewController { + func makeGroupEditVC(groupList: [String]) -> GroupEditViewController { let viewModel = GroupEditViewModel(groupList: groupList) let groupEditVC = GroupEditViewController.controllerFromStoryboard(.groupEdit) groupEditVC.viewModel = viewModel diff --git a/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupAPI.swift b/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupAPI.swift index ef23184e..f6f521b1 100644 --- a/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupAPI.swift +++ b/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupAPI.swift @@ -38,7 +38,7 @@ public class GroupAPI { let statusCode = response.statusCode let data = response.data - let networkResult = self.judgeStatus(by: statusCode, data: data, type: [Group].self) + let networkResult = self.judgeStatus(by: statusCode, data: data, type: [String].self) completion(networkResult) case .failure(let err): diff --git a/NADA-iOS-forRelease/Sources/ViewControllers/BottomSheet/GroupNameEditBottomSheetViewController.swift b/NADA-iOS-forRelease/Sources/ViewControllers/BottomSheet/GroupNameEditBottomSheetViewController.swift index 76bbb0b3..fe2a5eaf 100644 --- a/NADA-iOS-forRelease/Sources/ViewControllers/BottomSheet/GroupNameEditBottomSheetViewController.swift +++ b/NADA-iOS-forRelease/Sources/ViewControllers/BottomSheet/GroupNameEditBottomSheetViewController.swift @@ -15,7 +15,7 @@ class GroupNameEditBottomSheetViewController: CommonBottomSheetViewController, U // 넘어온 그룹 이름 데이터를 받는 변수 선언 var text: String = "" var returnToGroupEditViewController: (() -> Void)? - var nowGroup: Group? + var nowGroup: String? private var bottomSheetViewTopConstraint: NSLayoutConstraint? // 그룹 추가 텍스트 필드 @@ -89,7 +89,7 @@ class GroupNameEditBottomSheetViewController: CommonBottomSheetViewController, U extension GroupNameEditBottomSheetViewController { func textFieldShouldReturn(_ textField: UITextField) -> Bool { textField.resignFirstResponder() - groupEditWithAPI(groupRequest: GroupEditRequest(groupId: nowGroup?.cardGroupId ?? 0, groupName: addGroupTextField.text ?? "")) +// groupEditWithAPI(groupRequest: GroupEditRequest(groupId: nowGroup?.cardGroupId ?? 0, groupName: addGroupTextField.text ?? "")) nowHideBottomSheetAndGoBack() return true diff --git a/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift b/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift index fdc19af5..538a96ad 100644 --- a/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift +++ b/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift @@ -91,7 +91,7 @@ class GroupViewController: UIViewController { @IBOutlet weak var emptyView: UIView! // 그룹 이름들을 담을 변수 생성 - var serverGroups: [Group]? = [] + var serverGroups: [String]? = [] var frontCards: [FrontCard]? = [] var serverCardsWithBack: Card? var groupId: Int? @@ -181,10 +181,10 @@ extension GroupViewController { GroupAPI.shared.groupListFetch() { response in switch response { case .success(let data): - if let group = data as? [Group] { + if let group = data as? [String] { self.serverGroups = group self.groupCollectionView.reloadData() - self.groupId = group[self.selectedRow].cardGroupId +// self.groupId = group[self.selectedRow].cardGroupId self.cardListInGroupWithAPI(cardListInGroupRequest: CardListInGroupRequest(cardGroupId: self.groupId ?? 0, pageNo: 1, pageSize: 1)) { if self.frontCards?.count != 0 { self.cardsCollectionView.scrollToItem(at: IndexPath(item: 0, section: 0), at: .top, animated: false) @@ -299,7 +299,7 @@ extension GroupViewController: UICollectionViewDataSource { guard let groupCell = collectionView.dequeueReusableCell(withReuseIdentifier: Const.Xib.groupCollectionViewCell, for: indexPath) as? GroupCollectionViewCell else { return UICollectionViewCell() } - groupCell.groupName.text = serverGroups?[indexPath.row].cardGroupName + groupCell.groupName.text = serverGroups?[indexPath.row] if indexPath.row == selectedRow { collectionView.selectItem(at: indexPath, animated: true, scrollPosition: .init()) @@ -337,7 +337,7 @@ extension GroupViewController: UICollectionViewDataSource { switch collectionView { case groupCollectionView: selectedRow = indexPath.row - groupId = serverGroups?[indexPath.row].cardGroupId +// groupId = serverGroups?[indexPath.row].cardGroupId offset = 0 frontCards?.removeAll() @@ -373,7 +373,7 @@ extension GroupViewController: UICollectionViewDelegateFlowLayout { guard let cell = groupCollectionView.dequeueReusableCell(withReuseIdentifier: Const.Xib.groupCollectionViewCell, for: indexPath) as? GroupCollectionViewCell else { return .zero } - cell.groupName.text = serverGroups?[indexPath.row].cardGroupName + cell.groupName.text = serverGroups?[indexPath.row] cell.groupName.sizeToFit() width = cell.groupName.frame.width + 30 height = collectionView.frame.size.height diff --git a/NADA-iOS-forRelease/Sources/ViewControllers/GroupEdit/VC/GroupEditViewController.swift b/NADA-iOS-forRelease/Sources/ViewControllers/GroupEdit/VC/GroupEditViewController.swift index 9ebdc53d..cf43e72b 100644 --- a/NADA-iOS-forRelease/Sources/ViewControllers/GroupEdit/VC/GroupEditViewController.swift +++ b/NADA-iOS-forRelease/Sources/ViewControllers/GroupEdit/VC/GroupEditViewController.swift @@ -19,8 +19,8 @@ class GroupEditViewController: UIViewController { // MARK: - Properties var viewModel: GroupEditViewModel! private let disposeBag = DisposeBag() - var serverGroups: [Group]? - var unClass: Int? + var serverGroups: [String]? + var unClass: String? // MARK: - @IBOutlet Properties @IBOutlet weak var groupEditTableView: UITableView! @@ -66,12 +66,12 @@ class GroupEditViewController: UIViewController { .withUnretained(self) .subscribe { owner, list in owner.setData(groupList: list) - self.unClass = self.serverGroups?[0].cardGroupId + self.unClass = self.serverGroups?[0] self.serverGroups?.remove(at: 0) }.disposed(by: self.disposeBag) } - func setData(groupList: [Group]) { + func setData(groupList: [String]) { self.serverGroups = groupList self.groupEditTableView.reloadData() } @@ -106,9 +106,9 @@ extension GroupEditViewController: UITableViewDelegate { self.makeCancelDeleteAlert(title: "그룹 삭제", message: "해당 그룹에 있던 명함은\n미분류 그룹으로 이동합니다.", cancelAction: { _ in // 취소 눌렀을 때 액션이 들어갈 부분 }, deleteAction: { _ in - self.groupDeleteWithAPI( - groupID: self.serverGroups?[indexPath.row].cardGroupId ?? 0, - defaultGroupId: self.unClass ?? 0) +// self.groupDeleteWithAPI( +// groupID: self.serverGroups?[indexPath.row].cardGroupId ?? 0, +// defaultGroupId: self.unClass ?? 0) self.groupEditTableView.reloadData() NotificationCenter.default.post(name: Notification.Name.passDataToGroup, object: 0, userInfo: nil) }) @@ -128,7 +128,7 @@ extension GroupEditViewController: UITableViewDelegate { .setTitle("그룹명 변경") .setHeight(184) nextVC.modalPresentationStyle = .overFullScreen - nextVC.text = serverGroups?[indexPath.row].cardGroupName ?? "" + nextVC.text = serverGroups?[indexPath.row] ?? "" nextVC.returnToGroupEditViewController = { self.groupListFetchWithAPI() } @@ -156,7 +156,7 @@ extension GroupEditViewController: UITableViewDataSource { } else { guard let serviceCell = tableView.dequeueReusableCell(withIdentifier: GroupEditTableViewCell.className, for: indexPath) as? GroupEditTableViewCell else { return UITableViewCell() } - serviceCell.initData(title: serverGroups?[indexPath.row].cardGroupName ?? "") + serviceCell.initData(title: serverGroups?[indexPath.row] ?? "") return serviceCell } } @@ -165,7 +165,7 @@ extension GroupEditViewController: UITableViewDataSource { // MARK: - Extensions extension GroupEditViewController { func serverGroupList() { - self.unClass = serverGroups?[0].cardGroupId + self.unClass = serverGroups?[0] serverGroups?.remove(at: 0) } } @@ -176,9 +176,9 @@ extension GroupEditViewController { GroupAPI.shared.groupListFetch { response in switch response { case .success(let data): - if let group = data as? [Group] { + if let group = data as? [String] { self.serverGroups = group - self.unClass = self.serverGroups?[0].cardGroupId + self.unClass = self.serverGroups?[0] self.serverGroups?.remove(at: 0) self.groupEditTableView.reloadData() } diff --git a/NADA-iOS-forRelease/Sources/ViewControllers/GroupEdit/ViewModel/GroupEditViewModel.swift b/NADA-iOS-forRelease/Sources/ViewControllers/GroupEdit/ViewModel/GroupEditViewModel.swift index 98d006c1..b9162a52 100644 --- a/NADA-iOS-forRelease/Sources/ViewControllers/GroupEdit/ViewModel/GroupEditViewModel.swift +++ b/NADA-iOS-forRelease/Sources/ViewControllers/GroupEdit/ViewModel/GroupEditViewModel.swift @@ -13,7 +13,7 @@ final class GroupEditViewModel: ViewModelType { // MARK: - Properties private let disposeBag = DisposeBag() - var groupList: [Group] = [] + var groupList: [String] = [] // MARK: - Inputs @@ -24,12 +24,12 @@ final class GroupEditViewModel: ViewModelType { // MARK: - Outputs struct Output { - var groupListRelay = PublishRelay<[Group]>() + var groupListRelay = PublishRelay<[String]>() } // MARK: - Initialize - init(groupList: [Group]) { + init(groupList: [String]) { self.groupList = groupList } } From f35e2d24ac43d6d06ddc60e6abd4d1ef9cd98fb8 Mon Sep 17 00:00:00 2001 From: dlwns33 Date: Mon, 1 May 2023 18:56:20 +0900 Subject: [PATCH 02/17] =?UTF-8?q?fix:=20=EA=B7=B8=EB=A3=B9=20=EC=86=8D=20?= =?UTF-8?q?=EB=AA=85=ED=95=A8=20=EB=AA=A8=EB=8D=B8=20=EC=88=98=EC=A0=95=20?= =?UTF-8?q?(#464)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Group/CardListInGroupRequest.swift | 2 +- .../NetworkService/Group/GroupService.swift | 9 +++++---- .../Group/GroupViewController.swift | 14 ++++++-------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/NADA-iOS-forRelease/Sources/NetworkModel/Group/CardListInGroupRequest.swift b/NADA-iOS-forRelease/Sources/NetworkModel/Group/CardListInGroupRequest.swift index b091c38e..eb380e86 100644 --- a/NADA-iOS-forRelease/Sources/NetworkModel/Group/CardListInGroupRequest.swift +++ b/NADA-iOS-forRelease/Sources/NetworkModel/Group/CardListInGroupRequest.swift @@ -8,7 +8,7 @@ import Foundation struct CardListInGroupRequest: Codable { - var cardGroupId: Int var pageNo: Int var pageSize: Int + var groupName: String } diff --git a/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupService.swift b/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupService.swift index fd6766aa..05e376c6 100644 --- a/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupService.swift +++ b/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupService.swift @@ -45,8 +45,8 @@ extension GroupService: TargetType { return "/card-group" case .cardAddInGroup: return "/card-group/mapping" - case .cardListFetchInGroup(let cardListInGroupRequest): - return "/card-group/\(cardListInGroupRequest.cardGroupId)/cards" + case .cardListFetchInGroup: + return "/card-group/cards" case .cardDeleteInGroup(let groupID, let cardID): return "/group/\(groupID)/\(cardID)" } @@ -84,11 +84,12 @@ extension GroupService: TargetType { return .requestJSONEncodable(groupRequest) case .cardAddInGroup(let gorupRequest): return .requestParameters(parameters: ["cardGroupId": gorupRequest.cardGroupID, - "cardUUID" : gorupRequest.cardUUID], + "cardUUID": gorupRequest.cardUUID], encoding: JSONEncoding.default) case .cardListFetchInGroup(let cardListInGroupRequest): return .requestParameters(parameters: ["pageNo": cardListInGroupRequest.pageNo, - "pageSize": cardListInGroupRequest.pageSize], encoding: URLEncoding.queryString) + "pageSize": cardListInGroupRequest.pageSize, + "groupName": cardListInGroupRequest.groupName], encoding: URLEncoding.queryString) } } diff --git a/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift b/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift index 538a96ad..4e5521a3 100644 --- a/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift +++ b/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift @@ -94,7 +94,7 @@ class GroupViewController: UIViewController { var serverGroups: [String]? = [] var frontCards: [FrontCard]? = [] var serverCardsWithBack: Card? - var groupId: Int? + var groupName: String? var selectedRow = 0 private var offset = 0 @@ -178,14 +178,14 @@ extension GroupViewController { extension GroupViewController { func groupListFetchWithAPI() { - GroupAPI.shared.groupListFetch() { response in + GroupAPI.shared.groupListFetch { response in switch response { case .success(let data): if let group = data as? [String] { self.serverGroups = group self.groupCollectionView.reloadData() -// self.groupId = group[self.selectedRow].cardGroupId - self.cardListInGroupWithAPI(cardListInGroupRequest: CardListInGroupRequest(cardGroupId: self.groupId ?? 0, pageNo: 1, pageSize: 1)) { + self.groupName = group[self.selectedRow] + self.cardListInGroupWithAPI(cardListInGroupRequest: CardListInGroupRequest(pageNo: 1, pageSize: 10, groupName: self.groupName ?? "미분류")) { if self.frontCards?.count != 0 { self.cardsCollectionView.scrollToItem(at: IndexPath(item: 0, section: 0), at: .top, animated: false) } @@ -243,7 +243,7 @@ extension GroupViewController { guard let nextVC = UIStoryboard.init(name: Const.Storyboard.Name.cardDetail, bundle: nil).instantiateViewController(withIdentifier: Const.ViewController.Identifier.cardDetailViewController) as? CardDetailViewController else { return } nextVC.cardDataModel = card - nextVC.groupId = self.groupId +// nextVC.groupId = self.groupId // nextVC.serverGroups = self.serverGroups // TODO: 고치세요 self.navigationController?.pushViewController(nextVC, animated: true) @@ -347,9 +347,7 @@ extension GroupViewController: UICollectionViewDataSource { DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { self.cardListInGroupWithAPI(cardListInGroupRequest: - CardListInGroupRequest(cardGroupId: self.groupId ?? 0, - pageNo: 1, - pageSize: 1)) { + CardListInGroupRequest(pageNo: 1, pageSize: 10, groupName: self.groupName ?? "")) { self.isInfiniteScroll = true } } From e1e3d3a29cf51bf432d762673b3b95ecd7c57fd8 Mon Sep 17 00:00:00 2001 From: dlwns33 Date: Mon, 1 May 2023 19:04:19 +0900 Subject: [PATCH 03/17] =?UTF-8?q?fix:=20=EB=AF=B8=EB=B6=84=EB=A5=98=20?= =?UTF-8?q?=EB=8C=80=EC=9D=91=20(#464)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewControllers/Group/GroupViewController.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift b/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift index 4e5521a3..701075d4 100644 --- a/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift +++ b/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift @@ -94,7 +94,7 @@ class GroupViewController: UIViewController { var serverGroups: [String]? = [] var frontCards: [FrontCard]? = [] var serverCardsWithBack: Card? - var groupName: String? + var groupName: String = "" var selectedRow = 0 private var offset = 0 @@ -184,8 +184,8 @@ extension GroupViewController { if let group = data as? [String] { self.serverGroups = group self.groupCollectionView.reloadData() - self.groupName = group[self.selectedRow] - self.cardListInGroupWithAPI(cardListInGroupRequest: CardListInGroupRequest(pageNo: 1, pageSize: 10, groupName: self.groupName ?? "미분류")) { + if group[self.selectedRow] != "미분류" { self.groupName = group[self.selectedRow] } + self.cardListInGroupWithAPI(cardListInGroupRequest: CardListInGroupRequest(pageNo: 1, pageSize: 10, groupName: self.groupName)) { if self.frontCards?.count != 0 { self.cardsCollectionView.scrollToItem(at: IndexPath(item: 0, section: 0), at: .top, animated: false) } @@ -337,7 +337,7 @@ extension GroupViewController: UICollectionViewDataSource { switch collectionView { case groupCollectionView: selectedRow = indexPath.row -// groupId = serverGroups?[indexPath.row].cardGroupId + if selectedRow != 0 { self.groupName = serverGroups?[indexPath.row] ?? "" } offset = 0 frontCards?.removeAll() @@ -347,7 +347,7 @@ extension GroupViewController: UICollectionViewDataSource { DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { self.cardListInGroupWithAPI(cardListInGroupRequest: - CardListInGroupRequest(pageNo: 1, pageSize: 10, groupName: self.groupName ?? "")) { + CardListInGroupRequest(pageNo: 1, pageSize: 10, groupName: self.groupName)) { self.isInfiniteScroll = true } } From c8ae119182fa8865a58fa6abc5e7c5a52919d9f5 Mon Sep 17 00:00:00 2001 From: dlwns33 Date: Mon, 1 May 2023 19:13:32 +0900 Subject: [PATCH 04/17] =?UTF-8?q?fix:=20=EB=AC=B4=ED=95=9C=20=EC=8A=A4?= =?UTF-8?q?=ED=81=AC=EB=A1=A4=20=EC=88=98=EC=A0=95=20(#464)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewControllers/Group/GroupViewController.swift | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift b/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift index 701075d4..d29928b5 100644 --- a/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift +++ b/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift @@ -269,11 +269,11 @@ extension GroupViewController: UICollectionViewDelegate { if isInfiniteScroll { isInfiniteScroll = false offset += 1 - /* - cardListInGroupWithAPI(cardListInGroupRequest: CardListInGroupRequest(userId: UserDefaults.standard.string(forKey: Const.UserDefaultsKey.userID) ?? "", groupId: serverGroups?.groups[self.selectedRow].cardGroupId ?? -1, offset: offset)) { + cardListInGroupWithAPI(cardListInGroupRequest: CardListInGroupRequest(pageNo: offset, + pageSize: 10, + groupName: serverGroups?[self.selectedRow] ?? "")) { self.isInfiniteScroll = true } - */ } } } @@ -337,7 +337,11 @@ extension GroupViewController: UICollectionViewDataSource { switch collectionView { case groupCollectionView: selectedRow = indexPath.row - if selectedRow != 0 { self.groupName = serverGroups?[indexPath.row] ?? "" } + if selectedRow == 0 { + self.groupName = "" + } else { + self.groupName = serverGroups?[indexPath.row] ?? "" + } offset = 0 frontCards?.removeAll() From 981bf6fcccc9de6a82c2e13c32d2ed589896f536 Mon Sep 17 00:00:00 2001 From: dlwns33 Date: Mon, 1 May 2023 19:19:15 +0900 Subject: [PATCH 05/17] =?UTF-8?q?fix:=20=EB=AA=85=ED=95=A8=20=EA=B7=B8?= =?UTF-8?q?=EB=A3=B9=20=EC=82=AD=EC=A0=9C=20API=20=EC=88=98=EC=A0=95=20(#4?= =?UTF-8?q?64)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/NetworkService/Group/GroupAPI.swift | 4 ++-- .../Sources/NetworkService/Group/GroupService.swift | 10 +++++----- .../GroupEdit/VC/GroupEditViewController.swift | 5 +++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupAPI.swift b/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupAPI.swift index f6f521b1..1578aa79 100644 --- a/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupAPI.swift +++ b/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupAPI.swift @@ -47,8 +47,8 @@ public class GroupAPI { } } - func groupDelete(groupID: Int, defaultGroupId: Int, completion: @escaping (NetworkResult) -> Void) { - groupProvider.request(.groupDelete(groupID: groupID, defaultGroupId: defaultGroupId)) { (result) in + func groupDelete(cardGroupName: String, completion: @escaping (NetworkResult) -> Void) { + groupProvider.request(.groupDelete(cardGroupName: cardGroupName)) { (result) in switch result { case .success(let response): let statusCode = response.statusCode diff --git a/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupService.swift b/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupService.swift index 05e376c6..cc284be2 100644 --- a/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupService.swift +++ b/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupService.swift @@ -10,7 +10,7 @@ import Moya enum GroupService { case groupListFetch - case groupDelete(groupID: Int, defaultGroupId: Int) + case groupDelete(cardGroupName: String) case groupAdd(groupRequest: GroupAddRequest) case groupEdit(groupRequest: GroupEditRequest) case cardAddInGroup(cardRequest: CardAddInGroupRequest) @@ -39,8 +39,8 @@ extension GroupService: TargetType { return "/card-group/list" case .groupReset: return "/card-group/clear" - case .groupDelete(let groupID, _): - return "/card-group/\(groupID)" + case .groupDelete: + return "/card-group" case .groupAdd, .groupEdit: return "/card-group" case .cardAddInGroup: @@ -75,8 +75,8 @@ extension GroupService: TargetType { return .requestPlain case .cardDeleteInGroup, .groupReset: return .requestPlain - case .groupDelete(_, let defaultGroupId): - return .requestParameters(parameters: ["defaultGroupId": defaultGroupId], + case .groupDelete(let cardGroupName): + return .requestParameters(parameters: ["cardGroupName": cardGroupName], encoding: URLEncoding.queryString) case .groupAdd(let groupRequest): return .requestJSONEncodable(groupRequest) diff --git a/NADA-iOS-forRelease/Sources/ViewControllers/GroupEdit/VC/GroupEditViewController.swift b/NADA-iOS-forRelease/Sources/ViewControllers/GroupEdit/VC/GroupEditViewController.swift index cf43e72b..97f88330 100644 --- a/NADA-iOS-forRelease/Sources/ViewControllers/GroupEdit/VC/GroupEditViewController.swift +++ b/NADA-iOS-forRelease/Sources/ViewControllers/GroupEdit/VC/GroupEditViewController.swift @@ -109,6 +109,7 @@ extension GroupEditViewController: UITableViewDelegate { // self.groupDeleteWithAPI( // groupID: self.serverGroups?[indexPath.row].cardGroupId ?? 0, // defaultGroupId: self.unClass ?? 0) + self.groupDeleteWithAPI(cardGroupName: self.serverGroups?[indexPath.row] ?? "") self.groupEditTableView.reloadData() NotificationCenter.default.post(name: Notification.Name.passDataToGroup, object: 0, userInfo: nil) }) @@ -194,8 +195,8 @@ extension GroupEditViewController { } } - func groupDeleteWithAPI(groupID: Int, defaultGroupId: Int) { - GroupAPI.shared.groupDelete(groupID: groupID, defaultGroupId: defaultGroupId) { response in + func groupDeleteWithAPI(cardGroupName: String) { + GroupAPI.shared.groupDelete(cardGroupName: cardGroupName) { response in switch response { case .success: print("groupDeleteWithAPI - success") From 151c2e248ae255e62fbecb7b99a8c6dcb8cfd694 Mon Sep 17 00:00:00 2001 From: dlwns33 Date: Mon, 1 May 2023 19:26:47 +0900 Subject: [PATCH 06/17] =?UTF-8?q?fix:=20=EB=AA=85=ED=95=A8=20=EA=B7=B8?= =?UTF-8?q?=EB=A3=B9=EB=AA=85=20=EC=88=98=EC=A0=95=20API=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(#464)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/NetworkModel/Group/GroupEditRequest.swift | 2 +- .../Sources/NetworkService/Group/GroupService.swift | 4 +++- .../BottomSheet/GroupNameEditBottomSheetViewController.swift | 1 + .../GroupEdit/VC/GroupEditViewController.swift | 3 --- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/NADA-iOS-forRelease/Sources/NetworkModel/Group/GroupEditRequest.swift b/NADA-iOS-forRelease/Sources/NetworkModel/Group/GroupEditRequest.swift index b6a7acb1..c3f13986 100644 --- a/NADA-iOS-forRelease/Sources/NetworkModel/Group/GroupEditRequest.swift +++ b/NADA-iOS-forRelease/Sources/NetworkModel/Group/GroupEditRequest.swift @@ -8,6 +8,6 @@ import Foundation struct GroupEditRequest: Codable { - var groupId: Int var groupName: String + var modifyGroupName: String } diff --git a/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupService.swift b/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupService.swift index cc284be2..f7390f2c 100644 --- a/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupService.swift +++ b/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupService.swift @@ -41,8 +41,10 @@ extension GroupService: TargetType { return "/card-group/clear" case .groupDelete: return "/card-group" - case .groupAdd, .groupEdit: + case .groupAdd: return "/card-group" + case .groupEdit: + return "/card-group/name" case .cardAddInGroup: return "/card-group/mapping" case .cardListFetchInGroup: diff --git a/NADA-iOS-forRelease/Sources/ViewControllers/BottomSheet/GroupNameEditBottomSheetViewController.swift b/NADA-iOS-forRelease/Sources/ViewControllers/BottomSheet/GroupNameEditBottomSheetViewController.swift index fe2a5eaf..810d5e76 100644 --- a/NADA-iOS-forRelease/Sources/ViewControllers/BottomSheet/GroupNameEditBottomSheetViewController.swift +++ b/NADA-iOS-forRelease/Sources/ViewControllers/BottomSheet/GroupNameEditBottomSheetViewController.swift @@ -90,6 +90,7 @@ extension GroupNameEditBottomSheetViewController { func textFieldShouldReturn(_ textField: UITextField) -> Bool { textField.resignFirstResponder() // groupEditWithAPI(groupRequest: GroupEditRequest(groupId: nowGroup?.cardGroupId ?? 0, groupName: addGroupTextField.text ?? "")) + groupEditWithAPI(groupRequest: GroupEditRequest(groupName: nowGroup ?? "", modifyGroupName: addGroupTextField.text ?? "")) nowHideBottomSheetAndGoBack() return true diff --git a/NADA-iOS-forRelease/Sources/ViewControllers/GroupEdit/VC/GroupEditViewController.swift b/NADA-iOS-forRelease/Sources/ViewControllers/GroupEdit/VC/GroupEditViewController.swift index 97f88330..8ebf6fce 100644 --- a/NADA-iOS-forRelease/Sources/ViewControllers/GroupEdit/VC/GroupEditViewController.swift +++ b/NADA-iOS-forRelease/Sources/ViewControllers/GroupEdit/VC/GroupEditViewController.swift @@ -106,9 +106,6 @@ extension GroupEditViewController: UITableViewDelegate { self.makeCancelDeleteAlert(title: "그룹 삭제", message: "해당 그룹에 있던 명함은\n미분류 그룹으로 이동합니다.", cancelAction: { _ in // 취소 눌렀을 때 액션이 들어갈 부분 }, deleteAction: { _ in -// self.groupDeleteWithAPI( -// groupID: self.serverGroups?[indexPath.row].cardGroupId ?? 0, -// defaultGroupId: self.unClass ?? 0) self.groupDeleteWithAPI(cardGroupName: self.serverGroups?[indexPath.row] ?? "") self.groupEditTableView.reloadData() NotificationCenter.default.post(name: Notification.Name.passDataToGroup, object: 0, userInfo: nil) From 5baa1a4a4816ba938fa48cdb7fd518fc50cb4950 Mon Sep 17 00:00:00 2001 From: dlwns33 Date: Mon, 1 May 2023 21:14:44 +0900 Subject: [PATCH 07/17] =?UTF-8?q?fix:=20=EB=AA=85=ED=95=A8=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20=EA=B7=B8=EB=A3=B9=EC=84=A0=ED=83=9D=20(#464)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Group/CardAddInGroupRequest.swift | 2 +- .../NetworkService/Group/GroupService.swift | 6 ++-- .../CardResultBottomSheetViewController.swift | 4 +-- ...SelectGroupBottomSheetViewController.swift | 34 +++++++++---------- .../CardDetail/CardDetailViewController.swift | 10 +++--- .../Home/VC/HomeViewController.swift | 2 +- .../TabBar/TabBarViewController.swift | 2 +- 7 files changed, 30 insertions(+), 30 deletions(-) diff --git a/NADA-iOS-forRelease/Sources/NetworkModel/Group/CardAddInGroupRequest.swift b/NADA-iOS-forRelease/Sources/NetworkModel/Group/CardAddInGroupRequest.swift index e582189c..0672920e 100644 --- a/NADA-iOS-forRelease/Sources/NetworkModel/Group/CardAddInGroupRequest.swift +++ b/NADA-iOS-forRelease/Sources/NetworkModel/Group/CardAddInGroupRequest.swift @@ -8,6 +8,6 @@ import Foundation struct CardAddInGroupRequest: Codable { + var cardGroupName: String? var cardUUID: String - var cardGroupID: Int } diff --git a/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupService.swift b/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupService.swift index f7390f2c..3c622a5e 100644 --- a/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupService.swift +++ b/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupService.swift @@ -84,9 +84,9 @@ extension GroupService: TargetType { return .requestJSONEncodable(groupRequest) case .groupEdit(let groupRequest): return .requestJSONEncodable(groupRequest) - case .cardAddInGroup(let gorupRequest): - return .requestParameters(parameters: ["cardGroupId": gorupRequest.cardGroupID, - "cardUUID": gorupRequest.cardUUID], + case .cardAddInGroup(let groupRequest): + return .requestParameters(parameters: ["cardGroupName": groupRequest.cardGroupName, + "cardUUID": groupRequest.cardUUID], encoding: JSONEncoding.default) case .cardListFetchInGroup(let cardListInGroupRequest): return .requestParameters(parameters: ["pageNo": cardListInGroupRequest.pageNo, diff --git a/NADA-iOS-forRelease/Sources/ViewControllers/BottomSheet/CardResultBottomSheetViewController.swift b/NADA-iOS-forRelease/Sources/ViewControllers/BottomSheet/CardResultBottomSheetViewController.swift index 7fafa910..c03dbe49 100644 --- a/NADA-iOS-forRelease/Sources/ViewControllers/BottomSheet/CardResultBottomSheetViewController.swift +++ b/NADA-iOS-forRelease/Sources/ViewControllers/BottomSheet/CardResultBottomSheetViewController.swift @@ -118,11 +118,11 @@ extension CardResultBottomSheetViewController { GroupAPI.shared.groupListFetch { response in switch response { case .success(let data): - if let group = data as? Groups { + if let groups = data as? [String] { let nextVC = SelectGroupBottomSheetViewController() nextVC.status = self.status nextVC.cardDataModel = self.cardDataModel - nextVC.serverGroups = group + nextVC.serverGroups = groups self.hideBottomSheetAndPresent(nextBottomSheet: nextVC, title: "그룹선택", height: 386) } case .requestErr(let message): diff --git a/NADA-iOS-forRelease/Sources/ViewControllers/BottomSheet/SelectGroupBottomSheetViewController.swift b/NADA-iOS-forRelease/Sources/ViewControllers/BottomSheet/SelectGroupBottomSheetViewController.swift index 0ada2ca4..101496f3 100644 --- a/NADA-iOS-forRelease/Sources/ViewControllers/BottomSheet/SelectGroupBottomSheetViewController.swift +++ b/NADA-iOS-forRelease/Sources/ViewControllers/BottomSheet/SelectGroupBottomSheetViewController.swift @@ -11,10 +11,10 @@ class SelectGroupBottomSheetViewController: CommonBottomSheetViewController { // MARK: - Properties var cardDataModel: Card? - var serverGroups: Groups? - var selectedGroup = 0 + var serverGroups: [String]? + var selectedGroup = "" var selectedGroupIndex = 0 - var groupId: Int? + var groupName: String? var status: Status = .add @@ -54,7 +54,7 @@ class SelectGroupBottomSheetViewController: CommonBottomSheetViewController { private func setupUI() { view.addSubview(groupPicker) view.addSubview(doneButton) - selectedGroup = serverGroups?.groups[0].cardGroupId ?? 0 + selectedGroup = serverGroups?[0] ?? "" groupPicker.delegate = self groupPicker.dataSource = self setupLayout() @@ -82,14 +82,14 @@ class SelectGroupBottomSheetViewController: CommonBottomSheetViewController { @objc func presentCardInfoViewController() { switch status { - case .detail: - changeGroupWithAPI(request: ChangeGroupRequest(cardID: cardDataModel?.cardUUID ?? "", - userID: UserDefaults.standard.string(forKey: Const.UserDefaultsKey.userID) ?? "", - groupID: groupId ?? 0, - newGroupID: selectedGroup)) - case .add, .addWithQR: - cardAddInGroupWithAPI(cardRequest: CardAddInGroupRequest(cardUUID: cardDataModel?.cardUUID ?? "", - cardGroupID: selectedGroup)) +// case .detail: +// changeGroupWithAPI(request: ChangeGroupRequest(cardID: cardDataModel?.cardUUID ?? "", +// userID: UserDefaults.standard.string(forKey: Const.UserDefaultsKey.userID) ?? "", +// groupID: groupName ?? 0, +// newGroupID: selectedGroup)) + case .add, .addWithQR, .detail: + cardAddInGroupWithAPI(cardRequest: CardAddInGroupRequest(cardGroupName: selectedGroup, + cardUUID: cardDataModel?.cardUUID ?? "")) case .group: return } @@ -103,7 +103,7 @@ extension SelectGroupBottomSheetViewController: UIPickerViewDelegate, UIPickerVi } func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { - return serverGroups?.groups.count ?? 1 + return serverGroups?.count ?? 1 } func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView { @@ -112,16 +112,16 @@ extension SelectGroupBottomSheetViewController: UIPickerViewDelegate, UIPickerVi label.textAlignment = .center if pickerView.selectedRow(inComponent: component) == row { - label.attributedText = NSAttributedString(string: serverGroups?.groups[row].cardGroupName ?? "", attributes: [NSAttributedString.Key.font: UIFont.textBold01, NSAttributedString.Key.foregroundColor: UIColor.mainColorNadaMain]) + label.attributedText = NSAttributedString(string: serverGroups?[row] ?? "", attributes: [NSAttributedString.Key.font: UIFont.textBold01, NSAttributedString.Key.foregroundColor: UIColor.mainColorNadaMain]) } else { - label.attributedText = NSAttributedString(string: serverGroups?.groups[row].cardGroupName ?? "", attributes: [NSAttributedString.Key.font: UIFont.textRegular03, NSAttributedString.Key.foregroundColor: UIColor.quaternary]) + label.attributedText = NSAttributedString(string: serverGroups?[row] ?? "", attributes: [NSAttributedString.Key.font: UIFont.textRegular03, NSAttributedString.Key.foregroundColor: UIColor.quaternary]) } return label } func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { - selectedGroup = serverGroups?.groups[row].cardGroupId ?? 0 + selectedGroup = serverGroups?[row] ?? "" selectedGroupIndex = row pickerView.reloadAllComponents() } @@ -143,7 +143,7 @@ extension SelectGroupBottomSheetViewController { guard let nextVC = UIStoryboard.init(name: Const.Storyboard.Name.cardDetail, bundle: nil).instantiateViewController(withIdentifier: Const.ViewController.Identifier.cardDetailViewController) as? CardDetailViewController else { return } nextVC.status = self.status nextVC.cardDataModel = self.cardDataModel - nextVC.groupId = self.selectedGroup + nextVC.groupName = self.selectedGroup nextVC.serverGroups = self.serverGroups NotificationCenter.default.post(name: Notification.Name.passDataToGroup, object: self.selectedGroupIndex, userInfo: nil) self.hideBottomSheetAndPresentVC(nextViewController: nextVC) diff --git a/NADA-iOS-forRelease/Sources/ViewControllers/CardDetail/CardDetailViewController.swift b/NADA-iOS-forRelease/Sources/ViewControllers/CardDetail/CardDetailViewController.swift index c75402fc..20f66b57 100644 --- a/NADA-iOS-forRelease/Sources/ViewControllers/CardDetail/CardDetailViewController.swift +++ b/NADA-iOS-forRelease/Sources/ViewControllers/CardDetail/CardDetailViewController.swift @@ -43,8 +43,8 @@ class CardDetailViewController: UIViewController { private var isFront = true var status: Status = .group - var serverGroups: Groups? - var groupId: Int? + var serverGroups: [String]? + var groupName: String? override func viewDidLoad() { super.viewDidLoad() @@ -122,7 +122,7 @@ extension CardDetailViewController { .setTitle("그룹선택") .setHeight(386) nextVC.status = .detail - nextVC.groupId = self.groupId + nextVC.groupName = self.groupName nextVC.serverGroups = self.serverGroups nextVC.cardDataModel = self.cardDataModel nextVC.modalPresentationStyle = .overFullScreen @@ -134,7 +134,7 @@ extension CardDetailViewController { message: "명함을 정말 삭제하시겠습니까?", deleteAction: { _ in // 명함 삭제 서버통신 - self.cardDeleteInGroupWithAPI(groupID: self.groupId ?? 0, cardID: self.cardDataModel?.cardUUID ?? "") +// self.cardDeleteInGroupWithAPI(groupID: self.groupId ?? 0, cardID: self.cardDataModel?.cardUUID ?? "") }) }) let options = UIMenu(title: "options", options: .displayInline, children: [changeGroup, deleteCard]) @@ -212,7 +212,7 @@ extension CardDetailViewController { // MARK: - @objc Methods @objc func didRecieveDataNotification(_ notification: Notification) { - groupId = notification.object as? Int ?? 0 + groupName = notification.object as? String ?? "" } @objc diff --git a/NADA-iOS-forRelease/Sources/ViewControllers/Home/VC/HomeViewController.swift b/NADA-iOS-forRelease/Sources/ViewControllers/Home/VC/HomeViewController.swift index 1bfdb760..26d1656f 100644 --- a/NADA-iOS-forRelease/Sources/ViewControllers/Home/VC/HomeViewController.swift +++ b/NADA-iOS-forRelease/Sources/ViewControllers/Home/VC/HomeViewController.swift @@ -293,7 +293,7 @@ extension HomeViewController { } } private func cardAddInGroupWithAPI(cardUUID: String, completion: @escaping () -> Void) { - GroupAPI.shared.cardAddInGroup(cardRequest: CardAddInGroupRequest(cardUUID: cardUUID, cardGroupID: 1)) { response in + GroupAPI.shared.cardAddInGroup(cardRequest: CardAddInGroupRequest(cardGroupName: nil, cardUUID: cardUUID)) { response in switch response { case .success: completion() diff --git a/NADA-iOS-forRelease/Sources/ViewControllers/TabBar/TabBarViewController.swift b/NADA-iOS-forRelease/Sources/ViewControllers/TabBar/TabBarViewController.swift index bfcf131d..41e96776 100644 --- a/NADA-iOS-forRelease/Sources/ViewControllers/TabBar/TabBarViewController.swift +++ b/NADA-iOS-forRelease/Sources/ViewControllers/TabBar/TabBarViewController.swift @@ -121,7 +121,7 @@ extension TabBarViewController { } } private func cardAddInGroupWithAPI(cardUUID: String, completion: @escaping () -> Void) { - GroupAPI.shared.cardAddInGroup(cardRequest: CardAddInGroupRequest(cardUUID: cardUUID, cardGroupID: 1)) { response in + GroupAPI.shared.cardAddInGroup(cardRequest: CardAddInGroupRequest(cardGroupName: nil, cardUUID: cardUUID)) { response in switch response { case .success: completion() From 6aa000c30e9004bf740b547c98220dbb556ecf75 Mon Sep 17 00:00:00 2001 From: dlwns33 Date: Mon, 1 May 2023 22:16:58 +0900 Subject: [PATCH 08/17] =?UTF-8?q?fix:=20=EA=B7=B8=EB=A3=B9=20=EC=95=88=20?= =?UTF-8?q?=EB=AA=85=ED=95=A8=20=EC=82=AD=EC=A0=9C=20API=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(#464)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Group/CardsInGroupResponse.swift | 37 +++++++++----- .../NetworkService/Group/GroupAPI.swift | 4 +- .../NetworkService/Group/GroupService.swift | 11 ++-- .../CardDetail/CardDetailViewController.swift | 6 ++- .../Group/GroupViewController.swift | 51 ++++++++++--------- 5 files changed, 64 insertions(+), 45 deletions(-) diff --git a/NADA-iOS-forRelease/Sources/NetworkModel/Group/CardsInGroupResponse.swift b/NADA-iOS-forRelease/Sources/NetworkModel/Group/CardsInGroupResponse.swift index 60269d25..c1126ab2 100644 --- a/NADA-iOS-forRelease/Sources/NetworkModel/Group/CardsInGroupResponse.swift +++ b/NADA-iOS-forRelease/Sources/NetworkModel/Group/CardsInGroupResponse.swift @@ -19,18 +19,27 @@ struct CardsInGroupResponse: Codable { // MARK: - Cards struct FrontCard: Codable { - let birth: String - let cardID: Int - let cardImage, cardName, cardType, cardUUID: String - let departmentName, instagram, mailAddress, mbti: String - let phoneNumber, tmi, twitter, urls: String - let userName: String + let cardID: Int + let cardUUID, cardType, cardName, departmentName: String + let userName, birth, mbti, instagram: String + let twitter, mailAddress: String? + let phoneNumber: String + let urls: [String] + let cardTastes: [CardTaste] + let tmi: String? + let cardImage: String + let isRepresentative: Bool - enum CodingKeys: String, CodingKey { - case birth - case cardID = "cardId" - case cardImage, cardName, cardType - case cardUUID = "cardUuid" - case departmentName, instagram, mailAddress, mbti, phoneNumber, tmi, twitter, urls, userName - } -} + enum CodingKeys: String, CodingKey { + case cardID = "cardId" + case cardUUID = "cardUuid" + case cardType, cardName, departmentName, userName, birth, mbti, instagram, twitter, mailAddress, phoneNumber, urls, cardTastes, tmi, cardImage, isRepresentative + } +} + +// MARK: - CardTaste +struct CardTaste: Codable { + let cardTasteName: String + let sortOrder: Int + let isChoose: Bool +} diff --git a/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupAPI.swift b/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupAPI.swift index 1578aa79..04cf9bb6 100644 --- a/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupAPI.swift +++ b/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupAPI.swift @@ -15,8 +15,8 @@ public class GroupAPI { public init() { } - func cardDeleteInGroup(groupID: Int, cardID: String, completion: @escaping (NetworkResult) -> Void) { - groupProvider.request(.cardDeleteInGroup(groupID: groupID, cardID: cardID)) { (result) in + func cardDeleteInGroup(cardUuid: String, cardGroupName: String, completion: @escaping (NetworkResult) -> Void) { + groupProvider.request(.cardDeleteInGroup(cardUuid: cardUuid, cardGroupName: cardGroupName)) { (result) in switch result { case .success(let response): let statusCode = response.statusCode diff --git a/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupService.swift b/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupService.swift index 3c622a5e..052f8040 100644 --- a/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupService.swift +++ b/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupService.swift @@ -15,7 +15,7 @@ enum GroupService { case groupEdit(groupRequest: GroupEditRequest) case cardAddInGroup(cardRequest: CardAddInGroupRequest) case cardListFetchInGroup(cardListInGroupRequest: CardListInGroupRequest) - case cardDeleteInGroup(groupID: Int, cardID: String) + case cardDeleteInGroup(cardUuid: String, cardGroupName: String) case groupReset } @@ -49,8 +49,8 @@ extension GroupService: TargetType { return "/card-group/mapping" case .cardListFetchInGroup: return "/card-group/cards" - case .cardDeleteInGroup(let groupID, let cardID): - return "/group/\(groupID)/\(cardID)" + case .cardDeleteInGroup(let cardUuid, _): + return "/card-group/card/\(cardUuid)" } } @@ -75,8 +75,11 @@ extension GroupService: TargetType { switch self { case .groupListFetch: return .requestPlain - case .cardDeleteInGroup, .groupReset: + case .groupReset: return .requestPlain + case .cardDeleteInGroup(_, let cardGroupName): + return .requestParameters(parameters: ["cardGroupName": cardGroupName], + encoding: URLEncoding.queryString) case .groupDelete(let cardGroupName): return .requestParameters(parameters: ["cardGroupName": cardGroupName], encoding: URLEncoding.queryString) diff --git a/NADA-iOS-forRelease/Sources/ViewControllers/CardDetail/CardDetailViewController.swift b/NADA-iOS-forRelease/Sources/ViewControllers/CardDetail/CardDetailViewController.swift index 20f66b57..c2178792 100644 --- a/NADA-iOS-forRelease/Sources/ViewControllers/CardDetail/CardDetailViewController.swift +++ b/NADA-iOS-forRelease/Sources/ViewControllers/CardDetail/CardDetailViewController.swift @@ -45,6 +45,7 @@ class CardDetailViewController: UIViewController { var status: Status = .group var serverGroups: [String]? var groupName: String? + var cardType: String = "" override func viewDidLoad() { super.viewDidLoad() @@ -60,8 +61,8 @@ class CardDetailViewController: UIViewController { } extension CardDetailViewController { - func cardDeleteInGroupWithAPI(groupID: Int, cardID: String) { - GroupAPI.shared.cardDeleteInGroup(groupID: groupID, cardID: cardID) { response in + func cardDeleteInGroupWithAPI(cardUuid: String, cardGroupName: String) { + GroupAPI.shared.cardDeleteInGroup(cardUuid: cardUuid, cardGroupName: cardGroupName) { response in switch response { case .success: print("cardDeleteInGroupWithAPI - success") @@ -135,6 +136,7 @@ extension CardDetailViewController { deleteAction: { _ in // 명함 삭제 서버통신 // self.cardDeleteInGroupWithAPI(groupID: self.groupId ?? 0, cardID: self.cardDataModel?.cardUUID ?? "") + self.cardDeleteInGroupWithAPI(cardUuid: self.cardDataModel?.cardUUID ?? "", cardGroupName: self.groupName ?? "") }) }) let options = UIMenu(title: "options", options: .displayInline, children: [changeGroup, deleteCard]) diff --git a/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift b/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift index d29928b5..f02ae760 100644 --- a/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift +++ b/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift @@ -92,7 +92,7 @@ class GroupViewController: UIViewController { // 그룹 이름들을 담을 변수 생성 var serverGroups: [String]? = [] - var frontCards: [FrontCard]? = [] + var frontCards: [Card]? = [] var serverCardsWithBack: Card? var groupName: String = "" @@ -134,7 +134,7 @@ extension GroupViewController { cardsCollectionView.dataSource = self groupCollectionView.register(GroupCollectionViewCell.nib(), forCellWithReuseIdentifier: Const.Xib.groupCollectionViewCell) - cardsCollectionView.register(CardInGroupCollectionViewCell.nib(), forCellWithReuseIdentifier: Const.Xib.cardInGroupCollectionViewCell) + cardsCollectionView.register(FrontCardCell.nib(), forCellWithReuseIdentifier: FrontCardCell.className) } private func setUI() { @@ -212,7 +212,7 @@ extension GroupViewController { self.activityIndicator.stopAnimating() self.loadingBgView.removeFromSuperview() - if let cards = data as? [FrontCard] { + if let cards = data as? [Card] { self.frontCards = cards if self.frontCards?.count == 0 { self.emptyView.isHidden = false @@ -243,9 +243,9 @@ extension GroupViewController { guard let nextVC = UIStoryboard.init(name: Const.Storyboard.Name.cardDetail, bundle: nil).instantiateViewController(withIdentifier: Const.ViewController.Identifier.cardDetailViewController) as? CardDetailViewController else { return } nextVC.cardDataModel = card -// nextVC.groupId = self.groupId - // nextVC.serverGroups = self.serverGroups - // TODO: 고치세요 + nextVC.groupName = self.groupName + nextVC.serverGroups = self.serverGroups +// nextVC.cardType = card.cardType self.navigationController?.pushViewController(nextVC, animated: true) } case .requestErr(let message): @@ -306,26 +306,31 @@ extension GroupViewController: UICollectionViewDataSource { } return groupCell case cardsCollectionView: - guard let cardCell = collectionView.dequeueReusableCell(withReuseIdentifier: Const.Xib.cardInGroupCollectionViewCell, for: indexPath) as? CardInGroupCollectionViewCell else { +// guard let cardCell = collectionView.dequeueReusableCell(withReuseIdentifier: Const.Xib.cardInGroupCollectionViewCell, for: indexPath) as? CardInGroupCollectionViewCell else { +// return UICollectionViewCell() +// } + guard let cardCell = collectionView.dequeueReusableCell(withReuseIdentifier: FrontCardCell.className, for: indexPath) as? FrontCardCell else { return UICollectionViewCell() } - guard let frontCards = frontCards else { return UICollectionViewCell() } - cardCell.backgroundImageView.updateServerImage(frontCards[indexPath.row].cardImage) - cardCell.cardUUID = frontCards[indexPath.row].cardUUID - cardCell.titleLabel.text = frontCards[indexPath.row].cardName - cardCell.descriptionLabel.text = frontCards[indexPath.row].departmentName - cardCell.userNameLabel.text = frontCards[indexPath.row].userName - cardCell.birthLabel.text = frontCards[indexPath.row].birth - cardCell.mbtiLabel.text = frontCards[indexPath.row].mbti - cardCell.instagramIDLabel.text = frontCards[indexPath.row].instagram - cardCell.lineURLLabel.text = frontCards[indexPath.row].urls - if frontCards[indexPath.row].instagram == "" { - cardCell.instagramIcon.isHidden = true - } - if frontCards[indexPath.row].urls == "" { - cardCell.urlIcon.isHidden = true - } + guard let frontCards = frontCards else { return UICollectionViewCell() } +// cardCell.backgroundImageView.updateServerImage(frontCards[indexPath.row].cardImage) +// cardCell.cardUUID = frontCards[indexPath.row].cardUUID +// cardCell.titleLabel.text = frontCards[indexPath.row].cardName +// cardCell.descriptionLabel.text = frontCards[indexPath.row].departmentName +// cardCell.userNameLabel.text = frontCards[indexPath.row].userName +// cardCell.birthLabel.text = frontCards[indexPath.row].birth +// cardCell.mbtiLabel.text = frontCards[indexPath.row].mbti +// cardCell.instagramIDLabel.text = frontCards[indexPath.row].instagram +// cardCell.lineURLLabel.text = frontCards[indexPath.row].urls +// +// if frontCards[indexPath.row].instagram == "" { +// cardCell.instagramIcon.isHidden = true +// } +// if frontCards[indexPath.row].urls == "" { +// cardCell.urlIcon.isHidden = true +// } + cardCell.initCellFromServer(cardData: frontCards[indexPath.row], isShareable: false) return cardCell default: From 0d5810c2d49bb7d1808c05617ffcea9010e6a65a Mon Sep 17 00:00:00 2001 From: dlwns33 Date: Mon, 1 May 2023 22:25:04 +0900 Subject: [PATCH 09/17] =?UTF-8?q?fix:=20=EA=B7=B8=EB=A3=B9=20=EC=95=88=20?= =?UTF-8?q?=EB=AA=85=ED=95=A8=20=EA=B7=B8=EB=A3=B9=20=EB=B3=80=EA=B2=BD=20?= =?UTF-8?q?API=20=EC=88=98=EC=A0=95=20(#464)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...SelectGroupBottomSheetViewController.swift | 48 +++++++++---------- .../CardDetail/CardDetailViewController.swift | 1 - 2 files changed, 22 insertions(+), 27 deletions(-) diff --git a/NADA-iOS-forRelease/Sources/ViewControllers/BottomSheet/SelectGroupBottomSheetViewController.swift b/NADA-iOS-forRelease/Sources/ViewControllers/BottomSheet/SelectGroupBottomSheetViewController.swift index 101496f3..9db27d94 100644 --- a/NADA-iOS-forRelease/Sources/ViewControllers/BottomSheet/SelectGroupBottomSheetViewController.swift +++ b/NADA-iOS-forRelease/Sources/ViewControllers/BottomSheet/SelectGroupBottomSheetViewController.swift @@ -82,12 +82,11 @@ class SelectGroupBottomSheetViewController: CommonBottomSheetViewController { @objc func presentCardInfoViewController() { switch status { -// case .detail: -// changeGroupWithAPI(request: ChangeGroupRequest(cardID: cardDataModel?.cardUUID ?? "", -// userID: UserDefaults.standard.string(forKey: Const.UserDefaultsKey.userID) ?? "", -// groupID: groupName ?? 0, -// newGroupID: selectedGroup)) - case .add, .addWithQR, .detail: + case .detail: + cardDeleteInGroupWithAPI(cardUuid: cardDataModel?.cardUUID ?? "", cardGroupName: groupName ?? "") + cardAddInGroupWithAPI(cardRequest: CardAddInGroupRequest(cardGroupName: selectedGroup, + cardUUID: cardDataModel?.cardUUID ?? "")) + case .add, .addWithQR: cardAddInGroupWithAPI(cardRequest: CardAddInGroupRequest(cardGroupName: selectedGroup, cardUUID: cardDataModel?.cardUUID ?? "")) case .group: @@ -160,25 +159,22 @@ extension SelectGroupBottomSheetViewController { } } - func changeGroupWithAPI(request: ChangeGroupRequest) { - // FIXME: - cardAddInGroup 으로 변경. -// GroupAPI.shared.changeCardGroup(request: request) { response in -// switch response { -// case .success: -// NotificationCenter.default.post(name: Notification.Name.passDataToGroup, object: self.selectedGroupIndex, userInfo: nil) -// NotificationCenter.default.post(name: Notification.Name.passDataToDetail, object: self.selectedGroup, userInfo: nil) -// self.makeOKAlert(title: "", message: "그룹이 변경되었습니다.") { _ in -// self.hideBottomSheetAndGoBack() -// } -// case .requestErr(let message): -// print("changeGroupWithAPI - requestErr: \(message)") -// case .pathErr: -// print("changeGroupWithAPI - pathErr") -// case .serverErr: -// print("changeGroupWithAPI - serverErr") -// case .networkFail: -// print("changeGroupWithAPI - networkFail") -// } -// } + func cardDeleteInGroupWithAPI(cardUuid: String, cardGroupName: String) { + GroupAPI.shared.cardDeleteInGroup(cardUuid: cardUuid, cardGroupName: cardGroupName) { response in + switch response { + case .success: + print("cardDeleteInGroupWithAPI - success") + self.navigationController?.popViewController(animated: true) + case .requestErr(let message): + print("cardDeleteInGroupWithAPI - requestErr: \(message)") + case .pathErr: + print("cardDeleteInGroupWithAPI - pathErr") + case .serverErr: + print("cardDeleteInGroupWithAPI - serverErr") + case .networkFail: + print("cardDeleteInGroupWithAPI - networkFail") + } + + } } } diff --git a/NADA-iOS-forRelease/Sources/ViewControllers/CardDetail/CardDetailViewController.swift b/NADA-iOS-forRelease/Sources/ViewControllers/CardDetail/CardDetailViewController.swift index c2178792..8ec2f97c 100644 --- a/NADA-iOS-forRelease/Sources/ViewControllers/CardDetail/CardDetailViewController.swift +++ b/NADA-iOS-forRelease/Sources/ViewControllers/CardDetail/CardDetailViewController.swift @@ -135,7 +135,6 @@ extension CardDetailViewController { message: "명함을 정말 삭제하시겠습니까?", deleteAction: { _ in // 명함 삭제 서버통신 -// self.cardDeleteInGroupWithAPI(groupID: self.groupId ?? 0, cardID: self.cardDataModel?.cardUUID ?? "") self.cardDeleteInGroupWithAPI(cardUuid: self.cardDataModel?.cardUUID ?? "", cardGroupName: self.groupName ?? "") }) }) let options = UIMenu(title: "options", options: .displayInline, children: [changeGroup, deleteCard]) From ad7badf48cb0391568ee703a70aed98bc305385a Mon Sep 17 00:00:00 2001 From: dlwns33 Date: Mon, 1 May 2023 23:23:30 +0900 Subject: [PATCH 10/17] =?UTF-8?q?fix:=20=EA=B7=B8=EB=A3=B9=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20=EB=B6=84=EA=B8=B0=EC=B2=98=EB=A6=AC=20(#464)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...SelectGroupBottomSheetViewController.swift | 52 +++++++++++++++---- .../Group/GroupViewController.swift | 6 ++- 2 files changed, 47 insertions(+), 11 deletions(-) diff --git a/NADA-iOS-forRelease/Sources/ViewControllers/BottomSheet/SelectGroupBottomSheetViewController.swift b/NADA-iOS-forRelease/Sources/ViewControllers/BottomSheet/SelectGroupBottomSheetViewController.swift index 9db27d94..6fa8da88 100644 --- a/NADA-iOS-forRelease/Sources/ViewControllers/BottomSheet/SelectGroupBottomSheetViewController.swift +++ b/NADA-iOS-forRelease/Sources/ViewControllers/BottomSheet/SelectGroupBottomSheetViewController.swift @@ -17,6 +17,7 @@ class SelectGroupBottomSheetViewController: CommonBottomSheetViewController { var groupName: String? var status: Status = .add + var isChanging = false private let groupPicker: UIPickerView = { let pickerView = UIPickerView() @@ -83,9 +84,10 @@ class SelectGroupBottomSheetViewController: CommonBottomSheetViewController { @objc func presentCardInfoViewController() { switch status { case .detail: - cardDeleteInGroupWithAPI(cardUuid: cardDataModel?.cardUUID ?? "", cardGroupName: groupName ?? "") - cardAddInGroupWithAPI(cardRequest: CardAddInGroupRequest(cardGroupName: selectedGroup, - cardUUID: cardDataModel?.cardUUID ?? "")) + isChanging = true + changeGroupWithAPI(cardUuid: cardDataModel?.cardUUID ?? "", + cardGroupName: groupName ?? "", + changingTo: selectedGroup) case .add, .addWithQR: cardAddInGroupWithAPI(cardRequest: CardAddInGroupRequest(cardGroupName: selectedGroup, cardUUID: cardDataModel?.cardUUID ?? "")) @@ -139,13 +141,19 @@ extension SelectGroupBottomSheetViewController { GroupAPI.shared.cardAddInGroup(cardRequest: cardRequest) { response in switch response { case .success: - guard let nextVC = UIStoryboard.init(name: Const.Storyboard.Name.cardDetail, bundle: nil).instantiateViewController(withIdentifier: Const.ViewController.Identifier.cardDetailViewController) as? CardDetailViewController else { return } - nextVC.status = self.status - nextVC.cardDataModel = self.cardDataModel - nextVC.groupName = self.selectedGroup - nextVC.serverGroups = self.serverGroups - NotificationCenter.default.post(name: Notification.Name.passDataToGroup, object: self.selectedGroupIndex, userInfo: nil) - self.hideBottomSheetAndPresentVC(nextViewController: nextVC) + if self.isChanging { + self.makeOKAlert(title: "", message: "그룹이 변경되었습니다.") { _ in + self.hideBottomSheetAndGoBack() + } + } else { + guard let nextVC = UIStoryboard.init(name: Const.Storyboard.Name.cardDetail, bundle: nil).instantiateViewController(withIdentifier: Const.ViewController.Identifier.cardDetailViewController) as? CardDetailViewController else { return } + nextVC.status = self.status + nextVC.cardDataModel = self.cardDataModel + nextVC.groupName = self.selectedGroup + nextVC.serverGroups = self.serverGroups + NotificationCenter.default.post(name: Notification.Name.passDataToGroup, object: self.selectedGroupIndex, userInfo: nil) + self.hideBottomSheetAndPresentVC(nextViewController: nextVC) + } case .requestErr(let message): print("postCardAddInGroupWithAPI - requestErr", message) self.showToast(message: message as? String ?? "", font: UIFont.button03, view: "wrongCard") @@ -177,4 +185,28 @@ extension SelectGroupBottomSheetViewController { } } + + func changeGroupWithAPI(cardUuid: String, cardGroupName: String, changingTo: String) { + GroupAPI.shared.cardDeleteInGroup(cardUuid: cardUuid, cardGroupName: cardGroupName) { response in + switch response { + case .success: + print("cardDeleteInGroupWithAPI - success") + self.cardAddInGroupWithAPI(cardRequest: CardAddInGroupRequest(cardGroupName: changingTo, + cardUUID: self.cardDataModel?.cardUUID ?? "")) + NotificationCenter.default.post(name: Notification.Name.passDataToGroup, object: self.selectedGroupIndex, userInfo: nil) + NotificationCenter.default.post(name: Notification.Name.passDataToDetail, object: self.selectedGroup, userInfo: nil) + self.makeOKAlert(title: "", message: "그룹이 변경되었습니다.") { _ in + self.hideBottomSheetAndGoBack() + } + case .requestErr(let message): + print("cardDeleteInGroupWithAPI - requestErr: \(message)") + case .pathErr: + print("cardDeleteInGroupWithAPI - pathErr") + case .serverErr: + print("cardDeleteInGroupWithAPI - serverErr") + case .networkFail: + print("cardDeleteInGroupWithAPI - networkFail") + } + } + } } diff --git a/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift b/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift index f02ae760..62f9086f 100644 --- a/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift +++ b/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift @@ -184,8 +184,9 @@ extension GroupViewController { if let group = data as? [String] { self.serverGroups = group self.groupCollectionView.reloadData() + print("selectedRow: ", self.selectedRow) if group[self.selectedRow] != "미분류" { self.groupName = group[self.selectedRow] } - self.cardListInGroupWithAPI(cardListInGroupRequest: CardListInGroupRequest(pageNo: 1, pageSize: 10, groupName: self.groupName)) { + self.cardListInGroupWithAPI(cardListInGroupRequest: CardListInGroupRequest(pageNo: 1, pageSize: 6, groupName: self.groupName)) { if self.frontCards?.count != 0 { self.cardsCollectionView.scrollToItem(at: IndexPath(item: 0, section: 0), at: .top, animated: false) } @@ -211,6 +212,8 @@ extension GroupViewController { case .success(let data): self.activityIndicator.stopAnimating() self.loadingBgView.removeFromSuperview() + // TODO: API 수정되면 밑에 리로드 지우기 + self.cardsCollectionView.reloadData() if let cards = data as? [Card] { self.frontCards = cards @@ -220,6 +223,7 @@ extension GroupViewController { self.emptyView.isHidden = true } self.cardsCollectionView.reloadData() + print("✅") } // completion() print("cardListInGroupWithAPI - success") From 9e844581be96786f8934246fb6ef7c456ed99bfb Mon Sep 17 00:00:00 2001 From: dlwns33 Date: Tue, 2 May 2023 10:30:17 +0900 Subject: [PATCH 11/17] =?UTF-8?q?fix:=20=EA=B7=B8=EB=A3=B9=20=EC=95=88=20?= =?UTF-8?q?=EB=AA=85=ED=95=A8=20cell=20=EA=B0=84=EA=B2=A9=20=EC=A1=B0?= =?UTF-8?q?=EC=A0=95=20(#464)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Cells/CardCell/CompanyFrontCardCell.xib | 2 +- .../Cells/CardCell/FanFrontCardCell.swift | 29 +++++++++++++++++++ .../Cells/CardCell/FanFrontCardCell.xib | 18 ++++++++---- .../Sources/Cells/CardCell/FrontCardCell.xib | 4 +-- .../Group/GroupViewController.swift | 5 ++-- 5 files changed, 48 insertions(+), 10 deletions(-) diff --git a/NADA-iOS-forRelease/Sources/Cells/CardCell/CompanyFrontCardCell.xib b/NADA-iOS-forRelease/Sources/Cells/CardCell/CompanyFrontCardCell.xib index 87ef0005..396670ff 100644 --- a/NADA-iOS-forRelease/Sources/Cells/CardCell/CompanyFrontCardCell.xib +++ b/NADA-iOS-forRelease/Sources/Cells/CardCell/CompanyFrontCardCell.xib @@ -9,7 +9,7 @@ - + diff --git a/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.swift b/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.swift index 3e1c8168..508aca4b 100644 --- a/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.swift +++ b/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.swift @@ -34,6 +34,19 @@ class FanFrontCardCell: CardCell { @IBOutlet weak var secondURLStackView: UIStackView! @IBOutlet weak var totalStackView: UIStackView! + @IBOutlet weak var titleLabelTop: NSLayoutConstraint! + @IBOutlet weak var titleLabelBottom: NSLayoutConstraint! + @IBOutlet weak var titleLabelLeading: NSLayoutConstraint! + @IBOutlet weak var userNameBottom: NSLayoutConstraint! + @IBOutlet weak var totalStackviewBottom: NSLayoutConstraint! + @IBOutlet weak var totalStackviewLeading: NSLayoutConstraint! + @IBOutlet weak var totalStackviewTrailing: NSLayoutConstraint! + + @IBOutlet weak var birthImageViewWidth: NSLayoutConstraint! + @IBOutlet weak var snsImageViewWidth: NSLayoutConstraint! + @IBOutlet weak var firstUrlWidth: NSLayoutConstraint! + @IBOutlet weak var secondUrlWidth: NSLayoutConstraint! + // MARK: - Life Cycle override func awakeFromNib() { @@ -76,6 +89,22 @@ extension FanFrontCardCell { firstURLStackView.alignment = .center secondURLStackView.alignment = .center } + func setConstraints() { + let constraints = [titleLabelTop, titleLabelBottom, titleLabelLeading, + userNameBottom, totalStackviewBottom, totalStackviewLeading, totalStackviewTrailing] + let labels = [titleLabel, userNameLabel, birthLabel, snsLabel, firstURLLabel, secondURLLabel] + let widths = [birthImageViewWidth, snsImageViewWidth, firstUrlWidth, secondUrlWidth] + constraints.forEach { + $0?.constant = ($0?.constant ?? 0) * (258/540) + } + labels.forEach { + $0?.font = $0?.font.withSize(12) + } + widths.forEach { + $0?.constant = 12 + } + totalStackView.spacing = 5 + } private func setTapGesture() { snsLabel.isUserInteractionEnabled = true let instagramTapGesture = UITapGestureRecognizer(target: self, action: #selector(tapSNSLabel)) diff --git a/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.xib b/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.xib index cb4cd186..99ba57bd 100644 --- a/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.xib +++ b/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.xib @@ -9,7 +9,7 @@ - + @@ -49,7 +49,6 @@ - diff --git a/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift b/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift index 6dc1bd67..473f2ba5 100644 --- a/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift +++ b/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift @@ -134,7 +134,9 @@ extension GroupViewController { cardsCollectionView.dataSource = self groupCollectionView.register(GroupCollectionViewCell.nib(), forCellWithReuseIdentifier: Const.Xib.groupCollectionViewCell) + cardsCollectionView.register(FrontCardCell.nib(), forCellWithReuseIdentifier: FrontCardCell.className) cardsCollectionView.register(FanFrontCardCell.nib(), forCellWithReuseIdentifier: FanFrontCardCell.className) + cardsCollectionView.register(CompanyFrontCardCell.nib(), forCellWithReuseIdentifier: CompanyFrontCardCell.className) } private func setUI() { @@ -310,34 +312,32 @@ extension GroupViewController: UICollectionViewDataSource { } return groupCell case cardsCollectionView: -// guard let cardCell = collectionView.dequeueReusableCell(withReuseIdentifier: Const.Xib.cardInGroupCollectionViewCell, for: indexPath) as? CardInGroupCollectionViewCell else { -// return UICollectionViewCell() -// } - guard let cardCell = collectionView.dequeueReusableCell(withReuseIdentifier: FanFrontCardCell.className, for: indexPath) as? FanFrontCardCell else { + guard let frontCards = frontCards else { return UICollectionViewCell() } + switch frontCards[indexPath.row].cardType { + case "BASIC": + guard let cardCell = collectionView.dequeueReusableCell(withReuseIdentifier: FrontCardCell.className, for: indexPath) as? FrontCardCell else { + return UICollectionViewCell() + } + cardCell.initCellFromServer(cardData: frontCards[indexPath.row], isShareable: false) + cardCell.setConstraints() + return cardCell + case "FAN": + guard let cardCell = collectionView.dequeueReusableCell(withReuseIdentifier: FanFrontCardCell.className, for: indexPath) as? FanFrontCardCell else { + return UICollectionViewCell() + } + cardCell.initCellFromServer(cardData: frontCards[indexPath.row], isShareable: false) + cardCell.setConstraints() + return cardCell + case "COMPANY": + guard let cardCell = collectionView.dequeueReusableCell(withReuseIdentifier: CompanyFrontCardCell.className, for: indexPath) as? CompanyFrontCardCell else { + return UICollectionViewCell() + } + cardCell.initCellFromServer(cardData: frontCards[indexPath.row], isShareable: false) +// cardCell.setConstraints() + return cardCell + default: return UICollectionViewCell() } - - guard let frontCards = frontCards else { return UICollectionViewCell() } -// cardCell.backgroundImageView.updateServerImage(frontCards[indexPath.row].cardImage) -// cardCell.cardUUID = frontCards[indexPath.row].cardUUID -// cardCell.titleLabel.text = frontCards[indexPath.row].cardName -// cardCell.descriptionLabel.text = frontCards[indexPath.row].departmentName -// cardCell.userNameLabel.text = frontCards[indexPath.row].userName -// cardCell.birthLabel.text = frontCards[indexPath.row].birth -// cardCell.mbtiLabel.text = frontCards[indexPath.row].mbti -// cardCell.instagramIDLabel.text = frontCards[indexPath.row].instagram -// cardCell.lineURLLabel.text = frontCards[indexPath.row].urls -// -// if frontCards[indexPath.row].instagram == "" { -// cardCell.instagramIcon.isHidden = true -// } -// if frontCards[indexPath.row].urls == "" { -// cardCell.urlIcon.isHidden = true -// } - cardCell.initCellFromServer(cardData: frontCards[indexPath.row], isShareable: false) - cardCell.setConstraints() - - return cardCell default: return UICollectionViewCell() } From 6f7cfd998e7069c7d7a22e9a240a32b4332c8a16 Mon Sep 17 00:00:00 2001 From: dlwns33 Date: Tue, 2 May 2023 12:00:08 +0900 Subject: [PATCH 13/17] =?UTF-8?q?fix:=20=EA=B7=B8=EB=A3=B9=20=EC=95=88=20?= =?UTF-8?q?=EB=AA=85=ED=95=A8=20cell=20companycard=20=EA=B0=84=EA=B2=A9=20?= =?UTF-8?q?=EC=A1=B0=EC=A0=95=20(#464)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Cells/CardCell/CompanyFrontCardCell.swift | 33 +++++++++++++++++++ .../Cells/CardCell/CompanyFrontCardCell.xib | 24 +++++++++++--- .../Cells/CardCell/FanFrontCardCell.swift | 2 +- .../Cells/CardCell/FrontCardCell.swift | 2 +- .../Group/GroupViewController.swift | 2 +- 5 files changed, 55 insertions(+), 8 deletions(-) diff --git a/NADA-iOS-forRelease/Sources/Cells/CardCell/CompanyFrontCardCell.swift b/NADA-iOS-forRelease/Sources/Cells/CardCell/CompanyFrontCardCell.swift index f7d0f7ac..1b38ce81 100644 --- a/NADA-iOS-forRelease/Sources/Cells/CardCell/CompanyFrontCardCell.swift +++ b/NADA-iOS-forRelease/Sources/Cells/CardCell/CompanyFrontCardCell.swift @@ -37,6 +37,21 @@ class CompanyFrontCardCell: CardCell { @IBOutlet weak var linkURLStackView: UIStackView! @IBOutlet weak var totalStackView: UIStackView! + @IBOutlet weak var titleLabelTop: NSLayoutConstraint! + @IBOutlet weak var titleLabelLeading: NSLayoutConstraint! + @IBOutlet weak var descLabelTop: NSLayoutConstraint! + @IBOutlet weak var userNameLabelTop: NSLayoutConstraint! + @IBOutlet weak var birthdayImageTop: NSLayoutConstraint! + @IBOutlet weak var birthdayImageWidth: NSLayoutConstraint! + @IBOutlet weak var mbtiImageLeading: NSLayoutConstraint! + @IBOutlet weak var mbtiImageWidth: NSLayoutConstraint! + @IBOutlet weak var mailImageWidth: NSLayoutConstraint! + @IBOutlet weak var phoneImageWidth: NSLayoutConstraint! + @IBOutlet weak var urlImageWidth: NSLayoutConstraint! + @IBOutlet weak var totalStackviewBottom: NSLayoutConstraint! + @IBOutlet weak var totalStackviewLeading: NSLayoutConstraint! + @IBOutlet weak var totalStackviewTrailing: NSLayoutConstraint! + // MARK: - Life Cycle override func awakeFromNib() { @@ -81,6 +96,24 @@ extension CompanyFrontCardCell { linkURLStackView.alignment = .center } + func setConstraints() { + let constraints = [titleLabelTop, titleLabelLeading, descLabelTop, + userNameLabelTop, birthdayImageTop, mbtiImageLeading, totalStackviewBottom, totalStackviewLeading, totalStackviewTrailing] + let labels = [titleLabel, descriptionLabel, userNameLabel, birthLabel, mbtiLabel, phoneNumberLabel, linkURLLabel, mailLabel] + let widths = [birthdayImageWidth, mbtiImageWidth, mailImageWidth, phoneImageWidth, urlImageWidth] + + constraints.forEach { + $0?.constant = ($0?.constant ?? 0) * (258/540) + } + labels.forEach { + $0?.font = $0?.font.withSize(($0?.font.pointSize ?? 0) * 0.65) + } + widths.forEach { + $0?.constant = 12 + } + totalStackView.spacing = 5 + print("✅✅") + } private func setTapGesture() { mailLabel.isUserInteractionEnabled = true let mailTapGesture = UITapGestureRecognizer(target: self, action: #selector(tapMailLabel)) diff --git a/NADA-iOS-forRelease/Sources/Cells/CardCell/CompanyFrontCardCell.xib b/NADA-iOS-forRelease/Sources/Cells/CardCell/CompanyFrontCardCell.xib index 396670ff..452b0a63 100644 --- a/NADA-iOS-forRelease/Sources/Cells/CardCell/CompanyFrontCardCell.xib +++ b/NADA-iOS-forRelease/Sources/Cells/CardCell/CompanyFrontCardCell.xib @@ -55,7 +55,7 @@ - + diff --git a/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.swift b/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.swift index 0ef8afb8..82ff9e51 100644 --- a/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.swift +++ b/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.swift @@ -98,7 +98,7 @@ extension FanFrontCardCell { $0?.constant = ($0?.constant ?? 0) * (258/540) } labels.forEach { - $0?.font = $0?.font.withSize(12) + $0?.font = $0?.font.withSize(($0?.font.pointSize ?? 0) * 0.65) } widths.forEach { $0?.constant = 12 diff --git a/NADA-iOS-forRelease/Sources/Cells/CardCell/FrontCardCell.swift b/NADA-iOS-forRelease/Sources/Cells/CardCell/FrontCardCell.swift index 0ff9cc71..7461493b 100644 --- a/NADA-iOS-forRelease/Sources/Cells/CardCell/FrontCardCell.swift +++ b/NADA-iOS-forRelease/Sources/Cells/CardCell/FrontCardCell.swift @@ -103,7 +103,7 @@ extension FrontCardCell { $0?.constant = ($0?.constant ?? 0) * (258/540) } labels.forEach { - $0?.font = $0?.font.withSize(12) + $0?.font = $0?.font.withSize(($0?.font.pointSize ?? 0) * 0.65) } widths.forEach { $0?.constant = 12 diff --git a/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift b/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift index 473f2ba5..0091d16c 100644 --- a/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift +++ b/NADA-iOS-forRelease/Sources/ViewControllers/Group/GroupViewController.swift @@ -333,7 +333,7 @@ extension GroupViewController: UICollectionViewDataSource { return UICollectionViewCell() } cardCell.initCellFromServer(cardData: frontCards[indexPath.row], isShareable: false) -// cardCell.setConstraints() + cardCell.setConstraints() return cardCell default: return UICollectionViewCell() From 2deff1aa22251ab576f3284e881925c50d032257 Mon Sep 17 00:00:00 2001 From: dlwns33 Date: Tue, 2 May 2023 12:36:24 +0900 Subject: [PATCH 14/17] =?UTF-8?q?fix:=20=EB=B9=84=EC=9C=A8=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9=EB=90=98=EC=96=B4=EC=9E=88=EC=A7=80=20=EC=95=8A?= =?UTF-8?q?=EC=95=98=EB=8D=98=20=EB=B6=80=EB=B6=84=20=EC=88=98=EC=A0=95=20?= =?UTF-8?q?(#464)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Cells/CardCell/CompanyFrontCardCell.swift | 2 +- .../Sources/Cells/CardCell/FanFrontCardCell.swift | 2 +- .../Sources/Cells/CardCell/FrontCardCell.swift | 5 +++-- NADA-iOS-forRelease/Sources/Cells/CardCell/FrontCardCell.xib | 1 + 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/NADA-iOS-forRelease/Sources/Cells/CardCell/CompanyFrontCardCell.swift b/NADA-iOS-forRelease/Sources/Cells/CardCell/CompanyFrontCardCell.swift index 1b38ce81..dc5262a4 100644 --- a/NADA-iOS-forRelease/Sources/Cells/CardCell/CompanyFrontCardCell.swift +++ b/NADA-iOS-forRelease/Sources/Cells/CardCell/CompanyFrontCardCell.swift @@ -106,7 +106,7 @@ extension CompanyFrontCardCell { $0?.constant = ($0?.constant ?? 0) * (258/540) } labels.forEach { - $0?.font = $0?.font.withSize(($0?.font.pointSize ?? 0) * 0.65) + $0?.font = $0?.font.withSize(($0?.font.pointSize ?? 0) * 0.6) } widths.forEach { $0?.constant = 12 diff --git a/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.swift b/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.swift index 82ff9e51..2dbf5152 100644 --- a/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.swift +++ b/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.swift @@ -98,7 +98,7 @@ extension FanFrontCardCell { $0?.constant = ($0?.constant ?? 0) * (258/540) } labels.forEach { - $0?.font = $0?.font.withSize(($0?.font.pointSize ?? 0) * 0.65) + $0?.font = $0?.font.withSize(($0?.font.pointSize ?? 0) * 0.6) } widths.forEach { $0?.constant = 12 diff --git a/NADA-iOS-forRelease/Sources/Cells/CardCell/FrontCardCell.swift b/NADA-iOS-forRelease/Sources/Cells/CardCell/FrontCardCell.swift index 7461493b..4a2452f8 100644 --- a/NADA-iOS-forRelease/Sources/Cells/CardCell/FrontCardCell.swift +++ b/NADA-iOS-forRelease/Sources/Cells/CardCell/FrontCardCell.swift @@ -46,6 +46,7 @@ class FrontCardCell: CardCell { @IBOutlet weak var instagramImageWidth: NSLayoutConstraint! @IBOutlet weak var phoneImageWidth: NSLayoutConstraint! @IBOutlet weak var urlImageWidth: NSLayoutConstraint! + @IBOutlet weak var mbtiImageWidth: NSLayoutConstraint! @IBOutlet weak var totalStackViewBottom: NSLayoutConstraint! @IBOutlet weak var totalStackViewLeading: NSLayoutConstraint! @IBOutlet weak var totalStackViewTrailing: NSLayoutConstraint! @@ -98,12 +99,12 @@ extension FrontCardCell { let constraints = [titleLabelTop, titleLabelLeading, descLabelTop, usernameLabelTop, birthdayImageTop, mbtiImageLeading, totalStackViewBottom, totalStackViewLeading, totalStackViewTrailing] let labels = [titleLabel, descriptionLabel, userNameLabel, birthLabel, mbtiLabel, instagramIDLabel, phoneNumberLabel, linkURLLabel] - let widths = [birthdayImageWidth, phoneImageWidth, urlImageWidth] + let widths = [birthdayImageWidth, phoneImageWidth, urlImageWidth, mbtiImageWidth] constraints.forEach { $0?.constant = ($0?.constant ?? 0) * (258/540) } labels.forEach { - $0?.font = $0?.font.withSize(($0?.font.pointSize ?? 0) * 0.65) + $0?.font = $0?.font.withSize(($0?.font.pointSize ?? 0) * 0.6) } widths.forEach { $0?.constant = 12 diff --git a/NADA-iOS-forRelease/Sources/Cells/CardCell/FrontCardCell.xib b/NADA-iOS-forRelease/Sources/Cells/CardCell/FrontCardCell.xib index 7f17f567..c75926e9 100644 --- a/NADA-iOS-forRelease/Sources/Cells/CardCell/FrontCardCell.xib +++ b/NADA-iOS-forRelease/Sources/Cells/CardCell/FrontCardCell.xib @@ -196,6 +196,7 @@ + From d3d86d2ca34f0aff17533b880d96e0f8e633b1da Mon Sep 17 00:00:00 2001 From: dlwns33 Date: Tue, 2 May 2023 12:41:59 +0900 Subject: [PATCH 15/17] =?UTF-8?q?fix:=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20?= =?UTF-8?q?=EB=B9=84=EC=9C=A8=20=EC=A1=B0=EC=A0=95=20(#464)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Cells/CardCell/CompanyFrontCardCell.swift | 2 +- .../Sources/Cells/CardCell/FanFrontCardCell.swift | 2 +- .../Sources/Cells/CardCell/FanFrontCardCell.xib | 3 +++ NADA-iOS-forRelease/Sources/Cells/CardCell/FrontCardCell.swift | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/NADA-iOS-forRelease/Sources/Cells/CardCell/CompanyFrontCardCell.swift b/NADA-iOS-forRelease/Sources/Cells/CardCell/CompanyFrontCardCell.swift index dc5262a4..c9bf44ad 100644 --- a/NADA-iOS-forRelease/Sources/Cells/CardCell/CompanyFrontCardCell.swift +++ b/NADA-iOS-forRelease/Sources/Cells/CardCell/CompanyFrontCardCell.swift @@ -103,7 +103,7 @@ extension CompanyFrontCardCell { let widths = [birthdayImageWidth, mbtiImageWidth, mailImageWidth, phoneImageWidth, urlImageWidth] constraints.forEach { - $0?.constant = ($0?.constant ?? 0) * (258/540) + $0?.constant = ($0?.constant ?? 0) * 0.6 } labels.forEach { $0?.font = $0?.font.withSize(($0?.font.pointSize ?? 0) * 0.6) diff --git a/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.swift b/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.swift index 2dbf5152..d2a4d63e 100644 --- a/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.swift +++ b/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.swift @@ -95,7 +95,7 @@ extension FanFrontCardCell { let labels = [titleLabel, userNameLabel, birthLabel, snsLabel, firstURLLabel, secondURLLabel] let widths = [birthImageViewWidth, snsImageViewWidth, firstUrlWidth, secondUrlWidth] constraints.forEach { - $0?.constant = ($0?.constant ?? 0) * (258/540) + $0?.constant = ($0?.constant ?? 0) * 0.6 } labels.forEach { $0?.font = $0?.font.withSize(($0?.font.pointSize ?? 0) * 0.6) diff --git a/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.xib b/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.xib index 99ba57bd..62db0d52 100644 --- a/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.xib +++ b/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.xib @@ -49,6 +49,7 @@ +