Skip to content

Commit

Permalink
Merge pull request #467 from dlwns33/feature/#466
Browse files Browse the repository at this point in the history
fix: 수정된 API 관련 에러사항 해결 #466
  • Loading branch information
dlwns33 authored May 2, 2023
2 parents ee55122 + 710021c commit 7518430
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 7518430

Please sign in to comment.