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

커뮤니티 게시글 작성 및 수정 기능 #69

Merged
merged 69 commits into from
Aug 30, 2024

Conversation

wjshim2003
Copy link
Collaborator

No description provided.

@@ -10,6 +10,7 @@ object SikshaColors {
val Black900 = Color(0xFF000000)

val Gray800 = Color(0xFF393939)
val Gray700 = Color(0xFF575757)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

색 쓰려는데 없어서 대충 추가함... 디자인 QA 때 같이 보자

@wjshim2003 wjshim2003 marked this pull request as ready for review August 21, 2024 13:54
@wjshim2003 wjshim2003 force-pushed the wjshim2003/create-modify-post branch from 98feff8 to 7f0580b Compare August 21, 2024 14:50
Copy link
Collaborator

@eastshine2741 eastshine2741 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고많았어~~~!!!

app/src/main/res/navigation/nav_graph.xml Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

큼직한 컴포저블 별로 @Preview 좀만 넣어줘
컴포즈 코드만 보고 어케생긴 UI를 그리는건지 알기어려워서

_board.value = communityRepository.getBoard(post.value.boardId)
_title.value = post.value.title
_content.value = post.value.content
_imageUriList.value = post.value.etc?.images?.map { Uri.parse(it) } ?: listOf()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image url을 Uri로 파싱하는 이유가 있어? edit 시에도 create와 마찬가지로 imageUriList: StateFlow<List<Uri>>를 사용하기 위함?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

엉 imageUriList는 이미지 추가할 때마다 uri로 관리하는데 서버에서는 기존 이미지 url을 string으로 내려 주니까 받을 때 파싱해 주고 있어

Comment on lines 136 to 143
val imageList = _imageUriList.value.map { uri ->
if (_imageFileList.value.containsKey(uri.toString())) {
val filename = uri.toString()
byteArrayToMultipartBody(filename, _imageFileList.value.getValue(filename))
} else {
getCompressedImageAsMultipartBody(context, uri)
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imageList는 유저가 새로 추가한 이미지의 Uri + 기존 이미지의 https url을 파싱하여 얻은 Uri이고
imageFileList는 기존 이미지의 https url to 기존 이미지의 https url로부터 다운받은 bytearray map인거지?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

엉 맞아 그래서 imageFileList(이제 리팩터링해서 downloadedImages)는 초기화 후에는 안 바뀜
_post도 수정 전 게시물 내용을 저장하는 용도라서 초기화 이후에는 안 바뀜

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ㅇㅎㅇㅎ 오키 그럼 post랑 imageFileList는 StateFlow일 필요 없겠네
StateFlow는 다른 객체로 바뀌는 걸 감지하기 위해서 쓰는거니까

일단 이렇게하고 담에 develop에서 바꿔줘

Comment on lines 91 to 97
fun deleteImageUri(index: Int) {
val uriList = _imageUriList.value.toMutableList()
if (index < uriList.size) {
uriList.removeAt(index)
_imageUriList.value = uriList
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기서 imageFileList는 안건드는 이유는, imageUriList에서 없애기만 해도 patchPost()할 때 해당 이미지가 제외되기 때문인거지?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

맞아맞아
뷰모델 내 프라퍼티들이 전체적으로 '원 글의 정보'와 '새로 쏠 정보'로 구분되어 있어
순서 조절해서 주석으로 달아 놓을게

@POST("/community/posts")
suspend fun postCreatePost(
@Part("board_id") boardId: Long,
@Part title: MultipartBody.Part,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

나도 String은 이렇게 안하면 계속 "가 붙어서 이렇게 했는데 같은 이유야?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

엉 나도 자꾸 큰따옴표 붙어 올라가서 걍 다 멀티파트 때려버림

Copy link
Collaborator

@eastshine2741 eastshine2741 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생많았다진짜루

@eastshine2741 eastshine2741 merged commit 1b33cab into develop Aug 30, 2024
2 checks passed
@eastshine2741 eastshine2741 deleted the wjshim2003/create-modify-post branch August 30, 2024 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants