diff --git a/PLAT/PLAT.xcodeproj/project.pbxproj b/PLAT/PLAT.xcodeproj/project.pbxproj index 5f1a6085..96ce8a38 100644 --- a/PLAT/PLAT.xcodeproj/project.pbxproj +++ b/PLAT/PLAT.xcodeproj/project.pbxproj @@ -1317,7 +1317,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"PLAT/Preview Content\""; - DEVELOPMENT_TEAM = 9XG4S4XZWN; + DEVELOPMENT_TEAM = MXGCKXDXUM; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = PLAT/App/Info.plist; @@ -1337,7 +1337,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0.0; - PRODUCT_BUNDLE_IDENTIFIER = com.letsplat.thinkyside; + PRODUCT_BUNDLE_IDENTIFIER = com.letsplat; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; @@ -1359,7 +1359,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"PLAT/Preview Content\""; - DEVELOPMENT_TEAM = 9XG4S4XZWN; + DEVELOPMENT_TEAM = MXGCKXDXUM; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = PLAT/App/Info.plist; @@ -1379,7 +1379,7 @@ "@executable_path/Frameworks", ); MARKETING_VERSION = 1.0.0; - PRODUCT_BUNDLE_IDENTIFIER = com.letsplat.thinkyside; + PRODUCT_BUNDLE_IDENTIFIER = com.letsplat; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; diff --git a/PLAT/PLAT/Data/PlatService/Service/PlaylistService/PlaylistServiceImpl.swift b/PLAT/PLAT/Data/PlatService/Service/PlaylistService/PlaylistServiceImpl.swift index ab22420c..55b28093 100644 --- a/PLAT/PLAT/Data/PlatService/Service/PlaylistService/PlaylistServiceImpl.swift +++ b/PLAT/PLAT/Data/PlatService/Service/PlaylistService/PlaylistServiceImpl.swift @@ -188,6 +188,19 @@ final class PlaylistServiceImpl: PlaylistServiceInterface { } } + /// 플레이리스트를 업데이트합니다. 이미지URL을 받습니다. + func updatePlaylist(playlistId: Int, title: String, imageUrl: String?) async -> Result { + + let request = UpdatePlaylistRequest(title: title, playlistImageUrl: imageUrl ?? "") + let response = await playlistRepository.updatePlaylist(request: request, playlistId: Int64(playlistId)) + switch response { + case .success: + return .success(()) + case .failure(let error): + return .failure(error) + } + } + /// 플레이리스트의 트랙 순서를 변경합니다. func updateTrackOrder(playlistId: Int, tracks: [Track]) async -> Result { diff --git a/PLAT/PLAT/Domain/Interface/PlaylistServiceInterface.swift b/PLAT/PLAT/Domain/Interface/PlaylistServiceInterface.swift index e3320179..c9c65731 100644 --- a/PLAT/PLAT/Domain/Interface/PlaylistServiceInterface.swift +++ b/PLAT/PLAT/Domain/Interface/PlaylistServiceInterface.swift @@ -14,6 +14,7 @@ protocol PlaylistServiceInterface { func uploadPlaylist(title: String, image: UIImage?, tracks: [Track]) async -> Result func appendTrackToPlaylist(playlistId: Int, trackId: Int) async -> Result func updatePlaylist(playlistId: Int, title: String, image: UIImage?) async -> Result + func updatePlaylist(playlistId: Int, title: String, imageUrl: String?) async -> Result func updateTrackOrder(playlistId: Int, tracks: [Track]) async -> Result func deleteTrackFromPlaylist(playlistId: Int, trackId: Int) async -> Result func deletePlaylist(playlistId: Int) async -> Result diff --git a/PLAT/PLAT/Domain/UseCase/PlaylistUseCase.swift b/PLAT/PLAT/Domain/UseCase/PlaylistUseCase.swift index 2d83a85a..1a90ff49 100644 --- a/PLAT/PLAT/Domain/UseCase/PlaylistUseCase.swift +++ b/PLAT/PLAT/Domain/UseCase/PlaylistUseCase.swift @@ -137,6 +137,20 @@ extension PlaylistUseCase { } } + /// 플레이리스트를 업데이트합니다. ImageUrl을 받습니다. + func updatePlaylist(playlistId: Int, title: String, imageUrl: String?) async { + let result = await playlistService.updatePlaylist( + playlistId: playlistId, + title: title, + imageUrl: imageUrl + ) + + switch result { + case .success: break + case .failure(let error): print(error) // TODO: 에러 처리 + } + } + /// 플레이리스트의 트랙 순서를 변경합니다. func updateTrackOrder(playlistId: Int, tracks: [Track]) { Task { diff --git a/PLAT/PLAT/Presentaion/Playlist/PlaylistDetailsEditView.swift b/PLAT/PLAT/Presentaion/Playlist/PlaylistDetailsEditView.swift index b977e3e2..947f1475 100644 --- a/PLAT/PLAT/Presentaion/Playlist/PlaylistDetailsEditView.swift +++ b/PLAT/PLAT/Presentaion/Playlist/PlaylistDetailsEditView.swift @@ -60,11 +60,15 @@ struct PlaylistDetailsEditView: View { ToolbarItem(placement: .primaryAction) { Button { Task { - await playlistUseCase.updatePlaylist( - playlistId: Int(selectedPlaylist.id), - title: selectedPlaylist.title, - image: selectedImage - ) + if let selectedImg = selectedImage { + await playlistUseCase.updatePlaylist( + playlistId: Int(selectedPlaylist.id), + title: selectedPlaylist.title, + image: selectedImage + ) + } else { + await playlistUseCase.updatePlaylist(playlistId: Int(selectedPlaylist.id), title: selectedPlaylist.title, imageUrl: selectedPlaylist.imageUrl) + } playlistUseCase.fetchPlaylistDetail(playlistId: Int(selectedPlaylist.id)) pathModel.pop() diff --git a/PLAT/PLAT/Presentaion/Playlist/PlaylistView.swift b/PLAT/PLAT/Presentaion/Playlist/PlaylistView.swift index 20f28dc1..a56dab6d 100644 --- a/PLAT/PLAT/Presentaion/Playlist/PlaylistView.swift +++ b/PLAT/PLAT/Presentaion/Playlist/PlaylistView.swift @@ -166,8 +166,16 @@ private struct PlaylistImageView: View { .placeholder { RoundedRectangle(cornerRadius: 12) .frame(width: 68, height: 68) + .foregroundStyle( + LinearGradient( + colors: [.orange, .indigo], + startPoint: .top, + endPoint: .bottom + ) + ) } .resizable() + .scaledToFill() .frame(width: 68, height: 68) .clipShape(RoundedRectangle(cornerRadius: 12)) }