From fc5d3259e501144ab7ab129f444cea6dc885a251 Mon Sep 17 00:00:00 2001 From: hyun99999 Date: Mon, 24 Apr 2023 19:02:44 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20initCell=20=EB=A9=94=EC=84=9C=EB=93=9C?= =?UTF-8?q?=20=ED=8C=8C=EB=9D=BC=EB=AF=B8=ED=84=B0=20=EC=88=98=EC=A0=95=20?= =?UTF-8?q?(#450)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Cells/CardCell/FanFrontCardCell.swift | 2 +- .../Cells/CardCell/FrontCardCell.swift | 46 +++++++++---------- 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.swift b/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.swift index 68118688..3e1c8168 100644 --- a/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.swift +++ b/NADA-iOS-forRelease/Sources/Cells/CardCell/FanFrontCardCell.swift @@ -190,7 +190,7 @@ extension FanFrontCardCell { /// 명함 미리보기 시 사용. func initCell(_ backgroundImage: UIImage?, - frontCardDataModel: FrontCardDataModel) { + _ frontCardDataModel: FrontCardDataModel) { backgroundImageView.image = backgroundImage ?? UIImage() titleLabel.text = frontCardDataModel.cardName userNameLabel.text = frontCardDataModel.userName diff --git a/NADA-iOS-forRelease/Sources/Cells/CardCell/FrontCardCell.swift b/NADA-iOS-forRelease/Sources/Cells/CardCell/FrontCardCell.swift index b3684d50..59fea3bc 100644 --- a/NADA-iOS-forRelease/Sources/Cells/CardCell/FrontCardCell.swift +++ b/NADA-iOS-forRelease/Sources/Cells/CardCell/FrontCardCell.swift @@ -120,7 +120,7 @@ extension FrontCardCell { } } - /// 서버에서 image 를 URL 로 가져올 경우 사용. + /// 명함 조회 시 사용. func initCellFromServer(cardData: Card, isShareable: Bool) { self.cardData = cardData @@ -157,37 +157,33 @@ extension FrontCardCell { shareButton.isHidden = !isShareable } - /// 명함생성할 때 image 를 UIImage 로 가져올 경우 사용 + /// 명함 미리보기 시 사용. func initCell(_ backgroundImage: UIImage?, - _ cardTitle: String, - _ cardDescription: String, - _ userName: String, - _ birth: String, - _ mbti: String, - _ instagramID: String, - _ phoneNumber: String, - _ linkURL: String, - isShareable: Bool) { + _ frontCardDataModel: FrontCardDataModel) { backgroundImageView.image = backgroundImage ?? UIImage() - titleLabel.text = cardTitle - descriptionLabel.text = cardDescription - userNameLabel.text = userName - birthLabel.text = birth - mbtiLabel.text = mbti - instagramIDLabel.text = instagramID - phoneNumberLabel.text = phoneNumber - linkURLLabel.text = linkURL + titleLabel.text = frontCardDataModel.cardName + descriptionLabel.text = frontCardDataModel.departmentName + userNameLabel.text = frontCardDataModel.userName + birthLabel.text = frontCardDataModel.birth + mbtiLabel.text = frontCardDataModel.mbti + instagramIDLabel.text = frontCardDataModel.instagram + phoneNumberLabel.text = frontCardDataModel.phoneNumber - if instagramID.isEmpty { + if let urls = frontCardDataModel.urls { + if urls[0].isEmpty { + linkURLStackView.isHidden = true + } else { + linkURLLabel.text = urls[0] + } + } + + if frontCardDataModel.instagram?.isEmpty ?? false { instagramStackView.isHidden = true } - if phoneNumber.isEmpty { + if frontCardDataModel.phoneNumber?.isEmpty ?? false { phoneNumberStackView.isHidden = true } - if linkURL.isEmpty { - linkURLStackView.isHidden = true - } - shareButton.isHidden = !isShareable + shareButton.isHidden = true } }