Skip to content

Commit

Permalink
Merge pull request #148 from hyun99999/feature/#145
Browse files Browse the repository at this point in the history
[FIX] #145 - 메인 flip 속도 조절 및 공유버튼 히든
  • Loading branch information
hyun99999 authored Dec 14, 2021
2 parents f6ef484 + 7f9097e commit 2d850e9
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 27 deletions.
27 changes: 15 additions & 12 deletions NADA-iOS-forRelease/Sources/Cells/CardCell/BackCardCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,34 +64,37 @@ extension BackCardCell {
_ isSauced: Bool,
_ firstTMI: String,
_ secondTMI: String,
_ thirdTMI: String) {
_ thirdTMI: String,
isShareable: Bool) {
if let bgImage = UIImage(named: backgroundImageString) {
self.backgroundImageView.image = bgImage
}

self.mintImageView.image = isMint == true ?
mintImageView.image = isMint == true ?
UIImage(named: "iconTasteOnMincho") : UIImage(named: "iconTasteOffMincho")
self.noMintImageView.image = isMint == false ?
noMintImageView.image = isMint == false ?
UIImage(named: "iconTasteOnBanmincho") : UIImage(named: "iconTasteOffBanmincho")

self.sojuImageView.image = isSoju == true ?
sojuImageView.image = isSoju == true ?
UIImage(named: "iconTasteOnSoju") : UIImage(named: "iconTasteOffSoju")
self.beerImageView.image = isSoju == false ?
beerImageView.image = isSoju == false ?
UIImage(named: "iconTasteOnBeer") : UIImage(named: "iconTasteOffBeer")

self.pourEatImageView.image = isBoomuk == true ?
pourEatImageView.image = isBoomuk == true ?
UIImage(named: "iconTasteOnBumeok") : UIImage(named: "iconTasteOffBumeok")
self.putSauceEatImageView.image = isBoomuk == false ?
putSauceEatImageView.image = isBoomuk == false ?
UIImage(named: "iconTasteOnZzik") : UIImage(named: "iconTasteOffZzik")

self.sauceChickenImageView.image = isSauced == true ?
sauceChickenImageView.image = isSauced == true ?
UIImage(named: "iconTasteOnSeasoned") : UIImage(named: "iconTasteOffSeasoned")
self.friedChickenImageView.image = isSauced == false ?
friedChickenImageView.image = isSauced == false ?
UIImage(named: "iconTasteOnFried") : UIImage(named: "iconTasteOffFried")

self.firstTmiLabel.text = firstTMI
self.secondTmiLabel.text = secondTMI
self.thirdTmiLabel.text = thirdTMI
firstTmiLabel.text = firstTMI
secondTmiLabel.text = secondTMI
thirdTmiLabel.text = thirdTMI

shareButton.isHidden = !isShareable
}

/// 명함생성할 때 image 를 UIImage 로 가져올 경우 사용
Expand Down
10 changes: 8 additions & 2 deletions NADA-iOS-forRelease/Sources/Cells/CardCell/FrontCardCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ extension FrontCardCell {
_ birth: String,
_ mbti: String,
_ instagramID: String,
_ linkURL: String) {
_ linkURL: String,
isShareable: Bool) {
if let bgImage = UIImage(named: backgroundImage) {
self.backgroundImageView.image = bgImage
}
Expand All @@ -112,6 +113,8 @@ extension FrontCardCell {
mbtiLabel.text = mbti
instagramIDLabel.text = instagramID
linkURLLabel.text = linkURL

shareButton.isHidden = !isShareable
}

/// 명함생성할 때 image 를 UIImage 로 가져올 경우 사용
Expand All @@ -122,7 +125,8 @@ extension FrontCardCell {
_ birth: String,
_ mbti: String,
_ instagramID: String,
_ linkURL: String) {
_ linkURL: String,
isShareable: Bool) {
backgroundImageView.image = backgroundImage ?? UIImage()
titleLabel.text = cardTitle
descriptionLabel.text = cardDescription
Expand All @@ -131,5 +135,7 @@ extension FrontCardCell {
mbtiLabel.text = mbti
instagramIDLabel.text = instagramID
linkURLLabel.text = linkURL

shareButton.isHidden = !isShareable
}
}
18 changes: 10 additions & 8 deletions NADA-iOS-forRelease/Sources/Cells/CardCell/MainCardCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ class MainCardCell: CardCell {

private var isFront = true

public var isShareable: Bool?
public var cardDataModel: Card?

// MARK: - View Life Cycle

override func awakeFromNib() {
super.awakeFromNib()

setUI()

setGestureRecognizer()
}

Expand All @@ -36,7 +36,6 @@ class MainCardCell: CardCell {
// MARK: - Extensions

extension MainCardCell {
private func setUI() { }
public func setFrontCard() {
guard let frontCard = FrontCardCell.nib().instantiate(withOwner: self, options: nil).first as? FrontCardCell else { return }

Expand All @@ -49,7 +48,8 @@ extension MainCardCell {
cardDataModel.birthDate,
cardDataModel.mbti,
cardDataModel.instagram ?? "",
cardDataModel.link ?? "")
cardDataModel.link ?? "",
isShareable: isShareable ?? false)

contentView.addSubview(frontCard)
}
Expand Down Expand Up @@ -80,7 +80,8 @@ extension MainCardCell {
cardDataModel.isSauced,
cardDataModel.oneTMI ?? "",
cardDataModel.twoTMI ?? "",
cardDataModel.thirdTMI ?? "")
cardDataModel.thirdTMI ?? "",
isShareable: isShareable ?? false)

contentView.addSubview(backCard)
isFront = false
Expand All @@ -96,17 +97,18 @@ extension MainCardCell {
cardDataModel.birthDate,
cardDataModel.mbti,
cardDataModel.instagram ?? "",
cardDataModel.link ?? "")
cardDataModel.link ?? "",
isShareable: isShareable ?? false)

contentView.addSubview(frontCard)
isFront = true
}
if swipeGesture.direction == .right {
UIView.transition(with: contentView, duration: 1, options: .transitionFlipFromLeft, animations: nil) { _ in
UIView.transition(with: contentView, duration: 0.5, options: .transitionFlipFromLeft, animations: nil) { _ in
self.contentView.subviews[0].removeFromSuperview()
}
} else {
UIView.transition(with: contentView, duration: 1, options: .transitionFlipFromRight, animations: nil) { _ in
UIView.transition(with: contentView, duration: 0.5, options: .transitionFlipFromRight, animations: nil) { _ in
self.contentView.subviews[0].removeFromSuperview()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class CardCreationPreviewViewController: UIViewController {

private var isFront = true
private var cardCreationRequest: CardCreationRequest?
private var isShareable = false

// MARK: - @IBOutlet Properties

Expand Down Expand Up @@ -83,7 +84,15 @@ extension CardCreationPreviewViewController {

frontCard.frame = CGRect(x: 0, y: 0, width: cardView.frame.width, height: cardView.frame.height)
guard let frontCardDataModel = frontCardDataModel else { return }
frontCard.initCell(cardBackgroundImage, frontCardDataModel.title, frontCardDataModel.description, frontCardDataModel.name, frontCardDataModel.birthDate, frontCardDataModel.mbti, frontCardDataModel.instagramID, frontCardDataModel.linkURL)
frontCard.initCell(cardBackgroundImage,
frontCardDataModel.title,
frontCardDataModel.description,
frontCardDataModel.name,
frontCardDataModel.birthDate,
frontCardDataModel.mbti,
frontCardDataModel.instagramID,
frontCardDataModel.linkURL,
isShareable: isShareable)

cardView.addSubview(frontCard)
}
Expand Down Expand Up @@ -147,7 +156,8 @@ extension CardCreationPreviewViewController {
frontCardDataModel.birthDate,
frontCardDataModel.mbti,
frontCardDataModel.instagramID,
frontCardDataModel.linkURL)
frontCardDataModel.linkURL,
isShareable: isShareable)

cardView.addSubview(frontCard)
isFront = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class CardDetailViewController: UIViewController {
@IBOutlet weak var backButton: UIButton!

public var cardDataModel: Card?
private var isShareable: Bool = false

private var isFront = true
var status: Status = .group
Expand Down Expand Up @@ -98,7 +99,8 @@ extension CardDetailViewController {
cardDataModel?.birthDate ?? "",
cardDataModel?.mbti ?? "",
cardDataModel?.instagram ?? "",
cardDataModel?.link ?? "")
cardDataModel?.link ?? "",
isShareable: isShareable)

cardView.addSubview(frontCard)
}
Expand Down Expand Up @@ -126,7 +128,8 @@ extension CardDetailViewController {
cardDataModel?.isSauced ?? true,
cardDataModel?.oneTMI ?? "",
cardDataModel?.twoTMI ?? "",
cardDataModel?.thirdTMI ?? "")
cardDataModel?.thirdTMI ?? "",
isShareable: isShareable)

cardView.addSubview(backCard)
isFront = false
Expand All @@ -141,7 +144,8 @@ extension CardDetailViewController {
cardDataModel?.birthDate ?? "",
cardDataModel?.mbti ?? "",
cardDataModel?.instagram ?? "",
cardDataModel?.link ?? "")
cardDataModel?.link ?? "",
isShareable: isShareable)

cardView.addSubview(frontCard)
isFront = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ extension FrontViewController: VerticalCardSwiperDatasource {
guard let cell = verticalCardSwiperView.dequeueReusableCell(withReuseIdentifier: Const.Xib.mainCardCell, for: index) as? MainCardCell else { return CardCell() }
guard let cardDataList = cardDataList else { return CardCell() }
cell.initCell(cardDataModel: cardDataList[index])
cell.isShareable = true
cell.setFrontCard()

return cell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ extension TeamNADAViewController: VerticalCardSwiperDatasource {
guard let cell = verticalCardSwiperView.dequeueReusableCell(withReuseIdentifier: Const.Xib.mainCardCell, for: index) as? MainCardCell else { return CardCell() }
guard let cardDataList = cardDataList else { return CardCell() }
cell.initCell(cardDataModel: cardDataList[index])
cell.isShareable = false
cell.setFrontCard()

return cell
Expand Down

0 comments on commit 2d850e9

Please sign in to comment.