Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] #118 - FrontCardCell 에서 인스타 앱, 링크 사파리 연결 #127

Merged
merged 1 commit into from
Dec 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NADA-iOS-forRelease/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<string></string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>instagram</string>
<string>kakaokompassauth</string>
<string>kakaolink</string>
</array>
Expand Down
3 changes: 0 additions & 3 deletions NADA-iOS-forRelease/Sources/Cells/CardCell/BackCardCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class BackCardCell: CardCell {
super.awakeFromNib()
setUI()
}
// TODO: - 2차 릴리즈/공유기능
@IBAction func touchShareButton(_ sender: Any) {
}

Expand All @@ -55,8 +54,6 @@ extension BackCardCell {
secondTmiLabel.textColor = .white
thirdTmiLabel.font = .textRegular04
thirdTmiLabel.textColor = .white
// TODO: - 2차 릴리즈/공유기능
shareButton.isHidden = true
Comment on lines -58 to -59
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

일단 숨겨놔 ㅋ ㅋ

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

계속 숨겨놓는것도 좋은 방법일 수도.... ^__^

}

/// 서버에서 image 를 URL 로 가져올 경우 사용.
Expand Down
39 changes: 37 additions & 2 deletions NADA-iOS-forRelease/Sources/Cells/CardCell/FrontCardCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ class FrontCardCell: CardCell {

override func awakeFromNib() {
super.awakeFromNib()
setUI()

setUI()
setTapGesture()
}
@IBAction func touchShareButton(_ sender: Any) {
}
Expand Down Expand Up @@ -56,7 +58,39 @@ extension FrontCardCell {
linkURLLabel.textColor = .white
linkURLLabel.numberOfLines = 2
linkURLLabel.lineBreakMode = .byTruncatingTail
shareButton.isHidden = true
}
private func setTapGesture() {
instagramIDLabel.isUserInteractionEnabled = true
let instagramTapGesture = UITapGestureRecognizer(target: self, action: #selector(tapInstagramLabel))
instagramIDLabel.addGestureRecognizer(instagramTapGesture)

linkURLLabel.isUserInteractionEnabled = true
let linkURLTapGesture = UITapGestureRecognizer(target: self, action: #selector(tapLinkURLLabel))
linkURLLabel.addGestureRecognizer(linkURLTapGesture)
}

// MARK: - @objc Methods

@objc
private func tapInstagramLabel() {
let instagramID = instagramIDLabel.text ?? ""
let appURL = URL(string: "instagram://user?username=\(instagramID)")!
let webURL = URL(string: "https://instagram.com/\(instagramID)")!

if UIApplication.shared.canOpenURL(appURL) {
UIApplication.shared.open(appURL, options: [:], completionHandler: nil)
} else {
UIApplication.shared.open(webURL, options: [:], completionHandler: nil)
}
}
Comment on lines +80 to +85
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

잘 긁어갑니다~

@objc
private func tapLinkURLLabel() {
let linkURL = linkURLLabel.text ?? ""
let webURL = URL(string: linkURL)!

if UIApplication.shared.canOpenURL(webURL) {
UIApplication.shared.open(webURL, options: [:], completionHandler: nil)
}
}

/// 서버에서 image 를 URL 로 가져올 경우 사용.
Expand Down Expand Up @@ -99,3 +133,4 @@ extension FrontCardCell {
linkURLLabel.text = linkURL
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ extension FrontViewController {
"Blog"
])
linkIDList.append(contentsOf: ["https://github.com/TeamNADAgit.luolix.top/TeamNADAgit.luolix.top/TeamNADAgit.luolix.top/TeamNADAgit.luolix.top/TeamNADA",
"https://github.com/TeamNADA"
"https://www.naver.com"
])
}

Expand Down Expand Up @@ -162,6 +162,7 @@ extension FrontViewController {

// MARK: - VerticalCardSwiperDelegate
extension FrontViewController: VerticalCardSwiperDelegate {
// TODO: - FrontCard 에서 링크를 통한 인스타, 사파리 접속을 위해 주석 처리.
func didTapCard(verticalCardSwiperView: VerticalCardSwiperView, index: Int) {
let frontCell = cardSwiper.cardForItem(at: index)
Comment on lines 164 to 167
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

델리게이트 야무지네용

let backCell = cardSwiper.cardForItem(at: index)
Expand Down