Skip to content

Commit

Permalink
[FEAT] #140 - 명함 상세 서버
Browse files Browse the repository at this point in the history
  • Loading branch information
dlwns33 committed Dec 21, 2021
1 parent 30694cf commit b14fc50
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
<connections>
<outlet property="backButton" destination="ppy-17-v7q" id="mdc-dd-yGB"/>
<outlet property="cardView" destination="0P6-1k-dQm" id="qGN-9y-K4Y"/>
<outlet property="idLabel" destination="J0e-kR-6Zc" id="4il-d0-UMv"/>
<outlet property="optionButton" destination="YU7-vs-utH" id="Jg4-K3-dTV"/>
</connections>
</viewController>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public class CardAPI {
private func judgeCardDetailFetchStatus(by statusCode: Int, _ data: Data) -> NetworkResult<Any> {

let decoder = JSONDecoder()
guard let decodedData = try? decoder.decode(GenericResponse<Card>.self, from: data)
guard let decodedData = try? decoder.decode(GenericResponse<CardClass>.self, from: data)
else {
return .pathErr
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class CardDetailViewController: UIViewController {
@IBOutlet weak var optionButton: UIButton!
@IBOutlet weak var cardView: UIView!
@IBOutlet weak var backButton: UIButton!
@IBOutlet weak var idLabel: UILabel!

public var cardDataModel: Card?
private var isShareable: Bool = false
Expand All @@ -61,6 +62,7 @@ extension CardDetailViewController {
case .add:
backButton.setImage(UIImage(named: "iconClear"), for: .normal)
}
idLabel.text = cardDataModel?.cardID
}
private func setMenu() {
let changeGroup = UIAction(title: "그룹 변경",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,26 @@ extension GroupViewController {
CardAPI.shared.cardDetailFetch(cardID: cardID) { response in
switch response {
case .success(let data):
if let card = data as? Card {
self.serverCardsWithBack = card
if let card = data as? CardClass {
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(cardID: card.card.cardID,
background: card.card.background,
title: card.card.title,
name: card.card.name,
birthDate: card.card.birthDate,
mbti: card.card.mbti,
instagram: card.card.instagram,
link: card.card.link,
cardDescription: card.card.cardDescription,
isMincho: card.card.isMincho,
isSoju: card.card.isSoju,
isBoomuk: card.card.isBoomuk,
isSauced: card.card.isSauced,
oneTmi: card.card.oneTmi,
twoTmi: card.card.twoTmi,
threeTmi: card.card.threeTmi)
self.navigationController?.pushViewController(nextVC, animated: true)
}
case .requestErr(let message):
print("cardDetailFetchWithAPI - requestErr: \(message)")
Expand Down Expand Up @@ -292,22 +310,7 @@ extension GroupViewController: UICollectionViewDataSource {
case groupCollectionView:
cardListInGroupWithAPI(cardListInGroupRequest: CardListInGroupRequest(userId: "nada", groupId: serverGroups?.groups[indexPath.row].groupID ?? 0, offset: 0))
case cardsCollectionView:
// cardDetailFetchWithAPI(cardID: serverCards?.cards[indexPath.row].cardID ?? "")
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(cardID: serverCards?.cards[indexPath.row].cardID ?? "" ,
// background: <#T##String#>,
// title: serverCards?.cards[indexPath.row].title ?? "",
// name: serverCards?.cards[indexPath.row].name ?? "",
// birthDate: serverCards?.cards[indexPath.row].birthDate ?? "",
// mbti: serverCards?.cards[indexPath.row].mbti ?? "",
// instagram: serverCards?.cards[indexPath.row].instagram ?? "",
// link: serverCards?.cards[indexPath.row].link ?? "",
// cardDescription: serverCards?.cards[indexPath.row].cardDescription ?? "",
// isMincho: serverCards?.cards[indexPath.row].,
// isSoju: <#T##Bool#>, isBoomuk: <#T##Bool#>, isSauced: <#T##Bool#>,
// oneTMI: <#T##String?#>, twoTMI: <#T##String?#>, thirdTMI: <#T##String?#>)
navigationController?.pushViewController(nextVC, animated: true)
cardDetailFetchWithAPI(cardID: serverCards?.cards[indexPath.row].cardID ?? "")
default:
print(indexPath.row)
}
Expand Down

0 comments on commit b14fc50

Please sign in to comment.