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

Refactor [#242] 추천친구 리팩토링 #268

Open
wants to merge 16 commits into
base: develop
Choose a base branch
from
Open
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
34 changes: 29 additions & 5 deletions YELLO-iOS/YELLO-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1040,10 +1040,7 @@
2AA0DBAB2A546D87002B1370 /* Recommending */ = {
isa = PBXGroup;
children = (
C3C57BEE2A5C066B00B84CAA /* ViewController */,
C3C57BED2A5C066200B84CAA /* View */,
C3C57BF12A5C087600B84CAA /* Cells */,
C3C57BF42A5C093D00B84CAA /* FriendModel.swift */,
C312C00B2AA5F80A00C73D0F /* Main */,
C31315A92A7A5F8100FB8B43 /* Search */,
);
path = Recommending;
Expand Down Expand Up @@ -1317,6 +1314,25 @@
path = Button;
sourceTree = "<group>";
};
C312C00A2AA5F7F500C73D0F /* Model */ = {
isa = PBXGroup;
children = (
C3C57BF42A5C093D00B84CAA /* FriendModel.swift */,
);
path = Model;
sourceTree = "<group>";
};
C312C00B2AA5F80A00C73D0F /* Main */ = {
isa = PBXGroup;
children = (
C3C57BEE2A5C066B00B84CAA /* ViewController */,
C3C57BED2A5C066200B84CAA /* View */,
C3C57BF12A5C087600B84CAA /* Cells */,
C312C00A2AA5F7F500C73D0F /* Model */,
);
path = Main;
sourceTree = "<group>";
};
C31315A22A78E4B800FB8B43 /* Cell */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1347,7 +1363,7 @@
C31315AB2A7A5F8F00FB8B43 /* View */ = {
isa = PBXGroup;
children = (
C390B8082A88D63000EA5A23 /* spinner_loading.json */,
C3C227E02ABB87740036BF2B /* Lottie */,
C31315A72A7A5F7E00FB8B43 /* FriendSearchView.swift */,
);
path = View;
Expand Down Expand Up @@ -1689,6 +1705,14 @@
path = Response;
sourceTree = "<group>";
};
C3C227E02ABB87740036BF2B /* Lottie */ = {
isa = PBXGroup;
children = (
C390B8082A88D63000EA5A23 /* spinner_loading.json */,
);
path = Lottie;
sourceTree = "<group>";
};
C3C560B92A8A6E410074E988 /* Search */ = {
isa = PBXGroup;
children = (
Expand Down
4 changes: 4 additions & 0 deletions YELLO-iOS/YELLO-iOS/Global/Literals/String.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ enum StringLiterals {
static let firstText = "친구가 내 추천인 코드로 가입하면"
static let secondText = "40분 대기 초기화 + 100포인트 지급!"
static let toastMessage = "링크가 복사되었습니다."
static let close = "닫기"
static let myRecommendCode = "내 추천인 코드"
static let copyStringHeader = "추천인코드: "
static let copyStringFooter = "\n\n우리 같이 YELL:O 해요!\nAndroid: https://play.google.com/store/apps/details?id=com.el.yello&hl=ko&gl=KR\niOS: https://apps.apple.com/app/id6451451050"
}

enum Recommending {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,10 @@ final class AroundSkeletonTableViewCell: UITableViewCell {

extension AroundSkeletonTableViewCell {
func showShimmer() {
self.genderImageView.animateShimmer()
self.genderLabel.animateShimmer()
self.nameLabel.animateShimmer()
self.keywordLabel.animateShimmer()
let shimmerArray = [genderImageView, genderLabel, receiverLabel, nameLabel, keywordLabel]

shimmerArray.forEach {
$0.animateShimmer()
}
}
}
16 changes: 7 additions & 9 deletions YELLO-iOS/YELLO-iOS/Presentation/Inviting/InvitingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ final class InvitingView: BaseView {
contentsView.backgroundColor = .white

closeButton.do {
$0.setTitle("닫기", for: .normal)
$0.setTitle(StringLiterals.Inviting.close, for: .normal)
$0.setImage(ImageLiterals.InvitingPopUp.icClose, for: .normal)
$0.setTitleColor(.grayscales600, for: .normal)
$0.imageView?.contentMode = .scaleAspectFit
Expand Down Expand Up @@ -75,7 +75,7 @@ final class InvitingView: BaseView {
}

recommender.do {
$0.text = "내 추천인 코드"
$0.text = StringLiterals.Inviting.myRecommendCode
$0.textColor = .purpleSub500
$0.font = .uiBody04
}
Expand Down Expand Up @@ -169,14 +169,13 @@ final class InvitingView: BaseView {

extension InvitingView {

@objc
func closeButtonClicked() {
// MARK: Objc function
@objc func closeButtonClicked() {
self.isHidden = true
self.removeFromSuperview()
}

@objc
func kakaoButtonClicked() {
@objc func kakaoButtonClicked() {
let templateId = Config.kakaoTempleteId

guard let filteredString = self.recommenderID.text else { return }
Expand Down Expand Up @@ -206,11 +205,10 @@ extension InvitingView {
}
}

@objc
func copyButtonClicked() {
@objc func copyButtonClicked() {
guard let recommender = self.recommenderID.text else { return }
let filteredID = String(recommender.dropFirst())
let recommenderID = "추천인코드: " + filteredID + "\n\n우리 같이 YELL:O 해요!\nAndroid: https://play.google.com/store/apps/details?id=com.el.yello&hl=ko&gl=KR\niOS: https://apps.apple.com/app/id6451451050"
let recommenderID = StringLiterals.Inviting.copyStringHeader + filteredID + StringLiterals.Inviting.copyStringFooter
UIPasteboard.general.string = recommenderID
print(UIPasteboard.general.string ?? "")
updateEvent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ final class MyYelloSkeletonTableViewCell: UITableViewCell {

extension MyYelloSkeletonTableViewCell {
func showShimmer() {
self.genderImageView.animateShimmer()
self.titleLabel.animateShimmer()
self.timeLabel.animateShimmer()
let shimmerArray = [genderImageView, titleLabel, timeLabel]

shimmerArray.forEach {
$0.animateShimmer()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ extension MyFriendSkeletonTableViewCell {
}

func showShimmer() {
self.profileImageView.animateShimmer()
self.nameLabel.animateShimmer()
self.schoolLabel.animateShimmer()
let shimmerArray = [profileImageView, nameLabel, schoolLabel]

shimmerArray.forEach {
$0.animateShimmer()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import Then

final class FriendEmptyTableViewCell: UITableViewCell {

/// 해당 파일은 현재 사용하지 않습니다.

// MARK: - Variables
// MARK: Constants
static let identifier = "FriendEmptyTableViewCell"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,13 @@ extension FriendSkeletonTableViewCell {
$0.top.equalTo(schoolLabel.snp.bottom).offset(19.adjustedHeight)
}
}
}

extension FriendSkeletonTableViewCell {

// MARK: Custom Function
func showShimmer() {
self.profileImageView.animateShimmer()
self.nameLabel.animateShimmer()
self.schoolLabel.animateShimmer()
let shimmerArray = [profileImageView, nameLabel, schoolLabel]

shimmerArray.forEach {
$0.animateShimmer()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ final class FriendTableViewCell: UITableViewCell {
let schoolLabel = UILabel()
lazy var addButton = UIButton()
let separatorLine = UIView()

var isTapped: Bool = false

weak var handleAddFriendButton: HandleAddFriendButton?
Expand Down Expand Up @@ -94,7 +95,7 @@ extension FriendTableViewCell {

addButton.do {
$0.setImage(ImageLiterals.Recommending.icAddFriendButton, for: .normal)
$0.tintColor = .yellow
$0.tintColor = .yelloMain500
$0.addTarget(self, action: #selector(addButtonTapped), for: .touchUpInside)
$0.isHidden = false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Amplitude
import SnapKit
import Then

final class EmptyFriendView: UIView {
final class EmptyFriendView: BaseView {

// MARK: - Variables
// MARK: Component
Expand All @@ -24,29 +24,8 @@ final class EmptyFriendView: UIView {
private var invitingView = InvitingView()

// MARK: - Function
// MARK: LifeCycle
override init(frame: CGRect) {
super.init(frame: frame)
setUI()
}

@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}

// MARK: - extension
extension EmptyFriendView {

// MARK: Layout Helpers
private func setUI() {
invitingView = InvitingView()
setStyle()
setLayout()
}

private func setStyle() {
override func setStyle() {
self.backgroundColor = .black
emptyImageView.do {
$0.image = ImageLiterals.Recommending.imgBannerInvite
Expand All @@ -70,7 +49,7 @@ extension EmptyFriendView {
}
}

private func setLayout() {
override func setLayout() {
self.addSubview(containView)
containView.addSubviews(emptyImageView,
emptyDescriptionLabel,
Expand Down Expand Up @@ -135,6 +114,5 @@ extension EmptyFriendView {
}

Amplitude.instance().logEvent("click_invite", withEventProperties: ["invite_view": keyValue])

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ final class InviteBannerView: BaseView {
// MARK: - Function
// MARK: Layout Helpers
override func setStyle() {
invitingView = InvitingView()

inviteImageView.do {
$0.image = ImageLiterals.Recommending.imgBannerInvite
Expand Down Expand Up @@ -88,17 +87,17 @@ final class InviteBannerView: BaseView {
invitingView.removeFromSuperview()

invitingView = InvitingView()
invitingView.profileUserYelloId()
invitingView.frame = viewController.view.bounds
invitingView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
self.invitingView.profileUserYelloId()
self.invitingView.frame = viewController.view.bounds
self.invitingView.autoresizingMask = [.flexibleWidth, .flexibleHeight]

if rootViewName == "kakao" {
Amplitude.instance().logEvent("click_invite", withEventProperties: ["invite_view": "recommend_kakao_yesfriend"])
} else if rootViewName == "school" {
Amplitude.instance().logEvent("click_invite", withEventProperties: ["invite_view": "recommend_school_yesfriend"])
}

invitingView.rootViewController = rootViewName
viewController.view.addSubview(invitingView)

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import SnapKit
import Then
import KakaoSDKTalk

final class KakaoFriendView: UIView {
final class KakaoFriendView: BaseView {

// MARK: - Variables
// MARK: Property
Expand All @@ -37,27 +37,16 @@ final class KakaoFriendView: UIView {
// MARK: LifeCycle
override init(frame: CGRect) {
super.init(frame: frame)
setUI()
setDelegate()
}

@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}

// MARK: - extension
extension KakaoFriendView {

// MARK: Layout Helpers
private func setUI() {
setStyle()
setLayout()
override func setUI() {
super.setUI()
updateView()
}

private func setStyle() {
override func setStyle() {
self.backgroundColor = .black

inviteBannerView.do {
Expand All @@ -82,7 +71,7 @@ extension KakaoFriendView {
}
}

private func setLayout() {
override func setLayout() {

self.addSubviews(
inviteBannerView,
Expand All @@ -106,6 +95,10 @@ extension KakaoFriendView {
$0.center.equalToSuperview()
}
}
}

// MARK: - extension
extension KakaoFriendView {

private func setDelegate() {
kakaoFriendTableView.dataSource = self
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ import UIKit
class NextButton: UIButton {

// MARK: - Functions
// MARK: Layout Helpers

/// 배너 버튼 터치 영역 넓히기
override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
let expandedBounds = bounds.insetBy(dx: -295.adjustedWidth, dy: -98.adjustedHeight)
return expandedBounds.contains(point)
}

// MARK: LifeCycle
override init(frame: CGRect) {
super.init(frame: frame)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,5 @@ final class RecommendingNavigationBarView: BaseView {
$0.centerY.equalToSuperview()
$0.trailing.equalToSuperview().inset(16.adjustedWidth)
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ final class RecommendingSegmentedControl: UISegmentedControl {
}()

// MARK: - Function
// MARK: init
// MARK: LifeCycle
override init(frame: CGRect) {
super.init(frame: frame)
removeBackgroundAndDivider()
Expand All @@ -60,6 +60,7 @@ final class RecommendingSegmentedControl: UISegmentedControl {
// MARK: - extension
extension RecommendingSegmentedControl {

// MARK: Layout Helpers
private func setUI() {
setStyle()
setLayout()
Expand Down
Loading