Skip to content
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
Binary file modified .DS_Store
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dogether/Data/Network/Request/ReviewTodoRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ struct ReviewTodoRequest: Encodable {
let result: String
let reviewFeedback: String

init(result: ReviewResults, reviewFeedback: String) {
init(result: ReviewStatus, reviewFeedback: String) {
self.result = result.rawValue
self.reviewFeedback = reviewFeedback
}
Expand Down
4 changes: 2 additions & 2 deletions dogether/Data/Repository/ChallengeGroupsRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class ChallengeGroupsRepository: ChallengeGroupsProtocol {
TodoEntity(
id: $0.id,
content: $0.content,
status: TodoStatus(rawValue: $0.status) ?? .waitCertification,
status: TodoStatus(rawValue: $0.status) ?? .uncertified,
certificationContent: $0.certificationContent,
certificationMediaUrl: $0.certificationMediaUrl,
reviewFeedback: $0.reviewFeedback
Expand All @@ -42,7 +42,7 @@ final class ChallengeGroupsRepository: ChallengeGroupsProtocol {
TodoEntity(
id: $0.id,
content: $0.content,
status: TodoStatus(rawValue: $0.status) ?? .waitCertification,
status: TodoStatus(rawValue: $0.status) ?? .uncertified,
thumbnailStatus: $0.isRead ? .done : .yet,
certificationContent: $0.certificationContent,
certificationMediaUrl: $0.certificationMediaUrl,
Expand Down
2 changes: 1 addition & 1 deletion dogether/Data/Repository/UserRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ final class UserRepository: UserProtocol {
TodoEntity(
id: info.id,
content: info.content,
status: TodoStatus(rawValue: info.status) ?? .waitCertification,
status: TodoStatus(rawValue: info.status) ?? .uncertified,
certificationContent: info.certificationContent,
certificationMediaUrl: info.certificationMediaUrl,
reviewFeedback: info.reviewFeedback,
Expand Down
40 changes: 20 additions & 20 deletions dogether/Data/RepositoryTest/ChallengeGroupsRepositoryTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ final class ChallengeGroupsRepositoryTest: ChallengeGroupsProtocol {

func getMyTodos(groupId: String, date: String) async throws -> [TodoEntity] {
let certify_pendings = (1 ... 2).map {
TodoEntity(id: $0, content: "testTodo \($0)", status: .waitCertification)
TodoEntity(id: $0, content: "testTodo \($0)", status: .uncertified)
}
let review_pendings = (3 ... 4).map {
TodoEntity(id: $0, content: "testTodo \($0)", status: .waitExamination, certificationContent: "test todo content \($0)")
TodoEntity(id: $0, content: "testTodo \($0)", status: .reviewed(.pending), certificationContent: "test todo content \($0)")
}
let approves = (5 ... 6).map {
TodoEntity(id: $0, content: "testTodo \($0)", status: .approve, certificationContent: "test todo content \($0)")
TodoEntity(id: $0, content: "testTodo \($0)", status: .reviewed(.approve), certificationContent: "test todo content \($0)")
}
let rejects = (7 ... 8).map {
TodoEntity(
id: $0, content: "testTodo \($0)testTodo \($0)testTodo \($0)", status: .reject,
id: $0, content: "testTodo \($0)testTodo \($0)testTodo \($0)", status: .reviewed(.reject),
certificationContent: "test todo content \($0)test todo content \($0)test todo content \($0)", reviewFeedback: "test todo reject reason \($0)test todo reject reason \($0)test todo reject reason \($0)test todo reject reason \($0)"
)
}
Expand All @@ -31,22 +31,22 @@ final class ChallengeGroupsRepositoryTest: ChallengeGroupsProtocol {

func getMemberTodos(groupId: Int, memberId: Int) async throws -> (index: Int, todos: [TodoEntity]) {
return (index: 3, todos: [
TodoEntity(id: 1, content: "신규 기능 개발", status: .waitCertification, thumbnailStatus: .done),
TodoEntity(id: 2, content: "치킨 먹기", status: .waitCertification, thumbnailStatus: .done, certificationContent: "치킨 냠냠", reviewFeedback: ""),
TodoEntity(id: 1, content: "신규 기능 개발", status: .waitCertification, thumbnailStatus: .done, reviewFeedback: "test"),
TodoEntity(id: 2, content: "치킨 먹기", status: .waitCertification, thumbnailStatus: .done, certificationContent: "치킨 냠냠"),
TodoEntity(id: 1, content: "신규 기능 개발", status: .waitExamination, thumbnailStatus: .yet),
TodoEntity(id: 2, content: "치킨 먹기", status: .waitExamination, thumbnailStatus: .yet, certificationContent: "치킨 냠냠", certificationMediaUrl: "https://dogether-bucket-dev.s3.ap-northeast-2.amazonaws.com/daily-todo-proof-media/mock/e.png"),
TodoEntity(id: 1, content: "신규 기능 개발", status: .waitExamination, thumbnailStatus: .yet, certificationMediaUrl: "https://dogether-bucket-dev.s3.ap-northeast-2.amazonaws.com/daily-todo-proof-media/mock/e1.png"),
TodoEntity(id: 2, content: "치킨 먹기", status: .approve, thumbnailStatus: .yet, certificationContent: "치킨 냠냠", certificationMediaUrl: "https://dogether-bucket-dev.s3.ap-northeast-2.amazonaws.com/daily-todo-proof-media/mock/e1.png"),
TodoEntity(id: 1, content: "신규 기능 개발", status: .approve, thumbnailStatus: .yet),
TodoEntity(id: 2, content: "치킨 먹기", status: .approve, thumbnailStatus: .yet, certificationContent: "치킨 냠냠"),
TodoEntity(id: 1, content: "신규 기능 개발", status: .approve, thumbnailStatus: .yet),
TodoEntity(id: 2, content: "치킨 먹기", status: .approve, thumbnailStatus: .yet, certificationContent: "치킨 냠냠"),
TodoEntity(id: 1, content: "신규 기능 개발", status: .reject, thumbnailStatus: .yet),
TodoEntity(id: 2, content: "치킨 먹기", status: .reject, thumbnailStatus: .yet, certificationContent: "치킨 냠냠"),
TodoEntity(id: 1, content: "신규 기능 개발", status: .reject, thumbnailStatus: .yet),
TodoEntity(id: 2, content: "치킨 먹기", status: .reject, thumbnailStatus: .yet, certificationContent: "치킨 냠냠")
TodoEntity(id: 1, content: "신규 기능 개발", status: .uncertified, thumbnailStatus: .done),
TodoEntity(id: 2, content: "치킨 먹기", status: .uncertified, thumbnailStatus: .done, certificationContent: "치킨 냠냠", reviewFeedback: ""),
TodoEntity(id: 1, content: "신규 기능 개발", status: .uncertified, thumbnailStatus: .done, reviewFeedback: "test"),
TodoEntity(id: 2, content: "치킨 먹기", status: .uncertified, thumbnailStatus: .done, certificationContent: "치킨 냠냠"),
TodoEntity(id: 1, content: "신규 기능 개발", status: .reviewed(.pending), thumbnailStatus: .yet),
TodoEntity(id: 2, content: "치킨 먹기", status: .reviewed(.pending), thumbnailStatus: .yet, certificationContent: "치킨 냠냠", certificationMediaUrl: "https://dogether-bucket-dev.s3.ap-northeast-2.amazonaws.com/daily-todo-proof-media/mock/e.png"),
TodoEntity(id: 1, content: "신규 기능 개발", status: .reviewed(.pending), thumbnailStatus: .yet, certificationMediaUrl: "https://dogether-bucket-dev.s3.ap-northeast-2.amazonaws.com/daily-todo-proof-media/mock/e1.png"),
TodoEntity(id: 2, content: "치킨 먹기", status: .reviewed(.approve), thumbnailStatus: .yet, certificationContent: "치킨 냠냠", certificationMediaUrl: "https://dogether-bucket-dev.s3.ap-northeast-2.amazonaws.com/daily-todo-proof-media/mock/e1.png"),
TodoEntity(id: 1, content: "신규 기능 개발", status: .reviewed(.approve), thumbnailStatus: .yet),
TodoEntity(id: 2, content: "치킨 먹기", status: .reviewed(.approve), thumbnailStatus: .yet, certificationContent: "치킨 냠냠"),
TodoEntity(id: 1, content: "신규 기능 개발", status: .reviewed(.approve), thumbnailStatus: .yet),
TodoEntity(id: 2, content: "치킨 먹기", status: .reviewed(.approve), thumbnailStatus: .yet, certificationContent: "치킨 냠냠"),
TodoEntity(id: 1, content: "신규 기능 개발", status: .reviewed(.reject), thumbnailStatus: .yet),
TodoEntity(id: 2, content: "치킨 먹기", status: .reviewed(.reject), thumbnailStatus: .yet, certificationContent: "치킨 냠냠"),
TodoEntity(id: 1, content: "신규 기능 개발", status: .reviewed(.reject), thumbnailStatus: .yet),
TodoEntity(id: 2, content: "치킨 먹기", status: .reviewed(.reject), thumbnailStatus: .yet, certificationContent: "치킨 냠냠")
])
}

Expand Down
2 changes: 1 addition & 1 deletion dogether/Data/RepositoryTest/UserRepositoryTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ final class UserRepositoryTest: UserProtocol {
TodoEntity(
id: info.id,
content: info.content,
status: TodoStatus(rawValue: info.status) ?? .waitCertification,
status: TodoStatus(rawValue: info.status) ?? .uncertified,
certificationContent: info.certificationContent,
certificationMediaUrl: info.certificationMediaUrl,
reviewFeedback: info.reviewFeedback,
Expand Down
8 changes: 4 additions & 4 deletions dogether/Domain/Entity/Enum/ButtonStatus.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ enum ButtonStatus {
var textColor: UIColor {
switch self {
case .enabled:
return .grey800
return Color.Text.inverse
case .disabled:
return .grey400
return Color.Text.disabled
}
}

var backgroundColor: UIColor {
switch self {
case .enabled:
return .blue300
return Color.Background.primary
case .disabled:
return .grey500
return Color.Background.disabled
}
}
}
34 changes: 15 additions & 19 deletions dogether/Domain/Entity/Enum/CertificationTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,36 @@ import UIKit

enum CertificationTypes {
case achievement
case approve
case reject

case review(ReviewStatus)

var iconImage: UIImage {
switch self {
case .achievement:
return .achievement
case .approve:
return .approve
case .reject:
return .reject
case .review(let status):
return status.image ?? .achievement
}
}

var text: String {
switch self {
case .achievement:
return "달성"
case .approve:
return "인정"
case .reject:
return "노인정"
case .review(let status):
return status.text
}
}

// FIXME: 추후 수정

var titleLabelWidth: CGFloat {
switch self {
case .achievement:
25
case .approve:
25
case .reject:
37
return 25
case .review(let status):
switch status {
case .pending: return 49
case .approve: return 25
case .reject: return 37
}
}
}
}
122 changes: 76 additions & 46 deletions dogether/Domain/Entity/Enum/FilterTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,83 +7,113 @@

import UIKit

enum FilterTypes: String, CaseIterable, BaseEntity {
case all = "전체"
case wait = "검사 대기"
case reject = "노인정"
case approve = "인정"

enum FilterTypes: BaseEntity, Equatable {
case all
case status(ReviewStatus)

// MARK: - 스타일 속성
var tag: Int {
switch self {
case .all:
return 0
case .wait:
return 1
case .reject:
return 2
case .approve:
return 3
case .status(let status):
switch status {
case .pending: return 1
case .reject: return 2
case .approve: return 3
}
}
}


var text: String {
switch self {
case .all:
return "전체"
case .status(let status):
return status.text
}
}

var image: UIImage? {
switch self {
case .all:
return nil
case .wait:
return .wait
case .reject:
return .reject
case .approve:
return .approve
case .status(let status):
return status.image
}
}

var backgroundColor: UIColor {
switch self {
case .all, .approve:
return .blue300
case .wait:
return .dogetherYellow
case .reject:
return .dogetherRed
case .all:
return Color.Background.primary
case .status(let status):
return status.backgroundColor
}
}

var emptyTitle: String {
switch self {
case .wait:
return "검사 대기 중인 투두가 없어요"
case .reject:
return "노인정받은 투두가 없어요"
case .approve:
return "인정받은 투두가 없어요"
default:
case .all:
return ""
case .status(let status):
switch status {
case .pending:
return "검사 대기 중인 투두가 없어요"
case .reject:
return "노인정받은 투두가 없어요"
case .approve:
return "인정받은 투두가 없어요"
}
}
}
var reviewResult: ReviewResults? {

var reviewStatus: ReviewStatus? {
switch self {
case .reject:
return .reject
case .approve:
return .approve
default:
case .all:
return nil
case .status(let status):
return status
}
}
}

// MARK: - CaseIterable 대체
extension FilterTypes {
init?(status: String) {
switch status.uppercased() {
static var allCases: [FilterTypes] {
[.all, .status(.pending), .status(.reject), .status(.approve)]
}
}

// MARK: - 서버 응답 매핑용
extension FilterTypes {
init?(rawValue: String) {
switch rawValue {
case "전체":
self = .all
case "검사 대기":
self = .status(.pending)
case "노인정":
self = .status(.reject)
case "인정":
self = .status(.approve)
default:
return nil
}
}

var rawValue: String {
return text
}

init?(statusString: String) {
switch statusString.uppercased() {
case "REVIEW_PENDING":
self = .wait
self = .status(.pending)
case "REJECT":
self = .reject
self = .status(.reject)
case "APPROVE":
self = .approve
self = .status(.approve)
default:
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions dogether/Domain/Entity/Enum/HistoryReadStatus.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ enum HistoryReadStatus: String {
var colors: [CGColor] {
switch self {
case .readYet:
return [UIColor.blue300.cgColor, UIColor.dogetherYellow.cgColor, UIColor.dogetherRed.cgColor]
return [UIColor.blue300.cgColor, UIColor.dogetherYellow.cgColor, UIColor.dogetherRed.cgColor] // FIXME: 컬러 추가 필요
case .readAll:
return [UIColor.grey500.cgColor, UIColor.grey500.cgColor]
return [UIColor.grey500.cgColor, UIColor.grey500.cgColor] // FIXME: 컬러 추가 필요
}
}
}
4 changes: 2 additions & 2 deletions dogether/Domain/Entity/Enum/PopupTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ enum AlertTypes {
var buttonColor: UIColor {
switch self {
case .leaveGroup, .withdraw:
return .dogetherRed
return .dogetherRed // FIXME: 컬러 추가 필요
case .pushNotice, .gallery, .camera, .logout, .saveTodo,
.needLogout, .needRevoke, .alreadyParticipated, .fullGroup, .unableToParticipate:
return .blue300
return Color.Background.primary
}
}

Expand Down
Loading