Skip to content

Commit

Permalink
Merge pull request #123 from JORDYMA-Link/BUG/#110
Browse files Browse the repository at this point in the history
[Bug][Refactor] - 코드 정리 및 안정성 향상 (#110)
  • Loading branch information
ILWAT authored Oct 22, 2024
2 parents f2442b5 + 178c3bb commit f3ec346
Show file tree
Hide file tree
Showing 18 changed files with 330 additions and 363 deletions.
2 changes: 1 addition & 1 deletion Projects/Core/Models/Sources/Feed/FeedCard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public struct FeedCard: Equatable {
public struct FeedCard: Hashable {
public let feedId: Int
public var title: String
public let summary: String
Expand Down
27 changes: 15 additions & 12 deletions Projects/Core/Models/Sources/SearchCalendar/SearchCalendar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,28 @@

import Foundation

// MARK: - FeedCalendarSearchResponse
// MARK: - CalendarSearch
/// 앱 내에서 사용하는 CalendarSearch Model입니다.
///
/// 현재 Network Response는 피드가 존재하지 않는 날짜의 데이터들도 전송하기 때문에 피드가 존재하는 날짜만 필터링하여 해당 Model을 사용합니다.
public struct SearchCalendar: Equatable {
public var existedFeedData: [Date: DaysInfo]
public var existedFeedData: [Date: DayInfo]

public init(
currentMonthData: [Date : DaysInfo]
currentMonthData: [Date : DayInfo]
) {
self.existedFeedData = currentMonthData
}
}

// MARK: - DaysInfo
public struct DaysInfo: Equatable {
public struct DayInfo: Equatable {
public let isArchived: Bool
public var list: [CalendarFeed]
public var list: [FeedCard]

public init(
isArchived: Bool,
list: [CalendarFeed]
list: [FeedCard]
) {
self.isArchived = isArchived
self.list = list
Expand All @@ -35,27 +38,27 @@ public struct DaysInfo: Equatable {

// MARK: - List
public struct CalendarFeed: Hashable {
public var folderID: Int
public var folderId: Int
public var folderName: String
public let feedID: Int
public let feedId: Int
public var title, summary, platform, platformImage: String
public var isMarked: Bool
public var keywords: [String]

public init(
folderID: Int,
folderId: Int,
folderName: String,
feedID: Int,
feedId: Int,
title: String,
summary: String,
platform: String,
platformImage: String,
isMarked: Bool,
keywords: [String]
) {
self.folderID = folderID
self.folderId = folderId
self.folderName = folderName
self.feedID = feedID
self.feedId = feedId
self.title = title
self.summary = summary
self.platform = platform
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,26 +51,28 @@ extension FeedCalendarSearchResponse {
}

extension DaysInfoResponse {
func toDomain() -> DaysInfo {
DaysInfo(
func toDomain() -> DayInfo {
DayInfo(
isArchived: self.isArchived,
list: self.list.map({ $0.toDomain() })
)
}
}

extension ListResponse {
func toDomain() -> CalendarFeed {
CalendarFeed(
folderID: self.folderID,
folderName: self.folderName,
feedID: self.feedID,
func toDomain() -> FeedCard {
FeedCard(
feedId: self.feedID,
title: self.title,
summary: self.summary,
platform: self.platform,
platformImage: self.platformImage,
isMarked: self.isMarked,
keywords: self.keywords
isUnclassified: false,
keywords: self.keywords,
recommendedFolder: [],
folderId: self.folderID,
folderName: self.folderName
)
}
}
Expand Down
4 changes: 2 additions & 2 deletions Projects/Feature/Scene/Auth/Login/LoginView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public struct LoginView: View {
}, backgroundColor: .bkColor(.black), title: "Apple로 시작하기", titleColor: .bkColor(.white), buttonImage: CommonFeature.Images.icoapple, buttonImageColor: .bkColor(.white))

makeTerms(
serviceTerms:makeTermsText("서비스 약관", url: "https://daffy-sandal-6ef.notion.site/ea068d8517af4ca0a719916f7d23dee2?pvs=4"),
privacyPolicy: makeTermsText("개인정보 처리방침", url: "https://daffy-sandal-6ef.notion.site/4df567ac571948f0a2b7d782bde3767a?pvs=4")
serviceTerms:makeTermsText("서비스 약관", url: BKExternalURL.termOfUse.urlString),
privacyPolicy: makeTermsText("개인정보 처리방침", url: BKExternalURL.privacy.urlString)
)
}
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import FSCalendar
///FSCalendar를 SwiftUI에서 사용할 수 있도록 UIViewRepresentable로 마이그레이션 진행한 View
///
///본 클래스는 TCA를 사용하는 것을 기준으로 만든 뷰로서 CalendarFeature의 Store를 구조체 생성시 추가해야합니다.
struct MigratedFSCalendarView: UIViewRepresentable {
struct FSCalendarView: UIViewRepresentable {

//MARK: - typealias
typealias UIViewType = FSCalendar
Expand All @@ -27,7 +27,6 @@ struct MigratedFSCalendarView: UIViewRepresentable {
@Binding var selectedDate: Date
@Binding var currentPage: Date
@Binding var eventDate: [Date]
@Binding var reload: Bool

//MARK: - Delegate Closure Properties
var didSelectDateAction: ((Date) -> Void)?
Expand All @@ -37,14 +36,12 @@ struct MigratedFSCalendarView: UIViewRepresentable {
selectedDate: Binding<Date>,
currentPage: Binding<Date>,
eventDate: Binding<[Date]>,
reload: Binding<Bool>,
didSelectDateAction: ((Date) -> Void)? = nil,
calendarCurrentPageDidChangeAction: ((Date) -> Void)? = nil
) {
self._selectedDate = selectedDate
self._currentPage = currentPage
self._eventDate = eventDate
self._reload = reload
self.didSelectDateAction = didSelectDateAction
self.calendarCurrentPageDidChangeAction = calendarCurrentPageDidChangeAction
}
Expand Down Expand Up @@ -95,20 +92,6 @@ struct MigratedFSCalendarView: UIViewRepresentable {
context.coordinator.isFirstOnAppear = true
}
}

if reload {
var defaultDateComponents = selectedDate.getDateComponents()
defaultDateComponents.day = (defaultDateComponents.day ?? 2) // 혹시 모를 실패의 경우 1일을 select 하도록
defaultDateComponents.hour = 9
defaultDateComponents.minute = 0
defaultDateComponents.second = 0

if let defaultDate = Calendar.current.date(from: defaultDateComponents) {
DispatchQueue.main.async {
self.didSelectDateAction?(defaultDate)
}
}
}
}

//MARK: - Coordinator
Expand Down
Loading

0 comments on commit f3ec346

Please sign in to comment.