Skip to content

feat: 커서 페이징 적용 #364

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

Merged
merged 11 commits into from
Feb 22, 2024
38 changes: 16 additions & 22 deletions iOS/Layover/Layover.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,6 @@
835A61A22B068115002F22A5 /* PlaybackInteractor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 835A619C2B068115002F22A5 /* PlaybackInteractor.swift */; };
835A61A62B0B4DDD002F22A5 /* Dashboard-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 835A61A52B0B4DDD002F22A5 /* Dashboard-Regular.ttf */; };
835A61A92B0B5A31002F22A5 /* LoginConfigurator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 835A61A82B0B5A31002F22A5 /* LoginConfigurator.swift */; };
8363A32D2B4C1CBB00772DDF /* PlaybackPresenterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8363A32C2B4C1CBA00772DDF /* PlaybackPresenterTests.swift */; };
8363A32F2B4C329100772DDF /* PlaybackInteractorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8363A32E2B4C329100772DDF /* PlaybackInteractorTests.swift */; };
8363A3332B4D6E9B00772DDF /* MockPlaybackWorker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8363A3322B4D6E9B00772DDF /* MockPlaybackWorker.swift */; };
836C33872B15A29600ECAFB0 /* Toast.swift in Sources */ = {isa = PBXBuildFile; fileRef = 836C33862B15A29600ECAFB0 /* Toast.swift */; };
836C338B2B15D22C00ECAFB0 /* PlaybackConfigurator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 836C338A2B15D22C00ECAFB0 /* PlaybackConfigurator.swift */; };
Expand All @@ -161,6 +159,7 @@
839F1DF82B62AEDA0071C622 /* LOTextLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 839F1DF72B62AEDA0071C622 /* LOTextLabel.swift */; };
83C35E1B2B108C3500D8DD5C /* PlaybackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 83C35E1A2B108C3500D8DD5C /* PlaybackView.swift */; };
83C35E1E2B10923C00D8DD5C /* PlaybackCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 83C35E1D2B10923C00D8DD5C /* PlaybackCell.swift */; };
FC06392E2B83D3F00019E4FB /* PostsPage.json in Resources */ = {isa = PBXBuildFile; fileRef = FC06392D2B83D3F00019E4FB /* PostsPage.json */; };
FC0E80242B1A0BBB00EF56D6 /* UploadPostPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC0E801E2B1A0BBB00EF56D6 /* UploadPostPresenter.swift */; };
FC0E80252B1A0BBB00EF56D6 /* UploadPostWorker.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC0E801F2B1A0BBB00EF56D6 /* UploadPostWorker.swift */; };
FC0E80262B1A0BBB00EF56D6 /* UploadPostRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC0E80202B1A0BBB00EF56D6 /* UploadPostRouter.swift */; };
Expand Down Expand Up @@ -199,6 +198,8 @@
FC4084CA2B1F291200CE4727 /* UploadVideoDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC4084C92B1F291200CE4727 /* UploadVideoDTO.swift */; };
FC4084CC2B1F2F5D00CE4727 /* UploadPost.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC4084CB2B1F2F5D00CE4727 /* UploadPost.swift */; };
FC42E4142B17AB69005D4956 /* VideoFileWorker.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC42E4132B17AB69005D4956 /* VideoFileWorker.swift */; };
FC43D9DA2B6F773C00FD9BCB /* PostsPageDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC43D9D92B6F773C00FD9BCB /* PostsPageDTO.swift */; };
FC43D9DC2B73935B00FD9BCB /* PostsPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC43D9DB2B73935B00FD9BCB /* PostsPage.swift */; };
FC49758F2B03432800D8627F /* Pretendard-SemiBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FC4975862B03432700D8627F /* Pretendard-SemiBold.ttf */; };
FC4975932B03432800D8627F /* Pretendard-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FC49758A2B03432800D8627F /* Pretendard-Bold.ttf */; };
FC4975942B03432800D8627F /* Pretendard-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FC49758B2B03432800D8627F /* Pretendard-Regular.ttf */; };
Expand Down Expand Up @@ -245,7 +246,6 @@
FC7E45462AFEB62B004F155A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FC7E45442AFEB62B004F155A /* LaunchScreen.storyboard */; };
FC7E456A2AFEC06E004F155A /* .swiftlint.yml in Resources */ = {isa = PBXBuildFile; fileRef = FC7E45692AFEC06E004F155A /* .swiftlint.yml */; };
FC8696D32B26008B00F9A7B9 /* SettingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 836C33972B1843BE00ECAFB0 /* SettingViewController.swift */; };
FC8DC42A2B5A5B7600FC772A /* LOImageCacher in Frameworks */ = {isa = PBXBuildFile; productRef = FC8DC4292B5A5B7600FC772A /* LOImageCacher */; };
FC8DC42F2B5A5C4600FC772A /* LOImageCacher in Frameworks */ = {isa = PBXBuildFile; productRef = FC8DC42E2B5A5C4600FC772A /* LOImageCacher */; };
FC930E752B0CD75C00AA48E3 /* ProfilePresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC930E6F2B0CD75C00AA48E3 /* ProfilePresenter.swift */; };
FC930E772B0CD75C00AA48E3 /* ProfileRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC930E712B0CD75C00AA48E3 /* ProfileRouter.swift */; };
Expand Down Expand Up @@ -419,8 +419,6 @@
835A61A52B0B4DDD002F22A5 /* Dashboard-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Dashboard-Regular.ttf"; sourceTree = "<group>"; };
835A61A82B0B5A31002F22A5 /* LoginConfigurator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginConfigurator.swift; sourceTree = "<group>"; };
835A61AA2B0B85FD002F22A5 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/LaunchScreen.strings; sourceTree = "<group>"; };
8363A32C2B4C1CBA00772DDF /* PlaybackPresenterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = PlaybackPresenterTests.swift; path = LayoverTests/Mocks/Workers/PlaybackPresenterTests.swift; sourceTree = SOURCE_ROOT; };
8363A32E2B4C329100772DDF /* PlaybackInteractorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = PlaybackInteractorTests.swift; path = LayoverTests/Mocks/Workers/PlaybackInteractorTests.swift; sourceTree = SOURCE_ROOT; };
8363A3322B4D6E9B00772DDF /* MockPlaybackWorker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockPlaybackWorker.swift; sourceTree = "<group>"; };
836C33862B15A29600ECAFB0 /* Toast.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Toast.swift; sourceTree = "<group>"; };
836C338A2B15D22C00ECAFB0 /* PlaybackConfigurator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaybackConfigurator.swift; sourceTree = "<group>"; };
Expand All @@ -430,6 +428,7 @@
839F1DF72B62AEDA0071C622 /* LOTextLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LOTextLabel.swift; sourceTree = "<group>"; };
83C35E1A2B108C3500D8DD5C /* PlaybackView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaybackView.swift; sourceTree = "<group>"; };
83C35E1D2B10923C00D8DD5C /* PlaybackCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaybackCell.swift; sourceTree = "<group>"; };
FC06392D2B83D3F00019E4FB /* PostsPage.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = PostsPage.json; sourceTree = "<group>"; };
FC0E801E2B1A0BBB00EF56D6 /* UploadPostPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UploadPostPresenter.swift; sourceTree = "<group>"; };
FC0E801F2B1A0BBB00EF56D6 /* UploadPostWorker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UploadPostWorker.swift; sourceTree = "<group>"; };
FC0E80202B1A0BBB00EF56D6 /* UploadPostRouter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UploadPostRouter.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -468,6 +467,8 @@
FC4084C92B1F291200CE4727 /* UploadVideoDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UploadVideoDTO.swift; sourceTree = "<group>"; };
FC4084CB2B1F2F5D00CE4727 /* UploadPost.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UploadPost.swift; sourceTree = "<group>"; };
FC42E4132B17AB69005D4956 /* VideoFileWorker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoFileWorker.swift; sourceTree = "<group>"; };
FC43D9D92B6F773C00FD9BCB /* PostsPageDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostsPageDTO.swift; sourceTree = "<group>"; };
FC43D9DB2B73935B00FD9BCB /* PostsPage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostsPage.swift; sourceTree = "<group>"; };
FC4975862B03432700D8627F /* Pretendard-SemiBold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Pretendard-SemiBold.ttf"; sourceTree = "<group>"; };
FC49758A2B03432800D8627F /* Pretendard-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Pretendard-Bold.ttf"; sourceTree = "<group>"; };
FC49758B2B03432800D8627F /* Pretendard-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Pretendard-Regular.ttf"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -642,7 +643,6 @@
194C21C72B1DF09B00C62645 /* Scenes */ = {
isa = PBXGroup;
children = (
8363A32B2B4C1C6900772DDF /* Playback */,
19B665D32B4EEDDD0083E63C /* SignUp */,
19AE481D2B29D02700DD4612 /* EditProfile */,
19AE48122B28C2A800DD4612 /* Setting */,
Expand Down Expand Up @@ -681,6 +681,7 @@
194C21CE2B1DF63D00C62645 /* MockDatas */ = {
isa = PBXGroup;
children = (
FC06392D2B83D3F00019E4FB /* PostsPage.json */,
FC4E0C122B28609C00152596 /* PostBoard.json */,
192513972B278645001533FA /* CheckSignUp.json */,
1925138D2B278645001533FA /* CheckUserName.json */,
Expand Down Expand Up @@ -740,6 +741,7 @@
isa = PBXGroup;
children = (
19A1692C2B17750B00DB34C0 /* Post.swift */,
FC43D9DB2B73935B00FD9BCB /* PostsPage.swift */,
19A169412B17C70C00DB34C0 /* Member.swift */,
19A169432B17C71C00DB34C0 /* Board.swift */,
FC4084CB2B1F2F5D00CE4727 /* UploadPost.swift */,
Expand Down Expand Up @@ -781,6 +783,7 @@
FC767F942B1222350088CF9B /* ProfileImageDTO.swift */,
FC767F962B1224B80088CF9B /* IntroduceDTO.swift */,
19A169372B17BCA800DB34C0 /* PostDTO.swift */,
FC43D9D92B6F773C00FD9BCB /* PostsPageDTO.swift */,
19A169392B17BCC400DB34C0 /* MemberDTO.swift */,
19A1693B2B17BD1C00DB34C0 /* BoardDTO.swift */,
8321A2FE2B1E428C000A12AF /* ReportDTO.swift */,
Expand Down Expand Up @@ -914,15 +917,6 @@
path = Playback;
sourceTree = "<group>";
};
8363A32B2B4C1C6900772DDF /* Playback */ = {
isa = PBXGroup;
children = (
8363A32C2B4C1CBA00772DDF /* PlaybackPresenterTests.swift */,
8363A32E2B4C329100772DDF /* PlaybackInteractorTests.swift */,
);
path = Playback;
sourceTree = "<group>";
};
836C33922B18436A00ECAFB0 /* Setting */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1305,7 +1299,6 @@
name = Layover;
packageProductDependencies = (
194551FC2B0386D100299768 /* KakaoSDK */,
FC8DC4292B5A5B7600FC772A /* LOImageCacher */,
19AF2A052B5D06B9008C3620 /* HLSCachingServer */,
);
productName = Layover;
Expand Down Expand Up @@ -1419,6 +1412,7 @@
1925139C2B278645001533FA /* DeleteVideo.json in Resources */,
1925139F2B278646001533FA /* PostListMore.json in Resources */,
1925139A2B278645001533FA /* PostList.json in Resources */,
FC06392E2B83D3F00019E4FB /* PostsPage.json in Resources */,
192513992B278645001533FA /* PostListEnd.json in Resources */,
192513A12B278646001533FA /* DeleteUser.json in Resources */,
192513A22B278646001533FA /* ReportPlaybackVideo.json in Resources */,
Expand Down Expand Up @@ -1492,6 +1486,7 @@
194552282B0479B600299768 /* BaseViewController.swift in Sources */,
194552212B0478B400299768 /* HomePresenter.swift in Sources */,
1972CCDA2B13A4BA00C3C762 /* SignUpWorker.swift in Sources */,
FC43D9DA2B6F773C00FD9BCB /* PostsPageDTO.swift in Sources */,
1945520D2B0399E500299768 /* MainTabBarViewController.swift in Sources */,
FC2511AB2B04EA6B004717BC /* MapConfigurator.swift in Sources */,
1945523B2B05258200299768 /* HomeConfigurator.swift in Sources */,
Expand All @@ -1516,6 +1511,7 @@
194552242B0478B400299768 /* HomeModels.swift in Sources */,
8321A3012B1F1EC5000A12AF /* MockReportWorker.swift in Sources */,
19A1692D2B17750B00DB34C0 /* Post.swift in Sources */,
FC43D9DC2B73935B00FD9BCB /* PostsPage.swift in Sources */,
194552022B038B8300299768 /* OSLog+.swift in Sources */,
8321A2F92B1E15F3000A12AF /* LOReportStackView.swift in Sources */,
FC0E80272B1A0BBB00EF56D6 /* UploadPostModels.swift in Sources */,
Expand Down Expand Up @@ -1659,15 +1655,13 @@
192513802B277CD7001533FA /* ProfileViewControllerTests.swift in Sources */,
194C21C62B1DEE6B00C62645 /* HomePresenterTests.swift in Sources */,
FC4E0C202B28B4C500152596 /* MockLocationFetcher.swift in Sources */,
8363A32D2B4C1CBB00772DDF /* PlaybackPresenterTests.swift in Sources */,
1925137A2B273D98001533FA /* StubAuthManager.swift in Sources */,
1925136D2B26F84E001533FA /* MockTagPlayListWorker.swift in Sources */,
19AE481A2B28C2B700DD4612 /* SettingPresenterTests.swift in Sources */,
19AE48172B28C2B700DD4612 /* SettingViewControllerTests.swift in Sources */,
19B665DA2B4EEDDD0083E63C /* SignUpInteractorTests.swift in Sources */,
19B665DB2B4EEDDD0083E63C /* SignUpPresenterTests.swift in Sources */,
194C21C32B1DEE6B00C62645 /* HomeViewControllerTests.swift in Sources */,
8363A32F2B4C329100772DDF /* PlaybackInteractorTests.swift in Sources */,
192513692B26F7CE001533FA /* TagPlayListInteractorTests.swift in Sources */,
19AE48232B29D03D00DD4612 /* EditProfileInteractorTests.swift in Sources */,
194C21CC2B1DF39200C62645 /* MockHomeWorker.swift in Sources */,
Expand Down Expand Up @@ -1991,15 +1985,15 @@
package = 194551FB2B03863B00299768 /* XCRemoteSwiftPackageReference "kakao-ios-sdk" */;
productName = KakaoSDK;
};
FC8DC42E2B5A5C4600FC772A /* LOImageCacher */ = {
isa = XCSwiftPackageProductDependency;
productName = LOImageCacher;
};
19AF2A052B5D06B9008C3620 /* HLSCachingServer */ = {
isa = XCSwiftPackageProductDependency;
package = 19AF2A042B5D06B9008C3620 /* XCRemoteSwiftPackageReference "HLSCachingServer" */;
productName = HLSCachingServer;
};
FC8DC42E2B5A5C4600FC772A /* LOImageCacher */ = {
isa = XCSwiftPackageProductDependency;
productName = LOImageCacher;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = FC7E452E2AFEB623004F155A /* Project object */;
Expand Down
14 changes: 14 additions & 0 deletions iOS/Layover/Layover/Models/PostsPage.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// PostsPage.swift
// Layover
//
// Created by kong on 2024/02/07.
// Copyright © 2024 CodeBomber. All rights reserved.
//

import Foundation

struct PostsPage {
let cursor: Int
let posts: [Post]
}
33 changes: 33 additions & 0 deletions iOS/Layover/Layover/Network/DTOs/PostsPageDTO.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// PostsPageDTO.swift
// Layover
//
// Created by kong on 2024/02/04.
// Copyright © 2024 CodeBomber. All rights reserved.
//

import Foundation

struct PostsPageDTO: Decodable {
let lastID: Int
let posts: [PostDTO]

enum CodingKeys: String, CodingKey {
case lastID = "lastId"
case posts = "boardsResDto"
}
}

struct PostRequestDTO: Encodable {
let cursor: Int?
let memberId: String?
}

extension PostsPageDTO {
func toDomain() -> PostsPage {
return PostsPage(
cursor: lastID,
posts: posts.map { $0.toDomain() }
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@
import Foundation

protocol PostEndPointFactory {
func makeHomePostListEndPoint() -> EndPoint<Response<[PostDTO]>>
func makeHomePostListEndPoint(at cursor: Int?) -> EndPoint<Response<PostsPageDTO>>
func makeMapPostListEndPoint(latitude: Double, longitude: Double) -> EndPoint<Response<[PostDTO]>>
func makeTagSearchPostListEndPoint(of tag: String, at page: Int) -> EndPoint<Response<[PostDTO]>>
}

final class DefaultPostEndPointFactory: PostEndPointFactory {
func makeHomePostListEndPoint() -> EndPoint<Response<[PostDTO]>> {
return EndPoint(
path: "/board/home",
method: .GET
)
func makeHomePostListEndPoint(at cursor: Int?) -> EndPoint<Response<PostsPageDTO>> {
var queryParameters: [String: Int]?
if let cursor {
queryParameters?.updateValue(cursor, forKey: "cursor")
}
return EndPoint(path: "/board/home",
method: .GET,
queryParameters: queryParameters)
}

func makeMapPostListEndPoint(latitude: Double, longitude: Double) -> EndPoint<Response<[PostDTO]>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ protocol UserEndPointFactory {
func makeIntroduceModifyEndPoint(introduce: String) -> EndPoint<Response<IntroduceDTO>>
func makeUserWithDrawEndPoint() -> EndPoint<Response<NicknameDTO>>
func makeUserInformationEndPoint(with id: Int?) -> EndPoint<Response<MemberDTO>>
func makeUserPostsEndPoint(at page: Int, of id: Int?) -> EndPoint<Response<[PostDTO]>>
func makeUserPostsEndPoint(at cursor: Int?, of id: Int?) -> EndPoint<Response<PostsPageDTO>>
func makeUserProfileImageDefaultEndPoint() -> EndPoint<Response<Data>>
func makeFetchUserProfilePresignedURL(of fileType: String) -> EndPoint<Response<PresignedURLDTO>>
}
Expand Down Expand Up @@ -76,12 +76,14 @@ final class DefaultUserEndPointFactory: UserEndPointFactory {
)
}

func makeUserPostsEndPoint(at page: Int, of id: Int? = nil) -> EndPoint<Response<[PostDTO]>> {
var queryParameters = [String: String]()
queryParameters.updateValue(String(page), forKey: "page")

func makeUserPostsEndPoint(at cursor: Int?, of id: Int? = nil) -> EndPoint<Response<PostsPageDTO>> {
var queryParameters: PostRequestDTO?
if let id {
queryParameters.updateValue(String(id), forKey: "memberId")
queryParameters = PostRequestDTO(cursor: cursor,
memberId: String(id))
} else {
queryParameters = PostRequestDTO(cursor: cursor,
memberId: nil)
}

return EndPoint(
Expand Down
4 changes: 0 additions & 4 deletions iOS/Layover/Layover/Network/Provider/Provider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ extension ProviderType {
method: method)
}

func upload(from fileURL: URL, to url: String, method: HTTPMethod = .PUT) async throws -> Data {
return try await upload(from: fileURL, to: url, method: method)
}

func upload(fromFile: URL,
to url: String,
method: HTTPMethod = .PUT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ extension EditProfileViewController: PHPickerViewControllerDelegate {
}
}
}.resume()
picker.deselectAssets(withIdentifiers: results.compactMap(\.assetIdentifier))
}
picker.deselectAssets(withIdentifiers: results.compactMap(\.assetIdentifier))
}
}
}
Expand Down
Loading