Skip to content

Commit

Permalink
[Merge] #198 - conflict 해결 및 머지
Browse files Browse the repository at this point in the history
  • Loading branch information
jeongdung-eo committed Jan 7, 2024
2 parents ae4d34a + d6f50b5 commit 7c81600
Show file tree
Hide file tree
Showing 10 changed files with 240 additions and 177 deletions.
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 @@ -25,7 +25,7 @@
0943A9F92A53239200614761 /* Bundle+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0943A9F82A53239200614761 /* Bundle+.swift */; };
09582B4829BDA7F600EF3207 /* DetailStackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09582B4729BDA7F600EF3207 /* DetailStackView.swift */; };
09582B4B29BDE37C00EF3207 /* DetailFooterReusableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09582B4A29BDE37C00EF3207 /* DetailFooterReusableView.swift */; };
09582B4D29BE277800EF3207 /* DetailHeaderReusableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09582B4C29BE277800EF3207 /* DetailHeaderReusableView.swift */; };
09582B4D29BE277800EF3207 /* DetailHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09582B4C29BE277800EF3207 /* DetailHeaderView.swift */; };
09582B4F29BEBAFA00EF3207 /* DetailCalendarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09582B4E29BEBAFA00EF3207 /* DetailCalendarViewController.swift */; };
09582B5129C0BC3600EF3207 /* DetailAchievementViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09582B5029C0BC3600EF3207 /* DetailAchievementViewController.swift */; };
0960C0D42A38BC6500A3D8DB /* KeychainUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0960C0D32A38BC6500A3D8DB /* KeychainUtil.swift */; };
Expand Down Expand Up @@ -184,7 +184,7 @@
0943A9F82A53239200614761 /* Bundle+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Bundle+.swift"; sourceTree = "<group>"; };
09582B4729BDA7F600EF3207 /* DetailStackView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailStackView.swift; sourceTree = "<group>"; };
09582B4A29BDE37C00EF3207 /* DetailFooterReusableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailFooterReusableView.swift; sourceTree = "<group>"; };
09582B4C29BE277800EF3207 /* DetailHeaderReusableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailHeaderReusableView.swift; sourceTree = "<group>"; };
09582B4C29BE277800EF3207 /* DetailHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailHeaderView.swift; sourceTree = "<group>"; };
09582B4E29BEBAFA00EF3207 /* DetailCalendarViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailCalendarViewController.swift; sourceTree = "<group>"; };
09582B5029C0BC3600EF3207 /* DetailAchievementViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailAchievementViewController.swift; sourceTree = "<group>"; };
0960C0D32A38BC6500A3D8DB /* KeychainUtil.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeychainUtil.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -468,7 +468,7 @@
097C003529AB8270008CAEF3 /* MissionListCollectionViewCell.swift */,
092E04B029BD9C86008A5892 /* MissionDetailCollectionViewCell.swift */,
09582B4A29BDE37C00EF3207 /* DetailFooterReusableView.swift */,
09582B4C29BE277800EF3207 /* DetailHeaderReusableView.swift */,
09582B4C29BE277800EF3207 /* DetailHeaderView.swift */,
);
path = Cells;
sourceTree = "<group>";
Expand Down Expand Up @@ -1331,7 +1331,7 @@
3BBB6C8F2A1E7BEA00B8745A /* CollectionViewLeftAlignLayout.swift in Sources */,
09A1465F2A192C4900DDC308 /* WeekMissionResponseDTO.swift in Sources */,
0930D37329B4FCAE0000C4AE /* StatisticsView.swift in Sources */,
09582B4D29BE277800EF3207 /* DetailHeaderReusableView.swift in Sources */,
09582B4D29BE277800EF3207 /* DetailHeaderView.swift in Sources */,
6CF4706A29A71D71008D145C /* Strings.swift in Sources */,
6CF4705F29A69025008D145C /* GeneralResponse.swift in Sources */,
097C003629AB8270008CAEF3 /* MissionListCollectionViewCell.swift in Sources */,
Expand Down
24 changes: 14 additions & 10 deletions iOS-NOTTODO/iOS-NOTTODO/Network/API/Home/HomeAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,20 @@ final class HomeAPI {
}
}

func getDailyDetailMission(id: Int, completion: @escaping (NetworkResult<Any>) -> Void) {
homeProvider.request(.dailyDetailMission(id: id)) { response in
switch response {
case let .success(response):
let statusCode = response.statusCode
let data = response.data
let networkResult = NetworkBase.judgeStatus(by: statusCode, data, MissionDetailResponseDTO.self)
completion(networkResult)
case let .failure(err):
print(err)
func getDailyDetailMission(id: Int, completion: @escaping (GeneralResponse<MissionDetailResponseDTO>?) -> Void) {
homeProvider.request(.dailyDetailMission(id: id)) { result in
switch result {
case .success(let response):
do {
self.missionDetailDailyData = try response.map(GeneralResponse<MissionDetailResponseDTO>?.self)
guard let missionDetailDailyData = self.missionDetailDailyData else { return completion(nil) }
completion(missionDetailDailyData)
} catch let err {
print(err.localizedDescription, 500)
}
case .failure(let err):
print(err.localizedDescription)
completion(nil)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,26 +319,17 @@ extension AddMissionViewController {
}

private func requestDailyMissionAPI(id: Int) {
HomeAPI.shared.getDailyDetailMission(id: id) { [weak self] result in
switch result {
case let .success(data):
if let missionData = data as? MissionDetailResponseDTO {
self?.nottodoInfoList[1] = missionData.title
self?.nottodoInfoList[2] = missionData.situation
self?.nottodoInfoList[3] = missionData.actions.first!.name
self?.nottodoInfoList[4] = missionData.goal
self?.addMissionCollectionView.reloadData()
} else {
print("Failed to cast data to MissionDetailResponseDTO")
}
case .pathErr:
print("pathErr")
case .serverErr:
print("serverErr")
case .networkFail:
print("networkFail")
case .requestErr:
print("networkFail")
HomeAPI.shared.getDailyDetailMission(id: id) { [weak self] response in
guard let self = self, let response = response else { return }

if let data = response.data {
self.nottodoInfoList[1] = data.title
self.nottodoInfoList[2] = data.situation
self.nottodoInfoList[3] = data.actions.first?.name ?? ""
self.nottodoInfoList[4] = data.goal
self.addMissionCollectionView.reloadData()
} else {
self.nottodoInfoList = ["", "", "", ""]
}
}
}
Expand Down Expand Up @@ -378,7 +369,7 @@ extension AddMissionViewController: UICollectionViewDataSource {
}
missionMenuCell.setCellData([currentCellInfo])
}

if let missionDateCell = cell as? DateCollectionViewCell {
missionDateCell.setDateList(dateList)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ extension CalendarView {
}
}

// MARK: - Action

extension CalendarView {

@objc
Expand All @@ -176,6 +178,9 @@ extension CalendarView {
func nextBtnTapped(_sender: UIButton) {
scrollCurrentPage(calendar: calendar, isPrev: false)
}
}

extension CalendarView {

@objc
func todayBtnTapped(_sender: UIButton) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ class DetailStackView: UIView {
fatalError("init(coder:) has not been implemented")
}
}

// MARK: - Methods

extension DetailStackView {

private func setUI(empty: UIImage) {
verticalStackView.do {
$0.addArrangedSubviews(tagLabel, titleLabel, emptyIcon)
Expand All @@ -48,21 +52,25 @@ extension DetailStackView {
$0.font = .Pretendard(.medium, size: 16)
$0.numberOfLines = 0
}

lineView.do {
$0.backgroundColor = .gray5
}

emptyIcon.do {
$0.contentMode = .scaleAspectFit
$0.isHidden = true
$0.image = empty
}
}

private func setLayout(isTop: Bool) {
addSubviews(verticalStackView, lineView)

verticalStackView.snp.makeConstraints {
$0.edges.equalToSuperview()
}

lineView.snp.makeConstraints {
if isTop {
$0.top.equalTo(verticalStackView.snp.top).offset(-25)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import UIKit
import SnapKit
import Then

final class DetailFooterReusableView: UICollectionReusableView {
final class DetailFooterView: UICollectionReusableView {

// MARK: - Properties

static let identifier = "DetailFooterReusableView"

var footerClosure: (() -> Void)?

// MARK: - UI Components
Expand All @@ -23,6 +24,7 @@ final class DetailFooterReusableView: UICollectionReusableView {
private let dateButton = UIButton(configuration: .plain())

// MARK: - Life Cycle

override init(frame: CGRect) {
super.init(frame: .zero)
setUI()
Expand All @@ -37,7 +39,7 @@ final class DetailFooterReusableView: UICollectionReusableView {

// MARK: - Method

extension DetailFooterReusableView {
extension DetailFooterView {
private func setUI() {
dateLabel.do {
$0.text = I18N.detailDate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,23 @@ import UIKit
import SnapKit
import Then

final class DetailHeaderReusableView: UICollectionReusableView {
final class DetailHeaderView: UIView {

// MARK: - Properties

static let identifier = "DetailHeaderReusableView"
var cancelClosure: (() -> Void)?
var editClosure: (() -> Void)?

// MARK: - UI Components

private let horizontalStackview = UIStackView()
private let emptyView = UIView()

private let cancelButton = UIButton()
private let editButton = UIButton()

// MARK: - Life Cycle

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

setUI()
setLayout()
}
Expand All @@ -40,41 +39,36 @@ final class DetailHeaderReusableView: UICollectionReusableView {

// MARK: - Method

extension DetailHeaderReusableView {
extension DetailHeaderView {

private func setUI() {
cancelButton.do {
$0.backgroundColor = .clear
$0.setImage(.icCancel, for: .normal)
$0.addTarget(self, action: #selector(cancelButtonTapped), for: .touchUpInside)
}

editButton.do {
$0.setTitle(I18N.detailEdit, for: .normal)
$0.setTitleColor(.gray4, for: .normal)
$0.titleLabel?.font = .Pretendard(.medium, size: 16)
$0.addTarget(self, action: #selector(editButtonTapped), for: .touchUpInside)
}
horizontalStackview.do {
$0.addArrangedSubviews(cancelButton, emptyView, editButton)
$0.axis = .horizontal
}
}

private func setLayout() {
addSubview(horizontalStackview)
addSubviews(cancelButton, editButton)

cancelButton.snp.makeConstraints {
$0.centerY.equalToSuperview()
$0.size.equalTo(CGSize(width: 24, height: 24))
$0.leading.equalToSuperview().offset(7)
$0.leading.equalToSuperview().inset(24)
}

editButton.snp.makeConstraints {
$0.centerY.equalToSuperview()
$0.size.equalTo(CGSize(width: 44, height: 35))
}
horizontalStackview.snp.makeConstraints {
$0.directionalHorizontalEdges.equalToSuperview().inset(17)
$0.top.equalToSuperview().offset(-5)
$0.height.equalTo(35)
$0.trailing.equalToSuperview().inset(17)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import SnapKit
final class MissionDetailCollectionViewCell: UICollectionViewCell {

// MARK: - Properties

static let identifier = "MissionDetailCollectionViewCell"

// MARK: - UI Components

private let missionTagLabel = PaddingLabel(padding: UIEdgeInsets(top: 4, left: 12, bottom: 4, right: 12))
Expand All @@ -26,9 +26,9 @@ final class MissionDetailCollectionViewCell: UICollectionViewCell {
private let verticalStackView = UIStackView()
private let action = DetailStackView(tag: I18N.detailAction, isTop: true, empty: .actionEmpty)
private let goal = DetailStackView(tag: I18N.detailGoal, isTop: false, empty: .goalEmpty)

// MARK: - Life Cycle

override init(frame: CGRect) {
super.init(frame: .zero)
setUI()
Expand All @@ -43,6 +43,7 @@ final class MissionDetailCollectionViewCell: UICollectionViewCell {
// MARK: - Methods

extension MissionDetailCollectionViewCell {

private func setUI() {
backgroundColor = .clear

Expand Down Expand Up @@ -84,15 +85,15 @@ extension MissionDetailCollectionViewCell {
$0.axis = .vertical
$0.spacing = 22
}

}

private func setLayout() {
contentView.addSubviews(missionTagLabel, accumulateView, missionLabel, verticalStackView)
accumulateView.addSubviews(accumulateSubView, accumulateLabel)

missionTagLabel.snp.makeConstraints {
$0.top.equalToSuperview().offset(30)
$0.top.equalToSuperview()
$0.leading.equalToSuperview().offset(29)
}

Expand Down Expand Up @@ -130,11 +131,13 @@ extension MissionDetailCollectionViewCell {
missionLabel.setLineSpacing(lineSpacing: 6.0)
accumulateLabel.text = "\(model.count)\n달성"

if model.actions.isEmpty || model.actions.contains(where: { $0.name.isEmpty }) {
let nonEmptyActions = model.actions.filter { !$0.name.isEmpty }

if nonEmptyActions.isEmpty {
action.titleLabel.isHidden = true
action.emptyIcon.isHidden = false
} else {
let actionNames = model.actions.map { $0.name }
let actionNames = nonEmptyActions.map { $0.name }
let joinedActionNames = actionNames.joined(separator: "\n")
action.titleLabel.text = joinedActionNames
action.titleLabel.setLineSpacing(lineSpacing: 7.0)
Expand All @@ -145,7 +148,7 @@ extension MissionDetailCollectionViewCell {
if model.goal.isEmpty {
goal.titleLabel.isHidden = true
goal.emptyIcon.isHidden = false

} else {
goal.verticalStackView.removeArrangedSubview(action.emptyIcon)
goal.emptyIcon.removeFromSuperview()
Expand Down
Loading

0 comments on commit 7c81600

Please sign in to comment.