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] #195 - 내 정보UI 로직 변경 #200

Merged
merged 13 commits into from
Jan 27, 2024
Merged
8 changes: 4 additions & 4 deletions iOS-NOTTODO/iOS-NOTTODO.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
098BFD5929B7999E008E80F9 /* MyProfileCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 098BFD5829B7999E008E80F9 /* MyProfileCollectionViewCell.swift */; };
098BFD5B29B79B6A008E80F9 /* MyInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 098BFD5A29B79B6A008E80F9 /* MyInfoModel.swift */; };
098BFD5D29B79CE3008E80F9 /* InfoCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 098BFD5C29B79CE3008E80F9 /* InfoCollectionViewCell.swift */; };
098BFD5F29B7AECF008E80F9 /* MyInfoHeaderCollectionReusableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 098BFD5E29B7AECF008E80F9 /* MyInfoHeaderCollectionReusableView.swift */; };
098BFD5F29B7AECF008E80F9 /* MyInfoHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 098BFD5E29B7AECF008E80F9 /* MyInfoHeaderView.swift */; };
099FC98129B3094F005B37E6 /* WeekMonthFSCalendar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 099FC98029B3094F005B37E6 /* WeekMonthFSCalendar.swift */; };
099FC98329B30A2E005B37E6 /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 099FC98229B30A2E005B37E6 /* Utils.swift */; };
099FC98929B3233D005B37E6 /* CalendarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 099FC98829B3233D005B37E6 /* CalendarView.swift */; };
Expand Down Expand Up @@ -202,7 +202,7 @@
098BFD5829B7999E008E80F9 /* MyProfileCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyProfileCollectionViewCell.swift; sourceTree = "<group>"; };
098BFD5A29B79B6A008E80F9 /* MyInfoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyInfoModel.swift; sourceTree = "<group>"; };
098BFD5C29B79CE3008E80F9 /* InfoCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfoCollectionViewCell.swift; sourceTree = "<group>"; };
098BFD5E29B7AECF008E80F9 /* MyInfoHeaderCollectionReusableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyInfoHeaderCollectionReusableView.swift; sourceTree = "<group>"; };
098BFD5E29B7AECF008E80F9 /* MyInfoHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyInfoHeaderView.swift; sourceTree = "<group>"; };
099FC98029B3094F005B37E6 /* WeekMonthFSCalendar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeekMonthFSCalendar.swift; sourceTree = "<group>"; };
099FC98229B30A2E005B37E6 /* Utils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Utils.swift; sourceTree = "<group>"; };
099FC98829B3233D005B37E6 /* CalendarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -434,7 +434,7 @@
098BFD6029B80137008E80F9 /* Cell */ = {
isa = PBXGroup;
children = (
098BFD5E29B7AECF008E80F9 /* MyInfoHeaderCollectionReusableView.swift */,
098BFD5E29B7AECF008E80F9 /* MyInfoHeaderView.swift */,
098BFD5829B7999E008E80F9 /* MyProfileCollectionViewCell.swift */,
098BFD5C29B79CE3008E80F9 /* InfoCollectionViewCell.swift */,
);
Expand Down Expand Up @@ -1323,7 +1323,7 @@
3B892ABB2A2FBD4C00A316BC /* RecommendSituationResponseDTO.swift in Sources */,
3B14A13B29A694C000F92897 /* UITextView+.swift in Sources */,
093DB0372A146BF900ECA5F6 /* MyInfoURL.swift in Sources */,
098BFD5F29B7AECF008E80F9 /* MyInfoHeaderCollectionReusableView.swift in Sources */,
098BFD5F29B7AECF008E80F9 /* MyInfoHeaderView.swift in Sources */,
3B482FA7299EB8FD00BCF424 /* UIViewController+.swift in Sources */,
0960C0D42A38BC6500A3D8DB /* KeychainUtil.swift in Sources */,
3B03D0D82B0F5EF300302872 /* CGSize+.swift in Sources */,
Expand Down
10 changes: 4 additions & 6 deletions iOS-NOTTODO/iOS-NOTTODO/Global/Enum/MyInfoURL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,23 @@ import Foundation
import SafariServices

enum MyInfoURL {
case guid, quesition, notice, contact, service, personalInfo, googleForm, opensource
case guid, faq, notice, question, service, personalInfo, googleForm
var url: String {
switch self {
case .guid:
return "https://teamnottodo.notion.site/f35a7f2d6d5c4b33b4d0949f6077e6cd"
case .quesition:
case .faq:
return "https://teamnottodo.notion.site/a6ef7036bde24e289e576ace099f39dc"
case .notice:
return "https://teamnottodo.notion.site/a5dbb310ec1d43baae02b7e9bf0b3411"
case .contact:
case .question:
return "http://pf.kakao.com/_fUIQxj/chat"
case .service:
return "https://teamnottodo.notion.site/81594da775614d23900cdb2475eadb73?pvs=4"
case .personalInfo:
return "https://teamnottodo.notion.site/5af34df7da3649fc941312c5f533c1eb"
case .googleForm:
return "https://forms.gle/rWFJrpVv1RqHwTg28"
case .opensource:
return "https://teamnottodo.notion.site/a391274a627643f6a4d1f2412d4cf170?pvs=4"
return "https://forms.gle/gwBJ4hL4bCTjXRTP6"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,22 @@ final class CompositionalLayout {
return section
}

class func setUpSection(layoutEnvironment: NSCollectionLayoutEnvironment, mode: UICollectionLayoutListConfiguration.HeaderMode, _ top: CGFloat, _ bottom: CGFloat) -> NSCollectionLayoutSection {
var config = UICollectionLayoutListConfiguration(appearance: .insetGrouped)
config.headerMode = mode
config.showsSeparators = true
config.separatorConfiguration.color = UIColor.gray2!
config.backgroundColor = .clear
config.headerTopPadding = 22
static func setUpSection(layoutEnvironment: NSCollectionLayoutEnvironment,
mode: UICollectionLayoutListConfiguration.HeaderMode = .none,
topContentInset: CGFloat = 0,
bottomContentInset: CGFloat = 0)
-> NSCollectionLayoutSection {
var listConfig = UICollectionLayoutListConfiguration(appearance: .insetGrouped)
listConfig.headerMode = mode
listConfig.showsSeparators = true
listConfig.separatorConfiguration.color = UIColor.gray2!
listConfig.backgroundColor = .clear
listConfig.headerTopPadding = 22

let section = NSCollectionLayoutSection.list(using: config, layoutEnvironment: layoutEnvironment)
section.contentInsets = NSDirectionalEdgeInsets(top: top, leading: 0, bottom: bottom, trailing: 0)
if config.headerMode == .supplementary {
let section = NSCollectionLayoutSection.list(using: listConfig, layoutEnvironment: layoutEnvironment)
section.contentInsets = NSDirectionalEdgeInsets(top: topContentInset, leading: 0, bottom: bottomContentInset, trailing: 0)

if listConfig.headerMode == .supplementary {
let headerSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .absolute(22))
let header = NSCollectionLayoutBoundarySupplementaryItem(layoutSize: headerSize, elementKind: UICollectionView.elementKindSectionHeader, alignment: .top)
section.boundarySupplementaryItems = [header]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

import UIKit

class InfoCollectionViewCell: UICollectionViewCell {
import SnapKit
import Then

final class InfoCollectionViewCell: UICollectionViewCell {

// MARK: - Properties

Expand All @@ -20,8 +23,11 @@ class InfoCollectionViewCell: UICollectionViewCell {
private let titleLabel = UILabel()
private let arrowImage = UIImageView()

// MARK: - Life Cycle

override init(frame: CGRect) {
super.init(frame: .zero)

setUI()
setLayout()
}
Expand All @@ -34,6 +40,7 @@ class InfoCollectionViewCell: UICollectionViewCell {
// MARK: - Methods

extension InfoCollectionViewCell {

private func setUI() {
backgroundColor = .gray1

Expand All @@ -47,6 +54,7 @@ extension InfoCollectionViewCell {
$0.axis = .horizontal
$0.spacing = 6
}

arrowImage.do {
$0.isHidden = true
$0.image = .icRightArrow
Expand All @@ -73,7 +81,8 @@ extension InfoCollectionViewCell {
}
}

func configureWithIcon(model: InfoModelTwo) {
func configureWithIcon(with model: InfoModel) {

iconImage.image = model.image
titleLabel.text = model.title

Expand All @@ -82,17 +91,10 @@ extension InfoCollectionViewCell {
}
}

func configureWithArrow(model: InfoModelThree) {
horizontalStackView.removeArrangedSubview(iconImage)
iconImage.removeFromSuperview()
titleLabel.text = model.title
arrowImage.isHidden = false
}

func configure(model: InfoModelFour) {
func configure(with model: InfoModel, isHidden: Bool) {
horizontalStackView.removeArrangedSubview(iconImage)
iconImage.removeFromSuperview()
titleLabel.text = model.title
arrowImage.isHidden = true
arrowImage.isHidden = isHidden
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,21 @@ import UIKit
import Then
import SnapKit

class MyInfoHeaderReusableView: UICollectionReusableView {
final class MyInfoHeaderView: UICollectionReusableView {

// MARK: - Properties

static let identifier = "MyInfoHeaderReusableView"
static let identifier = "MyInfoHeaderView"

// MARK: - UI Components

private let myInfoLabel = UILabel()

// MARK: - Life Cycle

override init(frame: CGRect) {
super.init(frame: .zero)

setUI()
setLayout()
}
Expand All @@ -33,14 +36,16 @@ class MyInfoHeaderReusableView: UICollectionReusableView {

// MARK: - Methods

extension MyInfoHeaderReusableView {
extension MyInfoHeaderView {

private func setUI() {
myInfoLabel.do {
$0.text = I18N.myInfo
$0.font = .Pretendard(.semiBold, size: 18)
$0.textColor = .white
}
}

private func setLayout() {
addSubview(myInfoLabel)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,31 @@

import UIKit

class MyProfileCollectionViewCell: UICollectionViewCell {
import SnapKit
import Then

final class MyProfileCollectionViewCell: UICollectionViewCell {

// MARK: - Properties

static let identifier = "MyProfileCollectionViewCell"

// MARK: - UI Components

private let logoImage = UIImageView()
private let verticalStackView = UIStackView()
private let userLabel = UILabel()
private let emailLabel = UILabel()


// MARK: - Life Cycle

override init(frame: CGRect) {
super.init(frame: .zero)

setUI()
setLayout()
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
Expand All @@ -34,6 +40,7 @@ class MyProfileCollectionViewCell: UICollectionViewCell {
// MARK: - Methods

extension MyProfileCollectionViewCell {

private func setUI() {
backgroundColor = .gray1

Expand All @@ -43,12 +50,14 @@ extension MyProfileCollectionViewCell {
$0.textColor = .white
$0.font = .Pretendard(.regular, size: 15)
}

emailLabel.do {
$0.textAlignment = .left
$0.numberOfLines = 1
$0.textColor = .gray4
$0.font = .Pretendard(.regular, size: 12)
}

verticalStackView.do {
$0.addArrangedSubviews(userLabel, emailLabel)
$0.axis = .vertical
Expand All @@ -73,7 +82,7 @@ extension MyProfileCollectionViewCell {
}
}

func configure(model: InfoModelOne) {
func configure(model: InfoModel) {
logoImage.image = model.image
userLabel.text = model.user
emailLabel.text = model.email
Expand Down
47 changes: 17 additions & 30 deletions iOS-NOTTODO/iOS-NOTTODO/Presentation/MyInfo/Model/MyInfoModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,23 @@

import UIKit

struct InfoModelOne: Hashable {
var image: UIImage
var user: String
var email: String
}

struct InfoModelTwo: Hashable {
var image: UIImage
var title: String
}
extension InfoModelTwo {
static let items: [InfoModelTwo] = [InfoModelTwo(image: .icGuide, title: "낫투두 가이드"),
InfoModelTwo(image: .icQuestion1, title: "자주 묻는 질문")
struct InfoModel: Hashable {

var image: UIImage?
var user: String?
var email: String?
var title: String?
static var profile: [InfoModel] = [InfoModel(image: .imgUser,
user: UserDefaults.standard.bool(forKey: DefaultKeys.isAppleLogin) ? KeychainUtil.getAppleUsername() : KeychainUtil.getKakaoNickname(),
email: UserDefaults.standard.bool(forKey: DefaultKeys.isAppleLogin) ? KeychainUtil.getAppleEmail() : KeychainUtil.getKakaoEmail())]
static let support: [InfoModel] = [InfoModel(image: .icGuide, title: "낫투두 가이드"),
InfoModel(image: .icQuestion1, title: "자주 묻는 질문")
]
}

struct InfoModelThree: Hashable {
var title: String
}
extension InfoModelThree {
static let items: [InfoModelThree] = [InfoModelThree(title: "공지사항"),
InfoModelThree(title: "문의하기"),
InfoModelThree(title: "약관 및 정책")
static let info: [InfoModel] = [InfoModel(title: "공지사항"),
InfoModel(title: "문의하기"),
InfoModel(title: "약관 및 정책")
]
}

struct InfoModelFour: Hashable {
var title: String
}
extension InfoModelFour {

static let item: [InfoModelFour] = [InfoModelFour(title: "버전 정보 "+(Utils.version ?? "1.0.0"))]
static func version() -> [InfoModel] { return [InfoModel(title: "버전 정보 "+(Utils.version ?? "1.0.0"))] }
}
Loading