feat(chat-room-bg): 배경 이미지 변경 기능 추가
This commit is contained in:
@@ -12,6 +12,7 @@ enum CharacterApi {
|
||||
case getCharacterHome
|
||||
case getCharacterDetail(characterId: Int)
|
||||
case getCharacterImageList(characterId: Int, page: Int, size: Int)
|
||||
case getMyCharacterImageList(characterId: Int64, page: Int, size: Int)
|
||||
}
|
||||
|
||||
extension CharacterApi: TargetType {
|
||||
@@ -27,6 +28,9 @@ extension CharacterApi: TargetType {
|
||||
|
||||
case .getCharacterImageList:
|
||||
return "/api/chat/character/image/list"
|
||||
|
||||
case .getMyCharacterImageList:
|
||||
return "/api/chat/character/image/list"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +50,16 @@ extension CharacterApi: TargetType {
|
||||
],
|
||||
encoding: URLEncoding.queryString
|
||||
)
|
||||
|
||||
case .getMyCharacterImageList(let characterId, let page, let size):
|
||||
return .requestParameters(
|
||||
parameters: [
|
||||
"characterId": characterId,
|
||||
"page": page,
|
||||
"size": size
|
||||
],
|
||||
encoding: URLEncoding.queryString
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,4 +26,18 @@ final class CharacterDetailGalleryRepository {
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
func getMyCharacterImageList(
|
||||
characterId: Int64,
|
||||
page: Int,
|
||||
size: Int = 20
|
||||
) -> AnyPublisher<Response, MoyaError> {
|
||||
return characterApi.requestPublisher(
|
||||
.getMyCharacterImageList(
|
||||
characterId: characterId,
|
||||
page: page,
|
||||
size: size
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import SwiftUI
|
||||
struct CharacterDetailGalleryView: View {
|
||||
@StateObject var viewModel = CharacterDetailGalleryViewModel()
|
||||
|
||||
private let columns = Array(repeating: GridItem(.flexible()), count: 3)
|
||||
private let columns = Array(repeating: GridItem(.flexible(), spacing: 0), count: 3)
|
||||
let characterId: Int
|
||||
|
||||
// 계산된 속성들
|
||||
@@ -30,7 +30,7 @@ struct CharacterDetailGalleryView: View {
|
||||
|
||||
// 갤러리 그리드
|
||||
ScrollView {
|
||||
LazyVGrid(columns: columns, spacing: 2) {
|
||||
LazyVGrid(columns: columns, spacing: 0) {
|
||||
ForEach(Array(viewModel.galleryItems.enumerated()), id: \.element.id) { index, item in
|
||||
galleryImageView(item: item, index: index)
|
||||
.onAppear {
|
||||
@@ -38,7 +38,7 @@ struct CharacterDetailGalleryView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 0)
|
||||
.frame(width: screenSize().width)
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
@@ -11,7 +11,7 @@ struct CharacterImageListResponse: Decodable {
|
||||
let items: [CharacterImageListItemResponse]
|
||||
}
|
||||
|
||||
struct CharacterImageListItemResponse: Decodable {
|
||||
struct CharacterImageListItemResponse: Decodable, Hashable {
|
||||
let id: Int
|
||||
let imageUrl: String
|
||||
let isOwned: Bool
|
||||
|
||||
Reference in New Issue
Block a user