Skip to content

Commit

Permalink
Merge pull request #352 from PLUB2022/feat/291-MyPage/ActiveMeeting
Browse files Browse the repository at this point in the history
[FEAT] 마이페이지 > 활동중인 모임
  • Loading branch information
soobin-k authored May 8, 2023
2 parents 575c7cb + 04ba352 commit a8ee518
Show file tree
Hide file tree
Showing 14 changed files with 532 additions and 38 deletions.
16 changes: 16 additions & 0 deletions PLUB.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@
C346B4AA29B1079900884E4F /* FirebaseCrashlytics in Frameworks */ = {isa = PBXBuildFile; productRef = C346B4A929B1079900884E4F /* FirebaseCrashlytics */; };
C346B4AC29B1079900884E4F /* FirebaseMessaging in Frameworks */ = {isa = PBXBuildFile; productRef = C346B4AB29B1079900884E4F /* FirebaseMessaging */; };
C34C097029773860001AFF16 /* DateBottomSheetViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C34C096F29773860001AFF16 /* DateBottomSheetViewController.swift */; };
C34D41F22A07395500F9E7AF /* MyFeedTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C34D41F12A07395500F9E7AF /* MyFeedTableViewCell.swift */; };
C34D41F42A07666D00F9E7AF /* NoActivityTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C34D41F32A07666D00F9E7AF /* NoActivityTableViewCell.swift */; };
C34F047E29C7049400E5B67E /* SettingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C34F047D29C7049400E5B67E /* SettingViewController.swift */; };
C34F048129C70FB900E5B67E /* SettingDetailSubView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C34F048029C70FB900E5B67E /* SettingDetailSubView.swift */; };
C34F048429C715A800E5B67E /* SettingSubview.swift in Sources */ = {isa = PBXBuildFile; fileRef = C34F048329C715A800E5B67E /* SettingSubview.swift */; };
Expand All @@ -325,6 +327,7 @@
C359FEAA29A08B7E00B2F561 /* ScheduleTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C359FEA929A08B7E00B2F561 /* ScheduleTitleView.swift */; };
C359FEAC29A09C5200B2F561 /* ScheduleDateSubView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C359FEAB29A09C5200B2F561 /* ScheduleDateSubView.swift */; };
C35AFD012998B0A500AB5CD3 /* EditMeetingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C35AFD002998B0A500AB5CD3 /* EditMeetingViewModel.swift */; };
C35C062F2A065A3400DCB8EB /* InquireMyFeedUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = C35C062E2A065A3400DCB8EB /* InquireMyFeedUseCase.swift */; };
C361743129AF95E2006AEAB1 /* MyMeetingResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = C361743029AF95E2006AEAB1 /* MyMeetingResponse.swift */; };
C361743329AF9B2D006AEAB1 /* MeetingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C361743229AF9B2D006AEAB1 /* MeetingViewModel.swift */; };
C361743629AFB875006AEAB1 /* MeetingCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C361743529AFB875006AEAB1 /* MeetingCollectionViewCell.swift */; };
Expand Down Expand Up @@ -415,6 +418,7 @@
C3FA748C2974984800A8BE4C /* MeetingIntroduceViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3FA748B2974984800A8BE4C /* MeetingIntroduceViewModel.swift */; };
C3FC1815298509C50083039A /* QuestionDeleteBottomSheetViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3FC1814298509C50083039A /* QuestionDeleteBottomSheetViewController.swift */; };
C3FC181729852D370083039A /* QuestionHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3FC181629852D370083039A /* QuestionHeaderView.swift */; };
C3FF87AC2A06572000DA6017 /* MyFeedResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3FF87AB2A06572000DA6017 /* MyFeedResponse.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -710,6 +714,8 @@
C344E53E2986B938009F73A9 /* MeetingCategoryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeetingCategoryViewController.swift; sourceTree = "<group>"; };
C344E5402986B9D7009F73A9 /* MeetingCategoryViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeetingCategoryViewModel.swift; sourceTree = "<group>"; };
C34C096F29773860001AFF16 /* DateBottomSheetViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateBottomSheetViewController.swift; sourceTree = "<group>"; };
C34D41F12A07395500F9E7AF /* MyFeedTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyFeedTableViewCell.swift; sourceTree = "<group>"; };
C34D41F32A07666D00F9E7AF /* NoActivityTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoActivityTableViewCell.swift; sourceTree = "<group>"; };
C34F047D29C7049400E5B67E /* SettingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingViewController.swift; sourceTree = "<group>"; };
C34F048029C70FB900E5B67E /* SettingDetailSubView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingDetailSubView.swift; sourceTree = "<group>"; };
C34F048329C715A800E5B67E /* SettingSubview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingSubview.swift; sourceTree = "<group>"; };
Expand All @@ -723,6 +729,7 @@
C359FEA929A08B7E00B2F561 /* ScheduleTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScheduleTitleView.swift; sourceTree = "<group>"; };
C359FEAB29A09C5200B2F561 /* ScheduleDateSubView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScheduleDateSubView.swift; sourceTree = "<group>"; };
C35AFD002998B0A500AB5CD3 /* EditMeetingViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditMeetingViewModel.swift; sourceTree = "<group>"; };
C35C062E2A065A3400DCB8EB /* InquireMyFeedUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InquireMyFeedUseCase.swift; sourceTree = "<group>"; };
C361743029AF95E2006AEAB1 /* MyMeetingResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyMeetingResponse.swift; sourceTree = "<group>"; };
C361743229AF9B2D006AEAB1 /* MeetingViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeetingViewModel.swift; sourceTree = "<group>"; };
C361743529AFB875006AEAB1 /* MeetingCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeetingCollectionViewCell.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -813,6 +820,7 @@
C3FA748B2974984800A8BE4C /* MeetingIntroduceViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeetingIntroduceViewModel.swift; sourceTree = "<group>"; };
C3FC1814298509C50083039A /* QuestionDeleteBottomSheetViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuestionDeleteBottomSheetViewController.swift; sourceTree = "<group>"; };
C3FC181629852D370083039A /* QuestionHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuestionHeaderView.swift; sourceTree = "<group>"; };
C3FF87AB2A06572000DA6017 /* MyFeedResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyFeedResponse.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -1936,6 +1944,7 @@
isa = PBXGroup;
children = (
C37237F22A02B0FF00328763 /* InquireMyTodoUseCase.swift */,
C35C062E2A065A3400DCB8EB /* InquireMyFeedUseCase.swift */,
);
path = MyPage;
sourceTree = "<group>";
Expand All @@ -1945,6 +1954,8 @@
children = (
C374E79229FC1E52004738C2 /* MyTodoTableViewCell.swift */,
C374E79429FC1E7E004738C2 /* MyTodoSectionHeaderView.swift */,
C34D41F12A07395500F9E7AF /* MyFeedTableViewCell.swift */,
C34D41F32A07666D00F9E7AF /* NoActivityTableViewCell.swift */,
);
path = Cell;
sourceTree = "<group>";
Expand Down Expand Up @@ -2056,6 +2067,7 @@
children = (
C3B3435A29BE3E5100935B73 /* MyPlubbingResponse.swift */,
C374E79629FC2F4D004738C2 /* MyTodoResponse.swift */,
C3FF87AB2A06572000DA6017 /* MyFeedResponse.swift */,
);
path = Response;
sourceTree = "<group>";
Expand Down Expand Up @@ -2515,6 +2527,7 @@
BA5D9ED529E3EE7400F06AB5 /* ArchiveRequest.swift in Sources */,
7085678828EEACFB008047DC /* InterestSelectCollectionViewCell.swift in Sources */,
C3B3435429BE3A1400935B73 /* MyPageRouter.swift in Sources */,
C34D41F22A07395500F9E7AF /* MyFeedTableViewCell.swift in Sources */,
BA5F050229F7D26500A3FA14 /* GetFeedDetailUseCase.swift in Sources */,
BA780E0F297138F10032C178 /* HeaderType.swift in Sources */,
C385D10F29894BF200EF88EC /* CreateMeetingViewModel.swift in Sources */,
Expand All @@ -2529,6 +2542,7 @@
C3330AD529F9A1830023CB04 /* ActiveMeetingViewModel.swift in Sources */,
70CF333929992FA60077FF47 /* RecruitmentFilterSlider.swift in Sources */,
BA42D1F328EDE10F00C20061 /* LoginViewController.swift in Sources */,
C3FF87AC2A06572000DA6017 /* MyFeedResponse.swift in Sources */,
C3413E122995450B004B8DBD /* UnderlineSegmentedControl.swift in Sources */,
BAE5D3372975B20000268D44 /* TokenResponse.swift in Sources */,
C38A5B9F297B022A00485355 /* SearchView.swift in Sources */,
Expand Down Expand Up @@ -2629,6 +2643,7 @@
70727A4529D5E570003DE956 /* TodoAlertView.swift in Sources */,
C3AB7441296B21E6003DD5E2 /* MeetingQuestionViewController.swift in Sources */,
C3100CB729BD8A5B005FCCAD /* MyPageViewController.swift in Sources */,
C35C062F2A065A3400DCB8EB /* InquireMyFeedUseCase.swift in Sources */,
BAB320EA29F3B6440056698C /* ArchiveUploadCell.swift in Sources */,
BAC8930929755B87000D44E2 /* SignUpRequest.swift in Sources */,
C371CDB229784F4E008950DD /* WeekDateCollectionViewCell.swift in Sources */,
Expand Down Expand Up @@ -2805,6 +2820,7 @@
C31605172997934100D27488 /* RecruitPostViewModel.swift in Sources */,
7095A58C292FB0B6002A52E6 /* InterestTypeCollectionViewCell.swift in Sources */,
C37237F32A02B0FF00328763 /* InquireMyTodoUseCase.swift in Sources */,
C34D41F42A07666D00F9E7AF /* NoActivityTableViewCell.swift in Sources */,
BA85BAA629A72D2400B4C59A /* BoardsRequest.swift in Sources */,
BA780E1129713BF30032C178 /* ParameterType.swift in Sources */,
BABB011C297ED74C004178EC /* InterestViewModel.swift in Sources */,
Expand Down
30 changes: 30 additions & 0 deletions PLUB/Sources/Models/MyPage/Response/MyFeedResponse.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// MyFeedResponse.swift
// PLUB
//
// Created by 김수빈 on 2023/05/06.
//

import Foundation

struct MyFeedResponse: Codable {
let plubbingInfo: PlubbingInfo
let feedInfo: FeedInfo

enum CodingKeys: String, CodingKey {
case plubbingInfo
case feedInfo = "myFeedList"
}
}

struct FeedInfo: Codable {
let totalElements: Int
let isLast: Bool
let feedList: [FeedsContent]

enum CodingKeys: String, CodingKey {
case totalElements
case isLast = "last"
case feedList = "content"
}
}
2 changes: 1 addition & 1 deletion PLUB/Sources/Models/MyPage/Response/MyTodoResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ struct TodoContent: Codable {

enum CodingKeys: String, CodingKey {
case date, totalLikes, isAuthor, todoList
case todoID = "todoTimelineID"
case todoID = "todoTimelineId"
}
}
9 changes: 7 additions & 2 deletions PLUB/Sources/Network/Routers/MyPageRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ import Alamofire
enum MyPageRouter {
case inquireMyMeeting(MyPlubbingParameter)
case inquireMyTodo(Int, Int)
case inquireMyFeed(Int, Int)
}

extension MyPageRouter: Router {
var method: HTTPMethod {
switch self {
case .inquireMyMeeting, .inquireMyTodo:
case .inquireMyMeeting, .inquireMyTodo, .inquireMyFeed:
return .get
}
}
Expand All @@ -26,6 +27,8 @@ extension MyPageRouter: Router {
return "/plubbings/all/my"
case .inquireMyTodo(let plubbingID, _):
return "/plubbings/\(plubbingID)/timeline/my"
case .inquireMyFeed(let plubbingID, _):
return "/plubbings/\(plubbingID)/feeds/my"
}
}

Expand All @@ -35,12 +38,14 @@ extension MyPageRouter: Router {
return .query(parameter)
case .inquireMyTodo(_, let cursorID):
return .query(["cursorId": cursorID])
case .inquireMyFeed(_, let cursorID):
return .query(["cursorId": cursorID])
}
}

var headers: HeaderType {
switch self {
case .inquireMyMeeting, .inquireMyTodo:
case .inquireMyMeeting, .inquireMyTodo, .inquireMyFeed:
return .withAccessToken
}
}
Expand Down
7 changes: 7 additions & 0 deletions PLUB/Sources/Network/Services/MyPageService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,11 @@ extension MyPageService {
) -> Observable<MyTodoResponse> {
sendObservableRequest(MyPageRouter.inquireMyTodo(plubbingID, cursorID))
}

func inquireMyFeed(
plubbingID: Int,
cursorID: Int
) -> Observable<MyFeedResponse> {
sendObservableRequest(MyPageRouter.inquireMyFeed(plubbingID, cursorID))
}
}
22 changes: 22 additions & 0 deletions PLUB/Sources/UseCases/MyPage/InquireMyFeedUseCase.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// InquireMyFeedUseCase.swift
// PLUB
//
// Created by 김수빈 on 2023/05/06.
//

import UIKit

import RxSwift

protocol InquireMyFeedUseCase {
func execute(plubbingID: Int, cursorID: Int) -> Observable<MyFeedResponse>
}

final class DefaultInquireMyFeedUseCase: InquireMyFeedUseCase {

func execute(plubbingID: Int, cursorID: Int) -> Observable<MyFeedResponse> {
MyPageService.shared
.inquireMyFeed(plubbingID: plubbingID, cursorID: cursorID)
}
}
78 changes: 65 additions & 13 deletions PLUB/Sources/Views/MyPage/Active/ActiveMeetingViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import UIKit

final class ActiveMeetingViewController: BaseViewController {
private let viewModel: ActiveMeetingViewModel
private let viewModel: ActiveMeetingViewModelType
private let recruitingHeaderView = RecruitingHeaderView()

private lazy var tableView = UITableView(frame: .zero, style: .grouped).then {
Expand All @@ -20,6 +20,8 @@ final class ActiveMeetingViewController: BaseViewController {
$0.tableHeaderView = recruitingHeaderView
$0.tableHeaderView?.frame.size.height = 114
$0.register(MyTodoTableViewCell.self, forCellReuseIdentifier: MyTodoTableViewCell.identifier)
$0.register(MyFeedTableViewCell.self, forCellReuseIdentifier: MyFeedTableViewCell.identifier)
$0.register(NoActivityTableViewCell.self, forCellReuseIdentifier: NoActivityTableViewCell.identifier)
$0.register(MyTodoSectionHeaderView.self, forHeaderFooterViewReuseIdentifier: MyTodoSectionHeaderView.identifier)
}

Expand All @@ -29,7 +31,7 @@ final class ActiveMeetingViewController: BaseViewController {
$0.layer.masksToBounds = true
}

init(viewModel: ActiveMeetingViewModel) {
init(viewModel: ActiveMeetingViewModelType) {
self.viewModel = viewModel
super.init(nibName: nil, bundle: nil)
}
Expand Down Expand Up @@ -65,12 +67,18 @@ final class ActiveMeetingViewController: BaseViewController {

override func bind() {
super.bind()
viewModel.meetingInfo
viewModel.meetingInfoDriver
.drive(with: self) { owner, myInfo in
owner.recruitingHeaderView.setupData(with: myInfo, type: .active)
}
.disposed(by: disposeBag)

viewModel.reloadTaleViewDriver
.drive(with: self) { owner, myInfo in
owner.tableView.reloadData()
}
.disposed(by: disposeBag)

recruitButton
.rx.tap
.asDriver()
Expand Down Expand Up @@ -137,21 +145,65 @@ extension ActiveMeetingViewController: UITableViewDelegate {

extension ActiveMeetingViewController: UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return 2
return MyActivityType.allCases.count
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(
withIdentifier: MyTodoTableViewCell.identifier,
for: indexPath
) as? MyTodoTableViewCell else { return UITableViewCell() }

cell.setupData()

return cell
switch MyActivityType.allCases[indexPath.section] {
case .todo:
if viewModel.todoList.isEmpty {
guard let cell = tableView.dequeueReusableCell(
withIdentifier: NoActivityTableViewCell.identifier,
for: indexPath
) as? NoActivityTableViewCell else { return UITableViewCell() }

cell.setupData(type: .todo)

return cell
} else {
let todo = viewModel.todoList[indexPath.row]
guard let cell = tableView.dequeueReusableCell(
withIdentifier: MyTodoTableViewCell.identifier,
for: indexPath
) as? MyTodoTableViewCell else { return UITableViewCell() }

cell.setupData(with: todo)

return cell
}

case .post:
if viewModel.feedList.isEmpty {
guard let cell = tableView.dequeueReusableCell(
withIdentifier: NoActivityTableViewCell.identifier,
for: indexPath
) as? NoActivityTableViewCell else { return UITableViewCell() }

cell.setupData(type: .post)

return cell
} else {
let feed = viewModel.feedList[indexPath.row]
guard let cell = tableView.dequeueReusableCell(
withIdentifier: MyFeedTableViewCell.identifier,
for: indexPath
) as? MyFeedTableViewCell else { return UITableViewCell() }

cell.configure(with: feed.toBoardModel)

return cell
}
}
}

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 2
switch MyActivityType.allCases[section] {
case .todo:
let todoCount = viewModel.todoList.count
return todoCount == 0 ? 1 : todoCount
case .post:
let feedCount = viewModel.feedList.count
return feedCount == 0 ? 1 : feedCount
}
}
}
Loading

0 comments on commit a8ee518

Please sign in to comment.