Skip to content

Commit

Permalink
[FIX] DO-NOTTO-DO#84 - 성취뷰 캘린더 Date 값 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
jeongdung-eo committed Jan 13, 2023
1 parent 570b66c commit 2e8fd19
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 28 deletions.
12 changes: 6 additions & 6 deletions NotToDo/NotToDo/Network/API/Achieve/AchieveAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ final class AchieveAPI {

private init() { }

public private(set) var situationStatisticsData: GeneralArrayResponse<SituationStatistcsResponse>?
public private(set) var missionStatisticsData: GeneralArrayResponse<MissionStatistcsResponse>?
public private(set) var situationStatisticsData: GeneralArrayResponse<SituationStatistcsResponseDTO>?
public private(set) var missionStatisticsData: GeneralArrayResponse<MissionStatistcsResponseDTO>?
public private(set) var achieveCalendarData: GeneralResponse<AchieveCalendarResponseDTO>?

// MARK: - GET

func getSituationStatistics(completion: @escaping (GeneralArrayResponse<SituationStatistcsResponse>?) -> Void) {
func getSituationStatistics(completion: @escaping (GeneralArrayResponse<SituationStatistcsResponseDTO>?) -> Void) {
achieveProvider.request(.situationStatistics) { result in
switch result {
case .success(let response):
do {
self.situationStatisticsData = try response.map(GeneralArrayResponse<SituationStatistcsResponse>?.self)
self.situationStatisticsData = try response.map(GeneralArrayResponse<SituationStatistcsResponseDTO>?.self)
guard let situationStatisticsData = self.situationStatisticsData else { return }
completion(situationStatisticsData)
} catch let err {
Expand All @@ -43,12 +43,12 @@ final class AchieveAPI {

// MARK: - GET

func getMissionStatistics(completion: @escaping (GeneralArrayResponse<MissionStatistcsResponse>?) -> Void) {
func getMissionStatistics(completion: @escaping (GeneralArrayResponse<MissionStatistcsResponseDTO>?) -> Void) {
achieveProvider.request(.missionStatistics) { result in
switch result {
case .success(let response):
do {
self.missionStatisticsData = try response.map(GeneralArrayResponse<MissionStatistcsResponse>?.self)
self.missionStatisticsData = try response.map(GeneralArrayResponse<MissionStatistcsResponseDTO>?.self)
guard let situationStatisticsData = self.missionStatisticsData else { return }
completion(self.missionStatisticsData)
} catch (let err) {
Expand Down
6 changes: 3 additions & 3 deletions NotToDo/NotToDo/Network/API/Recommend/RecommendAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ final class RecommendAPI {

private init() { }

public private(set) var recommendData: GeneralArrayResponse<RecommendElementResponse>?
public private(set) var recommendData: GeneralArrayResponse<RecommendElementResponseDTO>?

// MARK: - GET

func getRecommend(index: Int, completion: @escaping (GeneralArrayResponse<RecommendElementResponse>?) -> Void) {
func getRecommend(index: Int, completion: @escaping (GeneralArrayResponse<RecommendElementResponseDTO>?) -> Void) {
recommendProvider.request(.recommendEnvirionment(id: index )) { result in
switch result {
case .success(let response):
do {
self.recommendData = try response.map(GeneralArrayResponse<RecommendElementResponse>?.self)
self.recommendData = try response.map(GeneralArrayResponse<RecommendElementResponseDTO>?.self)
guard let recommendData = self.recommendData else { return }
completion(recommendData)
} catch let err {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation

// MARK: - MissionStatistcsResponse
struct MissionStatistcsResponse: Codable {
struct MissionStatistcsResponseDTO: Codable {
let count: Int
let title: String
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation

// MARK: - SituationStatistcsResponseElement
struct SituationStatistcsResponse: Codable {
struct SituationStatistcsResponseDTO: Codable {
let id, count: Int
let name: String
let missions: [SituationMissions]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import Foundation

// MARK: - RecommendElement
struct RecommendElementResponse: Codable, Hashable {
struct RecommendElementResponseDTO: Codable, Hashable {
let title: String
let recommendActions: [RecommendAction]
}
Expand All @@ -16,5 +16,3 @@ struct RecommendElementResponse: Codable, Hashable {
struct RecommendAction: Codable, Hashable {
let name: String
}

typealias Recommend = [RecommendElementResponse]
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ extension MissionTableViewCell {
}
}

func configure(_ item: MissionStatistcsResponse) {
func configure(_ item: MissionStatistcsResponseDTO) {
label.text = item.title
numberLabel.text = "\(item.count)"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,22 @@ final class AchievementViewController: UIViewController {
private lazy var missionView = MissionStatisticsView(frame: view.bounds)
private lazy var situationView = SituationStatisticsView(frame: view.bounds)
private var bottomLabel = UILabel()
private var dateFormatter = DateFormatter()
let calendar = Calendar(identifier: Calendar.Identifier.gregorian)
private var dateFormatter = DateFormatter().then {
$0.dateFormat = "yyyy-MM"
}

private lazy var safeArea = self.view.safeAreaLayoutGuide

var situationList: [SituationStatistcsResponse] = []
var missionList: [MissionStatistcsResponse] = []
var situationList: [SituationStatistcsResponseDTO] = []
var missionList: [MissionStatistcsResponseDTO] = []
private var achieveMonth: String?

// MARK: - View Life Cycle

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
requestAchieveAPI()
requestMonthAPI(month: "2023-01")
requestMonthAPI(month: dateFormatter.string(from: Date()))
}

override func viewDidLoad() {
Expand All @@ -61,7 +62,7 @@ final class AchievementViewController: UIViewController {

extension AchievementViewController {
func reloadMonthData() {
requestMonthAPI(month: "2023-01")
requestMonthAPI(month: dateFormatter.string(from: Date()))
}

func setUI() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CustomCalendar: UIView {
private lazy var leftBtn = UIButton()
private lazy var rightBtn = UIButton()
private lazy var headerImage = UIImageView()
private var currentPage: Date?
var currentPage: Date?
private lazy var today: Date = { return Date() }()
lazy var dateFormatter = DateFormatter()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class MissionStatisticsView: UIView {

// MARK: - Properties

var missionList: [MissionStatistcsResponse] = []
var missionList: [MissionStatistcsResponseDTO] = []

// MARK: - UI Components

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class SituationStatisticsView: UIView {
// MARK: - Properties

var hiddenSections = Set<Int>()
var situationList: [SituationStatistcsResponse] = []
var situationList: [SituationStatistcsResponseDTO] = []
var isSelected: [Bool] = []

// MARK: - UI Components
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class RecommendCollectionViewCell: UICollectionViewCell {
// MARK: - UI Components

lazy var nestedCollectionView = NestedView(frame: .zero)
var item: RecommendElementResponse?
var item: RecommendElementResponseDTO?

// MARK: - Life Cycle

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class RecommendViewController: UIViewController, CustomTabBarDelegate {
// MARK: - Properties

var navigationBarView = NavigationBarView(frame: CGRect(), mode: .leftRecommend)
var itemList: [RecommendElementResponse] = []
var itemList: [RecommendElementResponseDTO] = []
var selectedIndex: Int = 0

enum Section: Int, Hashable {
Expand Down Expand Up @@ -158,7 +158,7 @@ extension RecommendViewController {
snapShot.appendItems([], toSection: .main)
}

private func updateData(item: [RecommendElementResponse]) {
private func updateData(item: [RecommendElementResponseDTO]) {
var snapshot = dataSource.snapshot()
snapshot.appendItems(item, toSection: .main)
dataSource.apply(snapshot)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class NestedView: UIView {

// MARK: - Properties

var item: RecommendElementResponse?
var item: RecommendElementResponseDTO?

var isClickedClosure: ((_ section: Int, _ index: Int) -> Void)?
var section: Int?
Expand Down

0 comments on commit 2e8fd19

Please sign in to comment.