Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨마이페이지 음악 리스트 필터링 기능 추가 #301

Open
wants to merge 24 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
5f485d9
♻️#294: 마이페이지 리스트뷰 개선 작업
thoonk Jul 7, 2024
5b683f4
♻️#294: 마이페이지 리스트뷰 Height 조정 및 진입 시 Height 업데이트 선 호출 처리
thoonk Jul 8, 2024
2c40d34
♻️#294: 마이페이지 MyMusicType 상태 관리 로직 변경
thoonk Jul 10, 2024
3912cb5
♻️#294: 마이페이지 코드 정리 및 ViewWillAppearEvent 바인딩 처리
thoonk Jul 10, 2024
b7783d3
♻️#294: 마이페이지 초기 진입할 때, sticky tap list 미노출 이슈 처리
thoonk Jul 10, 2024
01b3f6d
♻️#294: 마이페이지 탭 버튼 쓰로틀 추가, 리스트뷰 separator 미노출되는 이슈 처리, 네트워크 에러 토스트 처리
thoonk Jul 11, 2024
29cc826
♻️#294: 마이페이지 초기 진입할 때 2번 호출되는 이슈 처리
thoonk Jul 11, 2024
6f35825
♻️#294: ScrollView 안 CollectionView contentSize 업데이트 이슈로 인해 UITableVi…
thoonk Jul 12, 2024
556ed14
♻️#294: datasource apply 애니메이션 적용
thoonk Jul 12, 2024
60cb964
♻️#294: 마이페이지 UseCase 리펙토링 및 기존 UseCase 네이밍 및 파일구조 정리
thoonk Jul 16, 2024
6401074
♻️#294: MyPageViewModel UseCase 변경 작업 (기존 MyPageModel 제거)
thoonk Jul 16, 2024
3332dc7
✨#296: 마이페이지 필터링 - TabBarView
thoonk Jul 18, 2024
60e47ea
✨#296: 마이페이지 필터링 - 정렬 필터 선택 모달 뷰
thoonk Jul 19, 2024
8090831
✨#296: 마이페이지 필터링 - MusicListCell UI 구현
thoonk Jul 19, 2024
ab7cdd4
🐛#296: 마이페이지 - MusicListCell AutoLayout constraints 충돌 처리
thoonk Jul 23, 2024
7c6c7c0
🐛#296: 마이페이지 - TabBarView UI 업데이트 안되는 이슈 처리
thoonk Jul 23, 2024
cccaf36
💄마이페이지 - UI 변경
thoonk Jul 23, 2024
5e419a0
💄마이페이지 - TabBarView 버튼 이미지 교체 및 지역별 필터링 버튼 UI 변경, 정렬 필터 선택 이미지 교체
thoonk Jul 24, 2024
cf02e13
💄#296: 마이페이지 - 좋아요 뷰 UI 변경
thoonk Jul 29, 2024
50bb2ac
🐛#296: 마이페이지 - 스티키 탭 노출 위치 변경
thoonk Jul 29, 2024
8f71a7f
✨#296: 마이페이지 필터링 API FilterType 파라미터 추가
thoonk Sep 30, 2024
6f164d8
✨#296: 마이페이지 필터링 타입 바인딩 및 드랍 시간 표기 작업
thoonk Oct 1, 2024
3c23ae5
✨#296: 마이페이지 필터링 타입 인기순 추가
thoonk Oct 5, 2024
0d57f3c
✨#296: 마이페이지 좋아요 UI 업데이트
thoonk Oct 22, 2024
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
354 changes: 295 additions & 59 deletions StreetDrop/StreetDrop.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ struct MyDropListResponseDTO: Decodable {
let music: Music
let content, createdAt: String
let itemLikeCount: Int
let isLiked: Bool

enum CodingKeys: String, CodingKey {
case itemID = "itemId"
case location, user, music, content, createdAt, itemLikeCount
case location, user, music, content, createdAt, itemLikeCount, isLiked
}
}

Expand Down Expand Up @@ -76,7 +77,8 @@ extension MyDropListResponseDTO {
comment: value.content,
createdAt: value.createdAt,
location: value.location.address,
likeCount: value.itemLikeCount
likeCount: value.itemLikeCount,
isLiked: value.isLiked
)
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ extension MyLikeListResponseDTO {
comment: value.content,
createdAt: value.createdAt,
location: value.location.address,
likeCount: value.itemLikeCount
likeCount: value.itemLikeCount,
isLiked: true
)
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ final class DefaultMyPageRepository {
}

extension DefaultMyPageRepository: MyPageRepository {
func fetchMyDropList() -> Single<TotalMyMusics> {
func fetchMyDropList(filterType: FilterType) -> Single<TotalMyMusics> {
return networkManager.request(
target: .init(NetworkService.myDropList),
target: .init(NetworkService.myDropList(filterType: filterType.param)),
responseType: MyDropListResponseDTO.self
)
.map { dto in
return dto.toEntity()
}
}

func fetchMyLikeList() -> Single<TotalMyMusics> {
func fetchMyLikeList(filterType: FilterType) -> Single<TotalMyMusics> {
return networkManager.request(
target: .init(NetworkService.myLikeList),
target: .init(NetworkService.myLikeList(filterType: filterType.param)),
responseType: MyLikeListResponseDTO.self
)
.map { dto in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import Foundation
import RxSwift

protocol MyPageRepository {
func fetchMyDropList() -> Single<TotalMyMusics>
func fetchMyLikeList() -> Single<TotalMyMusics>
func fetchMyDropList(filterType: FilterType) -> Single<TotalMyMusics>
func fetchMyLikeList(filterType: FilterType) -> Single<TotalMyMusics>
func fetchMyLevel() -> Single<MyLevel>
func fetchMyLevelProgress() -> Single<MyLevelProgress>
func fetchLevelPolicy() -> Single<[LevelPolicy]>
Expand Down
1 change: 1 addition & 0 deletions StreetDrop/StreetDrop/Domain/Entity/ModalOption.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ struct ModalOption {
let icon: UIImage?
let title: String
let acton: UIAction
var isSelected: Bool = false
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// DefaultMusicDropUseCase.swift
// DefaultDropMusicUseCase.swift
// StreetDrop
//
// Created by thoonk on 2023/09/17.
Expand All @@ -9,7 +9,7 @@ import Foundation

import RxSwift

final class DefaultMusicDropUseCase: MusicDropUseCase {
final class DefaultDropMusicUseCase: DropMusicUseCase {
private let dropMusicRepository: DropMusicRepository

init(dropMusicRepository: DropMusicRepository = DefaultDropMusicRepository()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// MusicDropUseCase.swift
// DropMusicUseCase.swift
// StreetDrop
//
// Created by thoonk on 2023/09/17.
Expand All @@ -9,6 +9,6 @@ import Foundation

import RxSwift

protocol MusicDropUseCase {
protocol DropMusicUseCase {
func drop(droppingInfo: DroppingInfo, content: String) -> Single<Int>
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// DefaultFetchingMusicWithinArea.swift
// DefaultFetchingMusicWithinAreaUseCase.swift
// StreetDrop
//
// Created by 차요셉 on 2023/09/22.
Expand All @@ -9,7 +9,7 @@ import Foundation

import RxSwift

final class DefaultFetchingMusicWithinArea: FetchingMusicWithinArea {
final class DefaultFetchingMusicWithinAreaUseCase: FetchingMusicWithinAreaUseCase {
private let mainRepository: MainRepository

init(mainRepository: MainRepository = DefaultMainRepository(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ import Foundation

import RxSwift

protocol FetchingMusicWithinArea {
protocol FetchingMusicWithinAreaUseCase {
func execute(lat: Double, lon: Double, distance: Double) -> Single<Musics>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// DefaultFetchingMyDropListUseCase.swift
// StreetDrop
//
// Created by thoonk on 7/16/24.
//

import Foundation

import RxSwift

final class DefaultFetchingMyDropListUseCase {
private let repository: MyPageRepository

init(repository: MyPageRepository = DefaultMyPageRepository()) {
self.repository = repository
}
}

extension DefaultFetchingMyDropListUseCase: FetchingMyDropListUseCase {
func fetchMyDropList(filterType: FilterType) -> Single<TotalMyMusics> {
return repository.fetchMyDropList(filterType: filterType)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// FetchingMyDropListUseCase.swift
// StreetDrop
//
// Created by thoonk on 7/16/24.
//

import Foundation

import RxSwift

protocol FetchingMyDropListUseCase {
func fetchMyDropList(filterType: FilterType) -> Single<TotalMyMusics>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// DefaultFetchingMyLevelUseCase.swift
// StreetDrop
//
// Created by thoonk on 7/16/24.
//

import Foundation

import RxSwift

final class DefaultFetchingMyLevelUseCase {
private let repository: MyPageRepository

init(repository: MyPageRepository = DefaultMyPageRepository()) {
self.repository = repository
}
}

extension DefaultFetchingMyLevelUseCase: FetchingMyLevelUseCase {
func fetchMyLevel() -> Single<MyLevel> {
return repository.fetchMyLevel()
}

func fetchMyLevelProgress() -> Single<MyLevelProgress> {
return repository.fetchMyLevelProgress()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// FetchingMyLevelUseCase.swift
// StreetDrop
//
// Created by thoonk on 7/16/24.
//

import Foundation

import RxSwift

protocol FetchingMyLevelUseCase {
func fetchMyLevel() -> Single<MyLevel>
func fetchMyLevelProgress() -> Single<MyLevelProgress>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// DefaultFetchingMyLikeListUseCase.swift
// StreetDrop
//
// Created by thoonk on 7/16/24.
//

import Foundation

import RxSwift

final class DefaultFetchingMyLikeListUseCase {
private let repository: MyPageRepository

init(repository: MyPageRepository = DefaultMyPageRepository()) {
self.repository = repository
}
}

extension DefaultFetchingMyLikeListUseCase: FetchingMyLikeListUseCase {
func fetchMyLikeList(filterType: FilterType) -> Single<TotalMyMusics> {
return repository.fetchMyLikeList(filterType: filterType)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// FetchingMyLikeListUseCase.swift
// StreetDrop
//
// Created by thoonk on 7/16/24.
//

import Foundation

import RxSwift

protocol FetchingMyLikeListUseCase {
func fetchMyLikeList(filterType: FilterType) -> Single<TotalMyMusics>
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import Foundation

import RxSwift

protocol NoticeUseCase {
protocol FetchingNoticeUseCase {
func fetchNoticeList() -> Single<[NoticeEntity]>
func fetchNoticeDetail(id: Int) -> Single<NoticeDetailEntity>
}

final class DefaultNoticeUseCase: NoticeUseCase {
final class DefaultFetchingNoticeUseCase: FetchingNoticeUseCase {
private let noticeRepository: NoticeRepository

init(noticeRepository: NoticeRepository = DefaultNoticeRepository()) {
Expand Down
10 changes: 6 additions & 4 deletions StreetDrop/StreetDrop/Network/NetworkService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ enum NetworkService {
case blockUser(blockUserID: Int)
case postFCMToken(token: FCMTokenRequestDTO)
case patchUsersMusicApp(musicAppQuery: String)
case myDropList
case myLikeList
case myDropList(filterType: String)
case myLikeList(filterType: String)
case myLevel
case myLevelProgress
case levelPolicy
Expand Down Expand Up @@ -96,7 +96,7 @@ extension NetworkService: TargetType {
case .patchUsersMusicApp:
return "/users/music-app"
case .myDropList:
return "/users/me/items/drop"
return "/v2/users/me/items/drop"
case .myLikeList:
return "/users/me/items/like"
case .myLevel:
Expand Down Expand Up @@ -161,9 +161,11 @@ extension NetworkService: TargetType {

var task: Moya.Task {
switch self {
case .getMyInfo, .myDropList, .myLikeList, .myLevel, .myLevelProgress, .levelPolicy, .recommendMusic, .userCircleRadius, .getPopUpInfomation,
case .getMyInfo, .myLevel, .myLevelProgress, .levelPolicy, .recommendMusic, .userCircleRadius, .getPopUpInfomation,
.getNoticeList, .getNoticeDetail:
return .requestPlain
case .myDropList(let filterType), .myLikeList(let filterType):
return .requestParameters(parameters: ["orderType": filterType], encoding: URLEncoding.default)
case .searchMusic(let keyword):
return .requestParameters(
parameters: ["keyword": keyword],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,7 @@ private extension CommunityViewController {
)

let modalView = OptionModalViewController(
type: .music,
firstOption: shareOption,
secondOption: claimOption,
thirdOption: blockOption
Expand Down Expand Up @@ -924,6 +925,7 @@ private extension CommunityViewController {
)

let modalView = OptionModalViewController(
type: .music,
firstOption: shareOption,
secondOption: claimOption,
thirdOption: blockOption
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class MainViewModel: ViewModel {
private let myInfoUseCase: MyInfoUseCase
private let fetchingPOIUseCase: FetchingPOIUseCase
private let fetchingMusicCountUseCse: FetchingMusicCountUseCase
private let fetchingMusicWithinArea: FetchingMusicWithinArea
private let fetchingMusicWithinAreaUseCase: FetchingMusicWithinAreaUseCase
private let fetchingPopUpInfomationUseCase: FetchingPopUpInfomationUseCase
private let postingPopUpUserReadingUseCase: PostingPopUpUserReadingUseCase

Expand All @@ -43,7 +43,7 @@ final class MainViewModel: ViewModel {
myInfoUseCase: MyInfoUseCase = DefaultMyInfoUseCase(),
fetchingPOIUseCase: FetchingPOIUseCase = DefaultFetchingPOIUseCase(),
fetchingMusicCountUseCse: FetchingMusicCountUseCase = DefaultFetchingMusicCountUseCase(),
fetchingMusicWithinArea: FetchingMusicWithinArea = DefaultFetchingMusicWithinArea(),
fetchingMusicWithinAreaUseCase: FetchingMusicWithinAreaUseCase = DefaultFetchingMusicWithinAreaUseCase(),
fetchingSingleMusicUseCase: FetchingSingleMusicUseCase = DefaultFetchingSingleMusicUseCase(),
fetchingPopUpInfomationUseCase: FetchingPopUpInfomationUseCase = DefaultFetchingPopUpInfomationUseCase(),
postingPopUpUserReadingUseCase: PostingPopUpUserReadingUseCase = DefaultPostingPopUpUserReadingUseCase()
Expand All @@ -52,7 +52,7 @@ final class MainViewModel: ViewModel {
self.myInfoUseCase = myInfoUseCase
self.fetchingPOIUseCase = fetchingPOIUseCase
self.fetchingMusicCountUseCse = fetchingMusicCountUseCse
self.fetchingMusicWithinArea = fetchingMusicWithinArea
self.fetchingMusicWithinAreaUseCase = fetchingMusicWithinAreaUseCase
self.fetchingPopUpInfomationUseCase = fetchingPopUpInfomationUseCase
self.postingPopUpUserReadingUseCase = postingPopUpUserReadingUseCase
self.locationManager.delegate = self
Expand Down Expand Up @@ -237,7 +237,7 @@ private extension MainViewModel {
}

func fetchMusicWithArea(output: Output, disposedBag: DisposeBag) {
fetchingMusicWithinArea.execute(
fetchingMusicWithinAreaUseCase.execute(
lat: self.location.coordinate.latitude,
lon: self.location.coordinate.longitude,
distance: userCircleRadius
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ class MusicDropViewModel: ViewModel {

var state: State = .drop
private let droppingInfo: DroppingInfo
private let musicDropUseCase: MusicDropUseCase
private let dropMusicUseCase: DropMusicUseCase
private let disposeBag: DisposeBag = DisposeBag()

init (
droppingInfo: DroppingInfo,
musicDropUseCase: MusicDropUseCase = DefaultMusicDropUseCase()
dropMusicUseCase: DropMusicUseCase = DefaultDropMusicUseCase()
) {
self.droppingInfo = droppingInfo
self.musicDropUseCase = musicDropUseCase
self.dropMusicUseCase = dropMusicUseCase
}

func convert(input: Input, disposedBag: RxSwift.DisposeBag) -> Output {
Expand Down Expand Up @@ -93,7 +93,7 @@ class MusicDropViewModel: ViewModel {
var comment = ""
input.comment.bind { comment = $0 }.disposed(by: DisposeBag())

self.musicDropUseCase.drop(droppingInfo: self.droppingInfo, content: comment)
self.dropMusicUseCase.drop(droppingInfo: self.droppingInfo, content: comment)
.subscribe(onSuccess: { response in
if !(200...299).contains(response) {
output.isSuccessDrop.accept(
Expand Down
Loading