Skip to content

Commit

Permalink
Merge pull request #493 from hyun99999/feature/#487
Browse files Browse the repository at this point in the history
fix: 명함 뒷면 배경 이미지 넣기 (#487, 488)
  • Loading branch information
hyun99999 authored May 8, 2023
2 parents 4f784ef + 025e42e commit 5416783
Show file tree
Hide file tree
Showing 17 changed files with 90 additions and 63 deletions.
20 changes: 20 additions & 0 deletions NADA-iOS-forRelease.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,14 @@
F8C83FC7272FA2A20009DF0D /* CardService.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8C83FC6272FA2A20009DF0D /* CardService.swift */; };
F8C83FC9272FA3190009DF0D /* GroupAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8C83FC8272FA3190009DF0D /* GroupAPI.swift */; };
F8C83FCB272FA32C0009DF0D /* GroupService.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8C83FCA272FA32C0009DF0D /* GroupService.swift */; };
F8D62F982A049CB800F9DF11 /* NotoSansCJKkr-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 39369930274A4FCB00684420 /* NotoSansCJKkr-Bold.otf */; };
F8D62F992A049CB800F9DF11 /* NotoSansCJKkr-Regular.otf in Resources */ = {isa = PBXBuildFile; fileRef = 39369931274A4FCB00684420 /* NotoSansCJKkr-Regular.otf */; };
F8D62F9A2A049CB800F9DF11 /* Spoqa Han Sans Neo Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 39369933274A4FCB00684420 /* Spoqa Han Sans Neo Bold.otf */; };
F8D62F9B2A049CB800F9DF11 /* Spoqa Han Sans Neo Regular.otf in Resources */ = {isa = PBXBuildFile; fileRef = 39369934274A4FCB00684420 /* Spoqa Han Sans Neo Regular.otf */; };
F8D62F9C2A049CB800F9DF11 /* NotoSansCJKkr-Medium.otf in Resources */ = {isa = PBXBuildFile; fileRef = 39369932274A4FCB00684420 /* NotoSansCJKkr-Medium.otf */; };
F8D62F9E2A049D5C00F9DF11 /* Font+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8D62F9D2A049D5C00F9DF11 /* Font+Extension.swift */; };
F8D62FA62A06742000F9DF11 /* Spoqa Han Sans Neo Medium.otf in Resources */ = {isa = PBXBuildFile; fileRef = F8D62FA52A06742000F9DF11 /* Spoqa Han Sans Neo Medium.otf */; };
F8D62FA82A06742600F9DF11 /* Spoqa Han Sans Neo Medium.otf in Resources */ = {isa = PBXBuildFile; fileRef = F8D62FA52A06742000F9DF11 /* Spoqa Han Sans Neo Medium.otf */; };
F8D74DD8276C7FB60071E5FC /* UIImageView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8D74DD7276C7FB60071E5FC /* UIImageView+Extension.swift */; };
F8D92E0A29D5324E002ACC73 /* Taste.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8D92E0929D5324E002ACC73 /* Taste.swift */; };
F8F00C3929DD474700A15377 /* UpdateNote.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8F00C3829DD474700A15377 /* UpdateNote.swift */; };
Expand Down Expand Up @@ -459,6 +467,8 @@
F8C83FC6272FA2A20009DF0D /* CardService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardService.swift; sourceTree = "<group>"; };
F8C83FC8272FA3190009DF0D /* GroupAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GroupAPI.swift; sourceTree = "<group>"; };
F8C83FCA272FA32C0009DF0D /* GroupService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GroupService.swift; sourceTree = "<group>"; };
F8D62F9D2A049D5C00F9DF11 /* Font+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Font+Extension.swift"; sourceTree = "<group>"; };
F8D62FA52A06742000F9DF11 /* Spoqa Han Sans Neo Medium.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Spoqa Han Sans Neo Medium.otf"; sourceTree = "<group>"; };
F8D74DD7276C7FB60071E5FC /* UIImageView+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImageView+Extension.swift"; sourceTree = "<group>"; };
F8D92E0929D5324E002ACC73 /* Taste.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Taste.swift; sourceTree = "<group>"; };
F8F00C3829DD474700A15377 /* UpdateNote.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateNote.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -736,6 +746,7 @@
39369931274A4FCB00684420 /* NotoSansCJKkr-Regular.otf */,
39369933274A4FCB00684420 /* Spoqa Han Sans Neo Bold.otf */,
39369934274A4FCB00684420 /* Spoqa Han Sans Neo Regular.otf */,
F8D62FA52A06742000F9DF11 /* Spoqa Han Sans Neo Medium.otf */,
);
path = Font;
sourceTree = "<group>";
Expand Down Expand Up @@ -1110,6 +1121,7 @@
isa = PBXGroup;
children = (
F87D2222298EA616001A882B /* Color+Extension.swift */,
F8D62F9D2A049D5C00F9DF11 /* Font+Extension.swift */,
);
path = Extension;
sourceTree = "<group>";
Expand Down Expand Up @@ -1587,6 +1599,12 @@
buildActionMask = 2147483647;
files = (
F838B66C298E5C5400D84340 /* Assets.xcassets in Resources */,
F8D62F9B2A049CB800F9DF11 /* Spoqa Han Sans Neo Regular.otf in Resources */,
F8D62F9A2A049CB800F9DF11 /* Spoqa Han Sans Neo Bold.otf in Resources */,
F8D62F992A049CB800F9DF11 /* NotoSansCJKkr-Regular.otf in Resources */,
F8D62F982A049CB800F9DF11 /* NotoSansCJKkr-Bold.otf in Resources */,
F8D62F9C2A049CB800F9DF11 /* NotoSansCJKkr-Medium.otf in Resources */,
F8D62FA82A06742600F9DF11 /* Spoqa Han Sans Neo Medium.otf in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -1652,6 +1670,7 @@
F8518055275D040C006BD5ED /* OnboardingCollectionViewCell.xib in Resources */,
39F5A3D1271461EA00191F94 /* BackCardCell.xib in Resources */,
39369939274A4FCB00684420 /* Spoqa Han Sans Neo Regular.otf in Resources */,
F8D62FA62A06742000F9DF11 /* Spoqa Han Sans Neo Medium.otf in Resources */,
39369938274A4FCB00684420 /* Spoqa Han Sans Neo Bold.otf in Resources */,
F8458D6229F5183B000D53A7 /* FanCardCreation.storyboard in Resources */,
7781294A275F6ED7004B34F4 /* CardDetail.storyboard in Resources */,
Expand Down Expand Up @@ -1737,6 +1756,7 @@
F838B66E298E5C5400D84340 /* Widgets.intentdefinition in Sources */,
F838B667298E5C5300D84340 /* WidgetsLiveActivity.swift in Sources */,
F8BCDD25298FFAF90044D0B4 /* WidgetsBundle.swift in Sources */,
F8D62F9E2A049D5C00F9DF11 /* Font+Extension.swift in Sources */,
F8BCDD22298FFA830044D0B4 /* QRCodeWidget.swift in Sources */,
F8BCDD26298FFB0B0044D0B4 /* MyCardWidget.swift in Sources */,
F8257750299546920067E145 /* Card.swift in Sources */,
Expand Down
1 change: 1 addition & 0 deletions NADA-iOS-forRelease/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
<string>NotoSansCJKkr-Regular.otf</string>
<string>Spoqa Han Sans Neo Bold.otf</string>
<string>Spoqa Han Sans Neo Regular.otf</string>
<string>Spoqa Han Sans Neo Medium.otf</string>
</array>
<key>UIApplicationSceneManifest</key>
<dict>
Expand Down

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
47 changes: 35 additions & 12 deletions NADA-iOS-forRelease/Sources/Cells/CardCell/BackCardCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,13 @@ class BackCardCell: CardCell {
@IBOutlet var tasteImageViews: [UIImageView]!
@IBOutlet var tasteLabels: [UILabel]!
@IBOutlet weak var tmiTitleLabel: UILabel!
@IBOutlet weak var shareButton: UIButton!
@IBOutlet weak var tmiLabel: UILabel!

// MARK: - View Life Cycle
override func awakeFromNib() {
super.awakeFromNib()
setUI()
}
@IBAction func touchShareButton(_ sender: Any) {
NotificationCenter.default.post(name: Notification.Name.presentCardShare, object: cardData, userInfo: nil)
}

// MARK: - Functions
static func nib() -> UINib {
Expand All @@ -42,9 +38,7 @@ class BackCardCell: CardCell {

// MARK: - Extensions
extension BackCardCell {
private func setUI() {
backgroundImageView.image = UIImage(named: "backCardBg")

private func setUI() {
tasteTitleLabel.font = .title02
tasteTitleLabel.textColor = .white

Expand All @@ -61,7 +55,12 @@ extension BackCardCell {
tmiLabel.numberOfLines = 0
}

func initCell(cardTasteInfo: [CardTasteInfo], tmi: String?, isShareable: Bool = false) {
/// 명함 미리보기 시 사용.
func initCell(_ backgroundImage: UIImage?,
_ cardTasteInfo: [CardTasteInfo],
_ tmi: String?) {
backgroundImageView.image = backgroundImage

let cardTasteInfo: [CardTasteInfo] = cardTasteInfo.sorted { $0.sortOrder > $1.sortOrder }

for index in stride(from: 0, to: cardTasteInfo.count, by: 2) {
Expand All @@ -77,13 +76,37 @@ extension BackCardCell {
tasteLabels[index].textColor = cardTasteInfo[index].isChoose ? .tasteLabel : .tasteLabel.withAlphaComponent(0.5)
}

if let tmi {
tmiLabel.text = tmi
tmiLabel.text = tmi
}

/// 명함 조회 시 사용.
func initCell(_ backgroundImage: String,
_ cardTasteInfo: [CardTasteInfo],
_ tmi: String?) {
if backgroundImage.hasPrefix("https://") {
self.backgroundImageView.updateServerImage(backgroundImage)
} else {
tmiLabel.text = ""
if let bgImage = UIImage(named: backgroundImage) {
self.backgroundImageView.image = bgImage
}
}

let cardTasteInfo: [CardTasteInfo] = cardTasteInfo.sorted { $0.sortOrder > $1.sortOrder }

for index in stride(from: 0, to: cardTasteInfo.count, by: 2) {
if cardTasteInfo[index].isChoose {
tasteImageViews[index / 2].image = UIImage(named: "imgBalanceLeft")
} else {
tasteImageViews[index / 2].image = UIImage(named: "imgBalanceRight")
}
}

for index in 0..<tasteLabels.count {
tasteLabels[index].text = cardTasteInfo[index].cardTasteName
tasteLabels[index].textColor = cardTasteInfo[index].isChoose ? .tasteLabel : .tasteLabel.withAlphaComponent(0.5)
}

shareButton.isHidden = !isShareable
tmiLabel.text = tmi
}

// TODO: - 로컬에서 image 를 가지고 있게 되면 사용할 메서드.
Expand Down
16 changes: 1 addition & 15 deletions NADA-iOS-forRelease/Sources/Cells/CardCell/BackCardCell.xib
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<view alpha="0.20000000000000001" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Q9H-oG-tzn">
<view alpha="0.40000000000000002" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Q9H-oG-tzn">
<rect key="frame" x="0.0" y="0.0" width="327" height="540"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<userDefinedRuntimeAttributes>
Expand Down Expand Up @@ -71,14 +71,6 @@
<constraint firstAttribute="height" constant="35" id="c3k-g5-uGj"/>
</constraints>
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="3tv-wQ-4Ka">
<rect key="frame" x="279" y="16" width="24" height="24"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" image="iconShare"/>
<connections>
<action selector="touchShareButton:" destination="gTV-IL-0wX" eventType="touchUpInside" id="9we-bF-B51"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="나의 취향" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dHb-jJ-jng">
<rect key="frame" x="24" y="50" width="67" height="22"/>
<fontDescription key="fontDescription" type="system" pointSize="18"/>
Expand Down Expand Up @@ -156,7 +148,6 @@
<constraint firstAttribute="bottom" secondItem="Rmd-7u-oYx" secondAttribute="bottom" id="6sP-l0-YJZ"/>
<constraint firstAttribute="trailing" secondItem="bNI-yG-96K" secondAttribute="trailing" constant="24" id="7eM-YI-3Qt"/>
<constraint firstItem="Q9H-oG-tzn" firstAttribute="leading" secondItem="Rmd-7u-oYx" secondAttribute="leading" id="7x9-tr-J5n"/>
<constraint firstAttribute="trailing" secondItem="3tv-wQ-4Ka" secondAttribute="trailing" constant="24" id="8M2-5e-Gzt"/>
<constraint firstItem="Z3d-Jw-0bl" firstAttribute="top" secondItem="Sfm-fL-vo0" secondAttribute="bottom" constant="16" id="8qH-Jg-J7V"/>
<constraint firstItem="FfP-9G-1a3" firstAttribute="top" secondItem="dHb-jJ-jng" secondAttribute="bottom" constant="2.5" id="9Bq-4m-Efc"/>
<constraint firstItem="trU-Am-jlp" firstAttribute="leading" secondItem="yWc-gu-ca5" secondAttribute="leading" id="9yw-5u-T00"/>
Expand All @@ -174,7 +165,6 @@
<constraint firstItem="XT5-iW-6kG" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="24" id="Y36-eF-FL8"/>
<constraint firstItem="19t-Fx-dQ8" firstAttribute="centerY" secondItem="Z3d-Jw-0bl" secondAttribute="centerY" id="Y3l-pu-rSB"/>
<constraint firstItem="bNI-yG-96K" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="24" id="YH6-4Z-GcG"/>
<constraint firstItem="3tv-wQ-4Ka" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" constant="16" id="Yho-5j-Btr"/>
<constraint firstItem="dHb-jJ-jng" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" constant="50" id="ZLX-Il-oq0"/>
<constraint firstAttribute="trailing" secondItem="FfP-9G-1a3" secondAttribute="trailing" constant="24" id="Zh6-xa-VD9"/>
<constraint firstItem="5Bo-yc-zB1" firstAttribute="leading" secondItem="sLy-tM-Foc" secondAttribute="leading" id="aKZ-4f-bRM"/>
Expand Down Expand Up @@ -207,7 +197,6 @@
</userDefinedRuntimeAttributes>
<connections>
<outlet property="backgroundImageView" destination="Rmd-7u-oYx" id="Ci4-HW-97h"/>
<outlet property="shareButton" destination="3tv-wQ-4Ka" id="uQj-kM-ZBL"/>
<outlet property="tasteTitleLabel" destination="dHb-jJ-jng" id="s2A-b9-Osl"/>
<outlet property="tmiLabel" destination="Ch6-5U-VOL" id="soW-Sy-5Zm"/>
<outlet property="tmiTitleLabel" destination="XT5-iW-6kG" id="75E-sq-FUS"/>
Expand All @@ -227,7 +216,4 @@
<point key="canvasLocation" x="131.15942028985509" y="79.6875"/>
</collectionViewCell>
</objects>
<resources>
<image name="iconShare" width="24" height="24"/>
</resources>
</document>
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ extension MainCardCell {
guard let backCard = BackCardCell.nib().instantiate(withOwner: self, options: nil).first as? BackCardCell else { return }
backCard.frame = CGRect(x: 0, y: 0, width: contentView.frame.width, height: contentView.frame.height)
guard let cardDataModel = cardDataModel else { return }
backCard.initCell(cardTasteInfo: cardDataModel.cardTastes, tmi: cardDataModel.tmi)

backCard.initCell(cardDataModel.cardImage, cardDataModel.cardTastes, cardDataModel.tmi)
contentView.addSubview(backCard)
isFront = false
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ class CardShareBottomSheetViewController: CommonBottomSheetViewController {
guard let backCard = BackCardCell.nib().instantiate(withOwner: self, options: nil).first as? BackCardCell else { return UIImage() }
backCard.frame = CGRect(x: 0, y: 0, width: 327, height: 540)
guard let cardDataModel = cardDataModel else { return UIImage() }
backCard.initCell(cardTasteInfo: cardDataModel.cardTastes, tmi: cardDataModel.tmi, isShareable: isShareable)
backCard.initCell(cardDataModel.cardImage, cardDataModel.cardTastes, cardDataModel.tmi)

let backCardView = UIView(frame: CGRect(x: 0, y: 0, width: 327, height: 540))
backCardView.addSubview(backCard)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,7 @@ extension CardCreationPreviewViewController {
isChoose: backCardDataModel.tastes.contains(tasteInfo[index].tasteName),
sortOrder: tasteInfo[index].sortOrder))
}

backCard.initCell(cardTasteInfo: cardTasteInfo, tmi: backCardDataModel.tmi)
backCard.initCell(cardBackgroundImage, cardTasteInfo, backCardDataModel.tmi)

cardView.addSubview(backCard)
isFront = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ extension CardDetailViewController {
guard let backCard = BackCardCell.nib().instantiate(withOwner: self, options: nil).first as? BackCardCell else { return }
backCard.frame = CGRect(x: 0, y: 0, width: cardView.frame.width, height: cardView.frame.height)
guard let cardDataModel = cardDataModel else { return }
backCard.initCell(cardTasteInfo: cardDataModel.cardTastes, tmi: cardDataModel.tmi)
backCard.initCell(cardDataModel.cardImage, cardDataModel.cardTastes, cardDataModel.tmi)

cardView.addSubview(backCard)
isFront = false
Expand Down
6 changes: 3 additions & 3 deletions Widgets/Resource/Extension/Color+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ extension Color {
static func backgroundColor(for colorScheme: ColorScheme) -> Color {
switch colorScheme {
case .light:
return Color(red: 255.0 / 255.0, green: 255.0 / 255.0, blue: 255.0 / 255.0)
return Color(red: 241.0 / 255.0, green: 243.0 / 255.0, blue: 245.0 / 255.0)
case .dark:
return Color(red: 19.0 / 255.0, green: 20.0 / 255.0, blue: 22.0 / 255.0, opacity: 0.5)
return Color(red: 43.0 / 255.0, green: 45.0 / 255.0, blue: 49.0 / 255.0)
@unknown default:
return Color(red: 255.0 / 255.0, green: 255.0 / 255.0, blue: 255.0 / 255.0)
return Color(red: 241.0 / 255.0, green: 243.0 / 255.0, blue: 245.0 / 255.0)
}
}

Expand Down
13 changes: 13 additions & 0 deletions Widgets/Resource/Extension/Font+Extension.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// Font+Extension.swift
// WidgetsExtension
//
// Created by kimhyungyu on 2023/05/05.
//

import SwiftUI

extension Font {
static let cardName = Font.custom("SpoqaHanSansNeo-Medium", size: 15)
static let userName = Font.custom("SpoqaHanSansNeo-Bold", size: 15)
}
9 changes: 9 additions & 0 deletions Widgets/Resource/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,14 @@
<key>NSExtensionPointIdentifier</key>
<string>com.apple.widgetkit-extension</string>
</dict>
<key>UIAppFonts</key>
<array>
<string>NotoSansCJKkr-Bold.otf</string>
<string>NotoSansCJKkr-Medium.otf</string>
<string>NotoSansCJKkr-Regular.otf</string>
<string>Spoqa Han Sans Neo Bold.otf</string>
<string>Spoqa Han Sans Neo Regular.otf</string>
<string>Spoqa Han Sans Neo Medium.otf</string>
</array>
</dict>
</plist>
Loading

0 comments on commit 5416783

Please sign in to comment.