diff --git a/NADA-iOS-forRelease/Sources/Cells/CardCell/CompanyFrontCardCell.swift b/NADA-iOS-forRelease/Sources/Cells/CardCell/CompanyFrontCardCell.swift index c9bf44ad..8f1662f5 100644 --- a/NADA-iOS-forRelease/Sources/Cells/CardCell/CompanyFrontCardCell.swift +++ b/NADA-iOS-forRelease/Sources/Cells/CardCell/CompanyFrontCardCell.swift @@ -15,6 +15,7 @@ class CompanyFrontCardCell: CardCell { // MARK: - Properties private var cardData: Card? + private var setConstraintDone = false // MARK: - @IBOutlet Properties @IBOutlet weak var backgroundImageView: UIImageView! @@ -97,6 +98,9 @@ extension CompanyFrontCardCell { linkURLStackView.alignment = .center } func setConstraints() { + if setConstraintDone { return } + setConstraintDone = true + let constraints = [titleLabelTop, titleLabelLeading, descLabelTop, userNameLabelTop, birthdayImageTop, mbtiImageLeading, totalStackviewBottom, totalStackviewLeading, totalStackviewTrailing] let labels = [titleLabel, descriptionLabel, userNameLabel, birthLabel, mbtiLabel, phoneNumberLabel, linkURLLabel, mailLabel] diff --git a/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.swift b/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.swift index d2a4d63e..cd90ddb9 100644 --- a/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.swift +++ b/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.swift @@ -14,6 +14,7 @@ class FanFrontCardCell: CardCell { // MARK: - Properties private var cardData: Card? + private var setConstraintDone = false // MARK: - @IBOutlet Properties @IBOutlet weak var backgroundImageView: UIImageView! @@ -90,10 +91,14 @@ extension FanFrontCardCell { secondURLStackView.alignment = .center } func setConstraints() { + if setConstraintDone { return } + setConstraintDone = true + 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) * 0.6 } diff --git a/NADA-iOS-forRelease/Sources/Cells/CardCell/FrontCardCell.swift b/NADA-iOS-forRelease/Sources/Cells/CardCell/FrontCardCell.swift index d35b33b8..e69dcae2 100644 --- a/NADA-iOS-forRelease/Sources/Cells/CardCell/FrontCardCell.swift +++ b/NADA-iOS-forRelease/Sources/Cells/CardCell/FrontCardCell.swift @@ -14,6 +14,7 @@ class FrontCardCell: CardCell { // MARK: - Properties private var cardData: Card? + private var setConstraintDone = false // MARK: - @IBOutlet Properties @IBOutlet weak var backgroundImageView: UIImageView! @@ -96,10 +97,14 @@ extension FrontCardCell { linkURLStackView.alignment = .center } func setConstraints() { + if setConstraintDone { return } + setConstraintDone = true + 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, mbtiImageWidth] + constraints.forEach { $0?.constant = ($0?.constant ?? 0) * 0.6 } diff --git a/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupService.swift b/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupService.swift index 9b9f8688..47353d10 100644 --- a/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupService.swift +++ b/NADA-iOS-forRelease/Sources/NetworkService/Group/GroupService.swift @@ -92,9 +92,14 @@ extension GroupService: TargetType { "cardUUID": groupRequest.cardUUID], encoding: JSONEncoding.default) case .cardListFetchInGroup(let cardListInGroupRequest): - return .requestParameters(parameters: ["pageNo": cardListInGroupRequest.pageNo, - "pageSize": cardListInGroupRequest.pageSize, - "groupName": cardListInGroupRequest.groupName], encoding: URLEncoding.queryString) + if cardListInGroupRequest.groupName == "미분류" { + return .requestParameters(parameters: ["pageNo": cardListInGroupRequest.pageNo, + "pageSize": cardListInGroupRequest.pageSize], encoding: URLEncoding.queryString) + } else { + return .requestParameters(parameters: ["pageNo": cardListInGroupRequest.pageNo, + "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 0091d16c..3f4641df 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: [Card]? = [] var serverCardsWithBack: Card? - var groupName: String = "" + var groupName: String = "미분류" var selectedRow = 0 private var offset = 0 @@ -187,7 +187,6 @@ extension GroupViewController { 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: 6, groupName: self.groupName)) { if self.frontCards?.count != 0 { self.cardsCollectionView.scrollToItem(at: IndexPath(item: 0, section: 0), at: .top, animated: false) @@ -347,11 +346,7 @@ extension GroupViewController: UICollectionViewDataSource { switch collectionView { case groupCollectionView: selectedRow = indexPath.row - if selectedRow == 0 { - self.groupName = "" - } else { - self.groupName = serverGroups?[indexPath.row] ?? "" - } + self.groupName = serverGroups?[indexPath.row] ?? "" offset = 0 frontCards?.removeAll() diff --git a/NADA-iOS-forRelease/Sources/ViewControllers/Home/VC/HomeViewController.swift b/NADA-iOS-forRelease/Sources/ViewControllers/Home/VC/HomeViewController.swift index 26d1656f..42687fc1 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(cardGroupName: nil, cardUUID: cardUUID)) { response in + GroupAPI.shared.cardAddInGroup(cardRequest: CardAddInGroupRequest(cardGroupName: "미분류", cardUUID: cardUUID)) { response in switch response { case .success: completion()