Skip to content

Commit

Permalink
feat #47: 데모데이 준비
Browse files Browse the repository at this point in the history
1. 그룹 가입 API에 응답 추가 및 CompleteView 데이터 연동
2. 투두 작성 화면 maximumTodoCount 연동 및 내비게이션 연동
3. 메인 화면 filter > empty list case 작업
4. PushNoticeTypes 추가 및 handleNotification 추가
5. 이미지 불러오는 임시 로직 추가
6. DogetherTodoItem UI 수정
7. 순위 화면 달성률 표현 단위 수정
8. 메인 화면 viewWillAppear 임시로 추가 (새로고침)
9. 투두 검사 모달에서 투두 여러개일 때 케이스 주석 (데모데이에서는 한개일 때로 케이스 제한)
10. 마이 페이지 내 통계 버튼 주석
11. saveNotiToken 추가 (UserDefaultsManager에 fcmToken 추가 및 로그인 성공시 저장하도록 구현)
12. 이미지 압축 로직 추가
  • Loading branch information
seungyooooong committed Feb 20, 2025
1 parent 30e52b3 commit a0af06a
Show file tree
Hide file tree
Showing 29 changed files with 409 additions and 124 deletions.
1 change: 1 addition & 0 deletions dogether/Data/Network/Response/GetGroupInfoResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ struct GetGroupInfoResponse: Decodable {
let name: String
let duration: Int
let joinCode: String
let maximumTodoCount: Int
let endAt: String
let remainingDays: Int
}
17 changes: 17 additions & 0 deletions dogether/Data/Network/Response/JoinGroupResponse.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// JoinGroupResponse.swift
// dogether
//
// Created by seungyooooong on 2/20/25.
//

import Foundation

struct JoinGroupResponse: Decodable {
let name: String
let maximumMemberCount: Int
let startAt: String
let endAt: String
let durationOption: Int
}

13 changes: 13 additions & 0 deletions dogether/Domain/Entity/FilterTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,17 @@ enum FilterTypes: String, CaseIterable {
return 66
}
}

var emptyDescription: String {
switch self {
case .wait:
return "검사 대기 중인 투두가 없어요"
case .reject:
return "노인정받은 투두가 없어요"
case .approve:
return "인정받은 투두가 없어요"
default:
return ""
}
}
}
4 changes: 3 additions & 1 deletion dogether/Domain/Entity/GroupInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ struct GroupInfo {
let name: String
let duration: Int
let joinCode: String
let maximumTodoCount: Int
let endAt: String
let remainingDays: Int

init(name: String = "", duration: Int = 0, joinCode: String = "", endAt: String = "", remainingDays: Int = 0) {
init(name: String = "", duration: Int = 0, joinCode: String = "", maximumTodoCount: Int = 0, endAt: String = "", remainingDays: Int = 0) {
self.name = name
self.duration = duration
self.joinCode = joinCode
self.maximumTodoCount = maximumTodoCount
self.endAt = endAt
self.remainingDays = remainingDays
}
Expand Down
14 changes: 14 additions & 0 deletions dogether/Domain/Entity/PushNoticeTypes.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// PushNoticeTypes.swift
// dogether
//
// Created by seungyooooong on 2/20/25.
//

import Foundation

enum PushNoticeTypes: String {
case join = "JOIN"
case certification = "CERTIFICATION"
case review = "REVIEW"
}
6 changes: 6 additions & 0 deletions dogether/Presentation/Common/CertificationInfoPopupView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ final class CertificationInfoPopupView: UIView {
self.todoInfo = todoInfo
super.init(frame: .zero)
setUI()

Task { @MainActor in
guard let mediaUrl = self.todoInfo.certificationMediaUrl, let url = URL(string: mediaUrl) else { return }
let (data, _) = try await URLSession.shared.data(from: url)
imageView.image = UIImage(data: data)
}
}
required init?(coder: NSCoder) { fatalError() }

Expand Down
1 change: 0 additions & 1 deletion dogether/Presentation/Common/CertificationPopupView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ final class CertificationPopupView: UIView {
certificationMaxLengthLabel.text = "/\(certificationMaxLength)"
certificationButton = DogetherButton(action: {
self.completeAction(self.certificationTextView.text)
PopupManager.shared.hidePopup()
}, title: "인증하기", status: .enabled)

[
Expand Down
29 changes: 26 additions & 3 deletions dogether/Presentation/Common/DogetherGroupInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ final class DogetherGroupInfo: UIView {
var groupName: String
var memberCount: Int
var duration: GroupChallengeDurations
var startAt: GroupStartAts
var startAt: GroupStartAts?
var startAtString: String?
var endAtString: String?

init(
groupName: String = "",
Expand All @@ -28,6 +30,22 @@ final class DogetherGroupInfo: UIView {
super.init(frame: .zero)
setUI()
}
init(
groupName: String = "",
memberCount: Int = 0,
duration: GroupChallengeDurations = .threeDays,
startAtString: String,
endAtString: String
) {
self.groupName = groupName
self.memberCount = memberCount
self.duration = duration
self.startAtString = startAtString
self.endAtString = endAtString

super.init(frame: .zero)
setUI()
}
required init?(coder: NSCoder) { fatalError() }

private let groupInfoView = {
Expand Down Expand Up @@ -94,8 +112,13 @@ final class DogetherGroupInfo: UIView {

durationInfoLabel.text = "\(duration.rawValue)"
memberCountInfoLabel.text = "\(memberCount)"
startDayInfoLabel.text = "\(DateFormatterManager.formattedDate(startAt.daysFromToday)) (\(startAt.text))"
endDayInfoLabel.text = "\(DateFormatterManager.formattedDate(startAt.daysFromToday + duration.rawValue)) (D-\(duration.rawValue))"
if let startAt {
startDayInfoLabel.text = "\(DateFormatterManager.formattedDate(startAt.daysFromToday)) (\(startAt.text))"
endDayInfoLabel.text = "\(DateFormatterManager.formattedDate(startAt.daysFromToday + duration.rawValue)) (D-\(duration.rawValue))"
} else if let startAtString, let endAtString {
startDayInfoLabel.text = "\(startAtString)"
endDayInfoLabel.text = "\(endAtString)"
}

[
groupInfoView,
Expand Down
20 changes: 6 additions & 14 deletions dogether/Presentation/Common/DogetherTodoItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ final class DogetherTodoItem: UIButton {
}
required init?(coder: NSCoder) { fatalError() }

private let dogetherTodoItem = {
let button = UIButton()
button.backgroundColor = .grey700
button.layer.cornerRadius = 8
return button
}()

private let todoImageView = UIImageView()
private let contentLabel = {
let label = UILabel()
Expand All @@ -45,15 +38,14 @@ final class DogetherTodoItem: UIButton {
return label
}()
private func setUI() {
dogetherTodoItem.addTarget(self, action: #selector(didTapTodoItem), for: .touchUpInside)
backgroundColor = .grey700
layer.cornerRadius = 8
addTarget(self, action: #selector(didTapTodoItem), for: .touchUpInside)
updateUI()

[dogetherTodoItem].forEach { addSubview($0) }
[todoImageView, contentLabel, buttonLabel].forEach { dogetherTodoItem.addSubview($0) }
[todoImageView, contentLabel, buttonLabel].forEach { addSubview($0) }

dogetherTodoItem.snp.makeConstraints {
$0.center.equalToSuperview()
$0.width.equalToSuperview()
self.snp.makeConstraints {
$0.height.equalTo(64)
}

Expand All @@ -69,7 +61,7 @@ final class DogetherTodoItem: UIButton {
contentLabel.snp.makeConstraints {
$0.centerY.equalToSuperview()
$0.left.equalTo(
todo.status == TodoStatus.waitCertificattion.rawValue ? dogetherTodoItem : todoImageView.snp.right
todo.status == TodoStatus.waitCertificattion.rawValue ? self : todoImageView.snp.right
).offset(
todo.status == TodoStatus.waitCertificattion.rawValue ? 16 : 8
)
Expand Down
8 changes: 7 additions & 1 deletion dogether/Presentation/Common/ExaminationModalityView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ final class ExaminationModalityView: UIView {
self.review = review
super.init(frame: .zero)
setUI()

Task { @MainActor in
guard let url = URL(string: self.review.mediaUrls[0]) else { return }
let (data, _) = try await URLSession.shared.data(from: url)
imageView.image = UIImage(data: data)
}
}
required init?(coder: NSCoder) { fatalError() }

Expand Down Expand Up @@ -103,7 +109,7 @@ final class ExaminationModalityView: UIView {
imageView.snp.makeConstraints {
$0.top.equalToSuperview().offset(24)
$0.horizontalEdges.equalToSuperview().inset(20)
$0.height.equalTo(303)
$0.width.height.equalTo(303)
}

contentLabel.snp.makeConstraints {
Expand Down
2 changes: 1 addition & 1 deletion dogether/Presentation/Common/RankingTopView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ final class RankingTopView: UIView {
rankingImageView.image = ranking.rank == 1 ? .crown1 : ranking.rank == 2 ? .crown2 : .crown3
profileImageView.image = ranking.rank == 1 ? .profile1 : ranking.rank == 2 ? .profile2 : .profile3
nameLabel.text = ranking.name
certificationLabel.text = "달성률 \(ranking.certificationRate)%"
certificationLabel.text = "달성률 \(Int(ranking.certificationRate))%"

[rankingView, rankingImageView].forEach { addSubview($0) }
[profileImageView, nameLabel, certificationLabel].forEach { rankingView.addSubview($0) }
Expand Down
9 changes: 8 additions & 1 deletion dogether/Presentation/View/CompleteViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,14 @@ final class CompleteViewController: BaseViewController {
// TODO: 추후 수정
switch groupType {
case .join:
groupInfoView = DogetherGroupInfo(groupName: "groupName", memberCount: 0, duration: .threeDays, startAt: .today)
guard let groupInfo = viewModel.joinGroupResponse else { return }
groupInfoView = DogetherGroupInfo(
groupName: groupInfo.name,
memberCount: groupInfo.maximumMemberCount,
duration: GroupChallengeDurations(rawValue: groupInfo.durationOption) ?? .threeDays,
startAtString: groupInfo.startAt,
endAtString: groupInfo.endAt
)
case .create:
noticeLabel.text = groupType.completeNoticeText
joinCodeLabel.text = viewModel.joinCode
Expand Down
8 changes: 4 additions & 4 deletions dogether/Presentation/View/GroupJoinViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ final class GroupJoinViewController: BaseViewController {
do {
let request = JoinGroupRequest(joinCode: enterCode) // "kelly-join-code"
// TODO: 추후 이슈 #6 수정되면 response 수정하고 completeViewController로 데이터 넘기는 작업 추가
let response: Void = try await NetworkManager.shared.request(GroupsRouter.joinGroup(joinGroupRequest: request))
let response: JoinGroupResponse = try await NetworkManager.shared.request(GroupsRouter.joinGroup(joinGroupRequest: request))

// 가입 성공 시 다음 화면 이동
print("✅ 가입 성공")
NavigationManager.shared.setNavigationController(CompleteViewController(type: .join))
let completeViewController = CompleteViewController(type: .join)
completeViewController.viewModel.joinGroupResponse = response
NavigationManager.shared.setNavigationController(completeViewController)

} catch {
print("❌ 가입 실패: \(error)")
Expand Down
Loading

0 comments on commit a0af06a

Please sign in to comment.